Tutorial by Examples: al

The following example adds a column admin to the users table, and gives that column the default value false. class AddDetailsToUsers < ActiveRecord::Migration[5.0] def change add_column :users, :admin, :boolean, default: false end end Migrations with defaults might take a long tim...
Now we'll try going for a little more complex example, using the capabilities of the controller to fill in the view. Here is our view: /application/views/hello_world.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <titl...
public class Tag { public IList<string> Synonyms { get; set; } } Synonyms is a collection-type property. When the Tag object is created using object initializer syntax, Synonyms can also be initialized with collection initializer syntax: Tag t = new Tag { Synonyms = new List&...
To read the contents to a file into a string variable: Dim fileContents As String = System.IO.File.ReadAllText("filename.txt") ReadAllText will open the specified file, read data to the end, then close the file. To read a file, separating it into an array element for each line: Dim f...
;; package.el is available since emacs 24 (require 'package) ;; Add melpa package source when using package list (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) ;; Load emacs packages and activate them ;; This must come before configurations o...
6.0 Introduced in C# 6.0, the Null Conditional Operator ?. will immediately return null if the expression on its left-hand side evaluates to null, instead of throwing a NullReferenceException. If its left-hand side evaluates to a non-null value, it is treated just like a normal . operator. Note tha...
To connect to a local Wildfly server via the command line, the tool bin/jboss-cli.sh can be used: $ ./bin/jboss-cli.sh --connect [standalone@localhost:9990 /] To connect to a remote Wildfly server, use the --controller option: $ ./bin/jboss-cli.sh --connect --controller=localhost:9990 [stan...
int a; std::cout << a; // Undefined behavior! This results in undefined behavior, because a is uninitialised. It is often, incorrectly, claimed that this is because the value is "indeterminate", or "whatever value was in that memory location before". However, it is th...
The call/N family of predicates can call arbitrary Prolog goals at run time: ?- G=true, call(G). true. ?- G=(true,false), call(G). false.
In Prolog, the so-called meta-call is a built-in language feature. All Prolog code is represented by Prolog terms, allowing goals to be constructed dynamically and be used like other goals without additional predicates: ?- Goal = dif(X, Y), Goal. dif(X, Y). Using this mechanism, other higher-or...
One of the most elementary DCG nonterminals is ... //0, which can be read as "anything at all": ... --> [] | [_], ... . It can be used to describe a list Ls that contains the element E via: phrase(( ..., [E], ... ), Ls)
Prerequisites In order to run Elasticsearch, a Java Runtime Environment (JRE) is required on the machine. Elasticsearch requires Java 7 or higher and recommends Oracle JDK version 1.8.0_73. Install Oracle Java 8 sudo add-apt-repository -y ppa:webupd8team/java sudo apt-get update echo "or...
The Locals window provides easy access to the current value of variables and objects within the scope of the function or subroutine you are running. It is an essential tool to debugging your code and stepping through changes in order to find issues. It also allows you to explore properties you might...
OrientDB is available in two editions: Community Edition is released as an open source project under the Apache 2 license. This license allows unrestricted free usage for both open source and commercial projects. Enterprise Edition is commercial software built on top of the Community Edit...
<template name="myTemplate"> {{#each results}} <div><span>{{name}}</span><span>{{age}}</span></div> {{/each}} </template> Template.myTemplate.onCreated(function() { this.results = new ReactiveVar(); Meteor.call('myMethod'...
When you need to pass a collection into a Java method: import scala.collection.JavaConverters._ val scalaList = List(1, 2, 3) JavaLibrary.process(scalaList.asJava) If the Java code returns a Java collection, you can turn it into a Scala collection in a similar manner: import scala.collectio...
defmodule Math do # We start of by passing the sum/1 function a list of numbers. def sum(numbers) do do_sum(numbers, 0) end # Recurse over the list when it contains at least one element. # We break the list up into two parts: # head: the first element of the list # ta...
.gitignore ignores files locally, but it is intended to be committed to the repository and shared with other contributors and users. You can set a global .gitignore, but then all your repositories would share those settings. If you want to ignore certain files in a repository locally and not make t...
There is a metamethod called __call, which defines the bevahiour of the object upon being used as a function, e.g. object(). This can be used to create function objects: -- create the metatable with a __call metamethod local meta = { __call = function(self) self.i = self.i + 1 e...
Ionic Framework A Cross-platform mobile application development framework using Angular JS and Front End web technologies. Official website: http://ionicframework.com/ Documentation: http://ionicframework.com/docs/ Installation and Setup Installation Ionic required NPM(Node Package Manager) an...

Page 61 of 269