Tutorial by Examples

<?php while ($condition): do_something(); endwhile; ?> <?php while ($condition): ?> <p>Do something in HTML</p> <?php endwhile; ?>
<?php foreach ($collection as $item): do_something($item); endforeach; ?> <?php foreach ($collection as $item): ?> <p>Do something in HTML with <?php echo $item; ?></p> <?php endforeach; ?>
<?php switch ($condition): case $value: do_something(); break; default: do_something_else(); break; endswitch; ?> <?php switch ($condition): ?> <?php case $value: /* having whitespace before your cases will cause an error */ ?&g...
<?php if ($condition): do_something(); elseif ($another_condition): do_something_else(); else: do_something_different(); endif; ?> <?php if ($condition): ?> <p>Do something in HTML</p> <?php elseif ($another_condition): ?> <p>...
Interleave your y or x values with NaNs x = [1:5; 6:10]'; x(3,2) = NaN x = 1 6 2 7 3 NaN 4 9 5 10 plot(x)
Numpy installation through pypi (the default package index used by pip) generally fails on Windows computers. The easiest way to install on Windows is by using precompiled binaries. One source for precompiled wheels of many packages is Christopher Gohkle's site. Choose a version according to your ...
See how to compile this code in Initialize and build import Html main = Html.text "Hello World!"
Django uses migrations to propagate changes you make to your models to your database. Most of the time django can generate them for you. To create a migration, run: $ django-admin makemigrations <app_name> This will create a migration file in the migration submodule of app_name. The first...
Sometimes, migrations generated by Django are not sufficient. This is especially true when you want to make data migrations. For instance, let's you have such model: class Article(models.Model): title = models.CharField(max_length=70) This model already have existing data and now you want ...
Creating the class to be the subject of the Mirror class Project { var title: String = "" var id: Int = 0 var platform: String = "" var version: Int = 0 var info: String? } Creating an instance that will actually be the subject of the mirror. Also he...
m := make(map[string][]int) Accessing a non-existent key will return a nil slice as a value. Since nil slices act like zero length slices when used with append or other built-in functions you do not normally need to check to see if a key exists: // m["key1"] == nil && len(m[&qu...
Python uses the C3 linearization algorithm to determine the order in which to resolve class attributes, including methods. This is known as the Method Resolution Order (MRO). Here's a simple example: class Foo(object): foo = 'attr foo of Foo' class Bar(object): foo = 'attr foo o...
Descriptors are objects that are (usually) attributes of classes and that have any of __get__, __set__, or __delete__ special methods. Data Descriptors have any of __set__, or __delete__ These can control the dotted lookup on an instance, and are used to implement functions, staticmethod, classmet...
The UITableViewDelegate is used to control how the table is displayed, and UITableViewDataSource is used to define the UITableView's data. There are two required methods and many optional ones which can be used to customize size, sections, headings, and cells in the UITableView. UITableViewDataSo...
To change the default stack order positioned elements (position property set to relative, absolute or fixed), use the z-index property. The higher the z-index, the higher up in the stacking context (on the z-axis) it is placed. Example In the example below, a z-index value of 3 puts green on to...
Relative positioning moves the element in relation to where it would have been in normal flow .Offset properties: top left right bottom are used to indicate how far to move the element from where it would have been in normal flow. .relpos{ position:relative; top:20px; left:3...
When absolute positioning is used the box of the desired element is taken out of the Normal Flow and it no longer affects the position of the other elements on the page. Offset properties: top left right bottom specify the element should appear in relation to its next non-static containing ...
Sometimes it's not a good practice expose an internal collection since it can lead to a malicious code vulnerability due to it's mutable characteristic. In order to provide "read-only" collections java provides its unmodifiable versions. An unmodifiable collection is often a copy of a mod...
Consider the following tough-to-vectorize for loop, which creates a vector of length len where the first element is specified (first) and each element x_i is equal to cos(x_{i-1} + 1): repeatedCosPlusOne <- function(first, len) { x <- numeric(len) x[1] <- first for (i in 2:len) { ...
Prerequisites nodejs To install the latest stable release of sails with the command-line tool issue following command: $ sudo npm install sails -g Depending on your OS you might not need to use sudo.

Page 148 of 1336