Tutorial by Examples: ase

A session is usually obtained using sessionmaker, which creates a Session class unique to your application. Most commonly, the Session class is bound to an engine, allowing instances to use the engine implicitly. from sqlalchemy.orm import sessionmaker # Initial configuration arguments Session ...
If it is important for a sequence of numbers generated by random() to differ, it is a good idea to specify a seed with randomSeed(): void setup() { Serial.begin(9600); // If analog pin 0 is left unconnected, analogRead(0) will produce a // different random number each time the ...
name:"john doe" Searches for multiple terms in specific order.
CMake knows several build types, which usually influence default compiler and linker parameters (such as debugging information being created) or alternative code paths. By default, CMake is able to handle the following build types: Debug: Usually a classic debug build including debugging informa...
You can add an interpreter directive (shebang) to your script. Create a file called hello_world.rb which contains: #!/usr/bin/env ruby puts 'Hello World!' Give the script executable permissions. Here's how to do that in Unix: $ chmod u+x hello_world.rb Now you do not need to call the Ru...
A single case discriminated union is like any other discriminated union except that it only has one case. // Define single-case discriminated union type. type OrderId = OrderId of int // Construct OrderId type. let order = OrderId 123 // Deconstruct using pattern matching. // Parentheses used...
Incorrect usage: In the following snippet, the last match will never be used: let x = 4 match x with | 1 -> printfn "x is 1" | _ -> printfn "x is anything that wasn't listed above" | 4 -> printfn "x is 4" prints x is anything that wasn't listed abov...
This example show how you can check if a service already exists (i.e., is installed on the machine) or not. This code requires only the lowest privileges necessary, so each process can perform the check, no matter what level of security it is running at. #define UNICODE #define _UNICODE #include ...
Destructuring also gives you the ability to interpret a sequence as a map: (def my-vec [:a 1 :b 2]) (def my-lst '("smthg else" :c 3 :d 4)) (let [[& {:keys [a b]}] my-vec [s & {:keys [c d]} my-lst] (+ a b c d)) ;= 10 It is useful for defining functions with named p...
The MEDIAN function since Oracle 10g is an easy to use aggregation function: SELECT MEDIAN(SAL) FROM EMP It returns the median of the values Works on DATETIME values too. The result of MEDIAN is computed by first ordering the rows. Using N as the number of rows in the group, Oracle calcula...
The function toupper will convert a string to upper case (capital letters). For example: BEGIN { greeting = "hello" loud_greeting = toupper(greeting) print loud_greeting } This code will output "HELLO" when run.
pg_dump -Fc -f DATABASE.pgsql DATABASE The -Fc selects the "custom backup format" which gives you more power than raw SQL; see pg_restore for more details. If you want a vanilla SQL file, you can do this instead: pg_dump -f DATABASE.sql DATABASE or even pg_dump DATABASE > DATABA...
Laravel allows user work on multiple database connections. If you need to connect to multiple databases and make them work together, you are beware of the connection setup. You also allow using different types of database in the same application if you required. Default connection In config/dat...
Consider the following example assuming that you have a ';'-delimited CSV to load into your database. 1;max;male;manager;12-7-1985 2;jack;male;executive;21-8-1990 . . . 1000000;marta;female;accountant;15-6-1992 Create the table for insertion. CREATE TABLE `employee` ( `id` INT NOT NULL , ...
NSURL *url = [NSURL URLWithString:@"http://www.example.com/"]; NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; // Configure the session here. NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration]; [[s...
Given the following definitions : public interface IMyInterface1 { string GetName(); } public interface IMyInterface2 { string GetName(); } public class MyClass : IMyInterface1, IMyInterface2 { string IMyInterface1.GetName() { return "IMyInterface1"...
Sometimes it is useful to create union types with only one case to implement record-like types: type Point = Point of float * float let point1 = Point(0.0, 3.0) let point2 = Point(-2.5, -4.0) These become very useful because they can be decomposed via pattern matching in the same way as tu...
In comparison to regular classes – case classes notation provides several benefits: All constructor arguments are public and can be accessed on initialized objects (normally this is not the case, as demonstrated here): case class Dog1(age: Int) val x = Dog1(18) println(x.age) // 18 (success!...
To make artisan migrate a fresh database before running tests, use DatabaseMigrations. Also if you want to avoid middleware like Auth, use WithoutMiddleware. <?php use Illuminate\Foundation\Testing\WithoutMiddleware; use Illuminate\Foundation\Testing\DatabaseMigrations; class ExampleTest ...
Creating a hub A quick configuration for a hub and node setup in selenium grid. For more information see: Grid 2 docs Requirements To set up a grid hub you need the flowing: Selenium-server-standalone-.jar Creating the hub To Create a Hub you need to run the selenium server. Download Se...

Page 8 of 40