Tutorial by Examples: ti

Some functions in R produce a side effect (i.e. saving, printing, plotting, etc) and do not always return a meaningful or desired value. %T>% (tee operator) allows you to forward a value into a side-effect-producing function while keeping the original lhs value intact. In other words: the tee op...
What is Dagger 2 ? The website describes itself as: Dagger is a fully static, compile-time dependency injection framework The library makes it easy to model dependency graphs as well as to reuse objects. Since reflection is only used at compile time as part of the annotation processing Dagger...
It is often useful to build matrices out of smaller matrices. Horizontal Concatenation Matrices (and vectors, which are treated as column vectors) can be horizontally concatenated using the hcat function. julia> hcat([1 2; 3 4], [5 6 7; 8 9 10], [11, 12]) 2×6 Array{Int64,2}: 1 2 5 6 7 ...
Fast Development process Decoupling Unit test writing Fast Development process When using dependency injection node developer can faster their development proceess because after DI there is less code conflict and easy to manage all module. Decoupling Modules becomes less couple then it i...
This example is how to turn an image into a Base64 string (i.e. a string you can use directly in a src attribute of an img tag). This example specifically uses the Imagick library (there are others available, such as GD as well). <?php /** * This loads in the file, image.jpg for manipulation....
Though it is an obsoleted part of the XSI standard, many implementations still support multiple expressions with Boolean operators and parenthesis. The (obsolete) operators are listed below with decreasing precedence. ( expression ) expression -a expression expression -o expression Using thes...
Create simple CRUD Operation Using Serverless Framework Install Serverless framework globally npm install serverless -g Create simple Lambda Service serverless create --template aws-nodejs --path myService Go to the myService Directory it should contain serverless.yml handler.js even...
Generators are fast coded and in many cases a slim alternative to heavy iterator-implementations. With the fast implementation comes a little lack of control when a generator should stop generating or if it should generate something else. However this can be achieved with the usage of the send() fu...
Regular expressions can be used to validate inputs by counting the number of matches. var validDate = false let numbers = "35/12/2016" let usPattern = "^(0[1-9]|1[012])[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19|20)\\d\\d$" let ukPattern = "^(0[1-9]|[12][0-9]|3[01])[-/](0[1...
Underscore is an open source functional programming utility library for JavaScript. Underscore provides many useful functions for working with arrays or collections of JavaScript objects, including filtering, sorting and querying. Node.js Make sure you have node and npm installed then type the fol...
Create a simple servlet: package web.example; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse...
public class BucketSort { public static void SortBucket(ref int[] input) { int minValue = input[0]; int maxValue = input[0]; int k = 0; for (int i = input.Length - 1; i >= 1; i--) { if (input[i] > maxValue) maxValue = input...
Install a Common Lisp implementation on the server. (E.g. sbcl, clisp, etc...) Install quicklisp on the server. Load SWANK with (ql:quickload :swank) Start the server with (swank:create-server). The default port is 4005. [On your local machine] Create a SSH tunnel with ssh -L4005:127.0.0.1:400...
Preconditions These instructions suppose you have any type of Linux, Unix, Mac with bash or Git-bash Windows. Windows: Download and install Git-bash for Windows, then execute 'bash' from command line. Other shells than bash are fine too, just replace the activate command below with activate.csh...
This can be done by using the event EntityTargetEvent Entities won't target the player if you cancel the event: @EventHandler public void onEntityTarget(EntityTargetEvent e) { Entity target = e.getEntity(); if(target instanceof Player) { Player playerTargetted = (Player) target...
JSON arrays represent a collection of objects. In JS, theres a bunch of collection functions off of them such as slice, pop, push. Objects have just more raw data. A JSONArray is an ordered sequence of values. Its external text form is a string wrapped in square brackets with commas separating the ...
This example shows how to populate report with data returned by a data view delegate. During the exercise, we will develop an inquiry screen showing list of Sales Orders between two dates. Data view delegate will be used to populate Sales Order information. Prerequisites: We start with declara...
There are times with multiple static objects where you need to be able to guarantee that the singleton will not be destroyed until all the static objects that use the singleton no longer need it. In this case std::shared_ptr can be used to keep the singleton alive for all users even when the static...
a@coolbox:~/workspace$ express --ejs my-app a@coolbox:~/workspace$ cd my-app a@coolbox:~/workspace/my-app$ npm install a@coolbox:~/workspace/my-app$ npm start
""" usage: sub <command> commands: status - show status list - print list """ import sys def check(): print("status") return 0 if sys.argv[1:] == ['status']: sys.exit(check()) elif sys.argv[1:] == ['list']: ...

Page 381 of 505