Using .Graph will filter the results to only include those that match the tagset for the alert. For instance an alert for os.low.memory{host=ny-web01} would only include series with the host=ny-web01 tags. If multiple series match then only the first matching result will be used.
template graph.tem...
Using .GraphAll will include all the results in the graph.
template graph.template {
subject = ...
body = `{{template "header" .}}
<strong>GraphAll</strong>
<div>{{.GraphAll .Alert.Vars.graph}}</div>
<strong>GraphAll With Y Axis...
Graph queries can be defined inline if you don't want to use an Alert variable.
template graph.template {
subject = ...
body = `{{template "header" .}}
<strong>Graph With Inline Query</strong>
<div>{{.Graph "q(\"avg:300s-avg:os.mem.perce...
If you want to graph two series on one graph, you can use the Merge function. This can also be combined with the Series function to manipulate the Y axis (like forcing it to start at zero).
template graph.template {
subject = ...
body = `{{template "header" .}}
<stro...
This uses the Dropbox Java SDK to create a shared link for a file at the Dropbox path /test.txt:
try {
SharedLinkMetadata sharedLinkMetadata = client.sharing().createSharedLinkWithSettings("/test.txt");
System.out.println(sharedLinkMetadata.getUrl());
} catch (CreateSharedLinkW...
This example uses the Dropbox .NET library to get a shared link for a file, either by creating a new one, or retrieving an existing one:
SharedLinkMetadata sharedLinkMetadata;
try {
sharedLinkMetadata = await this.client.Sharing.CreateSharedLinkWithSettingsAsync (path);
} catch (ApiException...
The following demo features an <output> element's use of the [for] and [form] attributes. Keep in mind, <output> needs JavaScript in order to function. Inline JavaScript is commonly used in forms as this example demonstrates. Although the <input> elements are type="number"...
In classes, super.foo() will look in superclasses only. If you want to call a default implementation from a superinterface, you need to qualify super with the interface name: Fooable.super.foo().
public interface Fooable {
default int foo() {return 3;}
}
public class A extends Object impl...
var parts = new[] { "Foo", "Bar", "Fizz", "Buzz"};
var joined = string.Join(", ", parts);
//joined = "Foo, Bar, Fizz, Buzz"
SELECT
'XPath example' AS 'head/title',
'This example demonstrates ' AS 'body/p',
'https://www.w3.org/TR/xpath/' AS 'body/p/a/@href',
'XPath expressions' AS 'body/p/a'
FOR XML PATH('html')
<html>
<head>
<title>XPath example</title>
&...
A useful tool in Java Concurrency is ThreadLocal – this allows you to have a variable that will be unique to a given thread. Thus, if the same code runs in different threads, these executions will not share the value, but instead each thread has its own variable that is local to the thread.
For exa...
When two margins are touching each other vertically, they are collapsed. When two margins touch horizontally, they do not collapse.
Example of adjacent vertical margins:
Consider the following styles and markup:
div{
margin: 10px;
}
<div>
some content
</div>
<div>...
NSArray *myColors = @[@"Red", @"Green", @"Blue", @"Yellow"];
// Preceding is the preferred equivalent to [NSArray arrayWithObjects:...]
Getting a single item
The objectAtIndex: method provides a single object. The first object in an NSArray is index 0. Si...
To pass data from the current view controller back to the previous view controller, you can use the delegate pattern.
This example assumes that you have made a segue in the Interface Builder and that you set the segue identifier to showSecondViewController. The outlets and actions must also be ho...
In a normal string, the backslash character is the escape character, which instructs the compiler to look at the next character(s) to determine the actual character in the string. (Full list of character escapes)
In verbatim strings, there are no character escapes (except for "" which is ...
In functions taking callable as an argument, you can also put a string with PHP built-in function. It's common to use trim as array_map parameter to remove leading and trailing whitespace from all strings in the array.
$arr = [' one ', 'two ', ' three'];
var_dump(array_map('trim', $arr));
...
To parse lots of parameters, the prefered way of doing this is using a while loop, a case statement, and shift.
shift is used to pop the first parameter in the series, making what used to be $2, now be $1. This is useful for processing arguments one at a time.
#!/bin/bash
# Load the user define...