Tutorial by Examples: er

The difference in months between two dates can be found using the MONTHS_BETWEEN( date1, date2 ): SELECT MONTHS_BETWEEN( DATE '2016-03-10', DATE '2015-03-10' ) AS difference FROM DUAL; Outputs: DIFFERENCE ---------- 12 If the difference includes part months then it will return the ...
Query: WITH generator ( value ) AS ( SELECT 1 FROM DUAL UNION ALL SELECT value + 1 FROM generator WHERE value < 10 ) SELECT value FROM generator; Output: VALUE ----- 1 2 3 4 5 6 7 8 9 10
For creating new user, We need to follow simple steps as below : Step 1: Login to MySQL as root $ mysql -u root -p Step 2 : We will see mysql command prompt mysql> CREATE USER 'my_new_user'@'localhost' IDENTIFIED BY 'test_password'; Here, We have successfully created new user, But this u...
we can create a new controller with rails g controller command. $ bin/rails generate controller controller_name The controller generator is expecting parameters in the form of generate controller ControllerName action1 action2. The following creates a Greetings controller with an action of hell...
public class App : Application { internal static NavigationPage NavPage; public App () { // The root page of your application MainPage = new RootPage(); } } public class RootPage : MasterDetailPage { public RootPage() { var menuPage = ne...
You can use re.finditer to iterate over all matches in a string. This gives you (in comparison to re.findall extra information, such as information about the match location in the string (indexes): import re text = 'You can try to find an ant in this string' pattern = 'an?\w' # find 'an' either w...
Appearance : Happens when your script tries to send a HTTP header to the client but there already was output before, which resulted in headers to be already sent to the client. Possible Causes : Print, echo: Output from print and echo statements will terminate the opportunity to send HTTP hea...
Pan gesture recognizers detect dragging gestures. The following example adds an image to a view controller and lets the user drag it around on screen. Objective-C - (void)viewDidLoad { [super viewDidLoad]; UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNa...
Premise The most confusing thing surrounding pointer syntax in C and C++ is that there are actually two different meanings that apply when the pointer symbol, the asterisk (*), is used with a variable. Example Firstly, you use * to declare a pointer variable. int i = 5; /* 'p' is a pointer to a...
Avoid code repetition in constructors by setting a tuple of variables with a one liner: class Contact: UIView { private var message: UILabel private var phone: UITextView required init?(coder aDecoder: NSCoder) { (message, phone) = self.dynamicType.setUp() su...
//Swift let initialScreen = storyboard.instantiateInitialViewController() //Objective-c UIViewController *initailScreen = [storyboard instantiateInitialViewController];
//Swift let viewController = storyboard.instantiateViewControllerWithIdentifier("identifier") //Objective-c UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"identifier"];
The following is a simple example of using the strategy pattern without a context class. There are two implementation strategies which implement the interface and solve the same problem in different ways. Users of the EnglishTranslation class can call the translate method and choose which strategy t...
The Builder pattern allows you to create an instance of a class with many optional variables in an easy to read way. Consider the following code: public class Computer { public GraphicsCard graphicsCard; public Monitor[] monitors; public Processor processor; public Memory[] r...
Another way to hide admin bar is to add if ( !current_user_can( 'manage_options' ) ) { add_filter( 'show_admin_bar', '__return_false' , 1000 ); } The users who don't have privileges to access Settings page, won't be able to see the admin bar.
Input.acceleration is used to read the accelerometer sensor. It returns Vector3 as a result which contains x,y and z axis values in 3D space. void Update() { Vector3 acclerometerValue = rawAccelValue(); Debug.Log("X: " + acclerometerValue.x + " Y: " + acclerometerV...
BigInteger supports the binary logic operations that are available to Number types as well. As with all operations they are implemented by calling a method. Binary Or: BigInteger val1 = new BigInteger("10"); BigInteger val2 = new BigInteger("9"); val1.or(val2); Output:...
'use strict'; const co = require('co'); module.exports = { // This is the index action and the route is mapped via /config/routes.js index(req, res) { co(function* index() { // Return a view without view model data // This typically will return the view defined at /vie...
Given a basic model: class SpreadsheetCells(Base): __tablename__ = 'spreadsheet_cells' id = Column(Integer, primary_key=True) y_index = Column(Integer) x_index = Column(Integer) You can retrieve an ordered list by chaining the order_by method. query = session.query(Spreads...
SELECT * FROM customers WHERE id IN ( SELECT DISTINCT customer_id FROM orders ); The above will give you all the customers that have orders in the system.

Page 148 of 417