Tutorial by Examples: c

A simple scatter plot import matplotlib.pyplot as plt # Data x = [43,76,34,63,56,82,87,55,64,87,95,23,14,65,67,25,23,85] y = [34,45,34,23,43,76,26,18,24,74,23,56,23,23,34,56,32,23] fig, ax = plt.subplots(1, figsize=(10, 6)) fig.suptitle('Example Of Scatterplot') # Create the Scatter P...
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
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...
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...
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...
>> img = imread('football.jpg'); Use imread to read image files into a matrix in MATLAB. Once you imread an image, it is stored as an ND-array in memory: >> size(img) ans = 256 320 3 The image 'football.jpg' has 256 rows and 320 columns and it has 3 color channels: Red, ...
A class or a structure may declare any function it's friend. If a function is a friend of a class, it may access all it's protected and private members: // Forward declaration of functions. void friend_function(); void non_friend_function(); class PrivateHolder { public: PrivateHolder(in...
A whole class may be declared as friend. Friend class declaration means that any member of the friend may access private and protected members of the declaring class: class Accesser { public: void private_accesser1(); void private_accesser2(); }; class PrivateHolder { public: P...
In every applications life-cycle comes a day where it's components needs to be updated. Everyone knows the pain of updating every single dependency one-by-one. Well here you just need to issue the command: npm update (-g) If the "-g" is there then npm will update the global packages. ...
Fast and short way to extract extension from file name in JavaScript will be: function get_extension(filename) { return filename.slice((filename.lastIndexOf('.') - 1 >>> 0) + 2); } It works correctly both with names having no extension (e.g. myfile) or starting with . dot (e.g. .h...

Page 266 of 826