Tutorial by Examples: and

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, ...
The following example creates a unique index on the JobCandidateID column of the HumanResources.JobCandidate table of the AdventureWorks2012 sample database. The example then creates a default full-text catalog, ft. Finally, the example creates a full-text index on the Resume column, using the ft ca...
Opening Generic ASCII Text Files 5.6.0 open my $filehandle, '<', $name_of_file or die "Can't open $name_of_file, $!"; This is the basic idiom for "default" File IO and makes $filehandle a readable input stream of bytes, filtered by a default system-specific decoder, which...
Enable utf8 pragma In order to enable utf8 pragma in one-liner, perl interpreter should be called with -Mutf8 option: perl -Mutf8 -E 'my $人 = "human"; say $人' Unicode handling with -C switch The -C command line flag lets you control Unicode features. It can be followed by a list of o...
The encoding to be used for the standard I/O filehandles (STDIN, STDOUT, and STDERR), can be set separately for each handle using binmode: binmode STDIN, ':encoding(utf-8)'; binmode STDOUT, ':utf8'; binmode STDERR, ':utf8'; Note: when reading one would in general prefer :encoding(utf-8) over :...
Setting encoding with open() When opening a text file, you may specify it's encoding explicitly with a three-argument open(). This en-/decoder attached to a file handle is called an "I/O layer": my $filename = '/path/to/file'; open my $fh, '<:encoding(utf-8)', $filename or die "...
static and templates folder in the apps may should also contain a folder with the name of app ex. blog this is a convention used to prevent namespace pollution, so we reference the files like /blog/base.html rather than /base.html which provides more clarity about the file we are referencing and pre...
The coordinate systems of Matplotlib come very handy when trying to annotate the plots you make. Sometimes you would like to position text relatively to your data, like when trying to label a specific point. Other times you would maybe like to add a text on top of the figure. This can easily be achi...
In order for a program to react to a certain signal, other than using default action, custom signal handler can be installed using sigaction. sigaction receives three arguments - signal to act on, pointer to sigaction_t structure which, if not NULL, is describing new behaviour and pointer to sigacti...
There are dozens of character sets with hundreds of collations. (A given collation belongs to only one character set.) See the output of SHOW COLLATION;. There are usually only 4 CHARACTER SETs that matter: ascii -- basic 7-bit codes. latin1 -- ascii, plus most characters needed for Western Eur...
Consider using Extension Methods as Functions which wrap other code, here's a great example that uses both a static method and and extension method to wrap the Try Catch construct. Make your code Bullet Proof... using System; using System.Diagnostics; namespace Samples { /// <summary&g...
Consider the following struct definitions: struct Foo { my_bool: bool, my_num: isize, my_string: String, } struct Bar (bool, isize, String); struct Baz; Constructing new structure values for these types is straightforward: let foo = Foo { my_bool: true, my_num: 42, my_string: ...
What's between \Q and \E is treated as normal characters #!/usr/bin/perl my $str = "hello.it's.me"; my @test = ( "hello.it's.me", "hello/it's!me", ); sub ismatched($) { $_[0] ? "MATCHED!" : "DID NOT MATCH!" } my @match = ( ...
Services declaration : # src/Acme/YourBundle/Resources/config/services.yml services: my_service: class: Acme\YourBundle\Service\MyService arguments: ["@doctrine", "%some_parameter%", "@another_service"] another_service: class: Ac...
Extensions add new functionality to an existing class, structure, enumeration, or protocol type. This includes the ability to extend types for which you do not have access to the original source code. Extensions in Swift can: Add computed properties and computed type properties Define instance ...
You can disable Lint checking from your Java and XML source files. Configuring lint checking in Java To disable Lint checking specifically for a Java class or method in your Android project, add the @SuppressLint annotation to that Java code. Example: @SuppressLint("NewApi") @Override...
The following technique allows you to add your content to an HTML element and center it both horizontally and vertically without worrying about its height or width. The outer container should have display: table; The inner container should have display: table-cell; should have vertical-al...
Similar to partial classes the new version of Visual Basic is now able to handle partial modules and partial interfaces. The syntax and behaviour is exactly the same as it would be for partial classes. A partial module example: Partial Module Module1 Sub Main() Console.Write("Ping -&g...
you can use -c <name>=<value> to add a configuration only for one command. To commit as an other user without having to change your settings in .gitconfig : git -c user.email = mail@example commit -m "some message" Note: for that example you don't need to precise both user...
for k in `git branch -a | sed s/^..//`; do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k --`\\t"$k";done | sort

Page 70 of 153