Tutorial by Examples: 2

root: build.gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle-experimental:0.8.0-alpha4' } } allprojects { repositories { jcenter() } } app: build.gradle apply plugin: 'com.andro...
Creating a Window with OpenGL context (extension loading through GLEW): #define GLEW_STATIC #include <GL/glew.h> #include <SDL2/SDL.h> int main(int argc, char* argv[]) { SDL_Init(SDL_INIT_VIDEO); /* Initialises Video Subsystem in SDL */ /* Setting up OpenGL version a...
Note: Following instructions are written for Python 2.7 (unless specified): instructions for Python 3.x are similar. WINDOWS First, download the latest version of Python 2.7 from the official Website (https://www.python.org/downloads/). Version is provided as an MSI package. To install it manu...
To install and load the current stable version of ggplot2 for your R installation use: # install from CRAN install.packages("ggplot2") To install the development version from github use # install.packages("devtools") devtools::install_github("hadley/ggplot2") ...
The complete sample code for this application (Android + Node server) is available in the PayPal Developer Github repository. At this point the PayPal future payments button has been clicked, we have an auth code and metadata ID from the PayPal SDK, and we need to pass those on to our server to com...
public function actionFormSubmission() { $security = new Security(); $string = Yii::$app->request->post('string'); $stringHash = ''; if (!is_null($string)) { $stringHash = $security->generatePasswordHash($string); } return $this->render('form-submi...
Services declaration : # src/Acme/YourBundle/Resources/config/services.yml services: my_service: class: Acme\YourBundle\Service\MyService arguments: ["@doctrine", "%some_parameter%", "@another_service"] another_service: class: Ac...
Go to Help → About Eclipse → Check if the m2e feature is there: .
import { Component } from '@angular/core'; import { Router , ROUTER_DIRECTIVES} from '@angular/router'; import { NgForm } from '@angular/forms'; @Component({ selector: 'login', template: ` <h2>Login</h2> <form #f="ngForm" (ngSubmit)="login(f.value,f....
Checking whether the current date contains the symbol for AM or PM Objective-C NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setLocale:[NSLocale currentLocale]]; [formatter setDateStyle:NSDateFormatterNoStyle]; [formatter setTimeStyle:NSDateFormatterShortStyle]; NSStr...
Since there is no STRING_SPLIT function we need to use XML hack to split the string into rows: Example: SELECT split.a.value('.', 'VARCHAR(100)') AS Value FROM (SELECT Cast ('<M>' + Replace('A|B|C', '|', '</M><M>')+ '</M>' AS XML) AS Data) AS A CROSS apply data...
This example assumes that the record module is set to the variable RECORDMODULE, as shown below. require(['N/record'], function(RECORDMODULE){ var recordType = RECORDMODULE.Type.SALES_ORDER; //The type of record to load. var recordID = 100; //The internal ID of the existing record insta...
For a 12hour time format one can use: ^(?:0?[0-9]|1[0-2])[-:][0-5][0-9]\s*[ap]m$ Where (?:0?[0-9]|1[0-2]) is the hour [-:] is the separator, which can be adjusted to fit your need [0-5][0-9] is the minute \s*[ap]m followed any number of whitespace characters, and am or pm If you need th...
The Keep-Alive extension to HTTP/1.0 and the persistent connection feature of HTTP/1.1 provide long-lived HTTP sessions which allow multiple requests to be sent over the same TCP connection. In some cases this has been shown to result in an almost 50% speedup in latency times for HTML documents ...
Since the release of Gradle 2.2, the use of the android-apt plugin is no longer used. The following method of setting up Dagger 2 should be used. For older version of Gradle, use the previous method shown below. For Gradle >= 2.2 dependencies { // apt command comes from the android-apt plu...
Positional parameters passed to the script from either the command line or a function: #!/bin/bash # $n is the n'th positional parameter echo "$1" echo "$2" echo "$3" The output of the above is: ~> $ ./testscript.sh firstarg secondarg thirdarg firstarg sec...
You can find description of the driver here. The quick example is: import psycopg2 db_host = 'postgres.server.com' db_port = '5432' db_un = 'user' db_pw = 'password' db_name = 'testdb' conn = psycopg2.connect("dbname={} host={} user={} password={}".format( ...
The zip function accepts 2 parameters of type SequenceType and returns a Zip2Sequence where each element contains a value from the first sequence and one from the second sequence. Example let nums = [1, 2, 3] let animals = ["Dog", "Cat", "Tiger"] let numsAndAnimals ...
Add following Paths to the PATH-Enviromentvariable [Path to CMake]\bin [Path to Git]\bin [Path to SDK]\tools [Path to SDK]\platform-tools [Path to NDK] [Path to ANT]\bin [Path to MinGW]\bin [Path to MinGW]\msys\1.0\bin [Path to Java jre]\bin [Path to Java jdk]\bin Make sure you use ba...
Often times, it is helpful to evaluate multiple expressions and to return the result from the first or second form rather than the last. This is easy to accomplish using let and, for instance: (let ((form1-result form1)) form2 form3 ;; ... form-n-1 form-n form1-result) Because...

Page 6 of 21