Tutorial by Examples: o

The Symbol.for method allows you to register and look up global symbols by name. The first time it is called with a given key, it creates a new symbol and adds it to the registry. let a = Symbol.for('A'); The next time you call Symbol.for('A'), the same symbol will be returned instead of a new o...
For more complex applications, flat execution profiles may be difficult to follow. This is why many profiling tools also generate some form of annotated callgraph information. gperf2dot converts text output from many profilers (Linux perf, callgrind, oprofile etc.) into a callgraph diagram. You can...
Google Perf Tools also provides a CPU profiler, with a slightly friendlier interface. To use it: Install Google Perf Tools Compile your code as usual Add the libprofiler profiler library to your library load path at runtime Use pprof to generate a flat execution profile, or a callgraph diagram...
The | can be used to have a single case statement match against multiple inputs to yield the same result: def f(str: String): String = str match { case "foo" | "bar" => "Matched!" case _ => "No match." } f("foo") // res0: String = M...
Given the following List of tuples: val pastries = List(("Chocolate Cupcake", 2.50), ("Vanilla Cupcake", 2.25), ("Plain Muffin", 3.25)) Pattern matching can be used to handle each element differently: pastries foreach { pa...
This is an example of an implementation of the identity monad in JavaScript, and could serve as a starting point to create other monads. Based on the conference by Douglas Crockford on monads and gonads Using this approach reusing your functions will be easier because of the flexibility this monad...
Bootstrapping Magento by calling: require_once 'app/Mage.php'; Mage::app(); // Your code This is the simplest way but not really the Magento way because we're not using class that extends Mage_Shell_Abstract - the class which when extended provides us with tools to parse command line arguments...
Magento way File resides in shell/custom.php <?php require_once' abstract.php'; class Stackoverflow_Shell_Custom extends Mage_Shell_Abstract { protected $_argname = array(); public function __construct() { parent::__construct(); // Time limit to infinity ...
The std::nth_element algorithm takes three iterators: an iterator to the beginning, nth position, and end. Once the function returns, the nth element (by order) will be the nth smallest element. (The function has more elaborate overloads, e.g., some taking comparison functors; see the above link for...
.exr -1 gives you details about the last exception thrown. !analyze -v usually does a good job as well. For .NET, the command !pe of the SOS extension shows details about the .NET exception that was thrown.
Hosted XSLT 2.0 Setup To run XSLT 2.0 in the browser, use one of the following XSLT 2.0 as a service hosts: XSLT Fiddle W3C XSLT Servlet Online XSLT Test Tool

SOS

SOS (son of strike) is the official WinDbg extension from Microsoft for .NET. It gets installed as part of the .NET framework and thus is available by default. Like any extension, it can be loaded using .load x:\full\path\to\sos.dll, but there are easier ways. Depending on the version of .NET, the ...
SOSex is an extension to SOS, written by Steve Johnson, a Microsoft employee. He provides SOSex for download for free, but it's not open source. Typically, the extension is not available side by side to any other DLL, so it is usually loaded with .load x:\full\path\to\sosex.dll. Besides simplifyin...
Print the path to the active developer directory (selected Xcode) xcode-select -p Select a different version of Xcode, e.g. Beta sudo xcode-select -s /Applications/Xcode-beta.app Reset to the default version of Xcode sudo xcode-select -r This is equivalent to running sudo xcode-select -s /Appl...
An incomplete list of WinDbg extensions that are not installed with WinDbg itself: ExtensionPurposeSOS.NET (official Microsoft extension)SOSex.NET (extension for SOS)CoSOS.NET (extension for SOS)NetExt.NET (with focus on networking)PyKDPython scriptingPDEWindows native and store applications (stowe...
CoSOS (cousin of SOS) is an open source extension for WinDbg focusing on .NET memory fragmentation (!gcview) and threading issues (!wfo, !tn). Typically, the extension is not available side by side to any other DLL, so it is usually loaded with .load x:\full\path\to\cosos.dll. It requires that SOS ...
Ref returns and ref locals are useful for manipulating and returning references to blocks of memory instead of copying memory without resorting to unsafe pointers. Ref Return public static ref TValue Choose<TValue>( Func<bool> condition, ref TValue left, ref TValue right) { ...
We're going to use the expression tree API to create a CalculateSalesTax tree. In plain English, here's a summary of the steps it takes to create the tree. Check if the product is taxable If it is, multiply the line total by the applicable tax rate and return that amount Otherwise return 0 ...
Determine your key ID gpg --list-secret-keys --keyid-format LONG /Users/davidcondrey/.gnupg/secring.gpg -------------------------------------- sec 2048R/YOUR-16-DIGIT-KEY-ID YYYY-MM-DD [expires: YYYY-MM-DD] Your ID is a alphanumeric 16-digit code following the first forward-slash. ...
Sometimes we want to look at what is sent and received in the SOAP request. The following methods will return the XML in the request and response: SoapClient::__getLastRequest() SoapClient::__getLastRequestHeaders() SoapClient::__getLastResponse() SoapClient::__getLastResponseHeaders() For ex...

Page 572 of 1038