Tutorial by Examples

foreach varlist1 list1 ?varlist2 list2 ...? body foreach is a powerful control structure that allows looping over a list or multiple lists. set alpha [list a b c d e f] foreach {key} $alpha { puts "key: $key" } Multiple variable names may be specified. set alphaindexes [list a ...
Subclassing also Subclasses Singleton Class class Example end Example.singleton_class #=> #<Class:Example> def Example.foo :example end class SubExample < Example end SubExample.foo #=> :example SubExample.singleton_class.superclass #=> #<Class:Example> ...
Instances never contain a method they only carry data. However we can define a singleton class for any object including an instance of a class. When a message is passed to an object (method is called) Ruby first checks if a singleton class is defined for that object and if it can reply to that mess...
There are three ways to reopen a Singleton Class Using class_eval on a singleton class. Using class << block. Using def to define a method on the object's singleton class directly class Example end Example.singleton_class.class_eval do def foo :foo end end Example.fo...
In the Tcl language in many cases, no special quoting is needed. These are valid strings: abc123 4.56e10 my^variable-for.my%use The Tcl language splits words on whitespace, so any literals or strings with whitespace should be quoted. There are two ways to quote strings. With braces and with...
By default Entity Framework maps decimal properties to decimal(18,2) columns in database tables. public class Box { public int Id { set; get; } public decimal Length { set; get; } public decimal Width { set; get; } public decimal Height { set; get; } } We can change the p...
A Semaphore is a high-level synchronizer that maintains a set of permits that can be acquired and released by threads. A Semaphore can be imagined as a counter of permits that will be decremented when a thread acquires, and incremented when a thread releases. If the amount of permits is 0 when a thr...
Attributes are global state (*). If they were implemented in JavaScript they would look something like this // pseudo code gl = { ARRAY_BUFFER: null, vertexArray: { attributes: [ { enable: ?, type: ?, size: ?, normalize: ?, stride: ?, offset: ?, buffer: ? }, { enabl...
Uniforms are per program state. Every shader program has its own uniform state and its own locations.
Texture units are global state. If they were implemented in JavaScript they would look something like this // pseudo code gl = { activeTextureUnit: 0, textureUnits: [ { TEXTURE_2D: ?, TEXTURE_CUBE_MAP: ? }, { TEXTURE_2D: ?, TEXTURE_CUBE_MAP: ? }, { TEXTURE_2D: ?, TEXTURE_CUBE_...
//all attributes $collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*'); //specific attributes $collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('name'); //certain attributes are special...
$productFound = ($product->getId() !== null)
To view difference between two branch git diff <branch1>..<branch2> To view difference between two branch git diff <commitId1>..<commitId2> To view diff with current branch git diff <branch/commitId> To view summary of changes git diff --stat <branch/com...
The revert command allows discarding unwanted uncommitted changes. Reverting changes to a single file. hg revert example.c Reverting all changes. This will discard all changes not just the current directory. hg revert --all hg will output which files were reverted. reverting exa...
Cross Platform Portability Runs on Windows, Mac OS X, Linux, and virtually every variant of unix. Event driven programming Trigger events based on variable read / write / unset. Trigger events when a command is entered or left. Trigger events when a I/O channel (file or network) becom...
ValueConverted To StringConverted To NumberConverted To Booleanundefinded"undefined"NaNfalsenull"null"0falsetrue"true"1false"false"0NaN"NaN"false"" empty string0false" "0true"2.4" (numeric)2.4true"test" (non nu...
class base { }; class derived: public base { }; int main() { base* p = new derived(); delete p; // The is undefined behavior! } In section [expr.delete] §5.3.5/3 the standard says that if delete is called on an object whose static type does not have a virtual destructor: if the...
In C++ methods that differs only by const qualifier can be overloaded. Sometimes there may be a need of two versions of getter that return a reference to some member. Let Foo be a class, that has two methods that perform identical operations and returns a reference to an object of type Bar: class ...
A lot of users find themselves in a situation where they just want to copy, move or delete a line quickly and return to where they were. Usually, if you'd want to move a line which contains the word lot below the current line you'd type something like: /lot<Esc>dd<C-o>p But to boost...
This is a basic in-app keyboard. The same method could be used to make just about any keyboard layout. Here are the main things that need to be done: Create the keyboard layout in an .xib file, whose owner is a Swift or Objective-C class that is a UIView subclass. Tell the UITextField to use t...

Page 657 of 1336