Tutorial by Examples

Default date format: "mm/dd/yy" The following example shows how you can set the date format in initialization with the dateFormat option. <input type="text" id="datepicker"> <script> $("#datepicker").datepicker({ dateFormat: "...
Prerequisites Create a new project and add an iOS app to that project in the Firebase Console. Download and include GoogleServices-Info.plist in your application. Add Firebase Storage to your app Add the following dependency to your project's Podfile: pod 'Firebase/Storage' Run pod insta...
In assignments, you can split an Iterable into values using the "unpacking" syntax: Destructuring as values a, b = (1, 2) print(a) # Prints: 1 print(b) # Prints: 2 If you try to unpack more than the length of the iterable, you'll get an error: a, b, c = [1] # Raises: ValueError:...
In functions, you can define a number of mandatory arguments: def fun1(arg1, arg2, arg3): return (arg1,arg2,arg3) which will make the function callable only when the three arguments are given: fun1(1, 2, 3) and you can define the arguments as optional, by using default values: def fun...
When you want to create a function that can accept any number of arguments, and not enforce the position or the name of the argument at "compile" time, it's possible and here's how: def fun1(*args, **kwargs): print(args, kwargs) The *args and **kwargs parameters are special parame...
let fetchRequest = NSFetchRequest(entityName: "Foo") var thePredicate: NSPredicate? thePredicate = NSPredicate(format: "message == 'example'") The entity Foo has a message string attribute
Since Laravel version 5.2.31 the web middleware is applied by default within the RouteServiceProvider (https://github.com/laravel/laravel/commit/5c30c98db96459b4cc878d085490e4677b0b67ed) In app/Providers/RouteServiceProvider.php you will find the following functions which apply the middleware on ev...
switch statements are useful when you want to have your program do many different things according to the value of a particular test variable. An example usage of switch statement is like this: int a = 1; switch (a) { case 1: puts("a is 1"); break; case 2: puts("...
A common issue that users of Eclipse encounter is related to the default system JVM. A typical situation is a 64 bit Windows which has both 32 and 64 bit versions of Java installed, and a 32 bit Eclipse. If the 64 bit version of Java is the system default, when Eclipse is launched an error dialog i...
$ gunzip -c input.fastq.gz | paste - - - - | head @IL31_4368:1:1:996:8507/2 TCCCTTACCCCCAAGCTCCATACCCTCCTAATGCCCACACCTCTTACCTTAGGA + FFCEFFFEEFFFFFFFEFFEFFFEFCFC<EEFEFFFCEFF<;EEFF=FEE?FCE @IL31_4368:1:1:996:21421/2 CAAAAACTTTCACTTTACCTGCCGGGTTTCCCAGTTTACATTCCACTGTTTGAC + ...
$ gunzip -c input.fastq.gz | awk '{printf("%s%s",$0,((NR+1)%4==1?"\n":"\t"));}' | head @IL31_4368:1:1:996:8507/2 TCCCTTACCCCCAAGCTCCATACCCTCCTAATGCCCACACCTCTTACCTTAGGA + FFCEFFFEEFFFFFFFEFFEFFFEFCFC<EEFEFFFCEFF<;EEFF=FEE?FCE @IL31_4368:1:1:996:21421/2...
To open a new window, add the following code somewhere where you can keep a reference to the new window (I.E., the app delegate). Swift let storyboard:NSStoryboard = NSStoryboard(name: "Main", bundle: nil) guard let controller:NSWindowController = storyboard.instantiateControllerWithIde...
The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form. The target attribute defines a name of, or keyword for, a browsing context (e.g. tab, window, or inline frame). From Tag with a target attribute: <form ta...
The following example shows how you can use the pushd command and the popd command in a batch program to change the current directory from the one in which the batch program was run and then change it back: @echo off rem This batch file deletes all .txt files in a specified directory pushd %1 ...
To print the directory stack, use the command pushd without any parameters: @echo off cd C:\example\ pushd one pushd ..\two pushd ..\.. pushd echo Current Directory: %cd% echo: popd pushd three pushd echo Current Directory: %cd% Output: C:\example\two ...
private final OkHttpClient client = new OkHttpClient(); public void run() throws Exception { Request request = new Request.Builder() .url(yourUrl) .build(); Response response = client.newCall(request).execute(); if (!response.isSuccessful()) throw new IOExcept...
private final OkHttpClient client = new OkHttpClient(); public void run() throws Exception { Request request = new Request.Builder() .url(yourUrl) .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOExcepti...
private final OkHttpClient client = new OkHttpClient(); public void run() throws Exception { RequestBody formBody = new FormBody.Builder() .add("search", "Jurassic Park") .build(); Request request = new Request.Builder() .url("https:...
private static final String IMGUR_CLIENT_ID = "..."; private static final MediaType MEDIA_TYPE_PNG = MediaType.parse("image/png"); private final OkHttpClient client = new OkHttpClient(); public void run() throws Exception { // Use the imgur image upload API as ...
Grab via Maven: <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> <version>3.6.0</version> </dependency> or Gradle: compile 'com.squareup.okhttp3:okhttp:3.6.0'

Page 579 of 1336