Tutorial by Examples: bas

By default, migrations are applied to the same database specified by the db application component. If you want them to be applied to a different database, you may specify the db command-line option like shown below: yii migrate --db=db2
AlertDialog.Builder builder = new AlertDialog.Builder(context); //Set Title builder.setTitle("Reset...") //Set Message .setMessage("Are you sure?") //Set the icon of the dialog .setIcon(drawable) //Set...
Records are an extension of sum algebraic data type that allow fields to be named: data StandardType = StandardType String Int Bool --standard way to create a sum type data RecordType = RecordType { -- the same sum type with record syntax aString :: String , aNumber :: Int , isTrue :...
Setup monitoring beacons func initiateRegion(ref:BeaconHandler){ let uuid: NSUUID = NSUUID(UUIDString: "<UUID>") let beacon = CLBeaconRegion(proximityUUID: uuid, identifier: "") locationManager?.requestAlwaysAuthorization() //cllocation manager obj. ...
Model using System.ComponentModel.DataAnnotations; public class ViewModel { [Required(ErrorMessage="Name is required")] public string Name { get; set; } [StringLength(14, MinimumLength = 14, ErrorMessage = "Invalid Phone Number")] [Required(ErrorMessag...
In case your project needs to be based on a specific Symfony version, use the optional second argument of the new command: # use the most recent version in any Symfony branch $ symfony new my_project_name 2.8 $ symfony new my_project_name 3.1 # use a specific Symfony version $ symfony new my_...
Consider this simple example: import QtQuick 2.7 import QtQuick.Controls 2.0 ApplicationWindow { visible: true width: 400 height: 640 Rectangle{ id: rect anchors.centerIn: parent height: 100 width: parent.width color: "blue...
A list can be rendered using the v-for directive. The syntax requires that you specify the source array to iterate on, and an alias that will be used to reference each item in the iteration. In the following example we use items as the source array, and item as the alias for each item. HTML <di...
The main methods that are useful with this class are popleft and appendleft from collections import deque d = deque([1, 2, 3]) p = d.popleft() # p = 1, d = deque([2, 3]) d.appendleft(5) # d = deque([5, 2, 3])
To support a given application, you often create a new role and database to match. The shell commands to run would be these: $ createuser -P blogger Enter password for the new role: ******** Enter it again: ******** $ createdb -O blogger blogger This assumes that pg_hba.conf has been prope...
In C, a string is a sequence of characters that is terminated by a null character ('\0'). We can create strings using string literals, which are sequences of characters surrounded by double quotation marks; for example, take the string literal "hello world". String literals are automatica...
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...
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(QWidget...
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(QWidget...
Layout Unity basic editor will look like below. Basic functionalities of some default windows/tabs are described in the image. Linux Layout There is a little difference in menu layout of linux version, like the screenshot below, Basic Usage Create an empty GameObject by right clicking in th...
The @Html.AntiForgeryToken() helper method protects against cross-site request forgery (or CSRF) attacks. It can be used by simply using the Html.AntiForgeryToken() helper within one of your existing forms and decorating its corresponding Controller Action with the [ValidateAntiForgeryToken] attri...
Java ThreadLocal is used to create thread local variables. It is known that threads of an Object share it’s variables, so the variable is not thread safe. We can use synchronization for thread safety but if we want to avoid synchronization,ThreadLocal allows us to create variables which are local to...
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 ...
With the shape-outside CSS property one can define shape values for the float area so that the inline content wraps around the shape instead of the float's box. CSS img:nth-of-type(1) { shape-outside: circle(80px at 50% 50%); float: left; width: 200px; } img:nth-of-type(2) { shape-ou...
Import the numpy module to use any part of it. import numpy as np Most examples will use np as shorthand for numpy. Assume "np" means "numpy" in code examples. x = np.array([1,2,3,4])

Page 13 of 65