Tutorial by Examples

Defines a new type based on an existing type. Its syntax mirrors that of a variable declaration. /* Byte can be used wherever `unsigned char` is needed */ typedef unsigned char Byte; /* Integer is the type used to declare an array consisting of a single int */ typedef int Integer[1]; /* Nod...
This storage class denotes that an identifier has automatic storage duration. This means once the scope in which the identifier was defined ends, the object denoted by the identifier is no longer valid. Since all objects, not living in global scope or being declared static, have automatic storage d...
The static storage class serves different purposes, depending on the location of the declaration in the file: To confine the identifier to that translation unit only (scope=file). /* No other translation unit can use this variable. */ static int i; /* Same; static is attached to the functi...
Used to declare an object or function that is defined elsewhere (and that has external linkage). In general, it is used to declare an object or function to be used in a module that is not the one in which the corresponding object or function is defined: /* file1.c */ int foo = 2; /* Has externa...
Hints to the compiler that access to an object should be as fast as possible. Whether the compiler actually uses the hint is implementation-defined; it may simply treat it as equivalent to auto. The only property that is definitively different for all objects that are declared with register is that...
$ react-native start On latest version of React Native, no need to run the packager. It will run automatically. By default this starts the server at port 8081. To specify which port the server is on $ react-native start --port PORTNUMBER
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...
The System.String class supports a number of methods to convert between uppercase and lowercase characters in a string. System.String.ToLowerInvariant is used to return a String object converted to lowercase. System.String.ToUpperInvariant is used to return a String object converted to upper...
Detailed instructions on getting windows-phone set up or installed.
There are two functions that can be used to obtain a readable representation of an object. repr(x) calls x.__repr__(): a representation of x. eval will usually convert the result of this function back to the original object. str(x) calls x.__str__(): a human-readable string that describes the obje...
There are two main approaches to creating a thread in Java. In essence, creating a thread is as easy as writing the code that will be executed in it. The two approaches differ in where you define that code. In Java, a thread is represented by an object - an instance of java.lang.Thread or its subcl...
A simple example of using multiple processes would be two processes (workers) that are executed separately. In the following example, two processes are started: countUp() counts 1 up, every second. countDown() counts 1 down, every second. import multiprocessing import time from random impor...
import UIKit import WebKit class ViewController: UIViewController, UISearchBarDelegate, WKNavigationDelegate, WKUIDelegate { var searchbar: UISearchBar! //All web-browsers have a search-bar. var webView: WKWebView! //The WKWebView we'll use. var toolbar: UIToolbar! //Toolb...
A file can be locked using the FileChannel API that can be acquired from Input Output streams and readers Example with streams // Open a file stream FileInputStream ios = new FileInputStream(filename); // get underlying channel FileChannel channel = ios.getChannel(); /* * t...
HashMap is an implementation of the Map interface that provides a Data Structure to store data in Key-Value pairs. 1. Declaring HashMap Map<KeyType, ValueType> myMap = new HashMap<KeyType, ValueType>(); KeyType and ValueType must be valid types in Java, such as - String, Integer, Fl...
To ensure that our collection can be iterated using iterator or for-each loop, we have to take care of following steps: The stuff we want to iterate upon has to be Iterable and expose iterator(). Design a java.util.Iterator by overriding hasNext(), next() and remove(). I have added a simple ...

Page 478 of 1336