Tutorial by Examples

OPERATORS $postsGreaterThan = Post::find()->where(['>', 'created_at', '2016-01-25'])->all(); // SELECT * FROM post WHERE created_at > '2016-01-25' $postsLessThan = Post::find()->where(['<', 'created_at', '2016-01-25'])->all(); // SELECT * FROM post WHERE created_at < '2...
<?php namespace models; use yii\db\ActiveRecord; use yii\behaviors\TimestampBehavior; class Post extends ActiveRecord { public static function tableName() { return 'post'; } public function rules() { ...
Generators can be used to implement coroutines: # create and advance generator to the first yield def coroutine(func): def start(*args,**kwargs): cr = func(*args,**kwargs) next(cr) return cr return start # example coroutine @coroutine def adder(sum = 0): ...
Twig is a templating language that compiles to optimized PHP code. It is primarily used for outputting HTML, but can also be used to output any other text-based format. It is a standalone component that can be easily integrated into any PHP project. It provides many excellent features: Autoescap...
To get your most recent stash after running git stash, use git stash apply To see a list of your stashes, use git stash list You will get a list that looks something like this stash@{0}: WIP on master: 67a4e01 Merge tests into develop stash@{1}: WIP on master: 70f0d95 Add user role to lo...
You have to keep the operator precedence in mind when using await keyword. Imagine that we have an asynchronous function which calls another asynchronous function, getUnicorn() which returns a Promise that resolves to an instance of class Unicorn. Now we want to get the size of the unicorn using th...
async functions do not replace the Promise type; they add language keywords that make promises easier to call. They are interchangeable: async function doAsyncThing() { ... } function doPromiseThing(input) { return new Promise((r, x) => ...); } // Call with promise syntax doAsyncThing() ...
When accessing arrays with pointers, there are no bounds check and therefore no IndexOutOfRangeException will be thrown. This makes the code faster. Assigning values to an array with a pointer: class Program { static void Main(string[] args) { unsafe { int...
The Oracle SQL and PL/SQL || operator allows you to concatenate 2 or more strings together. Example: Assuming the following customers table: id firstname lastname --- ----------- ---------- 1 Thomas Woody Query: SELECT firstname || ' ' || lastname || ' is in my database.' a...
CSS3 introduces a few new units, including the rem unit, which stands for "root em". Let's look at how rem works. First, let's look at the differences between em and rem. em: Relative to the font size of the parent. This causes the compounding issue rem: Relative to the font size of t...
You can use the !$ to reduce repetition when using the command line: $ echo ping ping $ echo !$ ping You can also build upon the repetition $ echo !$ pong ping pong $ echo !$, a great game pong, a great game Notice that in the last example we did not get ping pong, a great game because...
Interaction with the history # List all previous commands history # Clear the history, useful if you entered a password by accident history -c Event designators # Expands to line n of bash history !n # Expands to last command !! # Expands to last command starting with "text&qu...
The aggregate function AVG() returns the average of a given expression, usually numeric values in a column. Assume we have a table containing the yearly calculation of population in cities across the world. The records for New York City look similar to the ones below: EXAMPLE TABLE city_namepopula...
Prerequisites iOS 8 or later, macOS 10.9 or later, all versions of tvOS and watchOS. Xcode 8.0 or later required. Realm Swift 2.3.0 was the last version to support Swift 2.x and Xcode 7.3. Installation Dynamic Framework Download the latest release of Realm and extract the zip....
Prerequisites Installation
Prerequisites Installation
Prerequisites iOS 7 or later, macOS 10.9 or later, all versions of tvOS and watchOS. Xcode 7.3 or later required. Installation Download the latest release of Realm files from here or from Github link and extract the zip. Navigate to ios/static/ directory Drag Realm.framework to t...
Prerequisites Installation
The second value in the curly braces dictates the length of the replacement string. By adjusting the second value to be positive or negative, the alignment of the string can be changed. string.Format("LEFT: string: ->{0,-5}<- int: ->{1,-5}<-", "abc", 123); string....
// Integral types as hex string.Format("Hexadecimal: byte2: {0:x2}; byte4: {0:X4}; char: {1:x2}", 123, (int)'A'); // Integers with thousand separators string.Format("Integer, thousand sep.: {0:#,#}; fixed length: >{0,10:#,#}<", 1234567); // Integer with leading zero...

Page 186 of 1336