Tutorial by Examples: ti

NOW() + INTERVAL 1 DAY -- This time tomorrow CURDATE() - INTERVAL 4 DAY -- Midnight 4 mornings ago Show the mysql questions stored that were asked 3 to 10 hours ago (180 to 600 minutes ago): SELECT qId,askDate,minuteDiff FROM ( SELECT qId,askDate, TIMESTAMPDIFF(MINUTE,askDate,no...
An Option is a discriminated union with two cases, None or Some. type Option<'T> = Some of 'T | None
A sequence is a series of elements that can be enumerated. It is an alias of System.Collections.Generic.IEnumerable and lazy. It stores a series of elements of the same type (can be any value or object, even another sequence). Functions from the Seq.module can be used to operate on it. Here is a s...
Autoboxing can come at a substantial memory overhead. For example: Map<Integer, Integer> square = new HashMap<Integer, Integer>(); for(int i = 256; i < 1024; i++) { square.put(i, i * i); // Autoboxing of large integers } will typically consume substantial amount of memory (...
Swift //Swift let viewController = UIViewController() let navigationController = UINavigationController(rootViewController: viewController) //Objective-C UIViewController *viewController = [[UIViewController alloc] init]; UINavigationController *navigationController = [[UINavigationControlle...
//Swift let fooViewController = UIViewController() navigationController?.pushViewController(fooViewController, animated: true) //Objective-C UIViewController *fooViewController = [[UIViewController alloc] init]; [navigationController pushViewController:fooViewController animated:YES];
As we know that we should use synchronized keyword to make execution of a method or block exclusive. But few of us may not be aware of one more important aspect of using synchronized and volatile keyword: apart from making a unit of code atomic, it also provides read / write barrier. What is this re...
Typically, when using UIControl or UIButton, we add a selector as a callback action for when an event occurs on a button or control, such as the user pressing the button or touching the control. For example, we would do the following: import UIKit class ViewController: UIViewController { @...
Go to editor (from tool window) Esc Switching focus to corresponding tool window Windows: Alt + <tool window number> OS X / macOS: Cmd + <tool window number> For example switching focus to the project window Windows: Alt + 1 OS X / macOS: Cmd + 1 Recent files popup Windows: Ctrl...
It is common within applications to need to have code like this : a = a + 1 or a = a * 2 There is an effective shortcut for these in place operations : a += 1 # and a *= 2 Any mathematic operator can be used before the '=' character to make an inplace operation : -= decrement the va...
All of the Bitwise operators (except ~) have their own in place versions a = 0b001 a &= 0b010 # a = 0b000 a = 0b001 a |= 0b010 # a = 0b011 a = 0b001 a <<= 2 # a = 0b100 a = 0b100 a >>= 2 # a = 0b001 a = 0b101 a ^= 0b011 # a = 0b110
Linux has a command for almost any tasks and most of them are intuitive and easily interpreted. Getting Help in Linux CommandUsabilityman <name>Read the manual page of <name>.man <section> <name>Read the manual page of <name>, related to the given section.man -k <e...
This example assumes that you have experience in creating Rails applications. To create an API-only app in Rails 5, run rails new name-of-app --api Add active_model_serializers in Gemfile gem 'active_model_serializers' install bundle in terminal bundle install Set the ActiveModelSeriali...
Realm currently does not support storing a list of primitives. It is on their todo list (GitHub issue #575), but for the meantime, here is a workaround. Create a new class for your primitive type, this uses Integer, but change it for whatever you want to store. public class RealmInteger extends Re...
Detailed instructions on getting unicode set up or installed.
(defun fn (x) (cond (test-condition1 the-value1) (test-condition2 the-value2) ... ... ... (t (fn reduced-argument-x)))) CL-USER 2788 > (defun my-fib (n) (cond ((= n 1) 1) ((= n...
(defun fn (x) (cond (test-condition the-value) (t (fn reduced-argument-x))))
Ruby has an or-equals operator that allows a value to be assigned to a variable if and only if that variable evaluates to either nil or false. ||= # this is the operator that achieves this. this operator with the double pipes representing or and the equals sign representing assigning of a valu...
This method just returns the first argument. var res1 = _.identity(10, 20); // res1 now is 10 var res2 = _.identity("hello", "world"); // res2 now is "hello" What does _.identity mean in lodash documentation? This method is used throughout lodash documentation...
You can pass latitude, longitude from your app to Google map using Intent String uri = String.format(Locale.ENGLISH, "http://maps.google.com/maps?q=loc:%f,%f", 28.43242324,77.8977673); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(intent);

Page 159 of 505