Tutorial by Examples

If we have this dictionary: set alpha {alice {items {}} bob {items {}} claudia {items {}} derek {items {}}} And want to add "fork" and "peanut" to Alice's items, this code won't work: dict lappend alpha alice items fork peanut dict get $alpha alice # => items {} items f...
There are two ways to register a background page in the extension manifest. The scripts property In the common case, a background page doesn't require any HTML markup. We can register these kinds of background pages using the scripts property. In this case, a background page will be generated...
The sort algorithm sorts a sequence defined by two iterators. This is enough to sort a built-in (also known as c-style) array. C++11 int arr1[] = {36, 24, 42, 60, 59}; // sort numbers in ascending order sort(std::begin(arr1), std::end(arr1)); // sort numbers in descending order sort(std::b...
The ref keyword is used to pass an Argument as Reference. out will do the same as ref but it does not require an assigned value by the caller prior to calling the function. Ref Parameter :-If you want to pass a variable as ref parameter then you need to initialize it before you pass it as ref param...
In Swift, memory management is done for you automatically using Automatic Reference Counting. (See Memory Management) Allocation is the process of reserving a spot in memory for an object, and in Swift understanding the performance of such requires some understanding of the heap and the stack. The h...
dump prints the contents of an object via reflection (mirroring). Detailed view of an array: let names = ["Joe", "Jane", "Jim", "Joyce"] dump(names) Prints: ▿ 4 elements - [0]: Joe - [1]: Jane - [2]: Jim - [3]: Joyce For a dictionary: let attr...
The lists form a monad. They have a monad instantiation equivalent to this one: instance Monad [] where return x = [x] xs >>= f = concat (map f xs) We can use them to emulate non-determinism in our computations. When we use xs >>= f, the function f :: a -> [b...
Assume we want to create a data type Person, which has a first and last name, an age, a phone number, a street, a zip code and a town. We could write data Person = Person String String Int Int String String String If we want now to get the phone number, we need to make a function getPhone :: P...
thinky is a lightweight node.js ORM for RethinkDB. First you need to have RethinkDB running on your server. Then install the thinky.io npm package into your project. npm install --save thinky Now import thinky into your model file. const thinky = require('thinky)(); const type = thinky.type ...
defmodule ATest do use ExUnit.Case [{1, 2, 3}, {10, 20, 40}, {100, 200, 300}] |> Enum.each(fn {a, b, c} -> test "#{a} + #{b} = #{c}" do assert unquote(a) + unquote(b) = unquote(c) end end) end Output: . 1) test 10 + 20 = 40 (Test.Test) t...
With Resources class it's possible to dynamically load assets that are not part of the scene. It's very usefull when you have to use on demand assets, for example localize multi language audios, texts, etc.. Assets must be placed in a folder named Resources. It's possible to have multiple Resource...
The ASP.NET Core RTM release introduced BundlerMinifier.Core, a new Bundling and Minification tool that can be easily integrated into existing ASP.NET Core applications and doesn't require any external extensions or script files. Using BundlerMinifier.Core To use this tool, simply add a reference ...
With ASP.NET Core the Microsoft team also introduced the Options pattern, which allows to have strong typed options and once configured the ability to inject the options into your services. First we start with a strong typed class, which will hold our configuration. public class MySettings { ...
p "This is %s" % "foo" # => "This is foo" p "%s %s %s" % ["foo", "bar", "baz"] # => "foo bar baz" p "%{foo} == %{foo}" % {:foo => "foo" } # => "foo == foo" See String...
This error occurs when tables are not adequately structured to handle the speedy lookup verification of Foreign Key (FK) requirements that the developer is mandating. CREATE TABLE `gtType` ( `type` char(2) NOT NULL, `description` varchar(1000) NOT NULL, PRIMARY KEY (`type`) ) ENGINE=InnoD...
If you need to add a property with a null value, you should use the predefined static final JSONObject.NULL and not the standard Java null reference. JSONObject.NULL is a sentinel value used to explicitly define a property with an empty value. JSONObject obj = new JSONObject(); obj.put("some...
Sometimes you may want to output something by one program and input it into another program, but can't use a standard pipe. ls -l | grep ".log" You could simply write to a temporary file: touch tempFile.txt ls -l > tempFile.txt grep ".log" < tempFile.txt This work...
While server side-code can run with elevated privileges, there is not an equivalent method to elevate privileges in client-side code (for obvious security reasons). As an alternative, you can specify credentials to emulate the access of a specific user or service account. To specify credentials, bu...
When testing for any of several equality comparisons: if a == 3 or b == 3 or c == 3: it is tempting to abbreviate this to if a or b or c == 3: # Wrong This is wrong; the or operator has lower precedence than ==, so the expression will be evaluated as if (a) or (b) or (c == 3):. The correct w...
Check existing remote git remote -v # origin https://github.com/username/repo.git (fetch) # origin https://github.com/usernam/repo.git (push) Changing repository URL git remote set-url origin https://github.com/username/repo2.git # Change the 'origin' remote's URL Verify new remote URL ...

Page 546 of 1336