Tutorial by Examples: 1

function meridiem(d:Date):String { return (d.hours > 11) ? "pm" : "am"; }
The simplest case is just preforming a task for a fixed known number of times. Say we want to display the numbers between 1 to n, we can write: n = 5; for k = 1:n display(k) end The loop will execute the inner statement(s), everything between the for and the end, for n times (5 in this ex...
With C++11 and higher calculations at compile time can be much easier. For example calculating the power of a given number at compile time will be following: template <typename T> constexpr T calculatePower(T value, unsigned power) { return power == 0 ? 1 : value * calculatePower(value,...
The installer requires PHP 5.4 or higher. If you still use the legacy PHP 5.3 version, you cannot use the Symfony Installer. Read the Creating Symfony Applications without the Installer section to learn how to proceed. - source: http://symfony.com/doc/current/book/installation.html
Python has only limited support for parsing ISO 8601 timestamps. For strptime you need to know exactly what format it is in. As a complication the stringification of a datetime is an ISO 8601 timestamp, with space as a separator and 6 digit fraction: str(datetime.datetime(2016, 7, 22, 9, 25, 59, 55...
When Intel defined the original 8086, it was a 16-bit processor with a 20-bit address bus (see below). They defined 8 general-purpose 16-bit registers - but gave them specific roles for certain instructions: AX The Accumulator register. Many opcodes either assumed this register, or were faster i...
To send an immediate message with data to JavaScript, you have to trigger an action from your init. init : ( Model, Cmd Msg ) init = ( Model 0, send SendOutgoing ) send : msg -> Cmd msg send msg = Task.perform identity identity (Task.succeed msg)
You can diff UTF-16 encoded files (localization strings file os iOS and macOS are examples) by specifying how git should diff these files. Add the following to your ~/.gitconfig file. [diff "utf16"] textconv = "iconv -f utf-16 -t utf-8" iconv is a program to convert differe...
The following method computes the sum of integers from 0 to N using recursion. public int sum(final int n) { if (n > 0) { return n + sum(n - 1); } else { return n; } } This method is O(N) and can be reduced to a simple loop using tail-call optimization. In f...
Create an interface decorated with a ServiceContract attribute and member functions decorated with the OperationContract attribute. namespace Service { [ServiceContract] interface IExample { [OperationContract] string Echo(string s); } } Create a concrete...
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...
Problem # models.py: class Library(models.Model): name = models.CharField(max_length=100) books = models.ManyToManyField(Book) class Book(models.Model): title = models.CharField(max_length=100) # views.py def myview(request): # Query the database. libraries = Librar...
Problem Django querysets are evaluated in a lazy fashion. For example: # models.py: class Author(models.Model): name = models.CharField(max_length=100) class Book(models.Model): author = models.ForeignKey(Author, related_name='books') title = models.CharField(max_length=100) ...
lazy var persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: "ProjectName") container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error { fatalError("Unreso...
The two functions fn1 and fn2 can return multiple tensors, but they have to return the exact same number and types of outputs. x = tf.constant(1.) bool = tf.constant(True) def fn1(): return tf.add(x, 1.), x def fn2(): return tf.add(x, 10.), x res1, res2 = tf.cond(bool, fn1, fn2)...
Build numberDescriptionProduct16.0.4366.1000Cumulative Update April 2016SharePoint Server 201616.0.4336.1000RTMSharePoint Server 201616.0.4327.1000Release CandidateSharePoint Server 201616.0.4266.100116.0.4306.1002 Beta 2SharePoint Server 2016
Assuming you have this YAML locale file: # config/locales/en.yml en: header: title: "My header title" and you want to display your title string, you can do this # in ERB files <%= t('header.title') %> # in SLIM files = t('header.title')
You can pass parameters to I18n t method: # Example config/locales/en.yml en: page: users: "%{users_count} users currently online" # In models, controller, etc... I18n.t('page.users', users_count: 12) # In views # ERB <%= t('page.users', users_count: 12) %> #S...
using System; using System.Security.Cryptography; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string source = "Hello World!"; using (SHA1 sha1Hash = SHA1.Create()) ...
using System; using System.Security.Cryptography; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string source = "Hello World!"; using (SHA512 sha512Hash = SHA512.Create()) ...

Page 2 of 16