Tutorial by Examples

Global installation using the PHP Archive wget https://phar.phpunit.de/phpunit.phar # download the archive file chmod +x phpunit.phar # make it executable sudo mv phpunit.phar /usr/local/bin/phpunit # move it to /usr/local/bin phpunit --version ...
Send a 304 Not Modified response status from the server send in response to a client request that contains headers If-Modified-Since and If-None-Match, if the request resource hasn’t changed. For example if a client request for a web page includes the header If-Modified-Since: Fri, 22 Jul 2016 14:3...
A pointer to a const object can be converted to a pointer to non-const object using the const_cast keyword. Here we use const_cast to call a function that is not const-correct. It only accepts a non-const char* argument even though it never writes through the pointer: void bad_strlen(char*); const...
Vim's standard search commands are / for forward search and ? for backward search. To start a search from normal mode: press /, type your pattern, press <CR> to perform the search. Examples: /foobar<CR> search forward for foobar ?foo\/bar<CR> search backward for ...
In normal mode, move the cursor to any word then press * to search forwards for the next occurrence of the word under the cursor, or press # to search backwards. * or # search for the exact word under the cursor: searching for big would only find big and not bigger. Under the hood, Vim uses a sim...
The :global command already has its own topic: The global command
You can open a new split within Vim with the following commands, in normal mode: Horizontally: :split <file name> :new Vertically: :vsplit <file name> :vnew split will open the file in a new split at the top or left of your screen (or current split.) :sp and :vs are convenie...
ANTLR contains a testing tool in its runtime library, this tool can be used to display information detailing how the parsing is performed to match input against defined rules in your grammar file. To use this tool contained within the ANTLR jar file you should setup your systems classpath to allow ...
Lexer rules define token types. Their name has to start with an uppercase letter to distinguish them from parser rules. INTEGER: [0-9]+; IDENTIFIER: [a-zA-Z_] [a-zA-Z_0-9]*; OPEN_PAREN: '('; CLOSE_PAREN: ')'; Basic syntax: SyntaxMeaningAMatch lexer rule or fragment named AA BMatch A follow...
Fragments are reusable parts of lexer rules which cannot match on their own - they need to be referenced from a lexer rule. INTEGER: DIGIT+ | '0' [Xx] HEX_DIGIT+ ; fragment DIGIT: [0-9]; fragment HEX_DIGIT: [0-9A-Fa-f];
When tokens like '{' are used in a parser rule, an implicit lexer rule will be created for them unless an explicit rule exists. In other words, if you have a lexer rule: OPEN_BRACE: '{'; Then both of these parser rules are equivalent: parserRule: '{'; parserRule: OPEN_BRACE; But if the OPE...
Several lexer rules can match the same input text. In that case, the token type will be chosen as follows: First, select the lexer rule which matches the longest input If the text matches an implicitly defined token (like '{'), use the implicit rule If several lexer rules match the same input l...
A lexer rule can have associated commands: WHITESPACE: [ \r\n] -> skip; Commands are defined after a -> at the end of the rule. skip: Skips the matched text, no token will be emited channel(n): Emits the token on a different channel type(n): Changes the emitted token type mode(n), pu...
A lexer action is a block of arbitrary code in the target language surrounded by {...}, which is executed during matching: IDENTIFIER: [A-Z]+ { log("matched rule"); }; A semantic predicate is a block of arbitrary code in the target language surrounded by {...}?, which evaluates to a bo...
if we want to change the Controllers directory we need: Move and/or rename the default Controllers directory where we want it. For example from app/Http/Controllers to app/Controllers Update all the namespaces of the files inside the Controllers folder, making they adhere to the new path, re...
There are several ways to insert data: Using the DB Facade public function run() { DB::table('users') ->insert([ 'name' => 'Taylor', 'age' => 21 ]); } Via Instantiating a Model public function run() { $user = new User; $us...
Within your DatabaseSeeder class you are able to call other seeders $this->call(TestSeeder::class) This allows you to keep one file where you can easily find your seeders. Keep in mind that you need to pay attention to the order of your calls regarding foreign key constraints. You can't refe...
Functions within a class can be overloaded for when they are accessed through a cv-qualified reference to that class; this is most commonly used to overload for const, but can be used to overload for volatile and const volatile, too. This is because all non-static member functions take this as a hi...
# make this routine available outside this translation unit .globl string_to_integer string_to_integer: # function prologue push %ebp mov %esp, %ebp push %esi # initialize result (%eax) to zero xor %eax, %eax # fetch pointer to the string mov 8(%ebp), %e...
Disclaimer: the examples presented here are only for the purpose of showing the use of abstract classes and inheritance and may not necessarily be of a practical use. Also, there is no sich thing as polymorphic in MATLAB and therefore the use of abstract classes is limited. This example is to show w...

Page 430 of 1336