Tutorial by Examples: al

If you want to catch all routes, then you could use a regular expression as shown: Route::any('{catchall}', 'CatchAllController@handle')->where('catchall', '.*'); Important: If you have other routes and you don't want for the catch-all to interfere, you should put it in the end. For example: ...
You can create a DataFrame from a list of simple tuples, and can even choose the specific elements of the tuples you want to use. Here we will create a DataFrame using all of the data in each tuple except for the last element. import pandas as pd data = [ ('p1', 't1', 1, 2), ('p1', 't2', 3, 4)...
if ([object respondsToSelector:@selector(someOptionalMethodInProtocol:)]) { [object someOptionalMethodInProtocol:argument]; }
Oracle's CONNECT BY functionality provides many useful and nontrivial features that are not built-in when using SQL standard recursive CTEs. This example replicates these features (with a few additions for sake of completeness), using SQL Server syntax. It is most useful for Oracle developers findin...
There are two main versions of IntelliJ IDEA: the Community edition and the Ultimate edition. The Community edition is free and is not lacking for features in terms of Java SE development. Windows & Linux Download IntelliJ IDEA from the JetBrains website, and follow installation procedures. If...
extern crate serde; extern crate serde_json; macro_rules! enum_str { ($name:ident { $($variant:ident($str:expr), )* }) => { #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum $name { $($variant,)* } impl ::serde::Serialize for $name {...
Given a sequence of steps we use repeatedly, it's often handy to store it in a function. Pipes allow for saving such functions in a readable format by starting a sequence with a dot as in: . %>% RHS As an example, suppose we have factor dates and want to extract the year: library(magrittr) ...
If you need to match characters that are a part of the regular expression syntax you can mark all or part of the pattern as a regex literal. \Q marks the beginning of the regex literal. \E marks the end of the regex literal. // the following throws a PatternSyntaxException because of the un-close...
The following code will print the arguments to the program, and the code will attempt to convert each argument into a number (to a long): #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <limits.h> int main(int argc, char* argv[]) { for (int ...
The specifier override has a special meaning in C++11 onwards, if appended at the end of function signature. This signifies that a function is Overriding the function present in base class & The Base class function is virtual There is no run time significance of this specifier as is mainl...
With virtual member functions: #include <iostream> struct X { virtual void f() { std::cout << "X::f()\n"; } }; struct Y : X { // Specifying virtual again here is optional // because it can be inferred from X::f(). virtual void f() { std::cout <&lt...
SQLite is a C library that is typically compiled directly into the application by downloading the source code of the latest version, and adding the sqlite3.c file to the project. Many script languages (e.g., Perl, Python, Ruby, etc.) and frameworks (e.g., Android) have support for SQLite; this is d...
A typical use case for a filter is to remove values from an array. In this example we pass in an array and remove any nulls found in it, returning the array. function removeNulls() { return function(list) { for (var i = list.length - 1; i >= 0; i--) { if (typeof list[i...
Another use case for filters is to format a single value. In this example, we pass in a value and we are returned an appropriate true boolean value. function convertToBooleanValue() { return function(input) { if (typeof input !== 'undefined' && input !== null ...
The <datalist> tag specifies a list of pre-defined options for an <input> element. It provide an "autocomplete" feature on <input> elements. Users will see a drop-down list of options as they write. <input list="Languages"> <datalist id="Langua...
child.py import time def main(): print "starting work" time.sleep(1) print "work work work work work" time.sleep(1) print "done working" if __name__ == '__main__': main() parent.py import os def main(): for i in range(5):...
Pass dynamic inventory to ansible-playbook: ansible-playbook -i inventory/dyn.py -l targethost my_playbook.yml python inventory/dyn.py should print out something like this: { "_meta": { "hostvars": { "10.1.0.10": { "ansible_user": ...
Python 3.x3.0 Python 3 added a new keyword called nonlocal. The nonlocal keyword adds a scope override to the inner scope. You can read all about it in PEP 3104. This is best illustrated with a couple of code examples. One of the most common examples is to create function that can increment: def c...
vimtutor is an interactive tutorial covering the most basic aspects of text editing. On UNIX-like system, you can start the tutorial with: $ vimtutor On Windows, “Vim tutor” can be found in the “Vim 7.x” directory under “All Programs” in the Windows menu. See :help vimtutor for further details...
NuGet version Before you start: make sure your NuGet version is up to date. In Visual Studio, go to Tools > Extensions and Updates, then Updates > Visual Studio Gallery. Check if there is a NuGet Update available and install it. Or, you can uninstall the existing nuget and reinstall it. It w...

Page 43 of 269