Tutorial by Examples

import shutil source='//192.168.1.2/Daily Reports' destination='D:\\Reports\\Today' shutil.copytree(source, destination) The destination directory must not exist already.
When an API is marked with NS_REFINED_FOR_SWIFT, it will be prefixed with two underscores (__) when imported to Swift: @interface MyClass : NSObject - (NSInteger)indexOfObject:(id)obj NS_REFINED_FOR_SWIFT; @end The generated interface looks like this: public class MyClass : NSObject { publ...
All Kotlin programs start at the main function. Here is an example of a simple Kotlin "Hello World" program: package my.program fun main(args: Array<String>) { println("Hello, world!") } Place the above code into a file named Main.kt (this filename is entirel...
To update a package use the following command: PM> Update-Package EntityFramework where EntityFramework is the name of the package to be updated. Note that update will run for all projects, and so is different from Install-Package EntityFramework which would install to "Default project&q...
PM> Uninstall-Package EntityFramework
PM> Uninstall-Package -ProjectName MyProjectB EntityFramework
Pull properties from an object passed into a function. This pattern simulates named parameters instead of relying on argument position. let user = { name: 'Jill', age: 33, profession: 'Pilot' } function greeting ({name, profession}) { console.log(`Hello, ${name} the ${pr...
PM> Install-Package EntityFramework -Version 6.1.2
The json_decode() function takes a JSON-encoded string as its first parameter and parses it into a PHP variable. Normally, json_decode() will return an object of \stdClass if the top level item in the JSON object is a dictionary or an indexed array if the JSON object is an array. It will also retur...
The json_encode function will convert a PHP array (or, since PHP 5.4, an object which implements the JsonSerializable interface) to a JSON-encoded string. It returns a JSON-encoded string on success or FALSE on failure. $array = [ 'name' => 'Jeff', 'age' => 20, 'active' => ...
// Check if service worker is available. if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js').then(function(registration) { console.log('SW registration succeeded with scope:', registration.scope); }).catch(function(e) { console.log('SW registration failed...
In this case, building against API 23, so permissions are handled too. You must add in the Manifest the following permission (wherever the API level you're using): <uses-permission android:name="android.permission.CAMERA"/> We're about to create an activity (Camera2Activity.java...
In this example, we can use GROUP BY not only determined the sort of the rows returned, but also what rows are returned, since we're using TOP to limit the result set. Let's say we want to return the top 5 highest reputation users from an unnamed popular Q&A site. Without ORDER BY This query ...
This uses the Dropbox .NET SDK to download a file from the Dropbox API at the remote path /Homework/math/Prime_Numbers.txt to the local file Prime_Numbers.txt: using (var response = await client.Files.DownloadAsync("/Homework/math/Prime_Numbers.txt")) { using (var fileStream = File....
This uses the Dropbox Python SDK to create a shared link for a file and also supplies a requested visibility and expiration in the settings: import datetime import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") expires = datetime.datetime.now() + datetime.timedelta(days=30...
#include <stdio.h> #include <string.h> int main(void) { /* Always ensure that your string is large enough to contain the characters * and a terminating NUL character ('\0')! */ char mystring[10]; /* Copy "foo" into `mystring`, until a NUL character is en...
The strcase*-functions are not Standard C, but a POSIX extension. The strcmp function lexicographically compare two null-terminated character arrays. The functions return a negative value if the first argument appears before the second in lexicographical order, zero if they compare equal, or positi...
int* foo(int bar) { int baz = 6; baz += bar; return &baz; /* (&baz) copied to new memory location outside of foo. */ } /* (1) The lifetime of baz and bar end here as they have automatic storage * duration (local variables), thus the returned pointer is not valid! */ ...
Starting with a given list a: a = [1, 2, 3, 4, 5] append(value) – appends a new element to the end of the list. # Append values 6, 7, and 7 to the list a.append(6) a.append(7) a.append(7) # a: [1, 2, 3, 4, 5, 6, 7, 7] # Append another list b = [8, 9] a.append(b) # a: [1, 2, 3, 4, ...
Use len() to get the one-dimensional length of a list. len(['one', 'two']) # returns 2 len(['one', [2, 3], 'four']) # returns 3, not 4 len() also works on strings, dictionaries, and other data structures similar to lists. Note that len() is a built-in function, not a method of a list objec...

Page 74 of 1336