Tutorial by Examples: and

Channel uses a Buffer to read/write data. A buffer is a fixed sized container where we can write a block of data at once. Channel is a quite faster than stream-based I/O. To read data from a file using Channel we need to have the following steps- We need an instance of FileInputStream. FileInput...
let let num=1+2 let num="1+2" let 'num= 1 + 2' let num=1 num+=2 You need quotes if there are spaces or globbing characters. So those will get error: let num = 1 + 2 #wrong let 'num = 1 + 2' #right let a[1] = 1 + 1 #wrong let 'a[1] = 1 + 1' ...
Exit status 0: success Exit status other than 0: failure To test on the exit status of a command: if command;then echo 'success' else echo 'failure' fi
Press controlr and type a pattern. For example, if you recently executed man 5 crontab, you can find it quickly by starting to type "crontab". The prompt will change like this: (reverse-i-search)`cr': man 5 crontab The `cr' there is the string I typed so far. This is an incremental s...
Due to not being Excel-VBA exclusive contents this Example has been moved to VBA documentation. Link: Dynamic Arrays (Array Resizing and Dynamic Handling)
Setup First, install the necessary packages with: npm install express cors mongoose Code Then, add dependencies to server.js, create the database schema and the name of the collection, create an Express.js server, and connect to MongoDB: var express = require('express'); var cors = require('...
Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members. In the example below, sayHello() and sayGoodbye() are using self and $this difference can be observed here. cl...
You can create temporary files which has a visible name on the file system which can be accessed via the name property. The file can, on unix systems, be configured to delete on closure (set by delete param, default is True) or can be reopened later. The following will create and open a named temp...
A Scripting Dictionary object stores information in Key/Item pairs. The Keys must be unique and not an array but the associated Items can be repeated (their uniqueness is held by the companion Key) and can be of any type of variant or object. A dictionary can be thought of as a two field in-memory ...
A common problem when working with Unity is when 2 or more developers are modifying a Unity scene or prefab (*.unity files). Git does not know how to merge them correctly out of the box. Thankfully the Unity team deployed a tool called SmartMerge which makes simple merge automatic. The first thing...
Elasticsearch is accessed through a HTTP REST API, typically using the cURL library. The messages between the search server and the client (your or your application) are sent in the form of JSON strings. By default, Elasticsearch runs on port 9200. In the examples below, ?pretty is added to tell El...
To get First object: MyModel.objects.first() To get last objects: MyModel.objects.last() Using Filter First object: MyModel.objects.filter(name='simple').first() Using Filter Last object: MyModel.objects.filter(name='simple').last()
A typeglob *foo holds references to the contents of global variables with that name: $foo, @foo, $foo, &foo, etc. You can access it like an hash and assign to manipulate the symbol tables directly (evil!). use v5.10; # necessary for say our $foo = "foo"; our $bar; say ref *foo{SCAL...
Microsoft Access is an Application Generator for developing databases and data-driven applications, primarily for local use. Microsoft Access consists of two main elements: A Relational Database Management System (RDBMS) that combines the Microsoft Jet Database Engine (Access 2003 and earler) or ...
In Emacs, file has the same meaning as in the operating system, and is used for permanent storage of data. A buffer is the internal representation of a file being edited. Files can be read into buffers using C-x C-f, and buffers can be written to files using C-x C-s (save file at its current locatio...
The & character appears first in entity references and must be escaped in element content or in attribute content. <?xml version="1.0"?> <document attribute="An ampersand is escaped as &"> An ampersand can also be escaped as & in element conte...
Attribute values can appear in simple or double quotes. The appropriate character must be escaped. <?xml version="1.0"?> <document quot-attribute="This is a "double quote" and this one is 'simple'" apos-attribute='This is a 'simple quot...
To load an image and place it on the canvas var image = new Image(); // see note on creating an image image.src = "imageURL"; image.onload = function(){ ctx.drawImage(this,0,0); } Creating an image There are several ways to create an image new Image() document.createEleme...
Simple one-liners may be specified as command line arguments to perl using the -e switch (think "execute"): perl -e'print "Hello, World!\n"' Due to Windows quoting rules you can't use single-quoted strings but have to use one of these variants: perl -e"print qq(Hello, W...
genRandom creates a stream of random numbers that has a one in four chance of terminating each time it's called. def genRandom: Stream[String] = { val random = scala.util.Random.nextFloat() println(s"Random value is: $random") if (random < 0.25) { Stream.empty[String] ...

Page 54 of 153