Tutorial by Examples

template<class InputIterator, class Function> Function for_each(InputIterator first, InputIterator last, Function f); Effects: Applies f to the result of dereferencing every iterator in the range [first, last) starting from first and proceeding to last - 1. Parameters: first, last -...
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 (...
First you need to install and start your Redis server, check the link below that can help you to install redis on you server or local machine. Installation and Setup Now open your command prompt and run command redis-cli : To save first set >SET 'keyname' then 'value' 127.0.0.1:6379> SET h...
To change password of current user just type: sudo passwd It will ask you to enter your current password: [sudo] password for <user>: And then you will be asked to enter new password: Enter new UNIX password: And finally you will be asked to re-enter your password: Retype new UNIX...
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...
YAML is a text based format allowing to store structured data in a hierarchy. YAML is designed to be human and machine readable with a minimum of overhead. The YAML specification can be found at yaml.org. There is also a reference card Comments start with # and go till newline, comments must be sep...
lazy val is a language feature where the initialization of a val is delayed until it is accessed for the first time. After that point, it acts just like a regular val. To use it add the lazy keyword before val. For example, using the REPL: scala> lazy val foo = { | println("Initial...
If you've got multiple implementations of the same interface, Spring can autowire them all into a collection object. I'm going to use an example using a Validator pattern1 Foo Class: public class Foo { private String name; private String emailAddress; private String errorMessage;...
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
If you have both Python 3 and Python 2 installed, you can specify which version of Python you would like pip to use. This is useful when packages only support Python 2 or 3 or when you wish to test with both. If you want to install packages for Python 2, run either: pip install [package] or: p...
#;(define (commented-out-function x) (print (string-append "This entire " "s-expression is commented out!")))
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...
Linux uses some conventions for present and parent directories. This can be a little confusing for beginners. Whenever you are in a terminal in Linux, you will be in what is called the current working directory. Often your command prompt will display either the full working directory, or just the l...
private static void explicitTaskParallism() { Thread.CurrentThread.Name = "Main"; // Create a task and supply a user delegate by using a lambda expression. Task taskA = new Task(() => Console.WriteLine($"Hello from task {nameof(taskA)}.")...
private static void Main(string[] args) { var a = new A(); var b = new B(); //implicit task parallelism Parallel.Invoke( () => a.DoSomeWork(), () => b.DoSomeOtherWork() ); }

Page 415 of 1336