Tutorial by Examples

Before you start the cherry-pick process, you can check if the commit you want to cherry-pick already exists in the target branch, in which case you don't have to do anything. git branch --contains <commit> lists local branches that contain the specified commit. git branch -r --contains <...
Bounded type parameters allow you to set restrictions on generic type arguments: class SomeClass { } class Demo<T extends SomeClass> { } But a type parameter can only bind to a single class type. An interface type can be bound to a type that already had a binding. This is achieve...
Run interactive vim tutorials as many times as needed to feel comfortable with the basics. Vim features several modes, e.g. normal mode, insert mode and command-line mode. Normal mode is for editing and navigating text. In this mode h, j, k and l correspond to the cursor keys ←, ↓, ↑ and →. Most c...
When attempting to print something for debugging in vimscript, it is tempting to simply do the following. echo "Hello World!" However, in the context of a complex plugin, there are often many other things happening right after you attempt to print your message, so it is important to ad...
Create a Java class which extends org.apache.hadoop.hive.ql.exec.hive.UDAF Create an inner class which implements UDAFEvaluator Implement five methods init() – This method initializes the evaluator and resets its internal state. We are using new Column() in the code below to indicate th...
A regex pattern where a DOTALL modifier (in most regex flavors expressed with s) changes the behavior of . enabling it to match a newline (LF) symbol: /cat (.*?) dog/s This Perl-style regex will match a string like "cat fled from\na dog" capturing "fled from\na" into Group 1....
Another example is a MULTILINE modifier (usually expressed with m flag (not in Oniguruma (e.g. Ruby) that uses m to denote a DOTALL modifier)) that makes ^ and $ anchors match the start/end of a line, not the start/end of the whole string. /^My Line \d+$/gm will find all lines that start with My...
The common modifier to ignore case is i: /fog/i will match Fog, foG, etc. The inline version of the modifier looks like (?i). Notes: In Java, by default, case-insensitive matching assumes that only characters in the US-ASCII charset are being matched. Unicode-aware case-insensitive matching c...
The modifier that allows using whitespace inside some parts of the pattern to format it for better readability and to allow comments starting with #: /(?x)^ # start of string (?=\D*\d) # the string should contain at least 1 digit (?!\d+$) # the string cannot consist of digi...
This is a .NET regex specific modifier expressed with n. When used, unnamed groups (like (\d+)) are not captured. Only valid captures are explicitly named groups (e.g. (?<name> subexpression)). (?n)(\d+)-(\w+)-(?<id>\w+) will match the whole 123-1_abc-00098, but (\d+) and (\w+) won't...
The UNICODE modifier, usually expressed as u (PHP, Python) or U (Java), makes the regex engine treat the pattern and the input string as Unicode strings and patterns, make the pattern shorthand classes like \w, \d, \s, etc. Unicode-aware. /\A\p{L}+\z/u is a PHP regex to match strings that consis...
The PCRE-compliant PCRE_DOLLAR_ENDONLY modifier that makes the $ anchor match at the very end of the string (excluding the position before the final newline in the string). /^\d+$/D is equal to /^\d+\z/ and matches a whole string that consists of 1 or more digits and will not match "123...
Another PCRE-compliant modifier expressed with /A modifier. If this modifier is set, the pattern is forced to be "anchored", that is, it is constrained to match only at the start of the string which is being searched (the "subject string"). This effect can also be achieved by ap...
The PCRE-compliant PCRE_UNGREEDY flag expressed with /U. It switches greediness inside a pattern: /a.*?b/U = /a.*b/ and vice versa.
One more PCRE modifier that allows the use of duplicate named groups. NOTE: only inline version is supported - (?J), and must be placed at the start of the pattern. If you use /(?J)\w+-(?:new-(?<val>\w+)|\d+-empty-(?<val>[^-]+)-collection)/ the "val" group values will be ...
A PCRE modifier that causes an error if any backslash in a pattern is followed by a letter that has no special meaning. By default, a backslash followed by a letter with no special meaning is treated as a literal. E.g. /big\y/ will match bigy, but /big\y/X will throw an exception. Inline v...
%storemagic stores variables and macros on IPython's database. To automatically restore stored variables at startup add this to ipython_config.py: c.StoreMagic.autorestore = True Example: In [1]: l = ['hello',10,'world'] In [2]: %store l In [3]: exit (IPython session is closed and started...
You may install Composer locally, as part of your project, or globally as a system wide executable. Locally To install, run these commands in your terminal. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" # to check the validity of the downloaded installer, ch...
Dojo provides us various themes like tundra, claro etc. Load themes using link tag in your HTML page pointing to Google CDN.
numpy.dot can be used to multiply a list of vectors by a matrix but the orientation of the vectors must be vertical so that a list of eight two component vectors appears like two eight components vectors: >>> a array([[ 1., 2.], [ 3., 1.]]) >>> b array([[ 1., 2., ...

Page 707 of 1336