Tutorial by Examples

UISplitViewController must be the rootViewController of your application. AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window = [[UIWindow alloc] i...
It is illegal to access a reference to an object that has gone out of scope or been otherwise destroyed. Such a reference is said to be dangling since it no longer refers to a valid object. #include <iostream> int& getX() { int x = 42; return x; } int main() { int& r...
itertools.permutations returns a generator with successive r-length permutations of elements in the iterable. a = [1,2,3] list(itertools.permutations(a)) # [(1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)] list(itertools.permutations(a, 2)) [(1, 2), (1, 3), (2, 1), (2, 3), (3...
Let's test our basic knowledge of tkinter by creating the classic "Hello, World!" program. First, we must import tkinter, this will vary based on version (see remarks section about "Differences between Python 2 and 3") In Python 3 the module tkinter has a lowercase t: import t...
import tkinter as tk class HelloWorld(tk.Frame): def __init__(self, parent): super(HelloWorld, self).__init__(parent) self.label = tk.Label(self, text="Hello, World!") self.label.pack(padx=20, pady=20) if __name__ == "__main__": ...
Pair allows us to treat two objects as one object. Pairs can be easily constructed with the help of template function std::make_pair. Alternative way is to create pair and assign its elements (first and second) later. #include <iostream> #include <utility> int main() { std::p...
In pass by value of parameter passing to a method, actual parameter value is copied to formal parameter value. So actual parameter value will not change after returning from called function. @interface SwapClass : NSObject -(void) swap:(NSInteger)num1 andNum2:(NSInteger)num2; @end @impleme...
In pass by reference of parameter passing to a method, address of actual parameter is passed to formal parameter. So actual parameter value will be changed after returning from called function. @interface SwapClass : NSObject -(void) swap:(int)num1 andNum2:(int)num2; @end @implementation S...
The example Checking a string for unwanted characters, describes how to test and reject strings that don't meet certain criteria. Obviously, rejecting input outright is not always possible, and sometimes you just have to make do with what you receive. In these cases, a cautious developer will attemp...
In this example we are going to create a directive to copy a text into the clipboard by clicking on an element copy-text.directive.ts import { Directive, Input, HostListener } from "@angular/core"; @Directive({ selector: '[text-copy]' }) export class TextCopyDir...
Have a look in your php.ini configuration file and enable Xdebug, add the following statement: [Xdebug] zend_extension=<full_path_to_xdebug_extension> xdebug.remote_enable=1 xdebug.remote_host=<the host where PhpStorm is running (e.g. localhost)> xdebug.remote_port=<the port to w...
Launch debug by clicking on the "beetle" icon: Debug window is now waiting instructions for next step: You can go to the next step by clicking F9 in the debug window or by clicking on the green arrow:
The input element with a type attribute whose value is "datetime" represents a control for setting the element’s value to a string representing a global date and time (with timezone information). <fieldset> <p><label>Meeting time: <input type=datetime name="m...
For now I think the catalog module contains almost everything you can add to a module. Api - Contains the service contracts. A set of interfaces that should not be changed unless the minor version changes. Not mandatory for a custom module but nice to have for comercial extensions. Data - Data...
Once a CMake project is initialized via project(), the output verbosity of the resulting build script can be adjusted via: CMAKE_VERBOSE_MAKEFILE This variable can be set via CMake's command line when configuring a project: cmake -DCMAKE_VERBOSE_MAKEFILE=ON <PATH_TO_PROJECT_ROOT> For G...
While Python has an assert statement, the Python unit testing framework has better assertions specialized for tests: they are more informative on failures, and do not depend on the execution's debug mode. Perhaps the simplest assertion is assertTrue, which can be used like this: import unittest ...
GNU Emacs uses a special format for documentation: info. The Common Lisp standard has been converted to the Texinfo format, which can be used to create documentation browsable with the info reader in GNU Emacs. See here: dpans2texi.el converts the TeX sources of the draft ANSI Common Lisp standard...
While being better in many regards, the new connection syntax in Qt5 has one big weakness: Connecting overloaded signals and slots. In order to let the compiler resolve the overloads we need to use static_casts to member function pointers, or (starting in Qt 5.7) qOverload and friends: #include &lt...
A role in Perl is essentially a set of methods and attributes which injected into a class directly. A role provides a piece of functionality which can be composed into (or applied to) any class (which is said to consume the role). A role cannot be inherited but may be consumed by another rol...
<svg width="800px" height="600px" > <defs> <filter id="posterize" color-interpolation-filters="sRGB"> <feComponentTransfer> <feFuncR type="discrete" tableValues="0 0.25 0.75 1.0"/> ...

Page 660 of 1336