Tutorial by Examples: l

Query to create table on db CREATE TABLE `user` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL, `course` smallint(5) unsigned DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; CREATE TABLE `course` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `nam...
In general, it is considered good practice to throw by value (rather than by pointer), but catch by (const) reference. try { // throw new std::runtime_error("Error!"); // Don't do this! // This creates an exception object // on the heap and would require you to catch the ...
Unlike other middleware functions error-handling middleware functions have four arguments instead of three: (err, req, res, next). Sample: app.use(function(err, req, res, next) { console.error(err.stack); res.status(500).send('Error found!'); });
Given a file sample: hello world ahello here hello_there A normal grep for "hello" returns: $ grep hello sample hello world ahello here hello_there Using -w allows to select those lines containing matches that form whole words: $ grep -w hello sample hello world
DBContract.java //Define the tables and columns of your local database public final class DBContract { /*Content Authority its a name for the content provider, is convenient to use the package app name to be unique on the device */ public static final String CONTENT_AUTHORITY =...
A module is an importable file containing definitions and statements. A module can be created by creating a .py file. # hello.py def say_hello(): print("Hello!") Functions in a module can be used by importing the module. For modules that you have made, they will need to be in t...
Suppose you have types like the following: interface IThing { } class Thing : IThing { } LINQ allows you to create a projection that changes the compile-time generic type of an IEnumerable<> via the Enumerable.Cast<>() and Enumerable.OfType<>() extension methods. IEnumerabl...
A Closure is a function taken together with an environment. The function is typically an anonymous function defined inside another function. The environment is the lexical scope of the enclosing function (very basic idea of a lexical scope of a function would be the scope that exists between the fun...
Suppose you have many changes in one or more files but from each file you only want to commit some of the changes, you can select the desired changes using: git add -p or git add -p [file] Each of your changes will be displayed individually, and for each change you will be prompted to choose...
defaultProps allows you to set default, or fallback, values for your component props. defaultProps are useful when you call components from different views with fixed props, but in some views you need to pass different value. Syntax ES5 var MyClass = React.createClass({ getDefaultProps: ...
componentWillUnmount() This method is called before a component is unmounted from the DOM. It is a good place to perform cleaning operations like: Removing event listeners. Clearing timers. Stopping sockets. Cleaning up redux states. componentWillUnmount(){ ... } An example of remo...
NSArray *myColors = @[@"Red", @"Green", @"Blue", @"Yellow"]; // Fast enumeration // myColors cannot be modified inside the loop for (NSString *color in myColors) { NSLog(@"Element %@", color); } // Using indices for (NSUInteger i = 0; ...
This is an example of a program written with manual memory management. You really shouldn't write your code like this, unless for some reason you can't use ARC (like if you need to support 32-bit). The example avoids @property notation to illustrate how you used to have to write getters and setters....
Register a production/sandbox account at https://dashboard.stripe.com/register Insert below code into your webpage where you want to have a checkout button. <form action="/charge" method="POST"> <script src="https://checkout.stripe.com/checkout.js" cl...
A word of caution: AsyncTask has many gotcha's apart from the memory leak described here. So be careful with this API, or avoid it altogether if you don't fully understand the implications. There are many alternatives (Thread, EventBus, RxAndroid, etc). One common mistake with AsyncTask is to c...
The installation instructions are available on IIS.net. See this for installing IIS 8.5
when the object is deleted, delete all the objects in the association.
when the object is deleted, delete all the objects in the association. In addition to that, when an object is removed from the association and not associated with another object (orphaned), also delete it.
when an object is save/update/delete, check the associations and save/update/delete all the objects found.
when an object is save/update/delete, check the associations and save/update/delete all the objects found. In additional to that, when an object is removed from the association and not associated with another object (orphaned), also delete it.

Page 222 of 861