Tutorial by Examples: c

Since Java 7 it has been possible to use one or more underscores (_) for separating groups of digits in a primitive number literal to improve their readability. For instance, these two declarations are equivalent: Java SE 7 int i1 = 123456; int i2 = 123_456; System.out.println(i1 == i2); // tru...
To produce nested JSON object, you need to simply add one JSON object to another: JSONObject mainObject = new JSONObject(); // Host object JSONObject requestObject = new JSONObject(); // Included object try { requestObject.put("lastname", lastname); reques...
Bootstrap's grid system has 12 units known as Columns that can be used to layout content horizontally across the viewport. The reason for a 12-unit grid (instead of 10, 16, etc..) is that 12 evenly divides into 6 (halves), 4 (quarters) and 3 (thirds). This makes adapting to a variety of layouts muc...
Create a node CREATE (neo:Company) //create node with label 'Company' CREATE (neo:Company {name: 'Neo4j', hq: 'San Mateo'}) //create node with properties Create a relationship CREATE (beginning_node)-[:edge_name{Attribute:1, Attribute:'two'}]->(ending_node) Query Templates Running neo...
CREATE (beginning_node)-[:edge_name{Attribute:1, Attribute:'two'}]->(ending_node)
A common problem when working with Unity is when 2 or more developers are modifying a Unity scene or prefab (*.unity files). Git does not know how to merge them correctly out of the box. Thankfully the Unity team deployed a tool called SmartMerge which makes simple merge automatic. The first thing...
A source code file is a (generally) plain text file which is to processed by the compiler. A source code file may contain up to one main program and any number of modules and external subprograms. For example, a source code file may contain the following module mod1 end module mod1 module mod...
/*(8)*/ SELECT /*9*/ DISTINCT /*11*/ TOP /*(1)*/ FROM /*(3)*/ JOIN /*(2)*/ ON /*(4)*/ WHERE /*(5)*/ GROUP BY /*(6)*/ WITH {CUBE | ROLLUP} /*(7)*/ HAVING /*(10)*/ ORDER BY /*(11)*/ LIMIT The order in which a query is processed and description of each section. V...
Elasticsearch is accessed through a HTTP REST API, typically using the cURL library. The messages between the search server and the client (your or your application) are sent in the form of JSON strings. By default, Elasticsearch runs on port 9200. In the examples below, ?pretty is added to tell El...
Partial classes provide an ability to split class declaration (usually into separate files). A common problem that can be solved with partial classes is allowing users to modify auto-generated code without fearing that their changes will be overwritten if the code is regenerated. Also multiple devel...
// Get the current colors of the gradient. let oldColors = self.gradientLayer.colors // Define the new colors for the gradient. let newColors = [UIColor.red.cgColor, UIColor.yellow.cgColor] // Set the new colors of the gradient. self.gradientLayer.colors = newColors // Initia...
Driver: 12c R1 11g R2 (Note: the driver is not included in Maven Central!) Driver class initialization: Class.forName("oracle.jdbc.driver.OracleDriver"); Connection URL Older format, with SID "jdbc:oracle:thin:@<hostname>:<port>:<SID>" Newer...
Padding Remember, members of a struct are usually padded to ensure they are aligned on their natural boundary: struct t { int a, b, c, d; // a is at offset 0, b at 4, c at 8, d at 0ch char e; // e is at 10h short f; // f is at 12h (naturally aligned) lo...
array_reduce reduces array into a single value. Basically, The array_reduce will go through every item with the result from last iteration and produce new value to the next iteration. Usage: array_reduce ($array, function($carry, $item){...}, $defaul_value_of_first_carry) $carry is the result f...
NppExec [sourceforge] allows you to execute commands and scripts from a console window in Notepad++. It can be found in the menu bar at Plugins -> NppExec or just by simply hitting the F6 key (the shortcut Ctrl+F6 will run the latest command) . Example: the following will Set the console to o...
Sometimes, you may have a list structure that looks like this: Animal Listing Table NameTypeDescriptionTitleString (Text)Name of the animalAgeNumberHow old the animal isValueCurrencyValue of the animalTypeLookup (Animal Types Table)Lookup Field (Gives dropdown of choices from Animal Types Table) ...
To get First object: MyModel.objects.first() To get last objects: MyModel.objects.last() Using Filter First object: MyModel.objects.filter(name='simple').first() Using Filter Last object: MyModel.objects.filter(name='simple').last()
Web applications often require static files like CSS or JavaScript files. To use static files in a Flask application, create a folder called static in your package or next to your module and it will be available at /static on the application. An example project structure for using templates is as f...
In an enum it is possible to define a specific behavior for a particular constant of the enum which overrides the default behavior of the enum, this technique is known as constant specific body. Suppose three piano students - John, Ben and Luke - are defined in an enum named PianoClass, as follows:...
A typeglob *foo holds references to the contents of global variables with that name: $foo, @foo, $foo, &foo, etc. You can access it like an hash and assign to manipulate the symbol tables directly (evil!). use v5.10; # necessary for say our $foo = "foo"; our $bar; say ref *foo{SCAL...

Page 302 of 826