Tutorial by Examples: 5

lscount returns a time bucketed count of matching documents in the LogStash index, according to the specified filter. A trivial use of this would be to check how many documents in total have been received in the 5 minutes, and alert if it is below a certain threshold. A Bosun alert for this might ...
// Java: Stream.of("a1", "a2", "a3") .map(s -> s.substring(1)) .mapToInt(Integer::parseInt) .max() .ifPresent(System.out::println); // 3 // Kotlin: sequenceOf("a1", "a2", "a3") .map { it.substring(1) } ...
// Java: String phrase = persons .stream() .filter(p -> p.age >= 18) .map(p -> p.name) .collect(Collectors.joining(" and ", "In Germany ", " are of legal age.")); System.out.println(phrase); // In Germany Max and Peter a...
// Convert string to ArrayBuffer. This step is only necessary if you wish to hash a string, not if you aready got an ArrayBuffer such as an Uint8Array. var input = new TextEncoder('utf-8').encode('Hello world!'); // Calculate the SHA-256 digest crypto.subtle.digest('SHA-256', input) // Wait fo...
This error appears while trying to update or delete records without including the WHERE clause that uses the KEY column. To execute the delete or update anyway - type: SET SQL_SAFE_UPDATES = 0; To enable the safe mode again - type: SET SQL_SAFE_UPDATES = 1;
A common question is how to juxtapose (combine) physically separate geographical regions on the same map, such as in the case of a choropleth describing all 50 American states (The mainland with Alaska and Hawaii juxtaposed). Creating an attractive 50 state map is simple when leveraging Google Maps...
Component code: angular.module('myModule', []).component('myComponent', { bindings: { myValue: '<' }, controller: function(MyService) { this.service = MyService; this.componentMethod = function() { return 2; }; } }); The test: describe('myComponent', f...
The web.config system.web.httpRuntime must target 4.5 to ensure the thread will renter the request context before resuming your async method. <httpRuntime targetFramework="4.5" /> Async and await have undefined behavior on ASP.NET prior to 4.5. Async / await will resume on an arb...
Html5-Canvas ... Is an Html5 element. Is supported in most modern browsers (Internet Explorer 9+). Is a visible element that is transparent by default Has a default width of 300px and a default height of 150px. Requires JavaScript because all content must be programmatically added to the Canv...
In case your project needs to be based on a specific Symfony version, use the optional second argument of the new command: # use the most recent version in any Symfony branch $ symfony new my_project_name 2.8 $ symfony new my_project_name 3.1 # use a specific Symfony version $ symfony new my_...
A minimal CMake project file that uses Qt5 can be: cmake_minimum_required(VERSION 2.8.11) project(myproject) find_package(Qt5 5.7.0 REQUIRED COMPONENTS Core ) set(CMAKE_AUTOMOC ON) add_executable(${PROJECT_NAME} main.cpp ) target_link_libraries(${PROJECT_NAME} Qt5::C...
The conventional connect syntax that uses SIGNAL and SLOT macros works entirely at runtime, which has two drawbacks: it has some runtime overhead (resulting also in binary size overhead), and there's no compile-time correctness checking. The new syntax addresses both issues. Before checking the synt...
By default Laravel project's public folder exposes the content of the app which can be requested from anywhere by anyone, the rest of the app code is invisible or inaccessible to anyone without proper permissions. After developing the application on your development machine, it needs to be pushed t...
To get SSIS working for a SQL Server 2005 environment Acquire SQL Server 2005 (x86 or 64 bit) images. Mount the second disk and launch the installation wizard "Next" your way through the dialogs until you see see this screen. Under Client Components, ensure Business Intelligence De...
A HTTP 500 Internal Server Error is a general message meaning that the server encountered something unexpected. Applications (or the overarching web server) should use a 500 when there's an error processing the request - i.e. an exception is thrown, or a condition of the resource prevents the proces...

MD5

Hash functions map binary strings of an arbitrary length to small binary strings of a fixed length. The MD5 algorithm is a widely used hash function producing a 128-bit hash value (16 Bytes, 32 Hexdecimal characters). The ComputeHash method of the System.Security.Cryptography.MD5 class returns the...
using System; using System.Security.Cryptography; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string source = "Hello World!"; using (SHA256 sha256Hash = SHA256.Create()) ...
using System; using System.Security.Cryptography; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string source = "Hello World!"; using (SHA512 sha512Hash = SHA512.Create()) ...
Because in .NET 3.5 and older you don't have Lazy<T> class you use the following pattern: public class Singleton { private Singleton() // prevents public instantiation { } public static Singleton Instance { get { return Nested.instanc...
To create a new Rails 5 API, open a terminal and run the following command: rails new app_name --api The following file structure will be created: create create README.rdoc create Rakefile create config.ru create .gitignore create Gemfile create app create app/as...

Page 1 of 6