Tutorial by Examples

CREATE TABLE ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, ... PRIMARY KEY(id), ... ); Main notes: Starts with 1 and increments by 1 automatically when you fail to specify it on INSERT, or specify it as NULL. The ids are always distinct from each other, but... Do not make a...
The ToString method on an enum returns the string name of the enumeration. For instance: Module Module1 Enum Size Small Medium Large End Enum Sub Main() Dim shirtSize As Size = Size.Medium Dim output As String = shirtSize.ToString() ...
The following examples use the UTF-8 encoding to represent filenames (and directory names) on disk. If you want to use another encoding, you should use Encode::encode(...). use v5.14; # Make Perl recognize UTF-8 encoded characters in literal strings. # For this to work: Make sure your text-editor...
Perl does not attempt to decode filenames returned by builtin functions or modules. Such strings representing filenames should always be decoded explicitly, in order for Perl to recognize them as Unicode. use v5.14; use Encode qw(decode_utf8); # Ensure that possible error messages printed to sc...
The quotes property is used to customize the opening and closing quotation marks of the <q> tag. q { quotes: "«" "»"; }
Some common operations in MATLAB, like differentiation or integration, output results that have a different amount of elements than the input data has. This fact can easily be overlooked, which would usually cause errors like Matrix dimensions must agree. Consider the following example: t = 0:0.1:1...
Recursive type Discriminated unions can be recursive, that is they can refer to themselves in their definition. The prime example here is a tree: type Tree = | Branch of int * Tree list | Leaf of int As an example, let's define the following tree: 1 2 5 3 4 We can defi...
Polymorphism means that a operation can also be applied to values of some other types. There are multiple types of Polymorphism: Ad hoc polymorphism: contains function overloading. The target is that a Method can be used with different types without the need of being generic. Parametric polym...
You can use parfor to execute the iterations of a loop in parallel: Example: poolobj = parpool(2); % Open a parallel pool with 2 workers s = 0; % Performing some parallel Computations parfor i=0:9 s = s + 1; end disp(s) % Outputs '10' d...
You can use the $q.all function to call a .then method after an array of promises has been successfully resolved and fetch the data they resolved with. Example: JS: $scope.data = [] $q.all([ $http.get("data.json"), $http.get("more-data.json"), ]).then(funct...
The $q constructor function is used to create promises from asynchronous APIs that use callbacks to return results. $q(function(resolve, reject) {...}) The constructor function receives a function that is invoked with two arguments, resolve and reject that are functions which are used to eithe...
Pug (old name is Jade) is a clean, whitespace sensitive syntax for writing HTML. Here is a simple example: doctype html html(lang="en") head title= pageTitle script(type='text/javascript'). if (foo) bar(1 + 5) body h1 Pug - node template engine #container...
var pug = require('pug'); // compile var fn = pug.compile('string of pug', options); var html = fn(locals); // render var html = pug.render('string of pug', merge(options, locals)); // renderFile var html = pug.renderFile('filename.pug', merge(options, locals)); Options filename U...
When using C#'s inbuilt lock statement an instance of some type is needed, but its state does not matter. An instance of object is perfect for this: public class ThreadSafe { private static readonly object locker = new object(); public void SomeThreadSafeMethod() { lock (locker) { ...
Ubuntu Below are detailed instructions to install Caffe, pycaffe as well as its dependencies, on Ubuntu 14.04 x64 or 14.10 x64. Execute the following script, e.g. "bash compile_caffe_ubuntu_14.sh" (~30 to 60 minutes on a new Ubuntu). # This script installs Caffe and pycaffe. # CPU onl...
//Get instance of cache using System.Runtime.Caching; var cache = MemoryCache.Default; //Check if cache contains an item with cache.Contains("CacheKey"); //get item from cache var item = cache.Get("CacheKey"); //get item from cache or add item if not existing obje...
If you want to provide a URL out of convenience for your user but map it directly to another one you're already using. Use a redirect: # config/routes.rb TestApp::Application.routes.draw do get 'courses/:course_name' => redirect('/courses/%{course_name}/lessons'), :as => "course&quot...
To create an albums collection, add the following to your config.yml file: collections: - albums Create a corresponding folder at the root of your Jekyll install, named exactly what you put in your config.yml file with an additional prepended underscore; in our example, <source>/_albums....
Microcontrollers use pins to interact with the rest of the circuit. These pins will usually be one of input / output pins, vin or ground. I/O pins can be simple digital I/O pins, or they can have some special carachteristics like being able to vary the voltage of their output using pulse width modul...
Even experienced Java developers tend to think that Java has only three protection modifiers. The language actually has four! The package private (a.k.a. default) level of visibility is often forgotten. You should pay attention to what methods you make public. The public methods in an application a...

Page 590 of 1336