# Tutorial by Examples: alt

## Not equal to

x != y This returns True if x and y are not equal and otherwise returns False. 12 != 1 # True 12 != '12' # True '12' != '12' # False

## Equal To

x == y This expression evaluates if x and y are the same value and returns the result as a boolean value. Generally both type and value need to match, so the int 12 is not the same as the string '12'. 12 == 12 # True 12 == 1 # False '12' == '12' # True 'spam' == 'spam' # True 'spam' == ...

## Operators as alternative to an infix operator

For every infix operator, e.g. + there is a operator-function (operator.add for +): 1 + 1 # Output: 2 from operator import add add(1, 1) # Output: 2 even though the main documentation states that for the arithmetic operators only numerical input is allowed it is possible: from operator impo...

## Choosing alt text

Alt-text is used by screen readers for visually impaired users and by search engines. It's therefore important to write good alt-text for your images. The text should look correct even if you replace the image with its alt attribute. For example: &lt;!-- Incorrect --&gt; &lt;img src=&quot;anonymo...

## Linux Bonding Health

Template Definition template linux.bonding { subject = {{.Last.Status}}: {{.Eval .Alert.Vars.by_host}} bad bond(s) on {{.Group.host}} body = `{{template &quot;header&quot; .}} &lt;h2&gt;Bond Status&lt;/h2&gt; &lt;table&gt; &lt;tr&gt;&lt;th&gt;Bond&lt;/th&gt;&lt;th&gt;Slave&...

## Quoting literal text

All the examples in this paragraph print the line !&quot;#\$&amp;'()*;&lt;=&gt;? @[\]^`{|}~ A backslash quotes the next character, i.e. the next character is interpreted literally. The one exception is a newline: backslash-newline expands to the empty string. echo \!\&quot;\#\\$\&amp;\'\(\)\*\;\...

## Converting a Stream of Optional to a Stream of Values

You may need to convert a Stream emitting Optional to a Stream of values, emitting only values from existing Optional. (ie: without null value and not dealing with Optional.empty()). Optional&lt;String&gt; op1 = Optional.empty(); Optional&lt;String&gt; op2 = Optional.of(&quot;Hello World&quot;);...

## Alternative CSS

&lt;link rel=&quot;alternate stylesheet&quot; href=&quot;path/to/style.css&quot; title=&quot;yourTitle&quot;&gt; Some browsers allow alternate style sheets to apply if they are offered. By default they will not be applied, but usually they can be changed through the browser settings: Firefox l...

## Alternative for statement

&lt;?php for (\$i = 0; \$i &lt; 10; \$i++): do_something(\$i); endfor; ?&gt; &lt;?php for (\$i = 0; \$i &lt; 10; \$i++): ?&gt; &lt;p&gt;Do something in HTML with &lt;?php echo \$i; ?&gt;&lt;/p&gt; &lt;?php endfor; ?&gt;

## Alternative while statement

&lt;?php while (\$condition): do_something(); endwhile; ?&gt; &lt;?php while (\$condition): ?&gt; &lt;p&gt;Do something in HTML&lt;/p&gt; &lt;?php endwhile; ?&gt;

## Alternative foreach statement

&lt;?php foreach (\$collection as \$item): do_something(\$item); endforeach; ?&gt; &lt;?php foreach (\$collection as \$item): ?&gt; &lt;p&gt;Do something in HTML with &lt;?php echo \$item; ?&gt;&lt;/p&gt; &lt;?php endforeach; ?&gt;

## Alternative switch statement

&lt;?php switch (\$condition): case \$value: do_something(); break; default: do_something_else(); break; endswitch; ?&gt; &lt;?php switch (\$condition): ?&gt; &lt;?php case \$value: /* having whitespace before your cases will cause an error */ ?&g...

## Alternative if/else statement

&lt;?php if (\$condition): do_something(); elseif (\$another_condition): do_something_else(); else: do_something_different(); endif; ?&gt; &lt;?php if (\$condition): ?&gt; &lt;p&gt;Do something in HTML&lt;/p&gt; &lt;?php elseif (\$another_condition): ?&gt; &lt;p&gt;...

## Size of integral types

The following types are defined as integral types: char Signed integer types Unsigned integer types char16_t and char32_t bool wchar_t With the exception of sizeof(char) / sizeof(signed char) / sizeof(unsigned char), which is split between § 3.9.1.1 [basic.fundamental/1] and § 5.3.3.1 [ex...

## Alter Column

ALTER TABLE Employees ALTER COLUMN StartingDate DATETIME NOT NULL DEFAULT (GETDATE()) This query will alter the column datatype of StartingDate and change it from simple date to datetime and set default to current date.

## Class methods: alternate initializers

Class methods present alternate ways to build instances of classes. To illustrate, let's look at an example. Let's suppose we have a relatively simple Person class: class Person(object): def __init__(self, first_name, last_name, age): self.first_name = first_name self.last...

## Altering operator precedence (with parentheses)

The order in which operators are evaluated is determined by the operator precedence (see also the Remarks section). In \$a = 2 * 3 + 4; \$a gets a value of 10 because 2 * 3 is evaluated first (multiplication has a higher precedence than addition) yielding a sub-result of 6 + 4, which equals to 10...

## Alternative loop syntax

You can also use loop with curly brackets like this: if ( have_posts() ) { while ( have_posts() ) { the_post(); var_dump( \$post ); } }

## Connect Your Local Meteor App to an Alternative Mongo DB

Set the MONGO_URL environment variable before starting your local Meteor app. Linux/MacOS Example: MONGO_URL=&quot;mongodb://some-mongo-host.com:1234/mydatabase&quot; meteor or export MONGO_URL=&quot;mongodb://some-mongo-host.com:1234/mydatabase&quot; meteor Windows Example Note: don't u...

## Altering the HTTP method (GET, POST, PUT, etc)

The URLRequestMethod class contains constants for the various request types you can make. These constants are to be allocated to URLRequest's method property: var request:URLRequest = new URLRequest('http://someservice.com'); request.method = URLRequestMethod.POST; Note that only GET and POST...

Page 1 of 6