Tutorial by Examples: e

public class JSEngine { /* * Note Nashorn is only available for Java-8 onwards * You can use rhino from ScriptEngineManager.getEngineByName("js"); */ ScriptEngine engine; ScriptContext context; public Bindings scope; // Initialize t...
class Person { constructor(firstname, lastname) { this._firstname = firstname; this._lastname = lastname; } get firstname() { return this._firstname; } set firstname(name) { this._firstname = name; } get lastname() { return this._lastname; } ...
Gradle Setup : build.gradle(Module: app) compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } jackOptions { enabled true } What is the Stream API ? Stream is a new abstract layer introdu...
import Json.Decode as JD import Json.Decode.Pipeline as JP type PostType = Image | Video type alias Post = { id: Int , postType: PostType } -- assuming server will send int value of 0 for Image or 1 for Video decodePostType: JD.Decoder PostType decodePostType = JD.int |&...
Google Test is a C++ testing framework maintained by Google. It requires building the gtest library and linking it to your testing framework when building a test case file. Minimal Example // main.cpp #include <gtest/gtest.h> #include <iostream> // Google Test test cases are cre...
Processlist This will show all active & sleeping queries in that order then by how long. SELECT * FROM information_schema.PROCESSLIST ORDER BY INFO DESC, TIME DESC; This is a bit more detail on time-frames as it is in seconds by default SELECT ID, USER, HOST, DB, COMMAND, TIME as time_second...
C++1x offers a selection of mutex classes: std::mutex - offers simple locking functionality. std::timed_mutex - offers try_to_lock functionality std::recursive_mutex - allows recursive locking by the same thread. std::shared_mutex, std::shared_timed_mutex - offers shared and unique lock functi...
If you want to notify other clients/users throughout the application ,you not need to worry about the connection because signalr new connection is created every time you visit other pages in the web app. we can leverage the users feature of signalr to achieve the same. see the example below: Here...
This example just illustrates how this keyword can be used. int a = 10; // Assume that type of variable 'a' is not known here, or it may // be changed by programmer (from int to long long, for example). // Hence we declare another variable, 'b' of the same type using // decltype keyword. de...
Let's say we have vector: std::vector<int> intVector; And we want to declare an iterator for this vector. An obvious idea is to use auto. However, it may be needed just declare an iterator variable (and not to assign it to anything). We would do: vector<int>::iterator iter; Howev...
program ForLoopWithContinueAndBreaks; {$APPTYPE CONSOLE} var var i : integer; begin for i := 1 to 10 do begin if i = 2 then continue; (* Skip this turn *) if i = 8 then break; (* Break the loop *) WriteLn( i ); end; WriteLn('Finish.'); end. Outpu...
program repeat_test; {$APPTYPE CONSOLE} var s : string; begin WriteLn( 'Type a words to echo. Enter an empty string to exit.' ); repeat ReadLn( s ); WriteLn( s ); until s = ''; end. This short example print on console Type a words to echo. Enter an empty string to exit....
To influence property lookup, the get handler must be used. In this example, we modify property lookup so that not only the value, but also the type of that value is returned. We use Reflect to ease this. let handler = { get(target, property) { if (!Reflect.has(target, property)) { ...
std::async: performs an asynchronous operation. std::future: provides access to the result of an asynchronous operation. std::promise: packages the result of an asynchronous operation. std::packaged_task: bundles a function and the associated promise for its return type.
We will look at a simple dispatch event with the example usage. (ns myapp.events (:require [re-frame.core :refer [reg-event-db]])) ...
program WhileEOF; {$APPTYPE CONSOLE} uses SysUtils; const cFileName = 'WhileEOF.dpr'; var F : TextFile; s : string; begin if FileExists( cFileName ) then begin AssignFile( F, cFileName ); Reset( F ); while not Eof(F) do begin ...
This sample used to common function for all type object serialization and deserialization. using System.Runtime.Serialization.Formatters.Binary; using System.Xml.Serialization; namespace Framework { public static class IGUtilities { public static string Serialization(this T obj) ...
This is similar to Docker-machine or minikube which are used to learn Docker and Kubernetes. It will run a virtual machine containing everything you need to test openshift-origin. Here is the documentation from openshift-origin and how to install it on any OS here I'll write doc for Debian-lik...
When a remote session is created via the New-PSsession cmdlet, the PSSession persists until the current PowerShell session ends. Meaning that, by default, the PSSession and all associated resources will continue to be used until the current PowerShell session ends. Multiple active PSSessions can b...
File exists: Sub FileExists() Dim fso as Scripting.FileSystemObject Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists("D:\test.txt") = True Then MsgBox "The file is exists." Else MsgBox "The file isn't exist...

Page 1108 of 1191