Tutorial by Examples: sin

The reduce method reduces the collection to a single value, passing the result of each iteration into the subsequent iteration. Please see reduce method. The reduce method loops through each item with a collection and produces new result to the next iteration. Each result from the last iteration ...
The <see> tag can be used to link to another class. It contains the cref member which should contain the name of the class that is to be referenced. Visual Studio will provide Intellsense when writing this tag and such references will be processed when renaming the referenced class, too. /// ...
You can use the System.IO.File.ReadAllText function to read the entire contents of a file into a string. string text = System.IO.File.ReadAllText(@"C:\MyFolder\MyTextFile.txt"); You can also read a file as an array of lines using the System.IO.File.ReadAllLines function: string[] line...
The System.IO.StreamWriter class: Implements a TextWriter for writing characters to a stream in a particular encoding. Using the WriteLine method, you can write content line-by-line to a file. Notice the use of the using keyword which makes sure the StreamWriter object is disposed as soon as ...
You can use the System.IO.File.WriteAllText function to write a string to a file. string text = "String that will be stored in the file"; System.IO.File.WriteAllText(@"C:\MyFolder\OutputFile.txt", text); You can also use the System.IO.File.WriteAllLines function which receiv...
Sometimes you may want maintain versions of a git repository on machines that have no network connection. Bundles allow you to package git objects and references in a repository on one machine and import those into a repository on another. git tag 2016_07_24 git bundle create changes_between_tags...
Detecting the current state of the network connection and responding to any changes that might occur, can be done by using one of several plugins. This example is about the cordova-plugin-network-information plugin. Add the plugin to the project: cordova plugin add cordova-plugin-network-informati...
$sce ("Strict Contextual Escaping") is a built-in angular service that automatically sanitize content and internal sources in templates. injecting external sources and raw HTML into the template requires manual wrapping of$sce. In this example we'll create a simple $sce sanitation f...
Concatenating strings using a StringBuilder can offer performance advantages over simple string concatenation using +. This is due to the way memory is allocated. Strings are reallocated with each concatenation, StringBuilders allocate memory in blocks only reallocating when the current block is e...
The String.Join method can be used to concatenate multiple elements from a string array. string[] value = {"apple", "orange", "grape", "pear"}; string separator = ", "; string result = String.Join(separator, value, 1, 2); Console.WriteLine(resu...
The $http service is a function which generates an HTTP request and returns a promise. General Usage // Simple GET request example: $http({ method: 'GET', url: '/someUrl' }).then(function successCallback(response) { // this callback will be called asynchronously // when the respo...
HTTP requests are widely used repeatedly across every web app, so it is wise to write a method for each common request, and then use it in multiple places throughout the app. Create a httpRequestsService.js httpRequestsService.js appName.service('httpRequestsService', function($q, $http){ ...
There are three types of code swaps that Instant run enables to support faster debugging and running app from your code in Android Studio. Hot Swap Warm Swap Cold Swap When are each of these swaps triggered? HOT SWAP is triggered when an existing method's implementation is changed. WARM SW...
There are a few changes where instant won't do its trick and a full build and reinstall fo your app will happen just like it used to happen before Instant Run was born. Change the app manifest Change resources referenced by the app manifest Change an Android widget UI element (requires a Clean ...
We have a C library named my_random that produces random numbers from a custom distribution. It provides two functions that we want to use: set_seed(long seed) and rand() (and many more we do not need). In order to use them in Cython we need to define an interface in the .pxd file and call the f...
Swing supports quite a few native L&Fs. You can always easily install one without calling for a specific L&F class: public class SystemLookAndFeel { public static void main ( final String[] args ) { // L&F installation should be performed within EDT (Event Dispatch ...
public class CustomLookAndFeel { public static void main ( final String[] args ) { // L&F installation should be performed within EDT (Event Dispatch Thread) // This is important to avoid any UI issues, exceptions or even deadlocks SwingUtilities.invokeLater...
Arithmetic computation can be also done without involving any other programs like this: Multiplication: echo $((5 * 2)) 10 Division: echo $((5 / 2)) 2 Modulo: echo $((5 % 2)) 1 Exponentiation: echo $((5 ** 2)) 25
Lambdas are meant to provide inline implementation code for single method interfaces and the ability to pass them around as we have been doing with normal variables. We call them Functional Interface. For example, writing a Runnable in anonymous class and starting a Thread looks like: //Old way n...
If you have the version tag v2.3 you can display all commits since that tag. gitk v2.3..

Page 56 of 161