Tutorial by Examples: and

Map 'Mapping' across a collection uses the map function to transform each element of that collection in a similar way. The general syntax is: val someFunction: (A) => (B) = ??? collection.map(someFunction) You can provide an anonymous function: collection.map((x: T) => /*Do something wi...
ndk-build NDK_PROJECT_PATH=PROJECT_PATH APP_BUILD_SCRIPT=MyAndroid.mk
public class ShakeDetector implements SensorEventListener { private static final float SHAKE_THRESHOLD_GRAVITY = 2.7F; private static final int SHAKE_SLOP_TIME_MS = 500; private static final int SHAKE_COUNT_RESET_TIME_MS = 3000; private OnShakeListener mListener; pri...
Open Android Monitor Tab Click on Screen Capture Button
Open Android Device Monitor ( ie C:<ANDROID_SDK_LOCATION>\tools\monitor.bat) Select your device Click on Screen Capture Button
If you use Linux (or Windows with Cygwin), you can run: adb shell screencap -p | sed 's/\r$//' > screenshot.png
A Gemfile is the standard way to organize dependencies in your application. A basic Gemfile will look like this: source 'https://rubygems.org' gem 'rack' gem 'sinatra' gem 'uglifier' You can specify the versions of the gem you want as follows: # Match except on point release. Use only 1.5....
To setup for using Android Gradle Plugin you need many things: java gradle the Android project folder structure an Android Manifest initial plugin setup The easiest way to get all of them is to follow these steps: Donwload and Install Java OpenJDK version 6 or 7 (you can use 8 with addi...
@Override public void onMessageReceived(RemoteMessage remoteMessage) { // ... // TODO(developer): Handle FCM messages here. Log.d(TAG, "From: " + remoteMessage.getFrom()); // Check if message contains a data payload. if (remoteMessage.getData().size() > 0) ...
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { // If you are receiving a notification message while your app is in the background, // this callback will no...
Knitr is an R package that allows us to intermingle R code with LaTeX code. One way to achieve this is inline code chunks. This apporach is demonstrated below. # r-noweb-file.Rnw \documentclass{article} \begin{document} This is an Rnw file (R noweb). It contains a combination of LateX and ...
Knitr is an R package that allows us to intermingle R code with LaTeX code. One way to achieve this is internal code chunks. This apporach is demonstrated below. # r-noweb-file.Rnw \documentclass{article} \begin{document} This is an Rnw file (R noweb). It contains a combination of LateX a...
This is a step-by-step guide to installing OpenCV 3 on a Debian-based Linux system from source. The steps should stay the same for other distros, just replace the relevant package manager commands when installing packages for the build. Note: If you don't feel like wasting time building stuff or di...
Command line scripts inside python packages are common. You can organise your package in such a way that when a user installs the package, the script will be available on their path. If you had the greetings package which had the command line script hello_world.py. greetings/ greetings/ ...
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...
Generate a random number To generate a pseudorandom floating point number between 0 and 1, use the RAND() function Suppose you have the following query SELECT i, RAND() FROM t; This will return something like this iRAND()10.619143887068220.9384516830914230.83482678498591 Random Number in a r...
Return the absolute value of a number SELECT ABS(2); -> 2 SELECT ABS(-46); -> 46 The sign of a number compares it to 0. SignResultExample-1n < 0SELECT SIGN(42); -> 10n = 0SELECT SIGN(0); -> 01n > 0SELECT SIGN(-3); -> -1 SELECT SIGN(-423421); -> -1
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") ...
public class ConnectSocketExample { private int HTTP_PORT = 80; /** * example method to create unconnected socket * then connect to it * at end return connected socket * * @param httpHostName - endpoint host name fot socket connection * @throws IOEx...
/** * we reuse a class written in example: * http://stackoverflow.com/documentation/sockets/2876/introduction-to-sockets#t=201607262114505531351 * pleas to familiar with it first to continue with this one **/ public class WriteToSocketExample extends ConnectSocketExample { private ...

Page 68 of 153