Tutorial by Examples: ci

You can calculate a number in the Fibonacci sequence using recursion. Following the math theory of F(n) = F(n-2) + F(n-1), for any i > 0, // Returns the i'th Fibonacci number public int fib(int i) { if(i <= 2) { // Base case of the recursive function. // i is either 1...
1. Target a device by serial number Use the -s option followed by a device name to select on which device the adb command should run. The -s options should be first in line, before the command. adb -s <device> <command> Example: adb devices List of devices attached emulator-55...
Use associated type when there is a one-to-one relationship between the type implementing the trait and the associated type. It is sometimes also known as the output type, since this is an item given to a type when we apply a trait to it. Creation trait GetItems { type First; // ^~~~ d...
Get the Source Package from http://typo3.org/download/ and upload this package to your web server. Put it one level above the document root. For this manual, we will use the .tar.gz file. Use the shell to execute the according commands: /var/www/site/htdocs/$ cd .. /var/www/site/$ wget get.typo3....
go() method The go() method loads a specific URL from the history list. The parameter can either be a number which goes to the URL within the specific position (-1 goes back one page, 1 goes forward one page), or a string. The string must be a partial or full URL, and the function will go to the f...
If realloc fails, it returns NULL. If you assign the value of the original buffer to realloc's return value, and if it returns NULL, then the original buffer (the old pointer) is lost, resulting in a memory leak. The solution is to copy into a temporary pointer, and if that temporary is not NULL, th...
Listing available remote versions for installation nvm ls-remote Installing a remote version nvm install <version> For example nvm install 0.10.13
Problem: Some data needs to be passed to a scene loaded from a fxml. Solution Set the controller using the FXMLLoader instance used later to load the fxml. Make sure the controller contains the relevant data before loading the fxml. Note: in this case the fxml file must not contain the fx:contro...
decimal literals are defined by using the suffix M or m on a real number: decimal m = 30.5M;
ClientContext clientContext = new ClientContext(siteUrl); Web oWebsite = clientContext.Web; clientContext.Load( oWebsite, website => website.Title, website => website.Created); clientContext.ExecuteQuery(); Console.WriteLine("Title: {...
ClientContext clientContext = new ClientContext(siteUrl); Web oWebsite = clientContext.Web; ListCollection collList = oWebsite.Lists; clientContext.Load( collList, lists => lists.Include( list => list.Title, list => list.Id)); clientContext.ExecuteQuery(...
ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements"); CamlQuery camlQuery = new CamlQuery(); ListItemCollection collListItem = oList.GetItems(camlQuery); clientContext.Load( collListItem, items =>...
ClientContext clientContext = new ClientContext("http://MyServer/sites/MySiteCollection"); GroupCollection collGroup = clientContext.Web.SiteGroups; Group oGroup = collGroup.GetById(7); UserCollection collUser = oGroup.Users; clientContext.Load(collUser, users => users.Includ...
Arrays in C can be seen as a contiguous chunk of memory. More precisely, the last dimension of the array is the contiguous part. We call this the row-major order. Understanding this and the fact that a cache fault loads a complete cache line into the cache when accessing uncached data to prevent sub...
def addNumbers = { a, b -> a + b } addNumbers(-7, 15) // returns 8
['cat', 'dog', 'fish'].collect { it.length() } it is the default name of the parameter if you have a single parameter and do not explicitly name the parameter. You can optionally declare the parameter as well. ['cat', 'dog', 'fish'].collect { animal -> animal.length() }
If you know that a value is of a specific type, you can explicitly cast it to that type in order to use it in a context where that type is needed. object value = -1; int number = (int) value; Console.WriteLine(Math.Abs(number)); If we tried passing value directly to Math.Abs(), we would get a ...
If you aren't sure whether a value is of the type you think it is, you can safely cast it using the as operator. If the value is not of that type, the resulting value will be null. object value = "-1"; int? number = value as int?; if(number != null) { Console.WriteLine(Math.Abs(nu...
A value will automatically be cast to the appropriate type if the compiler knows that it can always be converted to that type. int number = -1; object value = number; Console.WriteLine(value); In this example, we didn't need to use the typical explicit casting syntax because the compiler knows...
Explicit casting operators can be used to perform conversions of numeric types, even though they don't extend or implement one another. double value = -1.1; int number = (int) value; Note that in cases where the destination type has less precision than the original type, precision will be lost....

Page 11 of 42