Tutorial by Examples: er

A common and task of someone using the Linux Command Line (shell) is to search for files/directories with a certain name or containing certain text. There are 2 commands you should familiarise yourself with in order to accomplish this: Find files by name find /var/www -name '*.css' This will...
To make long text at most N characters long but leave last word intact, use .{0,N}\b pattern: ^(.{0,N})\b.*
Recover as the name implies, can attempt to recover from a panic. The recover must be attempted in a deferred statement as normal execution flow has been halted. The recover statement must appear directly within the deferred function enclosure. Recover statements in functions called by deferred f...
Most analysis customization is in the createComponents class, where the Tokenizer and TokenFilters are defined. CharFilters can be added in the initReader method. Analyzer analyzer = new Analyzer() { @Override protected Reader initReader(String fieldName, Reader reader) { retu...
TokenStream stream = myAnalyzer.tokenStream("myField", textToAnalyze); stream.addAttribute(CharTermAttribute.class); stream.reset(); while(stream.incrementToken()) { CharTermAttribute token = stream.getAttribute(CharTermAttribute.class); System.out.println(token.toString()); ...
After you’ve downloaded, these are the files and folders you should see: The bin folder holds the Cake console executables. The config folder holds the Configuration files CakePHP uses. Database connection details, bootstrapping, core configuration files and more should be stored here. The plug...
int signed_integer = -1; // The right shift operation exhibits implementation-defined behavior: int result = signed_integer >> 1;
// Supposing SCHAR_MAX, the maximum value that can be represented by a signed char, is // 127, the behavior of this assignment is implementation-defined: signed char integer; integer = 128;
// The allocation functions have implementation-defined behavior when the requested size // of the allocation is zero. void *p = malloc(0);
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...
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...
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 ...
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...
<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"/> ...
This filter selects only the high luminance areas of a source graphic, blurs the contents and composites the blurred content on top of the original. <svg width="800px" height="600px"> <defs> <filter id="highlightblur" color-interpolation-fi...

Page 209 of 417