Tutorial by Examples: al

Real life use cases for Singleton pattern; If you are developing a client-server application, you need single instrance of ConnectionManager, which manages the life cycle of client connections. The basic APIs in ConnectionManager : registerConnection: Add new connection to existing list of connec...
You can install the whole bundle by downloading the dmg package from here. The bundle contains a CoqIDE that can be used for writing your proofs or you can use coqtop command to run the interpreter on your terminal Installation of Coq on MacOS is easy using homebrew as well brew install coq or i...
//Add value to Isolated Storage Settings IsolatedStorageSettings.ApplicationSettings.Add("Key", "Value");
//Check if a value exists in settings already if (IsolatedStorageSettings.ApplicationSettings.Contains("Key")) { //perform logic }
string setting = IsolatedStorageSettings.ApplicationSettings["Key"] as string;
By default, Jsoup will display only block-level elements with a trailing line break. Inline elements are displayed without a line break. Given a body fragment, with inline elements: <select name="menu"> <option value="foo">foo</option> <option va...
Package TikZ lends itself very well to drawing graphs. This is a small example (requires TikZ 3.0+): \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{positioning,arrows.meta} \begin{document} \begin{tikzpicture}[auto,vertex/.style={draw,circle}] \node[vertex] (a) {A}; ...
TikZ implements several algorithms for automatic graph layouts (requires LuaLaTeX). \documentclass{article} \usepackage{tikz} \usetikzlibrary{graphs,graphdrawing,quotes} \usegdlibrary{force} \begin{document} \begin{tikzpicture} \graph[spring layout] { A -> ["1"...
Thorup's algorithm for single source shortest path for undirected graph has the time complexity O(m), lower than Dijkstra. Basic ideas are the following. (Sorry, I didn't try implementing it yet, so I might miss some minor details. And the original paper is paywalled so I tried to reconstruct it fr...
type Meter = Double This simple approach has serious drawbacks for unit handling as every other type that is a Double will be compatible with it: type Second = Double var length: Meter = 3 val duration: Second = 1 length = duration length = 0d All of the above compiles, so in this case un...
case class Meter(meters: Double) extends AnyVal case class Gram(grams: Double) extends AnyVal Value classes provide a type-safe way to encode units, even if they require a bit more characters to use them: var length = Meter(3) var weight = Gram(4) //length = weight //type mismatch; found : Gr...
h = 1.0 / n; #pragma omp parallel for private(x) shared(n, h, area) for (i = 1; i <= n; i++) { x = h * (i - 0.5); #pragma omp critical { area += (4.0 / (1.0 + x*x)); } } pi = h * area; In this example, each threads execute a subset of the iteration count and they accumul...
Installing software via APT (Advanced Package Tool) also know as 'apt-get'. To install Mozilla Firefox: Open a Terminal (Ctrl+Alt+T) Type sudo apt-get install firefox Hit Enter When it asks to install type 'Y' to confirm. Software will be downloaded and installed.
Eclipse would provide its own embedded Maven enviroment out-of-the-box, which is not recommended whenever a certain Maven version must be used or further configuration must be performed (proxy, mirrors and so on): that is, to have full control over which Maven environment would be used by the IDE. ...
The Compact Serialization is the most common serialization format and is designed to be used in a web context. JWS are represented into a string that contains Base64 Url Safe encoded information seperated by an dot ".". This mode does not support unprotected headers. Line breaks added f...
The Compact Serialization is the most common serialization format and is designed to be used in a web context. JWE are represented into a string that contains Base64 Url Safe encoded information seperated by an dot ".". This mode does not support unprotected headers or AAD. Line breaks ...
The JWS JSON Serialization represents digitally signed or MACed content as a JSON object. This representation is neither optimized for compactness nor URL-safe. This syntax is optimized for more than one digital signature and/or MAC operation. Line breaks added for readability { &quo...
As the General JWS JSON Serialization Syntax, the JWS JSON Serialization represents digitally signed or MACed content as a JSON object. This representation is neither optimized for compactness nor URL-safe. The flattened syntax is optimized for the single digital signature or MAC case. Line breaks...
The JWE JSON Serialization represents encrypted content as a JSON object. This representation is neither optimized for compactness nor URL safe. This syntax is optimized for more than one recipient. Line breaks added for readability { "protected":"<integrity-protect...
The flattened JWE JSON Serialization syntax is based upon the general syntax, but flattens it, optimizing it for the single-recipient case. Line breaks added for readability { "protected":"<integrity-protected header contents>", "unprotected":...

Page 163 of 269