Tutorial by Examples: ear

Consider the following three equations: x0 + 2 * x1 + x2 = 4 x1 + x2 = 3 x0 + x2 = 5 We can express this system as a matrix equation A * x = b with: A = np.array([[1, 2, 1], [0, 1, 1], [1, 0, 1]]) b = np.array([4, 3, 5]) Then, use np.linalg....
var go = GameObject.Find("NameOfTheObject"); ProsConsEasy to usePerformance degrades along the number of gameobjects in sceneStrings are weak references and suspect to user errors
var go = GameObject.FindGameObjectWithTag("Player"); ProsConsPossible to search both single objects and entire groupsStrings are weak references and suspect to user errors.Relatively fast and efficientCode is not portable as tags are hard coded in scripts.
By overloading the indexer you can create a class that looks and feels like an array but isn't. It will have O(1) get and set methods, can access an element at index 100, and yet still have the size of the elements inside of it. The SparseArray class class SparseArray { Dictionary<...
class MyDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar' ); private static $has_one = array( 'OtherDataObject' => 'OtherDataObject' ); private static $summary_fields = array( 'Name', 'OtherDat...
Sometimes we want to prepare a context for each test to be run under. The setUp method is run prior to each test in the class. tearDown is run at the end of every test. These methods are optional. Remember that TestCases are often used in cooperative multiple inheritance so you should be careful to...
There's no built in way to search a list for a particular item. However Programming in Lua shows how you might build a set that can help: function Set (list) local set = {} for _, l in ipairs(list) do set[l] = true end return set end Then you can put your list in the Set and test for m...
var gradient = createLinearGradient( startX, startY, endX, endY ) gradient.addColorStop(gradientPercentPosition, CssColor) gradient.addColorStop(gradientPercentPosition, CssColor) [optionally add more color stops to add to the variety of the gradient] Creates a reusable linear gradient (object...
A method can take an array parameter and destructure it immediately into named local variables. Found on Mathias Meyer's blog. def feed( amount, (animal, food) ) p "#{amount} #{animal}s chew some #{food}" end feed 3, [ 'rabbit', 'grass' ] # => "3 rabbits chew some gra...
In some cases we need to apply functions to a set of ND-arrays. Let's look at this simple example. A(:,:,1) = [1 2; 4 5]; A(:,:,2) = [11 22; 44 55]; B(:,:,1) = [7 8; 1 2]; B(:,:,2) = [77 88; 11 22]; A = ans(:,:,1) = 1 2 4 5 ans(:,:,2) = 11 22 44 55 >&...
set can also be invoked with just one argument. When called with just one argument, it returns the contents of that argument. % set x 235 235 % set x 235
To get more information about any git command – i.e. details about what the command does, available options and other documentation – use the --help option or the help command. For example, to get all available information about the git diff command, use: git diff --help git help diff Similarl...
If you want to change the order of a character strings you can use parentheses in the pattern to group parts of the string together. These groups can in the replacement argument be addresed using consecutive numbers. The following example shows how you can reorder a vector of names of the form &quo...
Search for all facts involving a pattern in an hypothesis or conclusion: Coq < Search (_ + O). plus_n_O: forall n : nat, n = n + 0 The _ character serves as a wildcard, it can be used multiple times: Coq < Search (S _ <= _). le_S_n: forall n m : nat, S n <= S m -> n <= m le...
Command line arguments parsing is Go is very similar to other languages. In you code you just access slice of arguments where first argument will be the name of program itself. Quick example: package main import ( "fmt" "os" ) func main() { progName := o...
Structure for Binary Search Tree (BST) nodes: struct node { int data; node * left; node * right; } Search Algorithm // Check if a value exists in the tree bool BSTSearch(node * current, int value) { if (current->data == value) { return true; } e...
Oozie is developed on a client-server architecture. Oozie server is a Java web application that runs Java servlet container within an embedded Apache Tomcat. Oozie provides three different type of clients to interact with the Oozie server: Command Line, Java Client API and HTTP REST API. Oozie serv...
The normal way to create an array of numbers: numbers = [1, 2, 3, 4, 5] Range objects can be used extensively to create an array of numbers: numbers = Array(1..10) # => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] numbers = (1..10).to_a # => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] #step and #map methods...
ARC can be disabled for individual files by adding the -fno-objc-arc compiler flag for each file. Conversely it can be added in Targets ▸ Build Phases ▸ Compile Sources
bookmarks, bookmark: create a new bookmark or list existing bookmarks branch: set or show the current branch name branches: list repository named branches config, showconfig, debugconfig: show combined config settings from all hgrc files files: list tracked files help: show help for a given t...

Page 9 of 21