Tutorial by Examples: ar

#include <stdio.h> #define is_const_int(x) _Generic((&x), \ const int *: "a const int", \ int *: "a non-const int", \ default: "of other type") int main(void) { const int i = 1; int j = 1; double...
Tuples group multiple values into a single compound value. The values within a tuple can be of any type and do not have to be of the same type as each other. Tuples are created by grouping any amount of values: let tuple = ("one", 2, "three") // Values are read using index n...
Tuples can be decomposed into individual variables with the following syntax: let myTuple = (name: "Some Name", age: 26) let (first, second) = myTuple print(first) // "Some Name" print(second) // 26 This syntax can be used regardless of if the tuple has unnamed properti...
Since the new line separator varies from platform to platform (e.g. \n on Unix-like systems or \r\n on Windows) it is often necessary to have a platform-independent way of accessing it. In Java it can be retrieved from a system property: System.getProperty("line.separator") Java SE 7 ...
Browse to File > New > Solution to bring you up the new project dialog. Select Android App and press Next. Configure your app by setting your app name and organization ID. Select the Target Platform most suited for your needs, or leave it as the default. Press Next: Set your Project name ...
Browse to File > New > Project to bring you up the New Project dialog. Navigate to Visual C# > Android and select Blank App: Give your app a Name and press OK to create your project. Set up your device for deployment, or configure an emulator To run your application, select the Debug...
The quick start guide includes information about using Docker to stand up a Bosun instance. $ docker run -d -p 4242:4242 -p 80:8070 stackexchange/bosun This will create a new instance of Bosun which you can access by opening a browser to http://docker-server-ip. The docker image includes HBase/O...
When calling a function without an explicit namespace qualifier, the compiler can choose to call a function within a namespace if one of the parameter types to that function is also in that namespace. This is called "Argument Dependent Lookup", or ADL: namespace Test { int call(int i)...
void Main() { unsafe { int[] a = {1, 2, 3}; fixed(int* b = a) { Console.WriteLine(b[4]); } } } Running this code creates an array of length 3, but then tries to get the 5th item (index 4). On my machine, this printed 1910457872, bu...
Variables you have provided in your view context can be accessed using double-brace notation: In your views.py: class UserView(TemplateView): """ Supply the request user object to the template """ template_name = "user.html" def get_context_data...
This example uses the Dropbox .NET library to try to get the metadata for an item at a particular path, and checks for a NotFound error: try { var metadata = await this.client.Files.GetMetadataAsync("/non-existant path"); Console.WriteLine(metadata.Name); } catch (Dropbox.Api.A...
Commits can be squashed during a git rebase. It is recommended that you understand rebasing before attempting to squash commits in this fashion. Determine which commit you would like to rebase from, and note its commit hash. Run git rebase -i [commit hash]. Alternatively, you can type HE...
In this tutorial we're going to learn how to set up the PayPal Android SDK to process a simple payment via either a PayPal payment or a credit card purchase. At the end of this example, you should have a simple button in an application that, when clicked, will forward the user to PayPal to confirm a...
The extension method to be called is determined at compile-time based on the reference-type of the variable being accessed. It doesn't matter what the variable's type is at runtime, the same extension method will always be called. open class Super class Sub : Super() fun Super.myExtension()...
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...
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...
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! */ ...
var array = [3, 2, 1] Creating a new sorted array As Array conforms to SequenceType, we can generate a new array of the sorted elements using a built in sort method. 2.12.2 In Swift 2, this is done with the sort() method. let sorted = array.sort() // [1, 2, 3] 3.0 As of Swift 3, it has...

Page 14 of 218