Tutorial by Examples

In order to login to a user's account on machine with SSH you can use the command ssh username@ip_address. It will ask for a password. If you type the correct password, you will be connected to the shell of that user on that machine. Otherwise it will prompt for the password again. For example roo...
Whereas Classes are more like blueprints, Objects are static (i.e. already instantiated): object Dog { def bark: String = "Raf" } Dog.bark() // yields "Raf" They are often used as a companion to a class, they allow you to write: class Dog(val name: String) { } ...
Lubridate provides ymd() series of functions for parsing character strings into dates. The letters y, m, and d correspond to the year, month, and day elements of a date-time. mdy("07-21-2016") # Returns Date ## [1] "2016-07-21" mdy("07-21-2016", t...
date <- now() date ## "2016-07-22 03:42:35 IST" year(date) ## 2016 minute(date) ## 42 wday(date, label = T, abbr = T) # [1] Fri # Levels: Sun < Mon < Tues < Wed < Thurs < Fri < Sat day(date) <- 31 ## "2016-07-31 03:42:35 IST" # If an ...
An instant is a specific moment in time. Any date-time object that refers to a moment of time is recognized as an instant. To test if an object is an instant, use is.instant. library(lubridate) today_start <- dmy_hms("22.07.2016 12:00:00", tz = "IST") # default tz="UT...
Intervals are simplest way of recording timespans in lubridate. An interval is a span of time that occurs between two specific instants. # create interval by substracting two instants today_start <- ymd_hms("2016-07-22 12-00-00", tz="IST") today_start ## [1] "2016-07-...
now_dt <- ymd_hms(now(), tz="IST") now_dt ## [1] "2016-07-22 13:53:09 IST" round_date() takes a date-time object and rounds it to the nearest integer value of the specified time unit. round_date(now_dt, "minute") ## [1] "2016-07-22 13:53:00 IST" r...
Unlike durations, periods can be used to accurately model clock times without knowing when events such as leap seconds, leap days, and DST changes occur. start_2012 <- ymd_hms("2012-01-01 12:00:00") ## [1] "2012-01-01 12:00:00 UTC" # period() considers leap year calculati...
with_tz returns a date-time as it would appear in a different time zone. nyc_time <- now("America/New_York") nyc_time ## [1] "2016-07-22 05:49:08 EDT" # corresponding Europe/Moscow time with_tz(nyc_time, tzone = "Europe/Moscow") ## [1] "2016-07-22 12:49:...
CSS: div{ width:200px; height:200px; background:teal; clip-path: polygon(0 0, 0 100%, 100% 50%); /* refer remarks before usage */ } HTML: <div></div> In the above example, a polygonal clipping path is used to clip the square (200 x 200) element into a triangle shape....
CSS: div{ width: 200px; height: 200px; background: teal; clip-path: circle(30% at 50% 50%); /* refer remarks before usage */ } HTML <div></div> This example shows how to clip a div to a circle. The element is clipped into a circle whose radius is 30% based on the dim...
Using Homebrew Prerequisites: Make sure you're on OS X 10.9 (Mavericks) or above, and have Homebrew installed. Run the following in your terminal: brew update && brew install rethinkdb Compile from source Building RethinkDB from source requires OS X 10.9 (Mavericks) or greater. Xcode...
GROUP BY is used in combination with aggregation functions. Consider the following table: orderIduserIdstoreNameorderValueorderDate143Store A2520-03-2016257Store B5022-03-2016343Store A3025-03-2016482Store C1026-03-2016521Store A4529-03-2016 The query below uses GROUP BY to perform aggregated calc...
When something fails in your transaction code and you want to undo it, you can rollback your transaction: BEGIN TRY BEGIN TRANSACTION INSERT INTO Users(ID, Name, Age) VALUES(1, 'Bob', 24) DELETE FROM Users WHERE Name = 'Todd' COMMIT TRANSACTION END TRY...
-XXaggressive is a collection of configurations that make the JVM perform at a high speed and reach a stable state as soon as possible. To achieve this goal, the JVM uses more internal resources at startup; however, it requires less adaptive optimization once the goal is reached. We recommend that y...
This option allows you to clear a TLA for references and values at TLA allocation time and pre-fetch the next chunk. When an integer, a reference, or anything else is declared, it has a default value of 0 or null (depending upon type). At the appropriate time, you will need to clear these references...
When used with -XXallocClearChunkSize, this option sets the size of the chunks to be cleared. If this flag is used but no value is specified, the default is 512 bytes. Usage: -XXallocClearChunks -XXallocClearChunkSize=<size>[k|K][m|M][g|G]
kotlin-gradle-plugin is used to compile Kotlin code with Gradle. Basically, its version should correspond to the Kotlin version you want to use. E.g. if you want to use Kotlin 1.0.3, then you need to aplly kotlin-gradle-plugin version 1.0.3 too. It's a good idea to externalize this version in gradl...
Protocol Oriented Programming is a useful tool in order to easily write better unit tests for our code. Let's say we want to test a UIViewController that relies on a ViewModel class. The needed steps on the production code are: Define a protocol that exposes the public interface of the class Vi...
You can use fprintf on a file just like you might on a console with printf. For example to keep track of game wins, losses and ties you might write /* saves wins, losses and, ties */ void savewlt(FILE *fout, int wins, int losses, int ties) { fprintf(fout, "Wins: %d\nTies: %d\nLosses: %d...

Page 312 of 1336