Tutorial by Examples: du

In Elm, reducing functions are called "folds", and there are two standard methods to "fold" values up: from the left, foldl, and from the right, foldr. > List.foldl (+) 0 [1,2,3] 6 : number The arguments to foldl and foldr are: reducing function: newValue -> accumul...
Sometimes you just need a diff to apply using patch. The regular git --diff does not work. Try this instead: git diff --no-prefix > some_file.patch Then somewhere else you can reverse it: patch -p0 < some_file.patch
You can also reference an object to publicly export and continuously append methods to that object: const auth = module.exports = {} const config = require('../config') const request = require('request') auth.email = function (data, callback) { // Authenticate with an email address } au...
Start using File Uploads in Rails is quite simple, first thing you have to do is to choice plugin for managing uploads. The most common onces are Carrierwave and Paperclip. Both are similar in functionality and rich in documentation on Let's have an look on example with simple avatar upload image w...
There are a few libraries for unit testing in Common Lisp FiveAM Prove, with a few unique features like extensive test reporters, colored output, report of test duration and asdf integration. Lisp-Unit2, similar to JUnit Fiasco, focusing on providing a good testing experience from the REPL. Su...
Onsen UI is an open-source framework that helps you build hybrid apps with native like performance. It can be used along with several well known JavaScript frameworks such as AngularJS (1 & 2), ReactJS and jQuery. Loading OnsenUI in a project is as easy as writing some standard tags of HTML in ...
DROP PROCEDURE if exists displayNext100WithName; DELIMITER $$ CREATE PROCEDURE displayNext100WithName ( nStart int, tblName varchar(100) ) BEGIN DECLARE thesql varchar(500); -- holds the constructed sql string to execute -- expands the sizing of the output buffer to accomoda...
A subprogram (which defines a procedure), can be either a subroutine or a function; it is said to be an internal subprogram if it is called or invoked from the same program or subprogram that contains it, as follows program my_program ! declarations ! executable statements, ! among which...
Most advanced user interfaces require the user to be able to pass information between the various functions which make up a user interface. MATLAB has a number of different methods to do so. guidata MATLAB's own GUI Development Environment (GUIDE) prefers to use a struct named handles to pass da...
itertools.combinations will return a generator of the k-combination sequence of a list. In other words: It will return a generator of tuples of all the possible k-wise combinations of the input list. For Example: If you have a list: a = [1,2,3,4,5] b = list(itertools.combinations(a, 2)) print ...
C++11 introduced core language and standard library support for moving an object. The idea is that when an object o is a temporary and one wants a logical copy, then its safe to just pilfer o's resources, such as a dynamically allocated buffer, leaving o logically empty but still destructible and co...
The dot product between two tensors can be performed using: tf.matmul(a, b) A full example is given below: # Build a graph graph = tf.Graph() with graph.as_default(): # A 2x3 matrix a = tf.constant(np.array([[1, 2, 3], [2, 4, 6]]), ...
The intent attribute of a dummy argument in a subroutine or function declares its intended use. The syntax is either one of intent(IN) intent(OUT) intent(INOUT) For example, consider this function: real function f(x) real, intent(IN) :: x f = x*x end function The intent(IN) specif...
A linked list is a linear collection of data elements, called nodes, which are linked to other node(s) by means of a "pointer." Below is a singly linked list with a head reference. ┌─────────┬─────────┐ ┌─────────┬─────────┐ HEAD ──▶│ data │"pointer"│──▶...
Production deployments will vary in many ways, but a standard convention when deploying in production is to define an environment variable called NODE_ENV and set its value to "production". Runtime flags Any code running in your application (including external modules) can check the valu...
NodeJS executes the module only the first time you require it. Any further require functions will re-use the same Object, thus not executing the code in the module another time. Also Node caches the modules first time they are loaded using require. This reduces the number of file reads and helps to...
Modules can be used to add new functions to existing Modules and Types. namespace FSharp.Collections module List = let pair item1 item2 = [ item1; item2 ] The new function can then be called as if it was an original member of List. open FSharp.Collections module Testing = le...
Python's string module provides constants for string related operations. To use them, import the string module: >>> import string string.ascii_letters: Concatenation of ascii_lowercase and ascii_uppercase: >>> string.ascii_letters 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ...
Gradle has the ability to add a wrapper to projects. This wrapper alleviates the need for all users or continuous integration systems to have Gradle installed. It also prevents version issues where there is some incompatibility between the version the project uses and that which users have installed...
RoboGuice is a framework that brings the simplicity and ease of Dependency Injection to Android, using Google's own Guice library. RoboGuice 3 slims down your application code. Less code means fewer opportunities for bugs. It also makes your code easier to follow -- no longer is your code littered ...

Page 12 of 47