Tutorial by Examples

The normal way to create an array of numbers: numbers = [1, 2, 3, 4, 5] Range objects can be used extensively to create an array of numbers: numbers = Array(1..10) # => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] numbers = (1..10).to_a # => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] #step and #map methods...
Download and install, either via Homebrew, or from website. For Brew, brew install git-lfs git lfs install Often you will also need to do some setup on the service that hosts your remote to allow it to work with lfs. This will be different for each host, but will likely just be checking a box sa...
A common workflow for using Git LFS is to declare which files are intercepted through a rules-based system, just like .gitignore files. Much of time, wildcards are used to pick certain file-types to blanket track. e.g. git lfs track "*.psd" When a file matching the above pattern is adde...
Suggested max len First, I will mention some common strings that are always hex, or otherwise limited to ASCII. For these, you should specify CHARACTER SET ascii (latin1 is ok) so that it will not waste space: UUID CHAR(36) CHARACTER SET ascii -- or pack into BINARY(16) country_code CHAR(2) CHAR...
Any size of INT may be used for AUTO_INCREMENT. UNSIGNED is always appropriate. Keep in mind that certain operations "burn" AUTO_INCREMENT ids. This could lead to an unexpected gap. Examples: INSERT IGNORE and REPLACE. They may preallocate an id before realizing that it won't be need...
There is already a separate entry for "FLOAT, DOUBLE, and DECIMAL" and "ENUM". A single page on datatypes is likely to be unwieldy -- I suggest "Field types" (or should it be called "Datatypes"?) be an overview, then split into these topic pages: INTs FLO...
These are the bitwise operators in VB.NET : And, Or, Xor, Not Example of And bitwise operation Dim a as Integer a = 3 And 5 The value of a will be 1. The result is obtained after comparing 3 and 5 in binary for. 3 in binary form is 011 and 5 in binary form is 101. The And operator places 1 if ...
String concatenation is when you combine two or more strings into a single string variable. String concatenation is performed with the & symbol. Dim one As String = "Hello " Dim two As String = "there" Dim result As String = one & two Non-string values will be conv...
7.0 OrElse Sub Main() Dim elements As List(Of Integer) = Nothing Dim average As Double = AverageElementsOrElse(elements) Console.WriteLine(average) ' Writes 0 to Console Try 'Throws ArgumentNullException average = AverageElementsOr(elements) Catch ex ...
Joseph Fourier showed that any periodic wave can be represented by a sum of simple sine waves. This sum is called the Fourier Series. The Fourier Series only holds while the system is linear. If there is, eg, some overflow effect (a threshold where the output remains the same no matter how much inpu...
using System; using System.Threading; using System.Threading.Tasks; class Program { static void Main( string[] args ) { object sync = new object(); int sum = 0; Parallel.For( 1, 1000, ( i ) => { lock( sync ) sum = sum + i; // lock is necessa...
Using the Library Database, we try to find the last book added to the database for each author. For this simple example we assume an always incrementing Id for each record added. SELECT MostRecentBook.Name, MostRecentBook.Title FROM ( SELECT Authors.Name, Books.Title, ...
As of Qt 5.1 and later you can use QQmlApplicationEngine instead of QQuickView to load and render a QML script. With QQmlApplicationEngine you do need to use a QML Window type as your root element. You can obtain the root context from the engine where you can then add global properties to the cont...
Not all objects can be converted to a JSON string. When an object has cyclic self-references, the conversion will fail. This is typically the case for hierarchical data structures where parent and child both reference each other: const world = { name: 'World', regions: [] }; world.region...
Creating a ServiceHost programmatically (without config file) in its most basic form: namespace ConsoleHost { class ConsoleHost { ServiceHost mHost; public Console() { mHost = new ServiceHost(typeof(Example), new Uri("net.tcp://localhost:9000/Example")); ...
A Cython pyx file needs to be translated to C code (cythonized) and compiled before it can be used from Python. A common approach is to create an extension module which is then imported in a Python program. Code For this example we create three files: hello.pyx contains the Cython code. test.p...
class ClassWithAReallyLongName { public: class Iterator { /* ... */ }; Iterator end(); }; Defining the member end with a trailing return type: auto ClassWithAReallyLongName::end() -> Iterator { return Iterator(); } Defining the member end without a trailing return type: Clas...
>>> df ID Year Jan_salary Feb_salary Mar_salary 0 1 2016 4500 4200 4700 1 2 2016 3800 3600 4400 2 3 2016 5500 5200 5300 >>> melted_df = pd.melt(df,id_vars=['ID','Year'], v...
abstract class Machine { constructor(public manufacturer: string) { } // An abstract class can define methods of it's own, or... summary(): string { return `${this.manufacturer} makes this machine.`; } // Require inheriting classes to implement methods ...
Create a MongoDB connection, that later you can query: $manager = new \MongoDB\Driver\Manager('mongodb://localhost:27017'); In the next example, you will learn how to query the connection object. This extension close the connection automatically, it's not necessary to close manually.

Page 558 of 1336