Tutorial by Examples: ti

For the common case of having one Flask application all you have to do is to create your Flask application, load the configuration of choice and then create the SQLAlchemy object by passing it the application. Once created, that object then contains all the functions and helpers from both sqlalchem...
Sometimes it happens that a file was being tracked by git, but in a later point in time was added to .gitignore, in order to stop tracking it. It's a very common scenario to forget to clean up such files before its addition to .gitignore. In this case, the old file will still be hanging around in th...
To create a patch, there are two steps. Make your changes and commit them. Run git format-patch <commit-reference> to convert all commits since the commit <commit-reference> (not including it) into patch files. For example, if patches should be generated from the latest two commit...
In build.sbt, make sure you include (here for Mysql and PostGreSQL): "mysql" % "mysql-connector-java" % "5.1.20", "org.postgresql" % "postgresql" % "9.3-1100-jdbc4", "com.typesafe.slick" %% "slick" % "3.1.1&...
First, make your class comply with the UISearchResultsUpdating protocol. class MyTableViewController: UITableViewController, UISearchResultsUpdating {} Add the search controller property: class MyTableViewController: UTableViewController, UISearchResultsUpdating { let searchController = UI...
for k in `git branch -a | sed s/^..//`; do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k --`\\t"$k";done | sort
Using the same example as Evaluating a NodeList in an XML document, here is how you would make multiple XPath calls efficiently: Given the following XML document: <documentation> <tags> <tag name="Java"> <topic name="Regular expression...
In this case, you want to have the expression compiled before the evaluations, so that each call to evaluate does not compile the same expression. The simple syntax would be: XPath xPath = XPathFactory.newInstance().newXPath(); //Make new XPath XPathExpression exp = xPath.compile("/documentat...
There are only a few language constructs in Prolog, and several ways for indenting them are common. No matter which style is chosen, one principle that should always be adhered to is to never place (;)/2 at the end of a line. This is because ; and , look very similar, and , frequently occurs at the...
A function that is declared constexpr is implicitly inline and calls to such a function potentially yield constant expressions. For example, the following function, if called with constant expression arguments, yields a constant expression too: C++11 constexpr int Sum(int a, int b) { return ...
.git/hooks/pre-commit #!/bin/sh if [ -s pom.xml ]; then echo "Running mvn verify" mvn clean verify if [ $? -ne 0 ]; then echo "Maven build failed" exit 1 fi fi
Prior to C++17, template deduction cannot deduce the class type for you in a constructor. It must be explicitly specified. Sometimes, however, these types can be very cumbersome or (in the case of lambdas) impossible to name, so we got a proliferation of type factories (like make_pair(), make_tuple(...
Types used in Sets and Dictionaries(key) must conform to Hashable protocol which inherits from Equatable protocol. Custom type conforming to Hashable protocol must implement A calculated property hashValue Define one of the equality operators i.e. == or !=. Following example implements Hasha...
Create a basic application with single view application template with swift as language Add SWRevealViewController.h and SWRevealViewController.m then click on Create Bridging Header button and add #import "SWRevealViewController.h" on the Bridging header Then select viewControll...
LINQ provides a method that makes it easy to create a collection filled with sequential numbers. For example, you can declare an array which contains the integers between 1 and 100. The Enumerable.Range method allows us to create sequence of integer numbers from a specified start position and a num...
Suppose you have a collection elements, and you want to create another collection containing the same elements but with all duplicates eliminated: Collection<Type> noDuplicates = new HashSet<Type>(elements); Example: List<String> names = new ArrayList<>( Arrays....
The JAXB Reference Implementation (JAXB-RI) has been included with the Java Development Kit since JDK 6 update 3. Refer to the Unofficial JAXB Guide for additional details on which JAXB-RI version is included with specific versions of the JDK.
// First load a collection object foreach($collection as $product) { $product->getSku(); $product->getName(); // Alternative method $product->getData('sku'); $product->getData('name'); }
Flyweight is one of structural design patterns. It is used to decrease the amount of used memory by sharing as much data as possible with similiar objects. This document will teach you how to use Flyweight DP properly. Let me explain the idea of it to you on a simple example. Imagine you're working...
Preludes and Re-Exports // To reduce the amount of imports that users need, you should // re-export important structs and traits. pub use foo::Client; pub use bar::Server; Sometimes, crates use a prelude module to contain important structs, just like std::io::prelude. Usually, these are impor...

Page 235 of 505