Tutorial by Examples: er

ViewPropertyAnimator is a simplified and optimized way to animate properties of a View. Every single View has a ViewPropertyAnimator object available through the animate() method. You can use that to animate multiple properties at once with a simple call. Every single method of a ViewPropertyAnimat...
To bootstrap a new Erlang project, simply choose the template you want to use from the list. The available templates can be retrieved by the following command: $ rebar3 new app (built-in): Complete OTP Application structure cmake (built-in): Standalone Makefile for building C/C++ in c_src escr...
We can always use ListView or RecyclerView for selection from list of items, but if we have small amount of choices and among those choices we want user to select one, we can use AlertDialog.Builder setAdapter. private void showDialog() { AlertDialog.Builder builder = new AlertDia...
(defun print-entry (key value) (format t "~A => ~A~%" key value)) (maphash #'print-entry *my-table*) ;; => NIL Using maphash allows to iterate over the entries of a hash table. The order of iteration is unspecified. The first argument is a function accepting two parameters: ...
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...
The Gradle team works regularly on improving the performance of different aspects of Gradle builds. If you’re using an old version of Gradle, you’re missing out on the benefits of that work. Try upgrading to the latest version of Gradle to see what kind of impact it has. Doing so is low risk because...
String#to_time Converts a string to a Time value. The form parameter can be either :utc or :local, defaults to :local. "13-12-2012".to_time # => 2012-12-13 00:00:00 +0100 "06:12".to_time # => 2012-12-13 06:12:00 +0100 "2012-12-13 06...
String#squish Returns a version of the given string without leading or trailing whitespace, and combines all consecutive whitespace in the interior to single spaces. Destructive version squish! operates directly on the string instance. Handles both ASCII and Unicode whitespace. %{ Multi-line ...
When this program #include <stdio.h> #include <string.h> int main(void) { int num = 0; char str[128], *lf; scanf("%d", &num); fgets(str, sizeof(str), stdin); if ((lf = strchr(str, '\n')) != NULL) *lf = '\0'; printf("%d \"%s\&...
Espresso by default has many matchers that help you find views that you need to do some checks or interactions with them. Most important ones can be found in the following cheat sheet: https://google.github.io/android-testing-support-library/docs/espresso/cheatsheet/ Some examples of matchers are...
Instead of adding an observer with a selector, a block can be used: id testObserver = [[NSNotificationCenter defaultCenter] addObserverForName:@"TestNotification" object:nil ...
Matlab allows some very trivial mistakes to go by silently, which might cause an error to be raised much later in the run - making debugging hard. If you assume something about your variables, validate it. function out1 = get_cell_value_at_index(scalar1,cell2) assert(isscalar(scalar1),'1st input ...
The Null-Coalescing operator ?? will return the left-hand side when not null. If it is null, it will return the right-hand side. object foo = null; object bar = new object(); var c = foo ?? bar; //c will be bar since foo was null The ?? operator can be chained which allows the removal of if...
ndk-build NDK_PROJECT_PATH=PROJECT_PATH APP_BUILD_SCRIPT=MyAndroid.mk
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....
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...
Checkboxes <%= check_box_tag(:pet_dog) %> <%= label_tag(:pet_dog, "I own a dog") %> <%= check_box_tag(:pet_cat) %> <%= label_tag(:pet_cat, "I own a cat") %> This will generate the following html <input id="pet_dog" name="pet_dog&q...
Assuming an implicit parameter list with more than one implicit parameter: case class Example(p1:String, p2:String)(implicit ctx1:SomeCtx1, ctx2:SomeCtx2) Now, assuming that one of the implicit instances is not available (SomeCtx1) while all other implicit instances needed are in-scope, to creat...
This is an example of a package-info.java file that binds an XML namespace to a serializable Java class. This should be placed in the same package as the Java classes that should be serialized using the namespace. /** * A package containing serializable classes. */ @XmlSchema ( xmlns = ...
npm --install express-generator -g

Page 193 of 417