Tutorial by Examples: al

Overall the easiest way to work with JSON is to have a case class mapping directly to the JSON (same fields name, equivalent types, etc.). case class Person( name: String, age: Int, hobbies: Seq[String], pet: Pet ) case class Pet( name: String, `type`: String ) // these...
You can use using in order to set an alias for a namespace or type. More detail can be found in here. Syntax: using <identifier> = <namespace-or-type-name>; Example: using NewType = Dictionary<string, Dictionary<string,int>>; NewType multiDictionary = new NewType(); /...
(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 ...
VBA supports 2 calendars : Gregorian and Hijri The Calendar property is used to modify or display the current calendar. The 2 values for the Calendar are: ValueConstantDescription0vbCalGregGregorian calendar (default)1vbCalHijriHijri calendar Example Sub CalendarExample() 'Cache the curren...
DateDiff() DateDiff() returns a Long representing the number of time intervals between two specified dates. Syntax DateDiff ( interval, date1, date2 [, firstdayofweek] [, firstweekofyear] ) interval can be any of the intervals defined in the DatePart() function date1 and date2 are the two ...
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...
Open Graph is a standard for metadata that extends the normal information contained within a site's head markup. This enables websites such as Facebook to display deeper and richer information about a website in a structured format. This information is then automatically displayed when users share l...
You want to convert all elements in an array to some other form. For example, you have theUsers = [ {id: 1, username: 'john'} {id: 2, username: 'lexy'} {id: 3, username: 'pete'} ] and you want to have an array of usernames only, i.e. ['john', 'lexy', 'pete'] Method 1 - using .map ...
theUsers = [ {id: 1, username: 'john'} {id: 2, username: 'lexy'} {id: 3, username: 'pete'} ] To retain only users whose id is greather than 2, use the following: [{id: 3, username: 'pete'}] Method 1 - using .filter filteredUsers = theUsers.filter (user) -> user.id >= 2 Met...
Alert is a simple popup that displays a set of buttons and gets an result depending on the button the user clicked: Example This lets the user decide, if (s)he really wants to close the primary stage: @Override public void start(Stage primaryStage) { Scene scene = new Scene(new Group(), 100...
You can wrap values into actions and pipe the result of one computation into another: return :: Monad m => a -> m a (>>=) :: Monad m => m a -> (a -> m b) -> m b However, the definition of a Monad doesn’t guarantee the existence of a function of type Monad m => m a -&...
person = name: "Duder von Broheim" age: 27 address: "123 Fake St" phoneNumber: "867-5309" {name, age, address, phoneNumber} = person
Any public Sub, Function, or Property inside a class module can be called by preceding the call with an object reference: Object.Procedure In a DateRange class, a Sub could be used to add a number of days to the end date: Public Sub AddDays(ByVal NoDays As Integer) mEndDate = mEndDate + No...
Intro An array is a container object that holds a number of values. In the following image you can see an array with size 10, the first element indexed 1 and the last element 10. Autohotkey offers a few ways of defining and creating arrays. Array := [] Array := Array() Creating and initia...
You can use the following code for going back and forward. if (!function_exists('mb_internal_encoding')) { function mb_internal_encoding($encoding = NULL) { return ($from_encoding === NULL) ? iconv_get_encoding() : iconv_set_encoding($encoding); } } if (!function_exists('mb_c...
Each resource directory under the res folder (listed in the example above) can have different variations of the contained resources in similarly named directory suffixed with different qualifier-values for each configuration-type. Example of variations of `` directory with different qualifier value...
Standard You don't need to create the variable, but it's a good practice as you can use that variable with clearInterval to stop the currently running interval. var int = setInterval("doSomething()", 5000 ); /* 5 seconds */ var int = setInterval(doSomething, 5000 ); /* same thing, no qu...
Prolog tries alternative clauses for a predicate in the order of appearance: likes(alice, music). likes(bob, hiking). // Either alice likes music, or bob likes hiking will succeed. The disjunction (OR) operator ; can be used to express this in one rule: likes(P,Q) :- ( P = alice , Q = ...

Page 116 of 269