Tutorial by Examples: st

Detailed instructions on getting model-view-controller set up or installed.
${parameter:-word} If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted. $ unset var $ echo "${var:-XX}" # Parameter is unset -> expansion XX occurs XX $ var="" # Parameter is null ...
Shortest match: $ a='I am a string' $ echo "${a#*a}" m a string Longest match: $ echo "${a##*a}" string
Shortest match: $ a='I am a string' $ echo "${a%a*}" I am Longest match: $ echo "${a%%a*}" I
First match: $ a='I am a string' $ echo "${a/a/A}" I Am a string All matches: $ echo "${a//a/A}" I Am A string Match at the beginning: $ echo "${a/#I/y}" y am a string Match at the end: $ echo "${a/%g/N}" I am a strinN Replace a pattern wi...
Project Object Model is the basic unit of Maven and defines the project structure, dependencies, etc. The following are very minimal to create a POM: project root modelVersion – should be set to 4.0.0 groupId – the ID of the project's group artifactId – the ID of the artifact (project) versi...
You can take advantage of Apache Maven's powerful features in Eclipse by installing the M2Eclipse feature. Follow these steps to install Maven in Eclipse: Open Eclipse and select Help → Install New Software… In the opened dialog, select the Add... button to add a new repository. Fill ...
For checking whether some object is of a certain class, the (binary) instanceof operator can be used since PHP version 5. The first (left) parameter is the object to test. If this variable is not an object, instanceof always returns false. If a constant expression is used, an error is thrown. The ...
Commands have one input (STDIN) and two kinds of outputs, standard output (STDOUT) and standard error (STDERR). For example: STDIN root@server~# read Type some text here Standard input is used to provide input to a program. (Here we're using the read builtin to read a line from STDIN.) STDO...
{ echo "contents of home directory" ls ~ } > output.txt
import pandas as pd df = pd.DataFrame(np.random.randn(5, 5), columns=list('ABCDE')) To generate various summary statistics. For numeric values the number of non-NA/null values (count), the mean (mean), the standard deviation std and values known as the five-number summary : min: minimum (smal...
import pylab as plt import numpy as np plt.style.use('ggplot') fig = plt.figure(1) ax = plt.gca() # make some testing data x = np.linspace( 0, np.pi, 1000 ) test_f = lambda x: np.sin(x)*3 + np.cos(2*x) # plot the test data ax.plot( x, test_f(x) , lw = 2) # set the axis labels ax...
The most common way to test Angular 2 apps is with the Jasmine test framework. Jasmine allows you to test your code in the browser. Install To get started, all you need is the jasmine-core package (not jasmine). npm install jasmine-core --save-dev --save-exact Verify To verify that Jasmine is...
The default Angular router allows navigation to and from any route unconditionally. This is not always the desired behavior. In a scenario where a user may conditionally be allowed to navigate to or from a route, a Route Guard may be used to restrict this behavior. If your scenario fits one of the...
File main.ts (or boot.ts) Consider the examples above: Create the guard (where the Guard is created) and Add guard to route configuration, (where the Guard is configured for route, then APP_ROUTER_PROVIDERS is exported), we can couple the bootstrap to Guard as follows import { bootstrap }...
Create an interface decorated with a ServiceContract attribute and member functions decorated with the OperationContract attribute. namespace Service { [ServiceContract] interface IExample { [OperationContract] string Echo(string s); } } Create a concrete...
Two ways to replace: by regex or by exact match. Note: the original String object will be unchanged, the return value holds the changed String. Exact match Replace single character with another single character: String replace(char oldChar, char newChar) Returns a new string resulting from...
functions.php: // We add the action twice, once for logged in users and once for non logged in users. add_action( 'wp_ajax_my_action', 'my_action_callback' ); add_action( 'wp_ajax_nopriv_my_action', 'my_action_callback' ); // Enqueue the script on the front end. add_action( 'wp_enqueue_script...
You can create a UIColor from a hexadecimal number or string, e.g. 0xff00cc, "#FFFFFF" Swift Int Value extension UIColor { convenience init(hex: Int, alpha: CGFloat = 1.0) { let r = CGFloat((hex >> 16) & 0xff) / 255 let g = CGFloat((hex >> 08) &amp...
When you need to iterate over the list of jQuery elements. Consider this DOM structure: <div class="container"> <div class="red one">RED 1 Info</div> <div class="red two">RED 2 Info</div> <div class="red three"...

Page 80 of 369