Tutorial by Examples

In the following, we are creating an example of an Aurelia Custom Element which will allow you to display Youtube videos via their video ID. An Aurelia Custom Element can be defined in two different ways: the first one is by creating a viewmodel and accompanying view, the second one is by just cre...
A basic custom element is created in Aurelia based on naming conventions, by simply adding the suffix CustomElement to the name of a class. This suffix will automatically be stripped out by Aurelia. The remaining part of the class name will be lowercased and separated using a hyphen and can then be ...
First the setup for the example: import datetime as dt from sqlalchemy import Column, Date, Integer, Text, create_engine, inspect from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() Session = sessionmaker() class User(B...
Given the following model class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(Text, nullable=False) birthday = Column(Date) You can filter columns in the query: import datetime as dt session.query(User).filter(User.name == 'Bob')...
An overload without conversions needed for parameter types or only conversions needed between types that are still considered exact matches is preferred over an overload that requires other conversions in order to call. void f(int x); void f(double x); f(42); // calls f(int) When an argument b...
In SQLAlchemy core, the result is RowProxy. In cases where you want an explicit dictionary, you can call dict(row). First the setup for the example: import datetime as dt from sqlalchemy import ( Column, Date, Integer, MetaData, Table, Text, create_engine, select) metadata = MetaData() u...
Let's suppose we have a reference to the JQuery type definition and we want to extend it to have additional functions from a plugin we included and which doesn't have an official type definition. We can easily extend it by declaring functions added by plugin in a separate interface declaration with ...
Declare public variables and methods type in the interface to define how other typescript code can interact with it. interface ISampleClassInterface { sampleVariable: string; sampleMethod(): void; optionalVariable?: string; } Here we create a class that implements the interface. ...
Installation npm install -D webpack typescript ts-loader webpack.config.js module.exports = { entry: { app: ['./src/'], }, output: { path: __dirname, filename: './dist/[name].js', }, resolve: { extensions: ['', '.js', '.ts'], }, module: { loaders: [...
The engine is used to connect to different databases using a connection URL: from sqlalchemy import create_engine engine = create_engine('postgresql://user:pass@localhost/test') Note, however, that the engine does not actually establish a connection until it is first used. The engine automat...
You can open a connection (i.e. request one from the pool) using a context manager: with engine.connect() as conn: result = conn.execute('SELECT price FROM products') for row in result: print('Price:', row['price']) Or without, but it must be closed manually: conn = engine.co...
If you only want to execute a single statement, you can use the engine directly and it will open and close the connection for you: result = engine.execute('SELECT price FROM products') for row in result: print('Price:', row['price'])
You can use engine.begin to open a connection and begin a transaction that will be rolled back if an exception is raised, or committed otherwise. This is an implicit way of using a transaction, since you don't have the option of rolling back manually. with engine.begin() as conn: conn.execute(...
To use the py2app framework you must install it first. Do this by opening terminal and entering the following command: sudo easy_install -U py2app You can also pip install the packages as : pip install py2app Then create the setup file for your python script: py2applet --make-setup MyAppli...
There are multiple ways to populate an array. Directly 'one-dimensional Dim arrayDirect1D(2) As String arrayDirect(0) = "A" arrayDirect(1) = "B" arrayDirect(2) = "C" 'multi-dimensional (in this case 3D) Dim arrayDirectMulti(1, 1, 2) arrayDirectMulti(0, 0, 0...
JSON data can also be read from files. Let's assume we have a file called data.json with the following content: [ { "Name" : "John Doe", "Standard" : 4 }, { "Name" : "Peter Parker", "Standard" : ...
In Android there is a default options menu, which can take a number of options. If a larger number of options needs to be displayed, then it makes sense to group those options in order to maintain clarity. Options can be grouped by putting dividers (i.e. horizontal lines) between them. In order to a...
Implicit parameters can be useful if a parameter of a type should be defined once in the scope and then applied to all functions that use a value of that type. A normal function call looks something like this: // import the duration methods import scala.concurrent.duration._ // a normal method...
To retrieve a list of all servers registered on the instance: EXEC sp_helpserver;
Two-way Data-Binding supports the following attributes: ElementPropertiesAbsListViewandroid:selectedItemPositionCalendarViewandroid:dateCompoundButtonandroid:checkedDatePickerandroid:yearandroid:monthandroid:dayEditTextandroid:textNumberPickerandroid:valueRadioGroupandroid:checkedButtonRatingBarand...

Page 249 of 1336