Tutorial by Examples: ga

Under the attributes section you add the attributes to your model. This button is a plus located at the bottom of the section. You can add any attributes that are relevant to your app. You have several options of types to choose from ranging from Booleans to Dates and more. The Inspector panel also ...
The Set object lets you store unique values of any type, whether primitive values or object references. You can push items into a set and iterate them similar to a plain JavaScript array, but unlike array, you cannot add a value to a Set if the value already exist in it. To create a new set: cons...
To add a value to a Set, use the .add() method: mySet.add(5); If the value already exist in the set it will not be added again, as Sets contain unique values. Note that the .add() method returns the set itself, so you can chain add calls together: mySet.add(1).add(2).add(3);
When developing several applications on one machine, it becomes useful to separate out dependencies into virtual environments. With the use of virtualenv, these environments are sourced into your shell so that when you run a command, it comes from that virtual environment. This is most commonly in...
To setup a new credential profile with the name myprofile: $ aws configure --profile myprofile AWS Access Key ID [None]: ACCESSKEY AWS Secret Access Key [None]: SECRETKEY Default region name [None]: REGIONNAME Default output format [None]: text | table | json For the AWS access key id and se...
Arithmetic operations are performed elementwise on Numpy arrays. For arrays of identical shape, this means that the operation is executed between elements at corresponding indices. # Create two arrays of the same size a = np.arange(6).reshape(2, 3) b = np.ones(6).reshape(2, 3) a # array([0, 1...
string str = "this--is--a--complete--sentence"; string[] tokens = str.Split(new[] { "--" }, StringSplitOptions.None); Result: [ "this", "is", "a", "complete", "sentence" ]
for comprehensions in Scala are just syntactic sugar. These comprehensions are implemented using the withFilter, foreach, flatMap and map methods of their subject types. For this reason, only types that have these methods defined can be utilized in a for comprehension. A for comprehension of the fo...
To create a human-readable presentation of a model object you need to implement Model.__str__() method (or Model.__unicode__() on python2). This method will be called whenever you call str() on a instance of your model (including, for instance, when the model is used in a template). Here's an exampl...
import java.io.*; import java.net.Socket; public class Main { public static void main(String[] args) throws IOException {//We don't handle Exceptions in this example //Open a socket to stackoverflow.com, port 80 Socket socket = new Socket("stackoverflow.com",8...
- initWithCalendarIdentifier: Initializes a newly-allocated NSCalendar object for the calendar specified by a given identifier. NSCalendar *calender = [[NSCalendar alloc]initWithCalendarIdentifier:@"gregorian"]; NSLog(@"%@",calender); - setFirstWeekday: Sets the index of the...
For the sake of this example, it is assumed the user is running Jetty as a distribution. For information on how to run Jetty as an embedded web server, please refer to the official documentation. Jetty can be downloaded from here and is available in both .zip and .gzip formats. Current versions of ...
implode() combines all the array values but looses all the key info: $arr = ['a' => "AA", 'b' => "BB", 'c' => "CC"]; echo implode(" ", $arr); // AA BB CC Imploding keys can be done using array_keys() call: $arr = ['a' => "AA", 'b'...
You can remove all the elements in a set using the .clear() method: mySet.clear();
Until Java 8, two instances of the same annotation could not be applied to a single element. The standard workaround was to use a container annotation holding an array of some other annotation: // Author.java @Retention(RetentionPolicy.RUNTIME) public @interface Author { String value(); } ...
base.twig.html <!DOCTYPE html> <html> <head> <title>{{ title | default('Hello World') }}</title> <link rel="stylesheet" type="text/css" href="theme.css"> {% block css %} {% endblock %} &...
The dir() function can be used to get a list of the members of a class: dir(Class) For example: >>> dir(list) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__...
The trim() method returns a new String with the leading and trailing whitespace removed. String s = new String(" Hello World!! "); String t = s.trim(); // t = "Hello World!!" If you trim a String that doesn't have any whitespace to remove, you will be returned the same S...
ISO/ANSI SQL: SELECT * FROM TableName FETCH FIRST 20 ROWS ONLY; MySQL; PostgreSQL; SQLite: SELECT * FROM TableName LIMIT 20; Oracle: SELECT Id, Col1 FROM (SELECT Id, Col1, row_number() over (order by Id) RowNumber FROM TableName) WHERE RowNumber <= 2...
Mercurial makes it easy to share your work, and to pull in contributions from other developers. This involves three key steps; cloning, pulling, and pushing. Clone To copy a remote repository to your local disk you "clone" it. To do so simply pass the remote URL you'd like to clone from....

Page 46 of 137