Tutorial by Examples: sin

To convert exceptions into Either or Option types, you can use methods that provided in scala.util.control.Exception import scala.util.control.Exception._ val plain = "71a" val optionInt: Option[Int] = catching(classOf[java.lang.NumberFormatException]) opt { plain.toInt } val eitherI...
Cask is a project management tool which can be also used to easily manage your local emacs configuration. Installing cask is easy. You can either run the following command on the command-line: curl -fsSL https://raw.githubusercontent.com/cask/cask/master/go | python Or if you are on a mac, you...
The method PrintWriter.format (called through System.out.format) can be used to print aligned strings in console. The method receives a String with the format information and a series of objects to format: String rowsStrings[] = new String[] {"1", &q...
In Java (and other languages), using null is a common way of indicating that there is no value attached to a reference variable. In Scala, using Option is preferred over using null. Option wraps values that might be null. None is a subclass of Option wrapping a null reference. Some is a subclass of...
""" ================================================================================ CREATE A 2 BY 2 GRID OF SUB-PLOTS WITHIN THE SAME FIGURE. ================================================================================ """ import matplotlib.pyplot as plt ...
""" ================================================================================ DRAW MULTIPLE LINES IN THE SAME PLOT ================================================================================ """ import matplotlib.pyplot as plt ...
You can create and configure build types in the module-level build.gradle file inside the android {} block. android { ... defaultConfig {...} buildTypes { release { minifyEnabled true proguardFiles getDefaultProguar...
One could easily center a child element using table display property. HTML <div class="wrapper"> <div class="parent"> <div class="child"></div> </div> </div> CSS .wrapper { display: table; vertica...
For added safety we can define the type of object that the array contains: NSArray<NSString *> *colors = @[@"Red", @"Green", @"Blue", @"Yellow"]; NSMutableArray<NSString *> *myColors = [NSMutableArray arrayWithArray:colors]; [myColors addObject:...
NSArray *myColors = @[@"Red", @"Green", @"Blue", @"Yellow"]; [myColors enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { NSLog(@"enumerating object %@ at index %lu", obj, idx); }]; By setting the stop parameter to YES you c...
C++11 The C++11 standards guarantees that the initialization of function scope objects are initialized in a synchronized manner. This can be used to implement a thread-safe singleton with lazy initialization. class Foo { public: static Foo& instance() { static Foo inst; ...
First, Install gulp and gulp-concat plugin to your project localy npm install --save-dev gulp gulp-concat and add gulp-concat task to your gulpfile.js var gulp = require('gulp'); var concat = require('gulp-concat'); gulp.task('default', function() { }); gulp.task('css', function() { ...
First, Install gulp, gulp-clean-css and gulp-rename to project directory localy npm install --save-dev gulp gulp-clean-css gulp-rename Than add following minify-css task to your gulpfile.js var gulp = require('gulp'); var cleanCSS = require('gulp-clean-css'); var rename = require('gulp-rename...
First, Install gulp and gulp-minify to project directory locally npm install --save-dev gulp gulp-minify Then add following min-js task to your gulpfile.js var gulp = require('gulp'); var minify = require('gulp-minify'); gulp.task('min-js', function() { return gulp.src('lib/*.js') ...
"Tags" are a type of label that can be applied to a repository at a certain point in time. They are frequently used to give human-readable names to important milestones so that they can be easily accessed later (for example, "version-1.2"). Creating a tag is exactly the same as...
A Subversion repository can be configured so that certain contents or commands are only accessible to certain users. In order to access this restricted content, you will need to specify a username and password. Your username and password can be specified directly as part of the command: $ svn che...
public class IntStack { private IntStackNode head; // IntStackNode is the inner class of the class IntStack // Each instance of this inner class functions as one link in the // Overall stack that it helps to represent private static class IntStackNode { privat...
C99 These functions returns the floating-point remainder of the division of x/y. The returned value has the same sign as x. Single Precision: #include <math.h> /* for fmodf() */ #include <stdio.h> /* for printf() */ int main(void) { float x = 10.0; float y = 5.1; ...
1. Passing integer data: SenderActivity Intent myIntent = new Intent(SenderActivity.this, ReceiverActivity.class); myIntent.putExtra("intVariableName", intValue); startActivity(myIntent); ReceiverActivity Intent mIntent = getIntent(); int intValue = mIntent.getIntExtra("intVa...
Using a doc comment instead of a regular comment enables dartdoc to find it and generate documentation for it. /// The number of characters in this chunk when unsplit. int get length => ... You are allowed to use most markdown formatting in your doc comments and dartdoc will process it accor...

Page 49 of 161