Tutorial by Examples: ti

There are two ways to connect to a MySQL/MariaDB server, depending on your infrastructure. Standard (TCP/IP) connection $dsn = 'mysql:dbname=demo;host=server;port=3306;charset=utf8'; $connection = new \PDO($dsn, $username, $password); // throw exceptions, when SQL error is caused $connection-...
Lists can be created in multiple ways. The recommended way is to use a List literal: var vegetables = ['broccoli', 'cabbage']; The List constructor can be used as well: var fruits = new List(); If you prefer stronger typing, you can also supply a type parameter in one of the following ways:...
Sets can be created via the constructor: var ingredients = new Set(); ingredients.addAll(['gold', 'titanium', 'xenon']);
Maps can be created in multiple ways. Using the constructor, you can create a new map as follow: var searchTerms = new Map(); Types for the key and value can also be defined using generics: var nobleGases = new Map<int, String>(); var nobleGases = <int, String>{}; Maps can othe...
Detailed instructions on getting google-maps set up or installed.
Eloquent is the ORM built into the Laravel framework. It allows you to interact with your database tables in an object-oriented manner, by use of the ActiveRecord pattern. A single model class usually maps to a single database table, and also relationships of different types (one-to-one, one-to-man...
In Haskell, it often makes sense not to bother with file handles at all, but simply read or write an entire file straight from disk to memory†, and do all the partitioning/processing of the text with the pure string data structure. This avoids mixing IO and program logic, which can greatly help avoi...
String#split splits a String into an Array, based on a delimiter. "alpha,beta".split(",") # => ["alpha", "beta"] An empty String results into an empty Array: "".split(",") # => [] A non-matching delimiter results in an Array...
The easiest way to create a multiline string is to just use multiple lines between quotation marks: address = "Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.&quot...
virtualenv is a tool to build isolated Python environments. This program creates a folder which contains all the necessary executables to use the packages that a Python project would need. Installing the virtualenv tool This is only required once. The virtualenv program may be available through yo...
A module is a file containing Python definitions and statements. Function is a piece of code which execute some logic. >>> pow(2,3) #8 To check the built in function in python we can use dir(). If called without an argument, return the names in the current scope. Else, return an alph...
If you've got a session which you wish to destroy, you can do this with session_destroy() /* Let us assume that our session looks like this: Array([firstname] => Jon, [id] => 123) We first need to start our session: */ session_start(); /* We can now remove all the v...
Just execute lsb_release -a. On Debian: $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux testing (stretch) Release: testing Codename: stretch On Ubuntu: $ lsb_release -a No LSB modules are available. Distributor ID: Ubun...
The most common way to create a Symbol object is by prefixing the string identifier with a colon: :a_symbol # => :a_symbol :a_symbol.class # => Symbol Here are some alternative ways to define a Symbol, in combination with a String literal: :"a_symbol" "a_symbol&quot...
Given a String: s = "something" there are several ways to convert it to a Symbol: s.to_sym # => :something :"#{s}" # => :something
Given a Symbol: s = :something The simplest way to convert it to a String is by using the Symbol#to_s method: s.to_s # => "something" Another way to do it is by using the Symbol#id2name method which is an alias for the Symbol#to_s method. But it's a method that is unique to the...
NSDictionary *inventory = @{ @"Mercedes-Benz SLK250" : @(13), @"BMW M3 Coupe" : @(self.BMWM3CoupeInventory.count), @"Last Updated" : @"Jul 21, 2016", @"Next Update" : self.nextInventoryUpdateString };
NSDictionary *inventory = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:13], @"Mercedes-Benz SLK250", [NSNumber numberWithInt:22], @"Mercedes-Benz E350", [NSNumber numberWithInt:19], @"BMW M3 Coupe", [NSNumber numberWithInt:16],...
There are a variety of ways to download and use D3. Direct Script Download Download and extract d3.zip Copy the resulting folder to where you will keep your project's dependencies Reference d3.js (for development) or d3.min.js (for production) in your HTML: <script type="text/javascri...
If a code module does not contain Option Explicit at the top of the module, then the compiler will automatically (that is, "implicitly") create variables for you when you use them. They will default to variable type Variant. Public Sub ExampleDeclaration() someVariable = 10 ...

Page 43 of 505