Tutorial by Examples: al

Short circuiting is a functionality that skips evaluating parts of a (if/while/...) condition when able. In case of a logical operation on two operands, the first operand is evaluated (to true or false) and if there is a verdict (i.e first operand is false when using &&, first operand is tr...
OSX Implement the contract of the role-specific protocol (NSAccessibilityButton, NSAccessibilityImage, NSAccessibilityGroup, etc) within the NSAccessibility protocol that best matches the behavior of the GUI element being rendered. Linux / BSD For GNOME applications, the GNOME Accessibility Impl...
Some procedures have optional arguments. Optional arguments always come after required arguments, but the procedure can be called without them. For example, if the function, ProcedureName were to have two required arguments (argument1, argument2), and one optional argument, optArgument3, it could b...
TRACE and DEBUG log levels are there to be able to convey high detail about the operation of the given code at runtime. Setting the log level above these is usually recommended, however some care must be taken for these statements to not affect performance even when seemingly "turned off"....
In general when making a call to the command line, the program will send the command and then continue its execution. However you may want to wait for the called program to finish before continuing your own execution (ex. The called program will write data to a file and your program needs that to a...
DATA: <TABLE NAME> TYPE <SORTED|STANDARD|HASHED> TABLE OF <TYPE NAME> WITH <UNIQUE|NON-UNIQUE> KEY <FIELDS FOR KEY>. Standard Table This table has all of the entries stored in a linear fashion and records are accessed in a linear way. For large table sizes, ...
Both #save and #destroy come wrapped in a transaction that ensures that whatever you do in validations or callbacks will happen under its protected cover. So you can use validations to check for values that the transaction depends on or you can raise exceptions in the callbacks to rollback, includin...
There are two types of callbacks associated with committing and rolling back transactions: after_commit and after_rollback. after_commit callbacks are called on every record saved or destroyed within a transaction immediately after the transaction is committed. after_rollback callbacks are called o...
Shade is a library developed by OpenStack to simplify interactions with OpenStack clouds, like DreamHost. $ pip install shade
Built-in functionals: lapply(), sapply(), and mapply() R comes with built-in functionals, of which perhaps the most well-known are the apply family of functions. Here is a description of some of the most common apply functions: lapply() = takes a list as an argument and applies the specified ...
User-defined functionals Users can create their own functionals to varying degrees of complexity. The following examples are from Functionals by Hadley Wickham: randomise <- function(f) f(runif(1e3)) lapply2 <- function(x, f, ...) { out <- vector("list", length(x...
To print a test field (TestField) from a test feature class (TestFC) in a test file geodatabase (Test.gdb) located in a temporary folder (C:\Temp): with arcpy.da.SearchCursor(r"C:\Temp\Test.gdb\TestFC",["TestField"]) as cursor: for row in cursor: print row[0]
long fib(long n) { return n < 2 ? n : fib(n - 1) + fib(n - 2); } struct FibStruct(int n) { // Remarks: n is a template ubyte[fib(n)] data; } void main() { import std.stdio : writeln; enum f10 = fib(10); // execute the function at compile-time pragma(msg, f10); /...
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver class UserProfile(models.Model): user = models.OneToOneField(User, related_name='user') website = models.URLField(default='', ...
Here is a simple JsonArray which you would like to convert to a Java ArrayList: { "list": [ "Test_String_1", "Test_String_2" ] } Now pass the JsonArray 'list' to the following method which returns a corresponding...
Config values can be set in three ways: Via private static variables on any class within a SilverStripe project Via yaml config files (stored in module-folder/_config/[file].yml) Via PHP at run time (Config::inst()->update('Director', 'environment_type', 'dev') Generally it's best to se...
Exceptions are powerful, but a single overzealous except clause can take it all away in a single line. try: res = get_result() res = res[0] log('got result: %r' % res) except: if not res: res = '' print('got exception') This example demonstrates 3 symptoms of t...
Download Use Firebird site to download the correct "server package" for your system. First, select the version of Firebird that you would like to install. Next, select the appropriated installer for your system. Example, for almost any version of Windows 32 bits, you would select under ...
The Scala Collections framework, according to its authors, is designed to be easy to use, concise, safe, fast, and universal. The framework is made up of Scala traits that are designed to be building blocks for creating collections. For more information on these building blocks, read the official S...
<svg xmlns="http://www.w3.org/2000/svg"> <switch> <text systemLanguage="en-UK" x="10" y="10">UK English</text> <text systemLanguage="fr" x="10" y="10">Français</text> <text ...

Page 124 of 269