Tutorial by Examples

module.exports.routes = { // sends matching regex (few patterns) as 'page' param 'r|/foo/([0-9]+)|page': 'FooController.get', 'r|/foo/(.*)|page': 'FooController.get', 'r|/foo/(\\w+)|page': 'FooController.get' };
C++11 The alignas keyword can be used to force a variable, class data member, declaration or definition of a class, or declaration or definition of an enum, to have a particular alignment, if supported. It comes in two forms: alignas(x), where x is a constant expression, gives the entity the ali...
Installation Creating a new project Selecting Target and minimum version for your Application
When creating the project You should check "Include Unit Tests" in the project creation dialog. After creating the project If you missed checking that item while creating your project, you could always add test files later. To do so: 1- Go to your project settings in Xcode 2- Go to ...
To get started with unit testing, which will be done in the tests file and will be testing the View Controller and Storyboard, we should introduce these two files to the test file. Defining the View Controller Swift var viewController : ViewController! Introducing the Storyboard and initializi...
According to Apple: Test Methods A test method is an instance method of a test class that begins with the prefix test, takes no parameters, and returns void, for example, (void)testColorIsRed(). A test method exercises code in your project and, if that code does not produce the expected result, ...
Testing a specific method To test a specific method, click the square next to the method definition. Testing all methods To test all methods, click the square next to the class definition. See the testing result If there is a green check next to the definition, the test has succeeded. If the...
To stop the Handler from execution remove the callback attached to it using the runnable running inside it: Runnable my_runnable = new Runnable() { @Override public void run() { // your code here } }; public Handler handler = new Handler(); // use 'new Handler(Looper.get...
In order to call a function through a function pointer, the function pointer's type must exactly match the function's type. Otherwise, the behaviour is undefined. Example: int f(); void (*p)() = reinterpret_cast<void(*)()>(f); p(); // undefined
To build up an expression like _ => _.Field == "VALUE" at runtime. Given a predicate _ => _.Field and a string value "VALUE", create an expression that tests whether or not the predicate is true. The expression is suitable for: IQueryable<T>, IEnumerable<T>...
Configuring the connection programmatically: var config = new ClientConfiguration { Servers = new List<Uri> { new Uri("http://localhost:8091/pools") }, BucketConfigs = new Dictionary<string, BucketConfiguration> ...
OOP - Object Oriented Programming is a vastly used programming paradigm in these days. In OOP, we model real world problems using Objects and there behaviors, in order to solve them, programmatically. There are four main OOP Concepts Inheritance Polymorphism Abstraction Encapsulation These...
A spannable TextView can be used in Android to highlight a particular portion of text with a different color, style, size, and/or click event in a single TextView widget. Consider that you have defined a TextView as follows: TextView textview=findViewById(R.id.textview); Then you can apply diff...
To get versionName and versionCode of current build of your application you should query Android's package manager. try { // Reference to Android's package manager PackageManager packageManager = this.getPackageManager(); // Getting package info of this application PackageInfo...
To get the time at which your app was installed or updated, you should query Android's package manager. try { // Reference to Android's package manager PackageManager packageManager = this.getPackageManager(); // Getting package info of this application PackageInfo info = pack...
foreach is unusual among the collections iterators in that it does not return a result. Instead it applies a function to each element that has only side effects. For example: scala> val x = List(1,2,3) x: List[Int] = List(1, 2, 3) scala> x.foreach { println } 1 2 3 The function sup...

Page 697 of 1336