Tutorial by Examples: amp

Date.now() returns the number of whole milliseconds that have elapsed since 1 January 1970 00:00:00 UTC. t = Date.now(); For example, Date.now() returns 1461069314 if it was called on 19 April 2016 at 12:35:14 GMT.
A typical email has three main components: A recipient (represented as an email address) A subject A message body Sending mail in PHP can be as simple as calling the built-in function mail(). mail() takes up to five parameters but the first three are all that is required to send an email (al...
This example shows the usage of the ILGenerator by generating code that makes use of already existing and new created members as well as basic Exception handling. The following code emits a DynamicAssembly that contains an equivalent to this c# code: public static class UnixTimeHelper { priva...
// Java: String phrase = persons .stream() .filter(p -> p.age >= 18) .map(p -> p.name) .collect(Collectors.joining(" and ", "In Germany ", " are of legal age.")); System.out.println(phrase); // In Germany Max and Peter a...
// Java: Map<Integer, String> map = persons .stream() .collect(Collectors.toMap( p -> p.age, p -> p.name, (name1, name2) -> name1 + ";" + name2)); System.out.println(map); // {18=Max, 23=Peter;Pamela, ...
// Java (verbose): Collector<Person, StringJoiner, String> personNameCollector = Collector.of( () -> new StringJoiner(" | "), // supplier (j, p) -> j.add(p.name.toUpperCase()), // accumulator (j1, j2) -> j1.merge(j2), // c...
// Java: IntSummaryStatistics ageSummary = persons.stream() .collect(Collectors.summarizingInt(p -> p.age)); System.out.println(ageSummary); // IntSummaryStatistics{count=4, sum=76, min=12, average=19.000000, max=23} // Kotlin: // something to hold the stats... da...
Scollector binaries for Windows, Mac, and Linux are available from the Bosun release page and can be saved to /opt/scollector/ or C:\Program Files\scollector\. The Scollector configuration file uses TOML v0.2.0 to specify various settings and defaults to being named scollector.toml in the same folde...
#Example of a PowerShell external collector. See http://bosun.org/scollector/external-collectors for details #This file should be saved in C:\Program Files\scollector\collectors\0\mymetrics.ps1 since it is a continuous output script #scollector.toml should have ColDir = 'C:\Program Files\scollecto...
div { font-size: 7px; border: 3px dotted pink; background-color: yellow; color: purple; } body.mystyle > div.myotherstyle { font-size: 11px; background-color: green; } #elmnt1 { font-size: 24px; border-color: red; } .mystyle .myotherstyle { ...
Any Chrome extension starts as an unpacked extension: a folder containing the extension's files. One file it must contain is manifest.json, which describes the basic properties of the extension. Many of the properties in that file are optional, but here is an absolute minimum manifest.json file: ...
First of all, implement your view holder: implements View.OnClickListener, View.OnLongClickListener Then, register the listeners as follows: itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); Next, override the listeners as follows: @Override public void onClick(Vie...
Step 1 If you already have Django installed, you can skip this step. pip install Django Step 2 Create a new project django-admin startproject hello That will create a folder named hello which will contain the following files: hello/ ├── hello/ │ ├── __init__.py │ ├── settings.py │...
Here is some sample XML against which example XPaths can be written: <r> <e a="1"/> <f a="2" b="1">Text 1</f> <f/> <g> <i c="2">Text 2</i> Text 3 <j>Text 4</j> </g&gt...
3.0 In Swift 3 there are multiple access-levels. This example uses them all except for open: public struct Car { public let make: String let model: String //Optional keyword: will automatically be "internal" private let fullName: String fileprivate var otherName...
public class SuperClass { private func secretMethod() {} } internal class SubClass: SuperClass { override internal func secretMethod() { super.secretMethod() } }
struct Square { private(set) var area = 0 var side: Int = 0 { didSet { area = side*side } } } public struct Square { public private(set) var area = 0 public var side: Int = 0 { didSet { area = side*side } ...
To write the traditional Hello World program in Rust, create a text file called hello.rs containing the following source code: fn main() { println!("Hello World!"); } This defines a new function called main, which takes no parameters and returns no data. This is where your progra...
Key Value Coding is integrated into NSObject using NSKeyValueCoding protocol. What this means? It means that any id object is capable of calling valueForKey method and its various variants like valueForKeyPath etc. ' It also means that any id object can invoke setValue method and its various vari...
The canvas element was introduced in HTML5 for drawing graphics. <canvas id="myCanvas"> Cannot display graphic. Canvas is not supported by your browser (IE<9) </canvas> The above will create a transparent HTML<canvas> element of 300×150 px in size. You can us...

Page 2 of 46