Tutorial by Examples

If your array or array-like object is numeric, that is, if all its elements are numbers, then you can use Math.min.apply or Math.max.apply by passing null as the first argument, and your array as the second. var myArray = [1, 2, 3, 4]; Math.min.apply(null, myArray); // 1 Math.max.apply(null, my...
To read default configuration properties: package com.example; public class ExampleApplication { private Properties getDefaults() throws IOException { Properties defaults = new Properties(); try (InputStream defaultsStream = ExampleApplication.class.getResou...
SOAP services can publish metadata that describes the methods that may be invoked by clients. Clients can use tools such as Visual Studio to automatically generate code (known as client proxies). The proxies hide the complexity of invoking a service. To invoke a service, one merely invokes a metho...
To find the largest or smallest element stored in a vector, you can use the methods std::max_element and std::min_element, respectively. These methods are defined in <algorithm> header. If several elements are equivalent to the greatest (smallest) element, the methods return the iterator to th...
You can create your own tag helpers by implementing ITagHelper or deriving from the convenience class TagHelper. The default convention is to target an html tag that matches the name of the helper without the optional TagHelper suffix. For example WidgetTagHelper will target a <widget> ta...
View components encapsulate reusable pieces of logic and views. They are defined by: A ViewComponent class containing the logic for fetching and preparing the data for the view and deciding which view to render. One or more views Since they contain logic, they are more flexible than partial v...
The default project template creates a partial view _LoginPartial.cshtml which contains a bit of logic for finding out whether the user is logged in or not and find out its user name. Since a view component might be a better fit (as there is logic involved and even 2 services injected) the followin...
The alert() method of the window object displays an alert box with a specified message and an OK or Cancel button. The text of that button depends on the browser and can't be modified. Syntax alert("Hello world!"); // Or, alternatively... window.alert("Hello world!"); Prod...
Prompt will display a dialog to the user requesting their input. You can provide a message that will be placed above the text field. The return value is a string representing the input provided by the user. var name = prompt("What's your name?"); console.log("Hello, " + name); ...
A hello world topic should consist of the most basic, complete, runnable, starter program available, that may be achieved by the widest amount of versions of the language, framework or system being documented. If necessary, the remarks should include basic instructions on how to prepare and execute ...
Move a rectangle 10 units to the right and 20 units down: <svg xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="30" height="30" transform="translate(10, 20)" /> </svg> Move it 0 units horizontally and...
Scale a rectangle horizontally by factor 2 and vertically by factor 0.5: <svg xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="40" height="40" transform="scale(2, 0.5)" /> </svg> The result is equiv...
Rotate a polygon clockwise by 90 degrees around the origin: <svg xmlns="http://www.w3.org/2000/svg"> <polygon points="0,0 30,0 15,20" transform="rotate(90)" /> </svg> The result is equivalent to <svg xmlns="http://www.w3.org/2000/svg...
skew a polygon horizontally by 45 degrees: <svg xmlns="http://www.w3.org/2000/svg"> <polygon points="0,0 30,0 30,30 0,30" transform="skewX(45)" /> </svg> The result is equivalent to <svg xmlns="http://www.w3.org/2000/svg"> ...
Apply a transformation matrix to a polygon: <svg xmlns="http://www.w3.org/2000/svg"> <polygon points="0,0 30,0 30,30 0,30" transform="matrix(1,0.6,-1.2,1,40,10)" /> </svg> Every point (x,y) will be transformed by applying matrix(a, b, c, d, e...
Transformations can be concatenated and are applied right to left Rotate a rectangle by 90 degrees and then move it down by 20 units and to the right by 20 units: <svg xmlns="http://www.w3.org/2000/svg"> <rect x="-10" y="-20" width="20" height=...
<svg width="400" height="400"> <defs> <pattern id="pattern1" width="0.2" height="0.2" patternUnits="objectBoundingBox"> <circle cx="10" cy="10" r="10" fill="#0000ff" /&...
Let’s try some basic expression in the REPL: CL-USER> (+ 1 2 3) 6 CL-USER> (- 3 1 1) 1 CL-USER> (- 3) -3 CL-USER> (+ 5.3 (- 3 2) (* 2 2)) 10.3 CL-USER> (concatenate 'string "Hello, " "World!") "Hello, World!" CL-USER> The basic building ...
Two popular options are to use: ipython notation: In [11]: df = pd.DataFrame([[1, 2], [3, 4]]) In [12]: df Out[12]: 0 1 0 1 2 1 3 4 Alternatively (this is popular over in the python documentation) and more concisely: df.columns # Out: RangeIndex(start=0, stop=2, step=1) df[0...
Use the pandas library as pd, this can be assumed (the import does not need to be in every example) import pandas as pd PEP8! 4 space indentation kwargs should use no spaces f(a=1) 80 character limit (the entire line fitting in the rendered code snippet should be strongly preferred)

Page 427 of 1336