Tutorial by Examples: called

While static constructors are always called before the first usage of a type it's sometimes useful to be able to force them to be called and the RuntimeHelpers class provide an helper for it: using System.Runtime.CompilerServices; // ... RuntimeHelpers.RunClassConstructor(typeof(Foo).TypeHand...
__CLASS__ magic constant returns the same result as get_class() function called without parameters and they both return the name of the class where it was defined (i.e. where you wrote the function call/constant name ). In contrast, get_class($this) and get_called_class() functions call, will both ...
For named (non-anonymous) functions, you can break when the function is executed. debug(functionName); The next time functionName function runs, the debugger will stop on its first line.
When an object is exposed to the template context, its arguments-less methods are available. This is useful when these functions are "getters". But it can be hazardeous if these methods alter some data or have some side effects. Eventhough you likely trust the template writer, he may not b...
echo off cls sqlcmd.exe -S "your server name" -U "sql user name" -P "sql password" -d "name of databse" -Q "here you may write your query/stored procedure" Batch files like these can be used to automate tasks, for example to make backups of ...
You can see list with all environment variables with: Get-Childitem env:
The following statement will create a new table called employee: CREATE TABLE EMPLOYEE ( EMPNO CHAR(6) NOT NULL, FIRSTNME VARCHAR(12) NOT NULL, LASTNAME VARCHAR(15) NOT NULL, SALARY DECIMAL(9,2) , PRIMARY KEY (EMPNO) ...
To track so called "virtual pageviews", use the ga('send') method right after your asynchronous request: Syntax: ga('send', 'pageview', 'path to your virtual page'); Example (Simple Link): <a href="http://example.com/my.pdf" onClick="ga('send', 'pageview', '/virtu...
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectActivityLeaks() .detectLeakedClosableObjects() .penaltyLog() .build());
If you do not see any logging, you can check if Configure() is called in your application. The easiest way is to add it as an attribute to your assembly: [assembly: log4net.Config.XmlConfigurator(Watch = true)] Then you do not have to add log4net.Config.XmlConfigurator.Configure() anywhere in y...
import sys import json # load input arguments from the text file filename = sys.argv[ 1 ] with open( filename ) as data_file: input_args = json.loads( data_file.read() ) # cast strings to floats x, y = [ float(input_args.get( key )) for key in [ 'x', 'y' ] ] print json.dumps( { ...

Page 1 of 1