Tutorial by Examples

const fs = require('fs'); const readline = require('readline'); const rl = readline.createInterface({ input: fs.createReadStream('text.txt') }); // Each new line emits an event - every time the stream receives \r, \n, or \r\n rl.on('line', (line) => { console.log(line); }); ...
const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.question('What is your name?', (name) => { console.log(`Hello ${name}!`); rl.close(); });
This example creates a trigger that inserts a record to a second table (MyAudit) after a record is inserted into the table the trigger is defined on (MyTable). Here the "inserted" table is a special table used by Microsoft SQL Server to store affected rows during INSERT and UPDATE statemen...
Install Atom for your distribution here. After that run the following commands from a terminal: apm install parinfer apm install language-clojure apm install proto-repl
Objects will often depend on other objects. Instead of creating the dependency in the constructor, the dependency should be passed into the constructor as a parameter. This ensures there is not tight coupling between the objects, and enables changing the dependency upon class instantiation. This has...
Detailed instructions on getting spring-security set up or installed.
To remove an existing alias, use: unalias {alias_name} Example: # create an alias $ alias now='date' # preview the alias $ now Thu Jul 21 17:11:25 CEST 2016 # remove the alias $ unalias now # test if removed $ now -bash: now: command not found
Sometimes you may want to bypass an alias temporarily, without disabling it. To work with a concrete example, consider this alias: alias ls='ls --color=auto' And let's say you want to use the ls command without disabling the alias. You have several options: Use the command builtin: command...
Note: GRAILS requires a Java JDK installed (a runtime environment JRE is not sufficient) on your system, before setting up Grails. Please refer to, how to install JDK. As of this writing, it is recommended to install the latest JDK. For Mac OSX, Linux, Cygwin, Solaris and FreeBSD: The simplest w...
[alias] logp=log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short lg = log --graph --date-order --first-parent \ --pretty=format:'%C(auto)%h%Creset %C(auto)%d%Creset %s %C(green)(%ad) %C(bold cyan)<%an>%Creset' lgb = log --graph --date-order --branches --first-paren...
Adding the DebuggerDisplay Attribute will change the way the debugger displays the class when it is hovered over. Expressions that are wrapped in {} will be evaluated by the debugger. This can be a simple property like in the following sample or more complex logic. [DebuggerDisplay("{StringPr...
There are multiple threads in your code and you need to safely communicate between them. You can use a Queue from the queue library. from queue import Queue from threading import Thread # create a data producer def producer(output_queue): while True: data = data_computation() ...
In Objective-C, method swizzling is the process of changing the implementation of an existing selector. This is possible due to the way Selectors are mapped on a dispatch table, or a table of pointers to functions or methods. Pure Swift methods are not dynamically dispatched by the Objective-C run...
Putting a & (ampersand) in front of an argument will pass it as the method's block. Objects will be converted to a Proc using the to_proc method. class Greeter def to_proc Proc.new do |item| puts "Hello, #{item}" end end end greet = Greeter.new %w(world l...
git diff [HEAD|--staged...] --word-diff Rather than displaying lines changed, this will display differences within lines. For example, rather than: -Hello world +Hello world! Where the whole line is marked as changed, word-diff alters the output to: Hello [-world-]{+world!+} You can omit...
In this approach, the single is accessed via the static method: Singleton.getInstance(); To enforce only one instance of the singleton, a private static variable retains the instance, while any additional attempts to instantiate an instance are enforced within the constructor. package { publ...
Cocoa is Apple's API to develop apps for macOS, formerly known as OS X. Cocoa is a container framework, and contains three sub-frameworks. Foundation AppKit CoreData Cocoa Touch is Apple's version of Cocoa to develop apps for iOS, watchOS and tvOS. Cocoa Touch contains the same sub-framewo...
If you want to download an object from GCS that is publicly viewable, the simplest way is to use a web browser or a command line tool to fetch a URL with this pattern: https://storage.googleapis.com/bucketName/objectName. Example: https://storage.googleapis.com/pub/someOfTheTeam.jpg
You can use git merge --squash to squash changes introduced by a branch into a single commit. No actual commit will be created. git merge --squash <branch> git commit This is more or less equivalent to using git reset, but is more convenient when changes being incorporated have a symbolic...
This filter is very useful. One of the common problems for developers is how to include templates in plugins they develop. The filter is applied immediately after wordpress locates the appropriate template in the active child/parent theme using the wp hierarchy. Be careful to define when you want ...

Page 177 of 1336