Tutorial by Examples

If you need to write a file using different locale settings to the default, you can use std::locale and std::basic_ios::imbue() to do that for a specific file stream: Guidance for use: You should always apply a local to a stream before opening the file. Once the stream has been imbued you shoul...
Linux running systemd, like Ubuntu 16.04, adding -H tcp://0.0.0.0:2375 to /etc/default/docker does not have the effect it used to. Instead, create a file called /etc/systemd/system/docker-tcp.socket to make docker available on a TCP socket on port 4243: [Unit] Description=Docker Socket for the AP...
By default, a new class module is a Private class, so it is only available for instantiation and use within the VBProject in which it is defined. You can declare, instantiate and use the class anywhere in the same project: 'Class List has Instancing set to Private 'In any other module in the SAME ...
Group by is often used with join statement. Let's assume we have two tables. The first one is the table of students: IdFull NameAge1Matt Jones202Frank Blue213Anthony Angel18 Second table is the table of subject each student can take: Subject_IdSubject1Maths2P.E.3Physics And because one student c...
MERGE INTO targetTable USING sourceTable ON (targetTable.PKID = sourceTable.PKID) WHEN MATCHED AND (targetTable.PKID > 100) THEN DELETE WHEN MATCHED AND (targetTable.PKID <= 100) THEN UPDATE SET targetTable.ColumnA = sourceTable.ColumnA, targetTable.Co...
WITH SourceTableCTE AS ( SELECT * FROM SourceTable ) MERGE TargetTable AS target USING SourceTableCTE AS source ON (target.PKID = source.PKID) WHEN MATCHED THEN UPDATE SET target.ColumnA = source.ColumnA WHEN NOT MATCHED THEN INSERT (ColumnA) VALUES (Source.ColumnA);...
MERGE INTO TargetTable AS Target USING (VALUES (1,'Value1'), (2, 'Value2'), (3,'Value3')) AS Source (PKID, ColumnA) ON Target.PKID = Source.PKID WHEN MATCHED THEN UPDATE SET target.ColumnA= source.ColumnA WHEN NOT MATCHED THEN INSERT (PKID, ColumnA) VALUES (Source.PKID...
SELECT COALESCE(NULL, NULL, 'TechOnTheNet.com', NULL, 'CheckYourMath.com'); Result: 'TechOnTheNet.com' SELECT COALESCE(NULL, 'TechOnTheNet.com', 'CheckYourMath.com'); Result: 'TechOnTheNet.com' SELECT COALESCE(NULL, NULL, 1, 2, 3, NULL, 4); Result: 1
An object can only be deallocated by delete if it was allocated by new and is not an array. If the argument to delete was not returned by new or is an array, the behavior is undefined. An object can only be deallocated by delete[] if it was allocated by new and is an array. If the argument to delet...
USE msdb Go SELECT dbo.sysjobs.Name AS 'Job Name', 'Job Enabled' = CASE dbo.sysjobs.Enabled WHEN 1 THEN 'Yes' WHEN 0 THEN 'No' END, 'Frequency' = CASE dbo.sysschedules.freq_type WHEN 1 THEN 'Once' WHEN 4 THEN 'Daily' ...
WITHOUT_ARRAY_WRAPPER option in FOR JSON clause will remove array brackets from the JSON output. This is useful if you are returning single row in the query. Note: this option will produce invalid JSON output if more than one row is returned. Input table data (People table) IdNameAge1John232J...
OPENJSON function parses JSON text and returns multiple outputs. Values that should be returned are specified using the paths defined in the WITH clause. If a path is not specified for some column, the column name is used as a path. This function casts returned values to the SQL types defined in the...
Structures and arrays of structures can be initialized by a series of values enclosed in braces, one value per member of the structure. struct Date { int year; int month; int day; }; struct Date us_independence_day = { 1776, 7, 4 }; struct Date uk_battles[] = { { 1066, ...
A basic function is defined and executed like this: function hello($name) { print "Hello $name"; } hello("Alice");
Functions can have optional parameters, for example: function hello($name, $style = 'Formal') { switch ($style) { case 'Formal': print "Good Day $name"; break; case 'Informal': print "Hi $name"; break; ...
Function arguments can be passed "By Reference", allowing the function to modify the variable used outside the function: function pluralize(&$word) { if (substr($word, -1) == 'y') { $word = substr($word, 0, -1) . 'ies'; } else { $word .= 's'; } } $w...
An object in PHP contains variables and functions. Objects typically belong to a class, which defines the variables and functions that all objects of this class will contain. The syntax to define a class is: class Shape { public $sides = 0; public function description() { ...
The standard requires that long double provides at least as much precision as double, which provides at least as much precision as float; and that a long double can represent any value that a double can represent, while a double can represent any value that a float can represent. The details of the ...
The array is one of Perl's basic variable types. It contains a list, which is an ordered sequence of zero or more scalars. The array is the variable holding (and providing access to) the list data, as is documented in perldata. You can assign a list to an array: my @foo = ( 4, 5, 6 ); You can u...
Lists can also be assigned to hash variables. When creating a list that will be assigned to a hash variable, it is recommended to use the fat comma => between keys and values to show their relationship: my %hash = ( foo => 42, bar => 43, baz => 44 ); The => is really only a specia...

Page 617 of 1336