Tutorial by Examples: ado

Many beginners to Mongo struggle with basics, such as how to insert an array, date, boolean, session variable, and so forth into a document record. This example provides some guidance on basic data inputs. Todos.insert({ text: "foo", // String listId: Session...
DocumentDB supports replacing JSON documents using the ReplaceDocumentAsync method of the DocumentClient class. await client.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(databaseName, collectionName, familyName), updatedFamily);
DocumentDB supports deleting JSON documents using the DeleteDocumentAsync method of the DocumentClient class. await client.DeleteDocumentAsync(UriFactory.CreateDocumentUri(databaseName, collectionName, documentName));
Examples of using functions with hotkeys: Hotkey, a, MyFunction ; Calls MyFunction() when a is pressed MyFunction() { MsgBox You pressed %A_ThisHotkey%. } Or: a::MyFunction() MyFunction() { MsgBox You pressed %A_ThisHotkey%. }
A downcast can be used to make use of a subclass's code and data inside of a function taking a parameter of its superclass. class Rat { var color = "white" } class PetRat: Rat { var name = "Spot" } func nameOfRat(🐭: Rat) -> String { guard let petRat = ...
This code adds outwardly increasing shadows to an image to create a "sticker" version of the image. Notes: In addition to being an ImageObject, the "img" argument can also be a Canvas element. This allows you to stickerize your own custom drawings. If you draw text on the Can...
Once shadowing is turned on, every new drawing to the canvas will be shadowed. Turn off further shadowing by setting context.shadowColor to a transparent color. // start shadowing context.shadowColor='black'; ... render some shadowed drawings ... // turn off shadowing. context.shadowColor=...
Warning! Apply shadows sparingly! Applying shadowing is expensive and is multiplicatively expensive if you apply shadowing inside an animation loop. Instead, cache a shadowed version of your image (or other drawing): At the start of your app, create a shadowed version of your image in a secon...
The traditional use of shadowing is to give 2-dimensional drawings the illusion of 3D depth. This example shows the same "button" with and without shadowing var canvas=document.createElement("canvas"); var ctx=canvas.getContext("2d"); document.body.appendChild(can...
Canvas does not have CSS's inner-shadow. Canvas will shadow the outside of a filled shape. Canvas will shadow both inside and outside a stroked shape. But it's easy to create inner-shadows using compositing. Strokes with an inner-shadow To create strokes with an inner-shadow, use destinat...
Some "classic" Prolog textbooks still use the confusing and error-prone failure-driven loop syntax where a fail construct is used to force backtracking to apply a goal to every value of a generator. For example, to print all numbers up to a given limit: fdl(X) :- between(1,X,Y), print(Y),...
Consider the following example: public final class Person { private final String firstName; private final String lastName; public Person(String firstName, String lastName) { this.firstName = (firstName == null) ? "" : firstName; this.lastName = (lastN...
context.globalCompositeOperation = 'source-atop' source-atop compositing clips new image inside an existing shape. // gold filled rect ctx.fillStyle='gold'; ctx.fillRect(100,100,100,75); // shadow ctx.shadowColor='black'; ctx.shadowBlur=10; // restrict new draw to cover existing pixels ct...
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; NSURL *URL = [NSURL URLWithString:@"http://example.com/download.zip"]; NSURLReq...
appendToFile: Append single src, or multiple srcs from local file system to the destination file system. Also reads input from stdin and appends to destination file system. Keep the as - hdfs dfs -appendToFile [localfile1 localfile2 ..] [/HDFS/FILE/PATH..] cat: Copies source paths to stdout. ...
Some Java programmers have a general aversion to throwing or propagating exceptions. This leads to code like the following: public Reader getReader(String pathname) { try { return new BufferedReader(FileReader(pathname)); } catch (IOException ex) { System.out.println(&q...
Arrays can be passed into vararg functions using the Spread Operator, *. Assuming the following function exists... fun printNumbers(vararg numbers: Int) { for (number in numbers) { println(number) } } You can pass an array into the function like so... val numbers = intArray...
This relies on the official consul docker image to run consul in clustered mode in a docker swarm with new swarm mode in Docker 1.12. This example is based on http://qnib.org/2016/08/11/consul-service/. Briefly the idea is to use two docker swarm services that talk to each other. This solves the pro...
When you add either of these tracking snippets to your website, you send a pageview for each page your users visit. Google Analytics processes this data and can infer a great deal of information including: The total time a user spends on your site. The time a user spends on each page and in what o...
It is common practice to use higher order functions instead of recursion, if there is a higher order function which expresses the right recursion pattern. In our case, sum-of-numbers can be defined using foldl: #lang racket (define (sum-of-numbers l) (foldl + 0 l)) (sum-of-numbers '(1 2 3 4 5)...

Page 5 of 7