Summary:
MVVM is an architectural pattern that is represented by three distinct components, the Model, View and ViewModel. In order to understand these three layers, it is necessary to briefly define each, followed by an explanation of how they work together.
Model is the layer that drives the bus...
One of the most common obstacles using classes is finding the proper approach to handle private states.
There are 4 common solutions for handling private states:
Using Symbols
Symbols are new primitive type introduced on in ES2015,
as defined at MDN
A symbol is a unique and immutable data typ...
Dedicated Workers
A dedicated web worker is only accessible by the script that called it.
Main application:
var worker = new Worker('worker.js');
worker.addEventListener('message', function(msg) {
console.log('Result from the worker:', msg.data);
});
worker.postMessage([2,3]);
worker.j...
In HBase, data are stored in tables with columns. Columns are regrouped in column families, which can be for example "personal" or "professional", each of these containing specific informations.
To create a table, you need to use the Admin Object, create it using :
Admin admin ...
In HBase, you can use 4 types of operations
Get : retrieves a row
Put : inserts one or more row(s)
Delete : delete a row
Scan : retrieves several rows
If you simply want to retrieve a row, given its row_key you can use the Get object:
Get get = new Get(Bytes.toBytes("my_row_key")...
Basically, the Scan object retrieves all the rows from the table, but what if you want to retrieve only the rows where the value of a given column is equal to something ? Let me introduce you the Filters, they work like the WHERE in SQL.
Before starting using the filters, if you know how your row_k...
There are two ways to define an anonymous function: the full syntax and a shorthand.
Full Anonymous Function Syntax
(fn [x y] (+ x y))
This expression evaluates to a function. Any syntax you can use with a function defined with defn (&, argument destructuring, etc.), you can also do with wi...
(defn print-some-items
[[a b :as xs]]
(println a)
(println b)
(println xs))
(print-some-items [2 3])
This example prints the output
2
3
[2 3]
The argument is destructured and the items 2 and 3 are assigned to the symbols a and b. The original argument, the entire vector [2 ...
In the node JS command prompt, inside your loopback project, type the following command to create a new model.
slc loopback:model
If you have installed LoopBack CLI tool, you can create model with:
lb model
The command prompt will request informations about the model to create. In this examp...
console.dir(object) displays an interactive list of the properties of the specified JavaScript object. The output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects.
var myObject = {
"foo":{
"bar":"d...
CDate()
CDate() converts something from any datatype to a Date datatype
Sub CDateExamples()
Dim sample As Date
' Converts a String representing a date and time to a Date
sample = CDate("September 11, 2001 12:34")
Debug.Print Format$(sample, "yyyy-mm-dd hh:nn:...
How To Install ANTLR in Eclipse
(Last tested on Indigo and ANTLR IDE 2.1.2)
Install Eclipse.
Download ANTLR complete binaries jar that includes ANTLR v2. Extract to a temp directory. Copy the antlr-n.n
folder to an appropriate permanent location, for example the same
folder that Eclipse is in...
Server Syntax
var io = require('socket.io')(80);
io.on('connection', function (mysocket) {
//custom event called `private message`
mysocket.on('private message', function (from, msg) {
console.log('I received a private message by ', from, ' saying ', msg);
});
//internal `di...
Suppose we want to read and stack a bunch of similarly-formatted files. The quick solution is:
rbindlist(lapply(list.files(patt="csv$"), fread), id=TRUE)
We might not be satisfied with this for a couple reasons:
It might run into errors when reading with fread or when stacking with ...
The available commands will be displayed, including a brief description, in tabular format.
In Windows 10 the following commands are listed:
CommandDescriptionASSOCDisplays or modifies file extension associations.ATTRIBDisplays or changes file attributes.BREAKSets or clears extended CTRL+C checkin...