Tutorial by Examples: l

A boolean represents the most basic datatype in TypeScript, with the purpose of assigning true/false values. // set with initial value (either true or false) let isTrue: boolean = true; // defaults to 'undefined', when not explicitely set let unsetBool: boolean; // can ...
Array type with known and possibly different types: let day: [number, string]; day = [0, 'Monday']; // valid day = ['zero', 'Monday']; // invalid: 'zero' is not numeric console.log(day[0]); // 0 console.log(day[1]); // Monday day[2] = 'Saturday'; // valid: [0, 'Saturday'] day[3] = fals...
Add one common horizontal line for all categorical variables # sample data df <- data.frame(x=('A', 'B'), y = c(3, 4)) p1 <- ggplot(df, aes(x=x, y=y)) + geom_bar(position = "dodge", stat = 'identity') + theme_bw() p1 + geom_hline(aes(yintercept=5), colour=...
To convert decimal number to binary format use base 2 Int32 Number = 15; Console.WriteLine(Convert.ToString(Number, 2)); //OUTPUT : 1111 To convert decimal number to octal format use base 8 int Number = 15; Console.WriteLine(Convert.ToString(Number, 8)); //OUTPUT : 17 To conv...
Specially useful for has_and_belongs_to_many relation, you can manually create a join table using the create_table method. Suppose you have two models Tags and Proyects, and you'd like to associate them using a has_and_belongs_to_many relation. You need a join table to associate instances of both c...
A GridLayout is a layout manager which places components inside a grid with equal cell sizes. You can set the number of rows, columns, the horizontal gap and the vertical gap using the following methods: setRows(int rows) setColumns(int columns) setHgap(int hgap) setVgap(int vgap) or you ca...
{foo: 'bar', biz: 'baz'}.keys # => [:foo, :biz] {foo: 'bar', biz: 'baz'}.values # => ["bar", "baz"] {foo: 'bar', biz: 'baz'}.to_a # => [[:foo, "bar"], [:biz, "baz"]] {foo: 'bar', biz: 'baz'}.each #<Enumerator: {:foo=>"bar", :b...
Highchart by default puts a credits label in the lower right corner of the chart. This can be removed using credits option in your chart settings. credits: { enabled: false } Or credits: false will remove the highcharts.com logo.
CSS styles for the credits label. Defaults to: credits: { style: { cursor: 'pointer', color: '#909090', fontSize: '10px' } },
C11 Queries the alignment requirement for the specified type. The alignment requirement is a positive integral power of 2 representing the number of bytes between which two objects of the type may be allocated. In C, the alignment requirement is measured in size_t. The type name may not be an inco...
Object oriented style Connect to Server $conn = new mysqli("localhost","my_user","my_password"); Set the default database: $conn->select_db("my_db"); Connect to Database $conn = new mysqli("localhost","my_user","my_password&q...
The query function takes a valid SQL string and executes it directly against the database connection $conn Object oriented style $result = $conn->query("SELECT * FROM `people`"); Procedural style $result = mysqli_query($conn, "SELECT * FROM `people`"); CAUTION A ...
PHP makes it easy to get data from your results and loop over it using a while statement. When it fails to get the next row, it returns false, and your loop ends. These examples work with mysqli_fetch_assoc - Associative array with column names as keys mysqli_fetch_object - stdClass object with ...
When we are finished querying the database, it is recommended to close the connection to free up resources. Object oriented style $conn->close(); Procedural style mysqli_close($conn); Note: The connection to the server will be closed as soon as the execution of the script ends, unless it...
In sequence workflows, yield adds a single item into the sequence being built. (In monadic terminology, it is return.) > seq { yield 1; yield 2; yield 3 } val it: seq<int> = seq [1; 2; 3] > let homogenousTup2ToSeq (a, b) = seq { yield a; yield b } > tup2Seq ("foo", &qu...
Occasionally you may want to use the same tuple type in multiple places throughout your code. This can quickly get messy, especially if your tuple is complex: // Define a circle tuple by its center point and radius let unitCircle: (center: (x: CGFloat, y: CGFloat), radius: CGFloat) = ((0.0, 0.0), ...
The return statement in Bash doesn't return a value like C-functions, instead it exits the function with a return status. You can think of it as the exit status of that function. If you want to return a value from the function then send the value to stdout like this: fun() { local var="S...
Some example cases when the result is an optional. var result: AnyObject? = someMethod() switch result { case nil: print("result is nothing") case is String: print("result is a String") case _ as Double: print("result is not nil, any value that is a Dou...
Before C++17, having pointers with a value of nullptr commonly represented the absence of a value. This is a good solution for large objects that have been dynamically allocated and are already managed by pointers. However, this solution does not work well for small or primitive types such as int, w...
Before C++17, a function typically represented failure in one of several ways: A null pointer was returned. e.g. Calling a function Delegate *App::get_delegate() on an App instance that did not have a delegate would return nullptr. This is a good solution for objects that have been dynamicall...

Page 225 of 861