If a sentence contains computer code (for example, the name of an HTML element), use the code element to mark it up:
<p>The <code>a</code> element creates a hyperlink.</p>
If the formatting (white space, new lines, indentation) of the code matters, use the pre element in combination with the code element:
<pre>
<code>
x = 42
if x == 42:
print "x is … … 42"
</code>
</pre>
You still have to esc...
To match something that does not contain a given string, one can use negative lookahead:
Regex syntax: (?!string-to-not-match)
Example:
//not matching "popcorn"
String regexString = "^(?!popcorn).*$";
System.out.println("[popcorn] " + ("popcorn".matches(r...
lib.rs:
pub fn to_test(output: bool) -> bool {
output
}
Each file in the tests/ folder is compiled as single crate.
tests/integration_test.rs
extern crate test_lib;
use test_lib::to_test;
#[test]
fn test_to_test(){
assert_eq!(to_test(true), true);
}
When you do a groupby you can select either a single column or a list of columns:
In [11]: df = pd.DataFrame([[1, 1, 2], [1, 2, 3], [2, 3, 4]], columns=["A", "B", "C"])
In [12]: df
Out[12]:
A B C
0 1 1 2
1 1 2 3
2 2 3 4
In [13]: g = df.groupby(...
It is possible to define custom string interpolators in addition to the built-in ones.
my"foo${bar}baz"
Is expanded by the compiler to:
new scala.StringContext("foo", "baz").my(bar)
scala.StringContext has no my method, therefore it can be provided by implicit c...
Using a Template Engine
The following code will setup Jade as template engine. (Note: Jade has been renamed to pug as of December 2015.)
const express = require('express'); //Imports the express module
const app = express(); //Creates an instance of the express module
const PORT = 3000; //Ra...
Example Using Activity w/ LocationRequest
/*
* This example is useful if you only want to receive updates in this
* activity only, and have no use for location anywhere else.
*/
public class LocationActivity extends AppCompatActivity implements
GoogleApiClient.ConnectionCallbacks, ...
Data Model
public class Item {
private String name;
public String getName() {
return name;
}
public void setName(String name){
this.name = name;
}
}
Layout XML
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:an...
If you want to parse a String to enum with Gson:
{"status" : "open"}
public enum Status {
@SerializedName("open")
OPEN,
@SerializedName("waiting")
WAITING,
@SerializedName("confirm")
CONFIRM,
@SerializedName(&...
SELECT
s.name + '.' + t.NAME AS TableName,
SUM(a.used_pages)*8 AS 'TableSizeKB' --a page in SQL Server is 8kb
FROM sys.tables t
JOIN sys.schemas s on t.schema_id = s.schema_id
LEFT JOIN sys.indexes i ON t.OBJECT_ID = i.object_id
LEFT JOIN sys.partitions p ON i.object_id = ...
Page 186 of 1088