Tutorial by Examples: c

This query will return all columns from the table sales where the values in the column amount is greater than 10 and the data in the region column in "US". SELECT * FROM sales WHERE amount > 10 AND region = "US" You can use regular expressions to select the columns you wan...
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...
A compound literal is an unnamed object which is created in the scope where is defined. The concept was first introduced in C99 standard. An example for compound literal is Examples from C standard, C11-§6.5.2.5/9: int *p = (int [2]){ 2, 4 }; p is initialized to the address of the first ele...
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...
A common workflow for using Git LFS is to declare which files are intercepted through a rules-based system, just like .gitignore files. Much of time, wildcards are used to pick certain file-types to blanket track. e.g. git lfs track "*.psd" When a file matching the above pattern is adde...
Suggested max len First, I will mention some common strings that are always hex, or otherwise limited to ASCII. For these, you should specify CHARACTER SET ascii (latin1 is ok) so that it will not waste space: UUID CHAR(36) CHARACTER SET ascii -- or pack into BINARY(16) country_code CHAR(2) CHAR...
Any size of INT may be used for AUTO_INCREMENT. UNSIGNED is always appropriate. Keep in mind that certain operations "burn" AUTO_INCREMENT ids. This could lead to an unexpected gap. Examples: INSERT IGNORE and REPLACE. They may preallocate an id before realizing that it won't be need...
String concatenation is when you combine two or more strings into a single string variable. String concatenation is performed with the & symbol. Dim one As String = "Hello " Dim two As String = "there" Dim result As String = one & two Non-string values will be conv...
7.0 OrElse Sub Main() Dim elements As List(Of Integer) = Nothing Dim average As Double = AverageElementsOrElse(elements) Console.WriteLine(average) ' Writes 0 to Console Try 'Throws ArgumentNullException average = AverageElementsOr(elements) Catch ex ...
using System; using System.Threading; using System.Threading.Tasks; class Program { static void Main( string[] args ) { object sync = new object(); int sum = 0; Parallel.For( 1, 1000, ( i ) => { lock( sync ) sum = sum + i; // lock is necessa...
Using the Library Database, we try to find the last book added to the database for each author. For this simple example we assume an always incrementing Id for each record added. SELECT MostRecentBook.Name, MostRecentBook.Title FROM ( SELECT Authors.Name, Books.Title, ...
As of Qt 5.1 and later you can use QQmlApplicationEngine instead of QQuickView to load and render a QML script. With QQmlApplicationEngine you do need to use a QML Window type as your root element. You can obtain the root context from the engine where you can then add global properties to the cont...
Not all objects can be converted to a JSON string. When an object has cyclic self-references, the conversion will fail. This is typically the case for hierarchical data structures where parent and child both reference each other: const world = { name: 'World', regions: [] }; world.region...
Creating a ServiceHost programmatically (without config file) in its most basic form: namespace ConsoleHost { class ConsoleHost { ServiceHost mHost; public Console() { mHost = new ServiceHost(typeof(Example), new Uri("net.tcp://localhost:9000/Example")); ...
abstract class Machine { constructor(public manufacturer: string) { } // An abstract class can define methods of it's own, or... summary(): string { return `${this.manufacturer} makes this machine.`; } // Require inheriting classes to implement methods ...
Create a MongoDB connection, that later you can query: $manager = new \MongoDB\Driver\Manager('mongodb://localhost:27017'); In the next example, you will learn how to query the connection object. This extension close the connection automatically, it's not necessary to close manually.
Example for searching just one user with a specific id, you should do: $options = ['limit' => 1]; $filter = ['_id' => new \MongoDB\BSON\ObjectID('578ff7c3648c940e008b457a')]; $query = new \MongoDB\Driver\Query($filter, $options); $cursor = $manager->executeQuery('database_name.collect...
Example for searching multiple users with the name "Mike": $filter = ['name' => 'Mike']; $query = new \MongoDB\Driver\Query($filter); $cursor = $manager->executeQuery('database_name.collection_name', $query); foreach ($cursor as $doc) { var_dump($doc); }
Example for adding a document: $document = [ 'name' => 'John', 'active' => true, 'info' => ['genre' => 'male', 'age' => 30] ]; $bulk = new \MongoDB\Driver\BulkWrite; $_id1 = $bulk->insert($document); $result = $manager->executeBulkWrite('database_name.collect...
Example for updating all documents where name is equal to "John": $filter = ['name' => 'John']; $document = ['name' => 'Mike']; $bulk = new \MongoDB\Driver\BulkWrite; $bulk->update( $filter, $document, ['multi' => true] ); $result = $manager->executeBu...

Page 347 of 826