Tutorial by Examples: ti

PrimitiveBoxed TypeMemory Size of primitive / boxedbooleanBoolean1 byte / 16 bytesbyteByte1 byte / 16 bytesshortShort2 bytes / 16 bytescharChar2 bytes / 16 bytesintInteger4 bytes / 16 byteslongLong8 bytes / 16 bytesfloatFloat4 bytes / 16 bytesdoubleDouble8 bytes / 16 bytes Boxed objects always requ...
UPDATE person SET state = 'NY' WHERE city = 'New York';
You can update multiple columns in a table in the same statement, separating col=val pairs with commas: UPDATE person SET country = 'USA', state = 'NY' WHERE city = 'New York';
You can also update data in a table based on data from another table: UPDATE person SET state_code = cities.state_code FROM cities WHERE cities.city = city; Here we are joining the person city column to the cities city column in order to get the city's state code. This is then used to updat...
Say we are working on a class representing a Person by their first and last names. We have created a basic class to do this and implemented proper equals and hashCode methods. public class Person { private final String lastName; //invariant - nonnull private final String firstName; //in...
Variables declared inside a function only exist (unless passed) inside that function. x <- 1 foo <- function(x) { y <- 3 z <- x + y return(z) } y Error: object 'y' not found Variables passed into a function and then reassigned are overwritten, but only insi...
Functions called within a function (ie subfunctions) must be defined within that function to access any variables defined in the local environment without being passed. This fails: bar <- function() { z <- x + y return(z) } foo <- function() { y <- 3 z <-...
The on.exit() function is handy for variable clean up if global variables must be assigned. Some parameters, especially those for graphics, can only be set globally. This small function is common when creating more specialized plots. new_plot <- function(...) { old_pars <- par(m...
Installing the haystack package pip install django-haystack Configuration Add haystack to your project's INSTALLED_APPS inside of your settings.py file: # settings.py INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', # Put...
Create custom class for calling multipart/form-data HttpURLConnection request MultipartUtility.java public class MultipartUtility { private final String boundary; private static final String LINE_FEED = "\r\n"; private HttpURLConnection httpConn; priva...
The option -v followed by an assignment of the form variable=value can be used to pass parameters to an awk program. This is illustrated by the punishment program below, whose job is to write count times the sentence “I shall not talk in class.” on standard output. The following example uses the v...
ng-model-options allows to change the default behavior of ng-model, this directive allows to register events that will fire when the ng-model is updated and to attach a debounce effect. This directive accepts an expression that will evaluate to a definition object or a reference to a scope value. ...
Custom events usually need custom event arguments containing information about the event. For example MouseEventArgs which is used by mouse events like MouseDown or MouseUp events, contains information about Location or Buttons which used to generate the event. When creating new events, to create a...
A cancelable event can be raised by a class when it is about to perform an action that can be canceled, such as the FormClosing event of a Form. To create such event: Create a new event arg deriving from CancelEventArgs and add additional properties for event data. Create an event using EventH...
If you have a list, and you want to use the elements of that list as the arguments to a function, what you want is apply: > (apply string-append (list "hello" " " "and hi" " " "are both words")) "hello and hi are both words" > (app...
Functions in Racket can be created with the lambda form. The form takes a list of arguments and a body. (lambda (x y) (* x y)) In the example above, the function takes in two arguments and returns the result of multiplying them. > ((lambda (x y) (* x y)) 4 4) 16 > ((lambda (x y) (* x y)...
Thread.sleep causes the current thread to suspend execution for a specified period. This is an efficient means of making processor time available to the other threads of an application or other applications that might be running on a computer system. There are two overloaded sleep methods in the Thr...
To set a value in NSUserDefaults, you can use the following functions: Swift < 3 setBool(_:forKey:) setFloat(_:forKey:) setInteger(_:forKey:) setObject(_:forKey:) setDouble(_:forKey:) setURL(_:forKey:) Swift 3 In Swift 3 the names of function is changed to set insted of set folloed by ...
To get a value in NSUserDefaults you can use the following functions: Swift arrayForKey(_:) boolForKey(_:) dataForKey(_:) dictionaryForKey(_:) floatForKey(_:) integerForKey(_:) objectForKey(_:) stringArrayForKey(_:) stringForKey(_:) doubleForKey(_:) URLForKey(_:) Objective-C -(nullab...
One of the most useful queries for end users of large RDBMS's is a search of an information schema. Such a query allows users to rapidly find database tables containing columns of interest, such as when attempting to relate data from 2 tables indirectly through a third table, without existing knowl...

Page 157 of 505