Tutorial by Examples: and

A green rect with a complex mask applied to it showing the background image. <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <mask id="myMask0"> <circle cx="50" c...
byte incoming; String inBuffer; void setup() { Serial.begin(9600); // or whatever baud rate you would like } void loop(){ // setup as non-blocking code if(Serial.available() > 0) { incoming = Serial.read(); if(incoming == '\n') { // newline, car...
This is just an extension on the sealed trait variant where a macro generates a set with all instances at compile time. This nicely omits the drawback that a developer can add a value to the enumeration but forget to add it to the allElements set. This variant especially becomes handy for large en...
the units-per-em property is one of the most important font properties. It's used to give any value of any other property any meaning. the CSS2 font spec has a nice definition of the em sqare: Certain values, such as width metrics, are expressed in units that are relative to an abstract square w...
Consider a basic class containing an object with getters and setters in Java: public class CountHolder { private int count = 0; public int getCount() { return count; } public void setCount(int c) { count = c; } } We can't access the count variable because it's private. But we can ac...
One needs the predicted probabilities in order to calculate the ROC-AUC (area under the curve) score. The cross_val_predict uses the predict methods of classifiers. In order to be able to get the ROC-AUC score, one can simply subclass the classifier, overriding the predict method, so that it would a...
Resource loading in Java comprises the following steps: Finding the Class or ClassLoader that will find the resource. Finding the resource. Obtaining the byte stream for the resource. Reading and processing the byte stream. Closing the byte stream. The last three steps are typically accomp...
To use typescript with react in a node project, you must first have a project directory initialized with npm. To initialize the directory with npm init Installing via npm or yarn You can install React using npm by doing the following: npm install --save react react-dom Facebook released its ow...
The simplest react component without a state and no properties can be written as: import * as React from 'react'; const Greeter = () => <span>Hello, World!</span> That component, however, can't access this.props since typescript can't tell if it is a react component. To access ...
VueJS can be used to easily handle user input as well, and the two way binding using v-model makes it really easy to change data easily. HTML : <script src="https://unpkg.com/vue/dist/vue.js"></script> <div id="app"> {{message}} <input v-model="...
This is for those moving to data.table >= 1.9.8 You have a data set of pet owners and names, but you suspect some repeated data has been captured. library(data.table) DT <- data.table(pet = c("dog","dog","cat","dog"), owner = c(&quot...
For getting the next 10 rows just run this query: SELECT * FROM TableName ORDER BY id OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY; Key points to consider when using it: ORDER BY is mandatory to use OFFSET and FETCH clause. OFFSET clause is mandatory with FETCH. You can never use, ORDER BY … FETC...
Let's say we have a form like the one below. We want to send the data to our webserver via AJAX and from there to a script running on an external server. So we have normal inputs, a multi-select field and a file dropzone where we can upload multiple files. Assuming the AJAX POST request was succ...
Session storage service : Common factory service that will save and return the saved session data based on the key. 'use strict'; /** * @ngdoc factory * @name app.factory:storageService * @description This function will communicate with HTML5 sessionStorage via Factory Service. */ a...
<html> <body> <% out.print("Today is:"+java.util.Calendar.getInstance().getTime()); %> </body> </html>
Manipulate the IP routing table using route Display routing table $ route # Displays list or routes and also resolves host names $ route -n # Displays list of routes without resolving host names for faster results Add/Delete route OptionDescriptionadd or delAdd or delete a route-host x.x.x.xA...
You can create new commands via php artisan make:command [commandName] So this will create [commandName] command class inside app/Console/Commands directory. inside this class you will find protected $signature and protected $description variables, it represents name and discription of your comma...
instance methods use an instance of a class. @interface MyTestClass : NSObject - (void)testInstanceMethod; @end They could then be used like so: MyTestClass *object = [[MyTestClass alloc] init]; [object testInstanceMethod]; Class method can be used with just the class name. @inte...
This is a sample Fastfile setup for a multi-flavor app. It gives you an option to build and deploy all flavors or a single flavor. After the deployment, it reports to Slack the status of the deployment, and sends a notification to testers in Beta by Crashlytics testers group. To build and deploy al...
//make column H wider and set the text align to the top and right worksheet.Column(8).Width = 25; worksheet.Column(8).Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; worksheet.Column(8).Style.VerticalAlignment = ExcelVerticalAlignment.Top; //wrap text in the cells worksheet.Column...

Page 118 of 153