Tutorial by Examples: sin

A lot of example code posted on StackOverflow includes snippets like this: if ("A".equals(someString)) { // do something } This does "prevent" or "avoid" a possible NullPointerException in the case that someString is null. Furthermore, it is arguable that ...
Though Go supports ++ and -- operators and the behaviour is found to be almost similar to c/c++, variables with such operators cannot be passed as argument to function. package main import ( "fmt" ) func abcd(a int, b int) { fmt.Println(a," &...
The %>% operator can also be used to pipe the dplyr output into ggplot. This creates a unified exploratory data analysis (EDA) pipeline that is easily customizable. This method is faster than doing the aggregations internally in ggplot and has the added benefit of avoiding unnecessary intermediat...
All SML expressions return a value. The REPL stores the return value of the last evaluated expression. it provides the value of the last evaluated expression within the REPL. smluser> sml Standard ML of New Jersey v110.78 [built: Thu Jul 23 11:21:58 2015] - 3+4; val it = 7 : int - it; val i...
To join and and for instance filter on the joined table use JoinQueryOver. IList<Customer> customers = session.QueryOver<Customer>() .Inner.JoinQueryOver(x => x.Organisation) .Where(y => y.Name == "Acme Inc") .List();
A good VOD (Video On Demand) service should start with the basics. Lets say you have a directory on your server that is not publicly accessible, yet through some sort of portal or paywall you want to allow users to access your media. var movie = path.resolve('./public/' + req.params.filename); ...
You can also use flent-ffmpeg to convert .mp4 files to .flv files, or other types: res.contentType('flv'); var pathToMovie = './public/' + req.params.filename; var proc = ffmpeg(pathToMovie) .preset('flashvideo') .on('end', function () { console.log(...
s/foo/bar/; # replace "foo" with "bar" in $_ my $foo = "foo"; $foo =~ s/foo/bar/; # do the above on a different variable using the binding operator =~ s~ foo ~ bar ~; # using ~ as a delimiter $foo = s/foo/bar/r; # non-destructive r flag: returns the repl...
One implementation of the io.Reader interface can be found in the bytes package. It allows a byte slice to be used as the source for a Reader. In this example the byte slice is taken from a string, but is more likely to have been read from a file or network connection. message := []byte("Hello...
Add a -behaviour directive to your module to indicate that it follows a behaviour: -behaviour(gen_server). The American spelling is also accepted: -behavior(gen_server). Now the compiler will give a warning if you've forgotten to implement and export any of the functions required by the beha...
You can access the command line arguments passed to your program using the std::env::args() function. This returns an Args iterator which you can loop over or collect into a Vec. Iterating Through Arguments use std::env; fn main() { for argument in env::args() { if argument == &qu...
For larger command line programs, using std::env::args() is quite tedious and difficult to manage. You can use clap to handle your command line interface, which will parse arguments, generate help displays and avoid bugs. There are several patterns that you can use with clap, and each one provides ...
Jersey (2) uses HK2 as its dependency injection (DI) system. We can use other injection systems, but its infrastructure is built with HK2, and allows us to also use it within our applications. Setting up simple dependency injection with Jersey takes just a few lines of code. Let say for example we ...
Add react-rails to your Gemfile: gem 'react-rails' And install: bundle install Next, run the installation script: rails g react:install This will: create a components.js manifest file and a app/assets/javascripts/components/ directory, where you will put your components place the follo...
React.js builds You can pick which React.js build (development, production, with or without add-ons) to serve in each environment by adding a config. Here are the defaults: # config/environments/development.rb MyApp::Application.configure do config.react.variant = :development end # conf...
Here is the JSON File we will be using called animals.json { "Sea Animals": [ { "name": "Fish", "question": "How many species of fish are there?" }, { "name": "Sharks", ...
It is not a good idea to expose Option types to C# code, as C# does not have a way to handle them. The options are either to introduce FSharp.Core as a dependency in your C# project (which is what you'd have to do if you're consuming an F# library not designed for interop with C#), or to change None...
Package Control - Download/Install this plugin to install and manage all your other plugins in sublime. Git - Keeps track of your git versioning system. Also enables you to execute some git commands from ST itself. GitGutter - With GitGutter, you can see which lines have been added, deleted or m...
// Must enable the feature to use associated constants #![feature(associated_consts)] use std::mem; // Associated constants can be used to add constant attributes to types trait Foo { const ID: i32; } // All implementations of Foo must define associated constants // unless a defaul...
Row-level security enables you to define some predicates that will control who could update rows in the table. First you need to define some table-value function that represents predicate that wll control access policy. CREATE FUNCTION dbo.pUserCanAccessProduct(@CompanyID int) RETURNS TABLE WIT...

Page 115 of 161