Tutorial by Examples: ad

public function up() { $this->addColumn('post', 'position', $this->integer()); }
Technically, autoloading works by executing a callback when a PHP class is required but not found. Such callbacks usually attempt to load these classes. Generally, autoloading can be understood as the attempt to load PHP files (especially PHP class files, where a PHP source file is dedicated for a ...
When the destructor for std::thread is invoked, a call to either join() or detach() must have been made. If a thread has not been joined or detached, then by default std::terminate will be called. Using RAII, this is generally simple enough to accomplish: class thread_joiner { public: thre...
SyncAdapter /** * Define a sync adapter for the app. * <p/> * <p>This class is instantiated in {@link SyncService}, which also binds SyncAdapter to the system. * SyncAdapter should only be initialized in SyncService, never anywhere else. * <p/> * <p>The system ca...
Sometimes you want to add an element to the beginning of an array without modifying any of the current elements (order) within the array. Whenever this is the case, you can use array_unshift(). array_unshift() prepends passed elements to the front of the array. Note that the list of elements is ...
Here is how to make a Heads Up Notification for capable devices, and use a Ticker for older devices. // Tapping the Notification will open up MainActivity Intent i = new Intent(this, MainActivity.class); // an action to use later // defined as an app constant: // public static final String ME...
We can use partial application to "lock" the first argument. After applying one argument we are left with a function which expects one more argument before returning the result. (+) :: Int -> Int -> Int addOne :: Int -> Int addOne = (+) 1 We can then use addOne in order to...
Given any value of type Int or Long to render a human readable string: fun Long.humanReadable(): String { if (this <= 0) return "0" val units = arrayOf("B", "KB", "MB", "GB", "TB", "EB") val digitGroups = (Mat...
In Kotlin you could write code like: val x: Path = Paths.get("dirName").apply { if (Files.notExists(this)) throw IllegalStateException("The important file does not exist") } But the use of apply is not that clear as to your intent. Sometimes it is clearer to create a ...
User can add custom route, mapping an URL to a specific action in a controller. This is used for search engine optimization purpose and make URLs readable. routes.MapRoute( name: "AboutUsAspx", // Route name url: "AboutUs.aspx", // URL with parameters defaults: new { c...
Definition : When multiple methods with the same name are declared with different parameters, it is referred to as method overloading. Method overloading typically represents functions that are identical in their purpose but are written to accept different data types as their parameters. Factors af...
The procedure describes how to add an Object library reference, and afterwards how to declare new variables with reference to the new library class objects. The example below shows how to add the PowerPoint library to the existing VB Project. As can be seen, currently the PowerPoint Object library...
import pandas as pd import io temp=u"""index; header1; header2; header3 1; str_data; 12; 1.4 3; str_data; 22; 42.33 4; str_data; 2; 3.44 2; str_data; 43; 43.34 7; str_data; 25; 23.32""" #after testing replace io.StringIO(temp) to filename df = pd.read_csv(io....
Table file with header, footer, row names, and index column: file: table.txt This is a header that discusses the table file to show space in a generic table file index name occupation 1 Alice Salesman 2 Bob Engineer 3 Charlie Janitor This is a footer becaus...
Introduction The BufferedReader class is a wrapper for other Reader classes that serves two main purposes: A BufferedReader provides buffering for the wrapped Reader. This allows an application to read characters one at a time without undue I/O overheads. A BufferedReader provides functi...
In the Project.pro file we add : CONFIG += sql in MainWindow.h we write : #include <QMainWindow> #include <QSql> #include <QDebug> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWid...
Occasionally you'd want to catch an exception and throw it from a different thread or method while preserving the original exception stack. This can be done with ExceptionDispatchInfo: using System.Runtime.ExceptionServices; void Main() { ExceptionDispatchInfo capturedException = null; ...
To install Eclipse RCP follow the steps : Download Eclipse RCP/RAP version from Eclipse.org Eclipse RCP/RAP project downloading URL
First, import the libraries that work with files: from os import listdir from os.path import isfile, join, exists A helper function to read only files from a directory: def get_files(path): for file in listdir(path): full_path = join(path, file) if isfile(full_path): ...
Syntax: add_months(p_date, integer) return date; Add_months function adds amt months to p_date date. SELECT add_months(date'2015-01-12', 2) m FROM dual; M2015-03-12 You can also substract months using a negative amt SELECT add_months(date'2015-01-12', -2) m FROM dual; M2014-11-12 When the...

Page 20 of 114