Introduction
Each spreadsheet document you want to access must be configured in the SheetDB panel as an API. After creating the API, you’ll receive a unique endpoint url. You can send RESTful requests to read, create, update or delete rows. The rest of the documentation explains how each request works and what you can expect in a response.
You can choose your preferred programming language in the upper right corner.
- Shell - the command line
- PHP - examples in vanilla PHP, you can also use our composer library
- JavaScript - we recommend to use Axios library or our npm library
- Node.js - we recommend to use Axios library or our npm library
- Pure HTML - to learn how to use SheetDB with only HTML go to Handlebars
Installation
You can use one of our Libraries:
WordPress plugin: SheetDB on WordPress
JavaScript: Google Spreadsheet REST API for JavaScript on GitHub
PHP: Google Spreadsheet REST API for PHP on GitHub
Node.js Google Spreadsheet REST API for Node.js on GitHub
Example spreadsheet
You can play with our test API here: https://sheetdb.io/api/v1/58f61be4dda40
You can also visit Google Sheets document here: google docs test document.
First row of your spreadsheet should contain the column names. Each next row will be treated as a record (according to naming from first row).
Our Example spreadsheet looks like this:
| id | name | age | comment |
|---|---|---|---|
| 1 | Tom | 41 | |
| 2 | Alex | 24 | |
| 3 | John | 51 | |
| 61 | Steve | 22 | special |
| 422 | James | 19 |
HTTP Status Codes
Each response is in JSON format. Of course, there is a status code in each response. Here is the list of available response codes:
| Status Code | Meaning |
|---|---|
| 200 OK | The request has succeeded for GET, PUT, PATCH and DELETE requests. |
| 201 Created | The request has succeeded for POST requests. |
| 400 Bad Request | API could not understand the request. |
| 401 Unauthorized | An error with authorization using a Google account or incorrect credentials for API if Basic Auth is enabled. |
| 402 Payment Required | Payment is required to process the request. |
| 403 Forbidden | Action is forbidden. |
| 404 Not Found | The server did not find anything matching the request. |
| 429 Too Many Requests | Exhausted limit requests. Check API limits |
| 500 Internal Server Error | We had a problem with our server. Try again later. |
| 1015 Rate limit | You are making too much requests, limit is 60 requests per 10 seconds. Try again in a minute. If you need more please contact us. |
SheetDB API
GET - All data
# Get all data
curl https://sheetdb.io/api/v1/58f61be4dda40
# Get 10 results starting from 20
curl https://sheetdb.io/api/v1/58f61be4dda40?limit=10&offset=20
# Get all data sorted by name in ascending order
curl https://sheetdb.io/api/v1/58f61be4dda40?sort_by=name&sort_order=asc
<?php
$options = array(
'http' => array(
'method' => 'GET'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
// Get all data
axios.get('https://sheetdb.io/api/v1/58f61be4dda40')
.then( response => {
console.log(response.data);
});
// Get 10 results starting from 20
axios.get('https://sheetdb.io/api/v1/58f61be4dda40?limit=10&offset=20')
.then( response => {
console.log(response.data);
});
// Get all data sorted by name in ascending order
axios.get('https://sheetdb.io/api/v1/58f61be4dda40?sort_by=name&sort_order=asc')
.then( response => {
console.log(response.data);
});
</script>
const sheetdb = require("sheetdb-node");
const client = sheetdb({ address: '58f61be4dda40' });
// Read whole spreadsheet
client.read().then(function(data) {
console.log(data);
}, function(error){
console.log(error);
});
// Read first two rows from sheet "Sheet2"
client.read({ limit: 2, sheet: "Sheet2" }).then(function(data) {
console.log(data);
}, function(err){
console.log(err);
});
Example response:
[
{
"id": "1",
"name": "Tom",
"age": "41"
},
{
"id": "2",
"name": "Alex",
"age": "24"
},
{
"id": "3",
"name": "John",
"age": "51"
}
]
GET https://sheetdb.io/api/v1/58f61be4dda40
Returns an array with all data from the spreadsheet.
You can use optional parameters:
limit
- the number of rows that should be returnedoffset
- row from which it should start (how many rows to skip)sort_by
- the column you want to sort bysort_order
- sort inasc
ordesc
order, you can also userandom
to get your data in a random ordersort_method
- if you want to sort by date, set this parameter todate
, it will automatically detect the date formatcast_numbers
- if you want to cast the value to a number, add column names separated by commas. Example: https://sheetdb.io/api/v1/58f61be4dda40?cast_numbers=id,agesingle_object
- if you want to get ony one item as an object (not in the array), set this parameter totrue
GET - Keys
# Get keys
curl https://sheetdb.io/api/v1/58f61be4dda40/keys
<?php
$options = array(
'http' => array(
'method' => 'GET'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/keys', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.get('https://sheetdb.io/api/v1/58f61be4dda40/keys')
.then( response => {
console.log(response.data);
});
</script>
const sheetdb = require("sheetdb-node");
const client = sheetdb({ address: '58f61be4dda40' });
client.endpoint('keys').then(function(data) {
console.log(data);
}, function(error){
console.log(error);
});
Example response:
["id", "name", "age", "comment"]
GET https://sheetdb.io/api/v1/58f61be4dda40/keys
Returns an array with all keys from the spreadsheet = values of the first row of the document.
GET - Document name
# Get the document name
curl https://sheetdb.io/api/v1/58f61be4dda40/name
<?php
$options = array(
'http' => array(
'method' => 'GET'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/name', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.get('https://sheetdb.io/api/v1/58f61be4dda40/name')
.then( response => {
console.log(response.data);
});
</script>
const sheetdb = require("sheetdb-node");
const client = sheetdb({ address: '58f61be4dda40' });
client.endpoint('name').then(function(data) {
console.log(data);
}, function(error){
console.log(error);
});
Example response:
{
"name": "SheetDB test document"
}
GET https://sheetdb.io/api/v1/58f61be4dda40/name
Returns the name of the document.
GET - List of available sheets
curl https://sheetdb.io/api/v1/58f61be4dda40/sheets
<?php
$options = array(
'http' => array(
'method' => 'GET'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/sheets', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.get('https://sheetdb.io/api/v1/58f61be4dda40/sheets')
.then( response => {
console.log(response.data);
});
</script>
const sheetdb = require("sheetdb-node");
const client = sheetdb({ address: '58f61be4dda40' });
client.endpoint('sheets').then(function(data) {
console.log(data);
}, function(error){
console.log(error);
});
Example response:
{
"sheets": [
"Sheet1",
"Sheet2"
]
}
GET https://sheetdb.io/api/v1/58f61be4dda40/sheets
Returns a list of all available sheets (tabs).
GET - Count
curl https://sheetdb.io/api/v1/58f61be4dda40/count
<?php
$options = array(
'http' => array(
'method' => 'GET'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/count', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.get('https://sheetdb.io/api/v1/58f61be4dda40/count')
.then( response => {
console.log(response.data);
});
</script>
const sheetdb = require("sheetdb-node");
const client = sheetdb({ address: '58f61be4dda40' });
client.endpoint('count').then(function(data) {
console.log(data);
}, function(error){
console.log(error);
});
Example response:
{
"rows": 5
}
GET https://sheetdb.io/api/v1/58f61be4dda40/count
Returns the number of rows in the document (without first row).
GET - Search in document
curl https://sheetdb.io/api/v1/58f61be4dda40/search?name=Steve&age=22&casesensitive=true
<?php
$options = array(
'http' => array(
'method' => 'GET'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/search?name=Steve&age=22&casesensitive=true', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.get('https://sheetdb.io/api/v1/58f61be4dda40/search?name=Steve&age=22&casesensitive=true')
.then( response => {
console.log(response.data);
});
</script>
const sheetdb = require("sheetdb-node");
const client = sheetdb({ address: '58f61be4dda40' });
// Get all rows where column 'id' is 'foo' and column 'value' is 'bar'
client.read({ search: { id: "1", name: "Tom" } }).then(function(data) {
console.log(data);
}, function(err){
console.log(err);
});
// Get first row where column 'player' is 'Smith',
// column 'score' is '41' from sheet named "Sheet2"
client.read({
limit: 1,
search: { 'player': 'Smith', 'score': 41 },
sheet: 'Sheet2'
}).then(function(data) {
console.log(data);
}, function(err){
console.log(err);
});
Example response:
[
{
"id": "61",
"name": "Steve",
"age": "22",
"comment": "special"
}
]
GET https://sheetdb.io/api/v1/58f61be4dda40/search?name=Steve&age=22&casesensitive=true
GET https://sheetdb.io/api/v1/58f61be4dda40/search_or?name=Steve&age=22&casesensitive=true
Returns an array of all rows matching parameters. If any query fails, the result will NOT be listed. If you want to check if any parameter is true, use the search_or endpoint (second URL above).
You can search using wildcards. Asterisk (*
) can represent any string.
Wildcard work only when READ and SEARCH permissions are both enabled, if only SEARCH peremission is enabled, wildcard will not work for security reasons.
If you want to exclude rows from the search results, use an exclamation mark before the value. For example, if you want all rows without name=Tom use this url: https://sheetdb.io/api/v1/58f61be4dda40/search?name=!Tom
You can use relational operators to determine if a value is greater than or less than a given number. Just start with <
, >
, <=
, >=
operator. Example urls:
- Greater than 3: https://sheetdb.io/api/v1/58f61be4dda40/search?id=>3
- Less than 3: https://sheetdb.io/api/v1/58f61be4dda40/search?id=<3
- Greater than or equal to 3: https://sheetdb.io/api/v1/58f61be4dda40/search?id=>=3
- Less than or equal to 3: https://sheetdb.io/api/v1/58f61be4dda40/search?id=<=3
You can use multiple queries for the same column, but you must use array notation ([]
at the end of the variable name), for example: https://sheetdb.io/api/v1/58f61be4dda40/search?name[]=!Tom&name[]=!Steve
If you want to search for a string with a space, just repace space with %20
If you want to include & symbol in your query, replace it with %26
You can use optional parameters:
limit
- the number of rows that should be returnedoffset
- row from which it should start (how many rows to skip)sort_by
- the column you want to sort bysort_order
- sort inasc
ordesc
ordersort_method
- if you want to sort by date, set this parameter todate
, it will automatically detect the date formatcast_numbers
- if you want to cast the value to a number, add column names separated by commas. Example: https://sheetdb.io/api/v1/58f61be4dda40?cast_numbers=id,agesingle_object
- if you want to get ony one item as an object (not in the array), set this parameter totrue
casesensitive
- by default search is not case sensitive, to make it case sensitive set this parameter totrue
For more examples, check out this blog post: Search feature in SheetDB API or this youtube video: Using SheetDB search API to filter results from Google Sheets.
POST - Create row
curl -X POST -H "Content-Type: application/json" https://sheetdb.io/api/v1/58f61be4dda40 -d '{"data":[{ "name": "Scott", "age": "25" }]}'
<?php
$data = http_build_query(
[
'data' =>
[
['name' => 'Scott', 'age' => 25]
]
]
);
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $data
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.post('https://sheetdb.io/api/v1/58f61be4dda40',{
"data": {"name": "Scott", "age": 25}
}).then( response => {
console.log(response.data);
});
</script>
const sheetdb = require("sheetdb-node");
const client = sheetdb({ address: '58f61be4dda40' });
// Adds single row
client.create({ name: "William", age: 25 }).then(function(data) {
console.log(data);
}, function(err){
console.log(err);
});
/// Adds bunch of rows
rows = [
{ name: "William", age: 25 },
{ name: "Jayden", age: 25 }
]
client.create(rows).then(function(data) {
console.log(data);
}, function(err){
console.log(err);
});
Example response:
{
"created": 1
}
POST https://sheetdb.io/api/v1/58f61be4dda40
Create rows in document. Your request should contain data
parameter - it should be an array of rows. Keys inside the object should be a column names (see # GET - keys) and values will be values inside a spreadsheet. Rows will be added at the end of spreadsheet. If you want to add a single row, simply send an array with one item {"data": [{"id":5,"name":"Frank"}]}
.
You can also add multiple rows at once using an array of objects. Example: {"data": [{"id":5,"name":"Frank"},{"id":6,"name":"Marc"}]}
You can use value INCREMENT
(upper case). SheetDB will look for the biggest number in the given column and increase by 1.
If for some reason you cannot put your data into the data
parameter, SheetDB will try to use the entire request data to match the spreadsheet format.
API will return the number of created rows with status code 201 Created
.
POST - Import JSON
curl -X POST -H "Content-Type: application/json" https://sheetdb.io/api/v1/58f61be4dda40/import/json -d '{"json":[{ "name": "Scott", "age": "25" }]}'
<?php
$data = http_build_query(
[
'json' =>
[
['name' => 'Scott', 'age' => 25]
]
]
);
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $data
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/import/json', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.post('https://sheetdb.io/api/v1/58f61be4dda40/import/json',{
"json": '{"name": "Scott", "age": 25}'
}).then( response => {
console.log(response.data);
});
</script>
Example response:
{
"created": 1
}
POST https://sheetdb.io/api/v1/58f61be4dda40/import/json
If you have an empty spreadsheet, above all with a first row unfilled, you can use this endpoint to import entire JSON file. Make sure that the spreadsheet is empty or the endpoint will append new content to the first row. The first row (column names) will be generated from the first object in the array.
Required parameters:
json
- should contain valid json array, e.g.[{ "name": "Scott", "age": "25" }]
Optional parameters:
sheet
- to select other then the first sheet
API will return the number of created rows with status code 201 Created
.
PATCH/PUT - Update
curl -X PATCH -H "Content-Type: application/json" https://sheetdb.io/api/v1/58f61be4dda40/id/61 -d '{"data":[{ "name": "Scott", "age": "25" }]}'
<?php
$data = http_build_query(
[
'data' =>
[
['name' => 'Scott', 'age' => 25]
]
]
);
$options = array(
'http' => array(
'method' => 'PATCH',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $data
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/id/61', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.patch('https://sheetdb.io/api/v1/58f61be4dda40/id/61',{
"data": {"name": "Scott", "age": 25}
}).then( response => {
console.log(response.data);
});
</script>
const sheetdb = require("sheetdb-node");
const client = sheetdb({ address: '58f61be4dda40' });
// Update all columns where 'name' is 'Smith' to have 'score' = 99 and 'comment' = 'Griffin'
client.update(
'name', // column name
'Tom', // value to search for
{ 'comment': 'Updated' } // object with updates
).then(function (data) {
console.log(data);
}, function (err) {
console.log(err);
});
// Update all columns where 'name' is 'Smith' to have 'score' = 99 and 'comment' = 'Griffin'
// In sheet named 'Sheet2'
client.update(
'player', // column name
'Smith', // value to search for
{ 'score': 99, 'comment': 'Griffin' }, // object with updates
'Sheet2'
).then(function (data) {
console.log(data);
}, function (err) {
console.log(err);
});
Example response:
{
"updated": 1
}
PATCH/PUT https://sheetdb.io/api/v1/58f61be4dda40/{column}/{value}
Update row(s) for given column and value. Similar to # GET - Search you must specify a key (column name) and value to find. Any rows that match the condition will be updated.
Requests will update only values passed in data object.
It returns count of updated rows.
PATCH/PUT - Batch update
curl -X PATCH -H "Content-Type: application/json" https://sheetdb.io/api/v1/58f61be4dda40/batch_update -d '{"data":[{"query":"id=1", "name":"Mathew", "age":20},{"query":"id=2", "age":25}]}'
<?php
$data = http_build_query(
[
'data' =>
[
['query' => 'id=1', 'name' => 'Mathew', 'age' => 20],
['query' => 'id=2', 'age' => 25],
]
]);
$options = array(
'http' => array(
'method' => 'PATCH',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $data
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/batch_update', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.patch('https://sheetdb.io/api/v1/58f61be4dda40/batch_update', {
data: [
{
"query":"id=1",
"name":"qwes",
"age":20
},
{
"query":"id=2",
"age":25,
}
]
}).then( response => {
console.log(response.data);
});
</script>
// our Node.js library does not support this method
Example response:
{
"updated": 2
}
PATCH/PUT https://sheetdb.io/api/v1/58f61be4dda40/batch_update
Update for various queries. You have to add an data
param to your request. Each object in it should have a query
key with the actual query (for example, "id=5"), and the remaining keys will be updated, as in a regular PATCH / PUT request. Here is an example of the data
parameter in the body of the request:
[
{
"query":"id=1",
"name":"Mathew",
"age":20
},
{
"query":"id=2",
"age":25,
}
]
Requests will update only values passed in data object.
It returns count of updated rows.
DELETE
curl -X DELETE -H "Content-Type: application/json" https://sheetdb.io/api/v1/58f61be4dda40/id/61'
<?php
$options = array(
'http' => array(
'method' => 'DELETE'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/id/61', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.delete('https://sheetdb.io/api/v1/58f61be4dda40/id/61')
.then( response => {
console.log(response.data);
});
</script>
const sheetdb = require("sheetdb-node");
const client = sheetdb({ address: '58f61be4dda40' });
// Delete all rows where 'name' equals 'Smith'
client.delete(
'id', // column name
'1' // value to search for
).then(function(data) {
console.log(data);
}, function(err){
console.log(err);
});
Example response:
{
"deleted": 1
}
DELETE https://sheetdb.io/api/v1/58f61be4dda40/{column}/{value}
Delete row(s) for given column and value. Similar to # GET - Search you must specify a key (column name) and value to find. Any rows that match the condition will be deleted.
It returns count of deleted rows.
You can use optional parameters:
limit
- the number of rows to delete. When dealing with a large spreadsheet and a large number of rows to delete, is's recommended to use limit.
DELETE - Duplicates
curl -X DELETE -H "Content-Type: application/json" https://sheetdb.io/api/v1/58f61be4dda40/duplicates
<?php
$options = array(
'http' => array(
'method' => 'DELETE'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/duplicates', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.delete('https://sheetdb.io/api/v1/58f61be4dda40/duplicates')
.then( response => {
console.log(response.data);
});
</script>
// our Node.js library does not support this method
Example response:
{
"duplicates": 3
}
DELETE https://sheetdb.io/api/v1/58f61be4dda40/duplicates
Deletes all duplicate rows, all columns must contain exactly the same data to be deleted.
By default first sheet (tab) is selected but you can target any sheet you want using param sheet. Example: ?sheet=Sheet2
It returns count of duplicated rows.
DELETE - All content
curl -X DELETE -H "Content-Type: application/json" https://sheetdb.io/api/v1/58f61be4dda40/all
<?php
$options = array(
'http' => array(
'method' => 'DELETE'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/all', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.delete('https://sheetdb.io/api/v1/58f61be4dda40/all')
.then( response => {
console.log(response.data);
});
</script>
// our Node.js library does not support this method
Example response:
{
"deleted": 5
}
DELETE https://sheetdb.io/api/v1/58f61be4dda40/all
Delete all rows without the first one (column names) in spreadsheet. By default first sheet (tab) is selected but you can target any sheet you want using param sheet. Example: ?sheet=Sheet2
It returns count of deleted rows.
Single cells
GET - Cells values
# Get A1 cell
curl https://sheetdb.io/api/v1/58f61be4dda40/cells/A1
<?php
$options = array(
'http' => array(
'method' => 'GET'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/cells/A1', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.get('https://sheetdb.io/api/v1/58f61be4dda40/cells/A1')
.then( response => {
console.log(response.data);
});
</script>
// we do not support single cells in our node package :(
Example response:
{
"A1":"id"
}
GET https://sheetdb.io/api/v1/58f61be4dda40/cells/A1
If you want to retrieve the contents of a single cell using coordinates like A1, B10 etc. you can use this endpoint. Returns an array with coordinates as key and cell contents as value.
If you want to get multiple cells just separate them with a comma. Example:
GET https://sheetdb.io/api/v1/58f61be4dda40/cells/A1,A2,B5
Multiple Sheets (tabs)
To select other then the first sheet you need to pass a sheet
parameter wtih sheet name. You can add this parameter to any of our RESTful requests (GET
, POST
, PATCH
, PUT
, DELETE
).
When sheet is not found you'll get 404 error.
Here are sample URLs for different methods (for a sheet named sheet2
):
GET
https://sheetdb.io/api/v1/58f61be4dda40?sheet=sheet2POST
https://sheetdb.io/api/v1/58f61be4dda40?sheet=sheet2PATCH
https://sheetdb.io/api/v1/58f61be4dda40/{column}/{value}?sheet=sheet2DELETE
https://sheetdb.io/api/v1/58f61be4dda40/{column}/{value}?sheet=sheet2
GET - All data from a tab
# Get all data from "Sheet2"
curl https://sheetdb.io/api/v1/58f61be4dda40?sheet=Sheet2
# You can still use limit, offset and sort parameters
curl https://sheetdb.io/api/v1/58f61be4dda40?sheet=Sheet2&limit=10&offset=20
<?php
// define options
$options = array(
'http' => array(
'method' => 'GET'
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40?sheet=Sheet2', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
// Get all data
axios.get('https://sheetdb.io/api/v1/58f61be4dda40?sheet=Sheet2')
.then( response => {
console.log(response.data);
});
// You can still use limit, offset and sort parameters
axios.get('https://sheetdb.io/api/v1/58f61be4dda40?sheet=Sheet2&limit=10&offset=20')
.then( response => {
console.log(response.data);
});
</script>
const sheetdb = require("sheetdb-node");
const client = sheetdb({ address: '58f61be4dda40' });
// Sheet "Sheet2"
client.read({ sheet: "Sheet2" }).then(function(data) {
console.log(data);
}, function(err){
console.log(err);
});
Example response:
[
{
"player": "Smith",
"score": "41"
},
{
"player": "Martha",
"score": "43"
},
{
"player": "Craig",
"score": "12"
},
{
"player": "Michael",
"score": "61"
}
]
GET https://sheetdb.io/api/v1/58f61be4dda40?sheet=Sheet2
This is an example how to get data from sheet Sheet2
POST - Add a sheet to the spreadsheet (tab)
curl -X POST -H "Content-Type: application/json" https://sheetdb.io/api/v1/58f61be4dda40/sheet -d '{"name": "New Sheet", "first_row":["id","name"]}'
<?php
$data = http_build_query(
[
'name' => "New Sheet",
'first_row' => ["id","name"]
]
);
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $data
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/sheet', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.post('https://sheetdb.io/api/v1/58f61be4dda40/sheet',{"name": "New Sheet", "first_row":["id","name"]})
.then( response => {
console.log(response.data);
});
</script>
// our Node.js library does not support this method
Example response:
{
"created":1
}
POST https://sheetdb.io/api/v1/58f61be4dda40/sheet
Creates a new sheet (tab) in the spreadsheet. 2 params are required:
name
- the name of the new sheetfirst_row
- first row of spreadsheet that contain an array with column names. For example:["id","name","score"]
DELETE - Delete a sheet (tab)
curl -X DELETE -H "Content-Type: application/json" https://sheetdb.io/api/v1/58f61be4dda40/sheet -d '{"name":"New Sheet"}'
<?php
$data = http_build_query(
[
'name' => "New Sheet"
]
);
$options = array(
'http' => array(
'method' => 'DELETE',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $data
)
);
$result = json_decode(
file_get_contents('https://sheetdb.io/api/v1/58f61be4dda40/sheet', false, stream_context_create($options))
);
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script>
axios.delete('https://sheetdb.io/api/v1/58f61be4dda40/sheet',{
"data":{
"name":"New Sheet"
}
})
.then( response => {
console.log(response.data);
});
</script>
// our Node.js library does not support this method
Example response:
{
"deleted": 1
}
DELETE https://sheetdb.io/api/v1/58f61be4dda40/sheet
Deletes a sheet (tab) and the content. Requires one param:
name
- the name of the sheet you want to delete
Our handlebars snippet
Handlebars Installation
Copy the following code and add it before the closing </body>
tag.
<script src="https://sheetdb.io/handlebars.js"></script>
That's it. You are ready to use our handlebars snippet.
Display data
Now you can display data from your spreadsheet.
- Add
data-sheetdb-url="SHEETDB_API_URL"
to the parent element. For example- Add handlebars
{{
and}}
and fill them with the column name you want to display.Optional parameters
<table> <thead> <tr> <td>ID</td> <td>Name</td> <td>Age</td> <td>Comment</td> </tr> </thead> <tbody data-sheetdb-url="https://sheetdb.io/api/v1/58f61be4dda40" data-sheetdb-sort-by="age" data-sheetdb-sort-order="desc"> <tr> <td>{{id}}</td> <td>{{name}}</td> <td>{{age}}</td> <td>{{comment}}</td> </tr> </tbody> </table> <script src="https://sheetdb.io/handlebars.js"></script>
- By default, you will receive data from the first sheet (tab). If you want to work with another sheet, use
data-sheetdb-sheet
and enter the name of the sheet (case sensitive). - You can limit and offset your response using
data-sheetdb-limit
anddata-sheetdb-offset
attributes - You can search for specific data in your sheet using
data-sheetdb-search
attribute. If you want to use more than one condition join them using & symbol. Example:data-sheetdb-search="name=Tom&age=15"
- If you want to use search_or endpoint, please specify
data-sheetdb-search-mode="or"
, if you want to target one column more than once, don't forget square brackets like this:data-sheetdb-search="id[]=1&id[]=2"
- You can sort the response using
data-sheetdb-sort-by
attribute - it should be a name of the column you want to sort by. You can alo specify the order usingdata-sheetdb-sort-order
- (desc or asc) - If the result is not found (e.g. in search or query string) you can use the
data-sheetdb-not-found-message
attribute and as the value give the message which will be displayed to the user.
Here is the result of right hand code:
ID Name Age Comment {{id}} {{name}} {{age}} {{comment}} Query strings
<form> <input type="text" name="id" placeholder="Enter the ID"> <input type="submit"> </form> <table> <thead> <tr> <td>ID</td> <td>Name</td> <td>Age</td> <td>Comment</td> </tr> </thead> <tbody data-sheetdb-url="https://sheetdb.io/api/v1/58f61be4dda40" data-sheetdb-query-string="id"> <tr> <td>{{id}}</td> <td>{{name}}</td> <td>{{age}}</td> <td>{{comment}}</td> </tr> </tbody> </table> <script src="https://sheetdb.io/handlebars.js"></script>
To change content dynamically you can use query strings. If you add
data-sheetdb-query-string
and specify the parameter you want to filter by, you can add query to the address bar. For example if you usedata-sheetdb-query-string="id"
and add ?id=3 to the url you will get filtered data and display only results with id=3.If you want to use more query strings, separate them with commas with no spaces in between. E.g
data-sheetdb-query-string="id,age"
.Here is the result of example code:
After entering your ID, watch what's happening in the address bar. After you submit,
?id=xxx
will be added to the url. This change in the url causes this feature to work. You can also add this parameter to your links to filter data using query strings.ID Name Age Comment {{id}} {{name}} {{age}} {{comment}} Slots
<span data-sheetdb-url="https://sheetdb.io/api/v1/58f61be4dda40" data-sheetdb-save="slot-example"> {{name}} </span> <span data-sheetdb-slot="slot-example"> {{id}} </span>
If you want to re-use your data, you can use the
data-sheetdb-save
attribute in your sheetdb element. To re-use your data usedata-sheetdb-slot
. You can use the same data inside as in the parent. To match them the value of save and slot must be the sameThis way, you only use 1 request instead of 2. Slots have access to the same data as the parent. You can’t change things like limit or search.
This is the result of our example (using only 1 request):
{{name}}
{{id}}
Events
window.addEventListener("sheetdb-downloaded", function() { // this code will be executed after all sheetdb data has been retrieved });
After downloading all the data, the handlebars library will trigger a custom event
sheetdb-downloaded
. You can listen for this event to execute some javascript code after getting the data and rendering the DOM.Update content
If you want to update the contents of SheetDB, you can use the global function
sheetdb_upd()
. It will force all content to be downloaded again from the spreadsheet.Other
Value Render Option
To your GET (get and search) requests, you can add optional
mode
parameter. It controls how values should be rendered in the output, as described in the following:FORMATTED_VALUE
(default) - Values will be calculated & formatted in the reply according to the cell's formatting. Formatting is based on the spreadsheet's locale, not the requesting user's locale. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return "$1.23".UNFORMATTED_VALUE
- Values will be calculated, but not formatted in the reply. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return the number 1.23.FORMULA
- Values will not be calculated. The reply will include the formulas. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return "=A1".Value Input Option
To your POST, PUT and PATCH (create and update) requests, you can add optional
mode
parameter. It controls whether input strings are parsed or not, as described in the following:USER_ENTERED
(default) - The input is parsed exactly as if it were entered into the Google Sheets UI, so "Mar 1 2016" becomes a date, and "=1+2" becomes a formula. Formats may also be inferred, so "$100.15" becomes a number with currency formatting.RAW
- The input is not parsed and is simply inserted as a string, so the input "=1+2" places the string "=1+2" in the cell, not a formula. (Non-string values like booleans or numbers are always handled as RAW.)Authentication
You can add HTTP Basic Auth to each API as an additional security for your API's. You can enable it on the API Settings tab.
You will receive a login and password. You have to send it for every request that has basic authentication enabled. If the credentials are incorrect API will respond with error
401 Unauthorized
.API Limits
After you hit your rate limit, your requests will return an error:
429 Too Many Requests
. You can check limits at our pricing page.There are 2 more limits:
- 100 requests per 100 seconds per user
- variable limit of requests per one spreadsheet (for 100 seconds)
Both are limits imposed by Google and cannot be changed. If you need more, best solution is enabling cache. SheetDB limit will be calculated as usual, however Google limits do not apply because in the case of cache results we do not query Google servers.
Make the first request before a larger batch to prepare the cache.
Additionally, there is a limit - 60 requests per 10 seconds from one IP address. If you need more please contact us.
Caching
By default, we cache your API data for 15 seconds. If you are on paid plan you can change this period in API settings up to 7 days. Caching guarantees the fastest response time, especially for a large number of requests.
When cache is enabled, changes to the spreadsheet are not reflected in the API's until the cache expires, or until you make changes to the spreadsheet using SheetDB API. There is also an endpoint to reset cache in API settings.
Example:
If you enable cache for 7 days and one day later you change the content in the Google Spreadsheet website, for the next 6 days, GET endpoint will return the old data! You can use purge endpoint to manually reset the cache.
If you modify a spreadsheet using SheetDB API - for example with the POST request, the cache will be cleared for you and after the change your GET requests will return new content immediately.
Data safety
The confidentiality of your data is very important to us, which is why we do not store any of your data on our servers, other than API data for caching reasons. Also, for people without an API URL, guessing is almost impossible, but if you still need more protection, you can enable Basic Auth.
We use the best tools and services available to protect your data.
What does SheetDB have access to?
SheetDB can only access spreadsheets for which the API has been created. This means that SheetDB do not have access to your other files.
This documentation is on GitHub
If you'd like to correct or add something here, please submit a pull request.
We are here for you!
If you have any questions please feel free to ask via email or inapp chat.
- Add handlebars


Welcome to the ProKarma Cloud Foundry Basic Demo!
The purpose of this application is to demonstrate some basic capabilities of the Pivotal Cloud Foundry Platform, in particular the Pivotal Elastic Runtime Service which is the core component responsible for running the application workloads as containers.
Application Components and Architecture
Currently the application is one deployment with the UI and backend packaged inside the same artifact - Spring Boot jar. However, logically the UI/client is completely separate from the backend services.
How to use this Application
Each menu item above links to a page that helps demonstrate a set of capabilities. The last item, Spring Boot, highlights the Spring Framework project that helps build production ready cloud applications and microservices in minutes. Spring Boot is not the focus on this demo. Learn more.
Each page has the same layout with the Accordion control and 3 groups:
- Application Environment Information - This provides information about the application environment when running inside PCF. You can see the Application Name, Container and Services information. This is useful to show things like load balancing, self healing, service binding among other things.
- Description - We provide information on the current page and additional resources.
- Demonstration - We list the things that can be demonstrated in the particular page.


{% extends 'base.html' %} {% load i18n %} {% load staticfiles %} {% block title %}{% trans "Represent Elected Officials and Electoral Districts API for Canada" %}{% endblock %} {% block content %}
{% trans "Try the demo app" %} {% trans "Use the free API" %} {% trans "Download the data" %}
{% trans "Represent matches a supporter's postal code or geocoded address to the correct elected officials. It makes it easy for you to build “email your representative” advocacy campaigns. During elections, we can connect your activists to political candidates." %}
“{% trans "I used your municipal data as part of a successful letter writing campaign from constituents to their elected municipal politicians, which resulted in the passage of the most definitive resolution ever opposing oil tanker traffic expansion on B.C.'s coast." %}” – Karl Hardin, Dogwood Initiative
{% trans "Collect a user's postal code or address, and use Represent to match it to an electoral district. By identifying their riding, you can invite supporters to take local actions or show readers stories from their local election race." %}
“{% trans "For our BC Election Guide, we used a few endpoints of the Represent API: the representative lookup by riding, the BC provincial riding boundaries and their simplified geometry (a time-consuming task, if not available), and the riding lookup by latitude and longitude." %}” – Phillip Smith, The Tyee
{% trans "If your people database contains postal codes or addresses, use Represent to match people to their electoral districts. By mapping people geographically, you can better target canvassing, mobilize volunteers, and organize donation drives." %}
{% trans 'Represent is open source and makes its source data available where possible' %}


During spring break of 2015 at BCIT, I went and redid one of my assignments a few times in a few different languages: C++, Haskell, JavaScript, PowerShell, and Python. C++ was the course I was studying and I had done a fair bit of python before. JavaScript I’d touched a couple times, but Haskell and PowerShell were completely unfamiliar to me.
The assignment I chose was a small lab assignment to calculate which set of 7 numbers had the most permutations that were prime numbers.
Considering 3-digit numbers, as a simpler example, gives a maximum of 4 permutations. There are 3 different solutions tied with 4 permutations.
- 149, 419, 491, 941
- 179, 197, 719, 971
- 379, 397, 739, 937
3-digit numbers are easy to work with, but when you get up to 7-digit numbers it becomes more important how you choose to solve it. I really enjoyed solving this one. So much so that I resolved it in a few different languages. The code is the purpose of this article so I’m about to give away how to solve it. Stop now if you want to do it yourself.
Solutions
The general solution I used is
- Generate all the prime numbers in the range you need: e.g. [1000000:9999999]
- Write a function that will take a number in that same range, and turn it into a key based on the digits it contains, so that 1045, 1405, 5041, and 4501 all give the same key
- Group all the prime numbers that have the same key, or just keep the largest group if you don’t care about ties.
- Report the largest group(s).
One other note: Do not take the results below as a benchmark for a language speed comparison. I ran different code in each of the languages, some of which I had no knowledge of prior to starting this project and are not necessarily optimal. Haskell was run through a virtual machine, C++ through Cygwin, JavaScript through chromium.
C++
In C++ the code was quite straightforward. I had been writing in C++ recently and was able to translate the algorithm into code in less than an hour.
I was able to take advantage of the bitset type to both shrink my volume of data and probably make it faster to manipulate. Since strings are mutable in C++, most people in my class converted the number to a string and then ran quicksort on it. I felt like doing something different so I wrote a function that would generate a key using only numeric transformations. My solution would work up to 9-digit numbers, although it could be generalized for more.
- #include <iostream>
- #include <algorithm>
- #include <bitset>
- #include <vector>
- #include <map>
- using namespace std;
- #define SIZE 7
- #define LOW 1000000
- #define N 9999999
- //isprime[n] is 1 if n is prime, 0 if n is not prime
- bitset<N> isprime;
- int reorder(int n);
- void loadPrimes();
- int main() {
- map<int, vector<int>> results;
- //generate primes
- loadPrimes();
- //for all numbers LOW to HIGH
- for (size_t i=LOW; i<N; i++)
- if (isprime[i])
- results[reorder(i)].push_back(i);
- //find the max prime combinations
- pair<int, vector<int>> max{0, {}};
- for (auto& x : results) {
- if (x.second.size() > max.second.size())
- max = x;
- }
- cout << "Highest: " << endl
- << max.first << ": " << max.second.size() << endl;
- }
- //generate all prime numbers in range
- void loadPrimes() {
- isprime.set();
- for (size_t i=2; i < N; i++)
- if (isprime[i])
- for(size_t j = 2; j * i < N; j++)
- isprime[j*i]=0;
- }
- //generate a key for the given number
- int reorder(int n) {
- int result = 0;
- static int v[SIZE];
- for(int i = 0; i < SIZE; ++i) {
- v[i] = n % 10;
- n /= 10;
- }
- sort(v, v + SIZE);
- for (auto x : v) {
- result *= 10;
- result += x;
- }
- while (result < LOW)
- result *= 10;
- return result;
- }
Running the code in c++ took about 2 seconds on my laptop for a 7-digit number. No other language that followed came close to meeting that speed.
Haskell
Haskell was an interesting language to investigate. This was my first time installing it and coding in it. It’s a functional language, so it feels like all I’m doing is setting up the relationships between variables, and then, only at the very end, I’m requesting a value to print. Once that value is requested, Haskell works backwards to resolve all the dependencies and calculate the necessary intermediate values to give me what I wanted to print out.
Another thing that I found really interesting was that all the functions were pure. There were no global variables in the background being manipulated, nor any object state. It was pure functions with no side effects. It practically eliminates runtime errors, and it feels good too.
- module lab6Haskell
- where
- upperBound = 99999
- lowerBound = 10000
- myPrimes = filter (>=lowerBound) (primes upperBound)
- grouped = group myPrimes
- -- This will return an example of the largest size of prime permutation group
- mostCommon = foldr (myMax) (0, []) grouped
- main = putStrLn (show mostCommon)
- -- for testing, compile with profiling:
- -- ghc --make Main.hs -prof -fprof-auto -o Main.exe
- -- main.exe +RTS -p
- -- prime generator
- primes n = sieve [2..n]
- where
- sieve [] = []
- sieve (p:xs) = p : sieve (filter (\x -> mod x p /= 0) xs)
- -- provided quicksort
- quicksort :: (Ord a) => [a] -> [a]
- quicksort [] = []
- quicksort (x:xs) =
- let smallerSorted = quicksort [a | a <- xs, a <= x]
- biggerSorted = quicksort [a | a <- xs, a > x]
- in smallerSorted ++ [x] ++ biggerSorted
- -- key generator
- key n = quicksort (show n)
- -- grouping digits (This one is the time killer.)
- group [] = []
- group (x:xs) =
- let matches = [e | e <- xs, key x == key e]
- others = group ( [e | e <- xs, key x /= key e] )
- in (length matches + 1, x : matches) : others
- -- sorting criteria
- myMax a b =
- if fst a > fst b
- then a
- else b
Another cool thing about Haskell is that it comes with a fancy profiler. I ran it on my program and it gave me this as the result:
All in all it was a really insightful exploration into another programming language.
JavaScript
JavaScript is written to do the same thing as C++, but instead of using a bitset, it generates a list of primes. That means each prime is a Number and not a single bit. What JavaScript does bring to the table to is integration with HTML, and the ability to easily make the code visually interactive, with a GUI.
- //This is meant to find the largest cluster
- // of 7 digit primes that are all permutations
- // of each other.
- function getPrimes(upperBound, lowerBound) {
- isPrime = []
- isPrime.length = upperBound
- for (i=0; i < upperBound; ++i) {
- isPrime[i] = true;
- }
- limit = Math.ceil(Math.sqrt(10));
- for (i = 2; i < isPrime.length; ++i) {
- if (isPrime[i] == true) {
- for (j = i*i; j < upperBound; j += i) {
- isPrime[j] = false;
- }
- }
- }
- primes = []
- for (i = 2; i < isPrime.length; ++i) {
- if (isPrime[i] == true && i > lowerBound) {
- primes.push(i);
- }
- }
- return primes
- }
- function getKey(n) {
- key = 0
- while (n > 0) {
- key += Math.pow(10, (n%10))
- n = Math.floor(n / 10)
- }
- return key
- }
- function getPrimePermutations() {
- primes = getPrimes(document.getElementById("upperBound").value, document.getElementById("lowerBound").value);
- // group primes by permutations
- matches = {}
- for (i in primes) {
- if (typeof matches[getKey(primes[i])] === "undefined") {
- matches[getKey(primes[i])] = [primes[i]];
- } else {
- matches[getKey(primes[i])].push(primes[i]);
- }
- }
- // find the highest count of prime permutations
- // and all digits that match that count
- max = [[]]
- for (i in matches) {
- if (matches[i].length > max[0].length) {
- max = [matches[i]]
- } else if (matches[i].length == max[0].length) {
- max.push(matches[i])
- }
- }
- document.getElementById("result").innerHTML="
Max length: " + max[0].length + " primes

Number of matches: " + max.length + "
";
- result = "
";
- for (i in max) {
- result += "
" + max[i] + "
";
- }
- result += "
"
- document.getElementById("values").innerHTML=result;
- }
It takes several seconds to calculate the answer for 7 digits, considerably slower than the C++ version, but not as much slower as I expected. I was pleasantly surprised!
PowerShell
It took a little bit to wrap my head around PowerShell being built for piping commands into commands, but it is actually really cool, and powerful. I had a working product in PowerShell faster than in any other language.
- Function GetKey ($n)
- {
- $key = 0
- while ($n -gt 0)
- {
- $key += [Math]::Pow(10, $n % 10)
- $n = ([Math]::Floor($n / 10))
- }
- return $key
- }
- Function GetFilteredPrimes
- {
- Param ([int]$upper, [int]$lower)
- $primes = (0..($upper))
- $result = @()
- for ($i = 2; $i -lt $upper; ++$i)
- {
- if ($primes[$i] -ne 0)
- {
- if ($primes[$i] -ge $lower)
- {
- $result += $i
- }
- for ($j = $i*$i; $j -le $upper; $j += $i)
- {
- $primes[$j] = 0
- }
- }
- }
- return $result
- }
- GetFilteredPrimes<PHONE_NUMBER>00 | Group-Object {getkey($_)} | Sort-Object Count | Select -Last 1
I was not patient enough to see how long it would take to calculate the 7-digit number, but 6 digits took about 4 minutes. Getting the primes was the most expensive part at 3 minutes, and grouping them took a minute more. I read a little about how to profile and optimize, but did not get far. I read that using things like [Math]::Pow() load up C# libraries, but avoiding C# did not appear to make a difference to computation times. Interesting experiment, and PowerShell is kind of fun, but I don’t have need for its strengths right now.
Python
Python is a favorite of mine, so naturally I wrote up the program here too.
- import math
- def main():
- primes = getPrimes(10000000, 1000000)
- matches = {}
- # group primes by permutations
- key = 0
- for prime in primes:
- key = getKey(prime)
- if key in matches:
- matches[key].append(prime)
- else:
- matches[key] = [prime]
- # find the highest count of prime permutations
- # and all digits that match that count
- max = [0, []]
- for match in matches.items():
- if len(match[1]) > max[0]:
- max[0] = len(match[1])
- max[1] = [match]
- elif len(match[1]) == max[0]:
- max[1].append(match)
- # report the answer, and all prime permutations
- print("max: %d permutations. (%d matches)" % (max[0], len(max[1])))
- for i in max[1]:
- print("%d:" % i[0], i[1])
- def getKey(n):
- key = 0
- while n > 0:
- key += 10 ** (n%10)
- n //= 10
- return key;
- def getPrimes(maxVal, minVal=0):
- primes = list(range(maxVal))
- limit = int(math.ceil(maxVal ** 0.5) + 1)
- for i in primes[2:limit]:
- if i != 0:
- for j in range(i*i, maxVal, i):
- primes[j] = 0
- return [i for i in primes if i != 0 and i > minVal]
- if __name__ == "__main__":
- main()
Python 2.7.6 and 3.3.3 both took about 10 seconds to calculate the result. I confess I'm a little upset that it's not running faster than the javascript edition. I like python, and may have to fiddle with this to improve it.


You got introduced to someone. I'll bet it was better than a seaside holiday, right? Let me know how it went so that I can do a better job in the future.


Win Probability from the Point Differential
2020-12-11
3 minutes
Most people model win/loss as binary in situations where win/loss is calculated in a non-binary way (e.g. in sports). But you lose a lot of information by labeling a win as binary instead of as its point differential. It’s better to model the point differential directly and then map that to a probability (which you can then label as win/loss).
For example, if your point differential follows the normal distribution you can use the normal CDF to map that score to a probability.  For a given standard deviation $\sigma$, the probability that the score differential $x$ is less than or equal to 0 is $\Phi(x, 0, \sigma)$. This is the probability that the home team loses the game. So $1-\Phi(x, 0, \sigma)$ is the probability that the home team wins the game.
But what do we do about $\sigma$? One option would be to fix it to a given value, but this means the score differential uncertainty at the end of the game would be treated similarly to the score differential at the beginning of the game. But that doesn’t really match reality. We know that the win probability for a team with the leading score with a minute left on the clock has higher certainty than the win probability associated with the same score at the very beginning of the game.
In order to capture this we can allow $\sigma$ to take on larger values earlier on in the game and smaller values towards the end of the game. Intuitively this makes sense. We are more certain about what the win probability should be towards the end of a game than at the beginning.
To do this mathematically we need to model $\sigma$ as a function of time. For example, in an NBA regulation basketball game (which lasts 48 minutes) we could define $\sigma = (48-t)^{0.5}$, where $t$ is the number of minutes that have elapsed in the game.
The choice of exponent depends on the application. Here we choose to take the square root of how many minutes are left in a regulation game. The exponent determines the uncertainty so that you’re not dealing with time directly (minutes in this case), but rather a transformation of time. This prevents you from having excessively large values for $\sigma$. For each point in time, the closer the exponent is to 1 then the more uncertainty there is in win probability and the closer the exponent is to 0 the more certainty there is in the win probability.
The graphic below (Python code follows) illustrates this result for a fixed score differential at varying time points in the game and with varying exponent values (0.2, 0.5, 0.8). The score differential is fixed at 3 (which, in this case, is interpreted as a 3 point lead for the home team). You can see how at different points in time a lower exponent value results in a relatively smaller standard deviation, which in turn results in a win probability closer to 1.
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
t = np.arange(0, 48, step=1)
def sd(time_elapsed, exponent):
result = (48 - time_elapsed)**exponent
return(result)
def win_prob(pt_diff, sd):
return(norm.cdf(pt_diff, 0, sd))
a = sd(t, 0.2)
b = sd(t, 0.5)
c = sd(t, 0.8)
wp_a = win_prob(3, a)
wp_b = win_prob(3, b)
wp_c = win_prob(3, c)
plt.figure(figsize=(7,10))
plt.subplot(2,1,1)
plt.title('Transformed Standard Deviation')
plt.xlabel('Time')
plt.ylabel('Standard Deviation')
plt.plot(t, a, lw=2, color='#8fb9a8', label='0.2')
plt.plot(t, b, lw=2, color='#fcd0ba', label='0.5')
plt.plot(t, c, lw=2, color='#765d69', label='0.8')
plt.legend(title='sd')
plt.subplot(2,1,2)
plt.title('Win Probability')
plt.xlabel('Time')
plt.ylabel('Win Probability')
plt.ylim(0,1.1)
plt.plot(t, wp_a, lw=2, color='#8fb9a8', label='0.2')
plt.plot(t, wp_b, lw=2, color='#fcd0ba', label='0.5')
plt.plot(t, wp_c, lw=2, color='#765d69', label='0.8')
plt.legend(title='sd', loc='lower right')
plt.savefig('./win_prob.svg', format='svg')
plt.close()
619 Words


Overview
Session
Establish or Modify Your Session
Signup
or
Login
Welcome
?
!
Logout
Welcome
?
!
Setup more admins
or
Logout
Welcome to Admin Party!
Everyone is admin.
Fix this


{% if title %}
"Autism doesn't comes with a manual,It comes with a parent that never gives up"
-Team AutismAI


Artificial-turf fibres foul creek, forces closing of Oak Bay High sports field
by Richard WattsThe artificial-turf field at Oak Bay High School has been covered and closed to prevent more artificial grass strands from washing into nearby Bowker Creek.
Kim Morris, secretary treasurer of the Greater Victoria School District, said the decision was made Monday to close and cover the soccer pitch to prevent further material from escaping.
The field, opened three years ago as a “state of the art” artificial turf, will be replaced under warranty in the spring, Morris said.
The field’s closing means community users, especially minor-league soccer teams, will lose a venue.
Morris said the school district is working with community groups to see if use of replacement fields can be arranged.
She said the school district was alerted on Friday that the field was shedding artificial-grass fibres and other non-biodegradable material, which was being washed into the storm-water system and Bowker Creek.
Investigations over the weekend confirmed the shedding was happening.
Soren Henrich, chairman of the Friends of Bowker Creek, called the latest example of the field’s material breaking down unfortunate. Henrich said when the field was first installed, it was shedding small plastic pellets.
“The whole idea of putting plastic so close to the creek doesn’t sound like a great idea, especially without any provisions for filtering and keeping material out of the creek.”
Henrich credited the school district with installing guards to direct runoff water around the school grounds and designing appropriate drainage for all fields prior to the rebuilt school’s re-opening in 2015. “There was a lot of good things done during the rebuilding of that school.”
Once seen as little more than an urban drainage ditch, Bowker Creek is now considered part of a natural ecosystem winding its way through an urban environment from the woods of the University of Victoria, through the Mount Tolmie and Cedar Hill neighbourhoods and into Oak Bay.
Henrich said community outreach and education and local-government initiatives have raised local knowledge of the creek.
“It’s like a ribbon park with access to nature and flowing water right in the city,” he said.


I first tried Mephedrone several months back, while the local MDMA supply was low. It came in several jiffy bags, but what was apparent was that even inside all these, the envelope stunk of it.
The first thing to hit me once I opened it, was just the sheer smell of it, far stronger than that of Amphetamine, and my initial thoughts were that I was never going to rail it. Boy was I wrong. The smell of it is really like ammonia, a really really strong chemical smell that you can't forget.
My first experience was bombing 150mg, and I was planning on staying in for the night to listen to music, etc. About 30 minutes after bombing it however, the sparkle and euphoria I normally get from MDMA was all around, and I decided to go hit a club, on my own.
 Effects wise, fairly euphoric, made me talk a lot, was stupidly horny, sweated A LOT - but I do that anyway on most stims, full of energy, and really loved music.
Compared to MDMA, similar euphoria (when bombed), far more hornyness, a bit less empathy, no psychadelia (although light tends to prism after several redoses, I think this is just a serotonin effect) - but what was amazing is that the next day, I felt brilliant, like I hadn't done anything the previous night. I would also compare it to speed and coke a little in its stimulating effects, which were far more than MDMA on its own.
After a couple of fun nights like this, I decided to try railing it, having really enjoyed the bombed effects. I set up a good 100mg line (the lines of this stuff are huge, and the stuff is awful to snort), and prepared to snort it in. As I got about half way along the line, the pain was so much that I had to stop. I literally staggered back, nose burning and eyes watering, and quickly went to the toilet, looking for tissue to blow it out into.  Within about 30 seconds of snorting it, I was much higher than I had ever been before, from experiences with pure MDMA, coke, a few research chems like Methylone. I bit my tongue within the first minute, I started gurning so fast.
The euphoria was absolutely crazy. I looked in the mirror, my eyes were saucers. I felt giddy from how amazing I felt. Stroking my arm was like having an orgasm. It was about as mindblowing as my first 'e'.
The crazyness was the pain to pleasure of it. It goes from being the most awful sharp pain, smelling like stinking piss, to the best I have ever felt, in about 30 seconds.
And I stay like that, for about 2/3 hours, and then suddenly come down, whack. The next day, I'm fine, but the sudden comedown of it is astounding. One moment I'm peaking quite high, then suddenly, its like someone turns the light off, and I have a desire to redose. When I redose, I get about 3/4 of the initial rush the first redose, 1/2 the next, 1/4 the next and nothing after that. I get a little more of a comedown the more I redose, and if I redose to the end, I feel quite bad at the end of the night but can't get to sleep. The next day is always fine however.
The stuff is dangerous in how much I can fiend it though. I can plan to just have a little line, and as soon as I get that first rush, I chase it all night trying to get that feeling back.
Every time snorted still feels like my first 'e' though, every breath I take is like it's my first.
I prefer it to 'e' as it has all the good effects, and minus the next day's hangover. Its brilliant especially for raving. However, the main downside, is how bad it tastes and smells, and how bad it is for my sinuses. I would compare snorting it to being kicked in the face by a horse. The drip is worse than the worst tasting food I can think of. But the strength of effects from snorting it are so ridiculously strong, its totally 100% worth it.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Simple project
- Add
{{tourStepTag}}
to your root app component
-
Define anchor points for the tour steps by adding the
tourAnchor
directive throughout your app.
-
Define your tour steps using
tourService.initialize(steps)
- Start the tour with
tourService.start()
- Check out the
demo
source code for an example.
Lazy loaded modules
-
Add
{{tourStepTag}}
to your root app component.
-
Import
{{moduleName}}.forRoot()
into your app module.
-
Import
{{moduleName}}
into all lazy loaded modules needing the tour.
-
Import the
TourService
in your highest level eagerly loaded component and initialize all your
steps there (even the ones in the lazy loaded modules).
Note:
Make sure every step object contains its route. For example, if the route to a step is '/home' then your step
object should have route: '/home'
as a member.
-
Define anchor points for your steps by adding the
tourAnchor
directive throughout your modules (any component that requires it at any level).
-
Start the tour with
tourService.start()
in the same component you initialized your steps. Call this right after the initialization.
- Check out the
demo source code for an example.


| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | 2× 5× 1× 11× 11× 2× 2× 2× 2× 1× 1× 1× 1× 9× 9× 9× 9× 9× 8× 8× 8× 8× 8× 8× 9× 5× 1× 1× 1× 3× 1× 1× 1× | pragma solidity ^0.4.18; import './MatryxOracleMessenger.sol'; import '../interfaces/IMatryxPlatform.sol'; import '../interfaces/factories/IMatryxTournamentFactory.sol'; import '../interfaces/IMatryxTournament.sol'; import './Ownable.sol'; /// @title MatryxPlatform - The Matryx platform contract. /// @author Max Howard -<EMAIL_ADDRESS>Sam Hessenauer -<EMAIL_ADDRESS>contract MatryxPlatform is MatryxOracleMessenger, IMatryxPlatform { address matryxTournamentFactoryAddress; address[] public allTournaments; mapping(address=>bool) tournamentExists; mapping(address=>address[]) entrantToTournamentArray; mapping(address=>address[]) authorToSubmissionArray; function MatryxPlatform(address _matryxTournamentFactoryAddress) public { matryxTournamentFactoryAddress = _matryxTournamentFactoryAddress; } /* * Events */ event TournamentCreated(address _owner, address _tournamentAddress, string _tournamentName, bytes32 _externalAddress, uint256 _MTXReward, uint256 _entryFee); event TournamentOpened(address _owner, address _tournamentAddress, string _tournamentName, bytes32 _externalAddress, uint256 _MTXReward, uint256 _entryFee); event TournamentClosed(address _tournamentAddress, uint256 _finalRoundNumber, uint256 _winningSubmissionIndex); event QueryID(string queryID); /// @dev Allows tournaments to invoke tournamentOpened events on the platform. /// @param _owner Owner of the tournament. /// @param _tournamentAddress Address of the tournament. /// @param _tournamentName Name of the tournament. /// @param _externalAddress External address of the tournament. /// @param _MTXReward Reward for winning the tournament. /// @param _entryFee Fee for entering into the tournament. function invokeTournamentOpenedEvent(address _owner, address _tournamentAddress, string _tournamentName, bytes32 _externalAddress, uint256 _MTXReward, uint256 _entryFee) public onlyTournament(msg.sender) { TournamentOpened(_owner, _tournamentAddress, _tournamentName, _externalAddress, _MTXReward, _entryFee); } /// @dev Allows tournaments to invoke tournamentClosed events on the platform. /// @param _tournamentAddress Address of the tournament. /// @param _finalRoundNumber Index of the round containing the winning submission. /// @param _winningSubmissionIndex Index of the winning submission. function invokeTournamentClosedEvent(address _tournamentAddress, uint256 _finalRoundNumber, uint256 _winningSubmissionIndex) public onlyTournament(msg.sender) { TournamentClosed(_tournamentAddress, _finalRoundNumber, _winningSubmissionIndex); } /* * Modifiers */ modifier onlyTournament(address _sender) { Erequire(tournamentExists[_sender]); _; } /* * MTX Balance Methods */ /// @dev Prepares the user's MTX balance, allowing them to use the platform. /// @param _toIgnore Request bytes (deprecated). function prepareBalance(uint256 _toIgnore) public { // Make sure that the user has not already attempted to prepare their balance uint256 qID = fromQuerierToQueryID[msg.sender]; uint256 queryResponse = queryResponses[qID]; Erequire(queryResponse == 0x0); this.Query(bytes32(_toIgnore), msg.sender); } /// @dev Returns whether or not the user can use the platform. /// @return Whether or not user has a positive balance. function balanceIsNonZero() public view returns (bool) { uint balance = latestResponseFromOracle(msg.sender); return balance != 0; } /// @dev Returns the user's balance /// @return Sender's MTX balance. function getBalance() public constant returns (uint256) { uint256 balance = latestResponseFromOracle(msg.sender); return balance; } /* * Tournament Entry Methods */ /// @dev Enter the user into a tournament and charge the entry fee. /// @param _tournamentAddress Address of the tournament to enter into. /// @return _success Whether or not user was successfully entered into the tournament. function enterTournament(address _tournamentAddress) public returns (bool _success) { IMatryxTournament tournament = IMatryxTournament(_tournamentAddress); // TODO: Charge the user the MTX entry fee. bool success = tournament.enterUserInTournament(msg.sender); Eif(success) { updateMyTournaments(msg.sender, _tournamentAddress); } return success; } /* * Tournament Admin Methods */ /// @dev Create a new tournament. /// @param _tournamentName Name of the new tournament. /// @param _externalAddress Off-chain content hash of tournament details (ipfs hash) /// @param _MTXReward Total tournament reward in MTX. /// @param _entryFee Fee to charge participant upon entering into tournament. /// @return _tournamentAddress Address of the newly created tournament function createTournament(string _tournamentName, bytes32 _externalAddress, uint256 _MTXReward, uint256 _entryFee) public returns (address _tournamentAddress) { IMatryxTournamentFactory tournamentFactory = IMatryxTournamentFactory(matryxTournamentFactoryAddress); address newTournament = tournamentFactory.createTournament(msg.sender, _tournamentName, _externalAddress, _MTXReward, _entryFee); TournamentCreated(msg.sender, newTournament, _tournamentName, _externalAddress, _MTXReward, _entryFee); // update data structures allTournaments.push(newTournament); tournamentExists[newTournament] = true; return newTournament; } function updateMyTournaments(address _author, address _tournament) internal { entrantToTournamentArray[_author].push(_tournament); } function updateMySubmissions(address _author, address _submission) public onlyTournament(msg.sender) { authorToSubmissionArray[_author].push(_submission); } /* * Access Control Methods */ /// @dev Returns whether or not the given tournament belongs to the sender. /// @param _tournamentAddress Address of the tournament to check. /// @return _isMine Whether or not the tournament belongs to the sender. function getTournament_IsMine(address _tournamentAddress) public constant returns (bool _isMine) { Erequire(tournamentExists[_tournamentAddress]); Ownable tournament = Ownable(_tournamentAddress); return (tournament.getOwner() == msg.sender); } /// @dev Returns the total number of tournaments /// @return _tournamentCount Total number of tournaments. function tournamentCount() public constant returns (uint256 _tournamentCount) { return allTournaments.length; } function getTournamentAtIndex(uint256 _index) public constant returns (address _tournamentAddress) { Erequire(_index >= 0); Erequire(_index < allTournaments.length); return allTournaments[_index]; } /* * Getter Methods */ /// @dev Returns addresses for submissions the sender has created. /// @return Address array representing submissions. function myTournaments() public constant returns (address[]) { return entrantToTournamentArray[msg.sender]; } function mySubmissions() public constant returns (address[]) { return authorToSubmissionArray[msg.sender]; } } |


Crude Oil Price and Forecast: WTI traders take clues from US-China tensions, OPEC+ eyed
by Yohay ElamWTI traders take intermediate clues from US-China tension ahead of OPEC+ meeting
WTI has been dropping to the intra-day low of $58.07 by the press time of early Friday in Asia. The energy benchmark seems to have negatively affected by the sluggish demand outlook due to the US-China tussle. Though, traders are more concerned for the next week’s meeting of major oil producers in Vienna.
Geopolitical tension concerning Iran can be considered as a counterforce to the latest tension between the United States (US) and China. Iran’s protests, even after turning softer, still give troubles to the policymakers and they blame the US for that, as per the UK Express. Read more…
| Overview | |
|---|---|
| Today last price | 58.09 |
| Today Daily Change | -0.23 |
| Today Daily Change % | -0.39% |
| Today daily open | 58.32 |
| Trends | |
|---|---|
| Daily SMA20 | 57.29 |
| Daily SMA50 | 55.78 |
| Daily SMA100 | 55.93 |
| Daily SMA200 | 57.64 |
| Levels | |
|---|---|
| Previous Daily High | 58.32 |
| Previous Daily Low | 57.69 |
| Previous Weekly High | 58.76 |
| Previous Weekly Low | 54.89 |
| Previous Monthly High | 56.97 |
| Previous Monthly Low | 51.19 |
| Daily Fibonacci 38.2% | 58.08 |
| Daily Fibonacci 61.8% | 57.93 |
| Daily Pivot Point S1 | 57.9 |
| Daily Pivot Point S2 | 57.48 |
| Daily Pivot Point S3 | 57.27 |
| Daily Pivot Point R1 | 58.53 |
| Daily Pivot Point R2 | 58.74 |
| Daily Pivot Point R3 | 59.16 |
WTI: Choppy around $58 amid slow Black Friday trading
WTI (oil futures on NYMEX) continues to fluctuate between gains and losses so far this Black Friday, as the sentiment remains mixed amid holiday-mode thin trading and ahead of the key OPEC+ meeting scheduled next week.
The black gold lacks directional bias at the moment, with the buyers somewhat hopeful about the output cuts being extended into the next year, when the OPEC and its allies (OPEC+) meet in Vienna on Dec. Read more...
WTI Levels to watch
WTI
| Overview | |
|---|---|
| Today last price | 58.01 |
| Today Daily Change | -0.30 |
| Today Daily Change % | -0.51 |
| Today daily open | 58.32 |
| Trends | |
|---|---|
| Daily SMA20 | 57.29 |
| Daily SMA50 | 55.78 |
| Daily SMA100 | 55.93 |
| Daily SMA200 | 57.64 |
| Levels | |
|---|---|
| Previous Daily High | 58.32 |
| Previous Daily Low | 57.69 |
| Previous Weekly High | 58.76 |
| Previous Weekly Low | 54.89 |
| Previous Monthly High | 56.97 |
| Previous Monthly Low | 51.19 |
| Daily Fibonacci 38.2% | 58.08 |
| Daily Fibonacci 61.8% | 57.93 |
| Daily Pivot Point S1 | 57.9 |
| Daily Pivot Point S2 | 57.48 |
| Daily Pivot Point S3 | 57.27 |
| Daily Pivot Point R1 | 58.53 |
| Daily Pivot Point R2 | 58.74 |
| Daily Pivot Point R3 | 59.16 |


Why choose us
Mordern design
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Unique Quality
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Mordern design
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Great support
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Our collection
-
Corona chair
Printed evening dress with straight sleeves
$14.86 -
Corona chair
Printed evening dress with straight sleeves
$14.86 -
Corona chair
Printed evening dress with straight sleeves
$14.86 -
Corona chair
Printed evening dress with straight sleeves
$14.86 -
Corona chair
Printed evening dress with straight sleeves
$14.86 -
Corona chair
Printed evening dress with straight sleeves
$14.86 -
Corona chair
Printed evening dress with straight sleeves
$14.86 -
Corona chair
Printed evening dress with straight sleeves
$14.86
Our-designer
Bertil Stam
Janet Park
Wm Munoz
Our-Project
From our blog
-
Our new work space
Feel alive! So if you’re looking for, here is a list of some of the most popular and fiestas the Mardin has to offer thisfiestas the Mardin has to offer!
Read more -
Modern trand collection
Feel alive! So if you’re looking for, here is a list of some of the most popular and fiestas the Mardin has to offer thisfiestas the Mardin has to offer!
Read more -
A woman thinking
Feel alive! So if you’re looking for, here is a list of some of the most popular and fiestas the Mardin has to offer thisfiestas the Mardin has to offer!
Read more


From Greg Ross at Futility Closet, I learn that an eriff is a two-year-old canary. Why there should be a specific word for a two-year-old canary is a deep and abiding mystery, at least to me.
And Thomas Nashe, in his Lenten Stuff, suggests that another name for a kestrel is a windfucker.


The server Encountered an Error and could not complete your request.
We are looking into this problem!
lets get you home


{% extends 'conducting/conducting.html' %} {% load static %} {% block javascript %} {% endblock javascript %} {% block tab_content %} {% include "conducting/conducting_header.html" with active_tab="quality" %}
There are a few steps you have to finish before assess the quality of the studies:


Individual Report
Your usage amount
{{ ind_mean }} kWh (Your predicted usage)
{{ user_mean }} kWh (Your actual usage)
Your usage grade
{{ ind_grade }}
{% if ind_grade == "A" %}
Why you got an A
You were in the top 20% percentile.
{% elif ind_grade == "B" %}Why you got a B
You were in the top 50% percentile.
{% elif ind_grade == "C" %}Why you got a C
You were in the top 80% percentile.
{% else %}Why you got an D
You were in the bottom 20% percentile.
{% endif %}Individual vs Community Energy Usage
Individual vs National Energy Usage
Community Report
Community vs National Energy Usage
Your community: {{ puma_name }}


Your boards on any webpage. Save pictures, links, text. Write messages and get notifications.
Sign Up on Mammoth
Already have an account? Sign In


--- layout: post title: Bing doesn’t defeat Google yet… date: 2009-08-01 13:10:04.000000000 +02:00 categories: [] tags: - Bing - Google - Search Engine status: publish type: post published: true meta: {} author: login: admin email<EMAIL_ADDRESS>display_name: Philippe first_name: Philippe last_name: Vlérick excerpt: !ruby/object:Hpricot::Doc options: {} ---
Two month ago, I set Bing as my default search engine in Chrome. I did this after reading one of Scott Hanselman’s blog post. The idea was to give the new Microsoft search engine a try, see if it could handle my daily needs.
During the first month, everything went right, I didn’t have to go back to Google once as far as I remember.
However, for the last few weeks, I had to go back to Google for some searches… I’m sure you know the feeling. You search for something on a search engine that is not Google, and when you look at the results you feel like something is hidden from you. Then you head to Google, try the same keywords, and get exactly what you were looking for.
I’m a bit disappointed. I really liked Bing’s overall look and feel, the changing background image, and the fact that it was a competitor to Google supremacy. I thought they finally put together a good search algorithm. In fact they are quite close, but not there yet.
I’ll give it another try in a few months, but for now I’m back to Google.


Provault is committed to protecting your privacy. We have prepared this Privacy Policy to describe to you our practices regarding the Personal Data (as defined below) we collect from users of our site, located at www.getPhotohub.com ("Site") and mobile application ("App") and our Service (as defined in the Terms of Service). Capitalized terms not defined in this Privacy Policy have the meanings given in our Terms of Service.


This is solely build to attract the users of cloud and provide them with a chance to get free cloud services from IBM bluemix Cloud for 2 years.


<< Previous Session
|
Next Session >>
Assessment - Lecture Quiz
Lecture 11: Behavioral Finance and the Role of Psy
1
.
Adam Smith in The Theory of Moral Sentiments from 1776 emphasizes that people's actions are not completely driven by selfishness, but by another important motive. What is this motive?
Points = 2.0
The Antisocial Personality Disorder.
A desire for praiseworthiness.
Social contagion.
Cognitive dissonance.
2
.
Which of the following components are not part of Daniel Kahneman's and Amos Tversky's Prospect Theory?
(More than one answer may apply.)
Points = 2.0
A value function that evaluates the outcome of the different prospects.
A value function that is concave in gains and convex in losses, with a kink at the reference point that separates the gains- from the loss-region.
An overconfidence-factor that is directly applied to the value function in the loss-region.
A probability weighting function that overvalues small probabilities and undervalues probabilities close to one.
3
.
Which of the following phenomena are attributable to overconfidence?
(More than one answer may apply.)
Points = 2.0
The tendency for people to think that they have very smart friends.
The tendency to think that CEOs are geniuses.
The fact that only between 5 and 10% of the students in the class had the correct weight of the earth within their 90% confidence interval.
The tendency to avoid anything that you might regret later.
4
.
Sendhil Mullainathan and his co-authors conducted an experiment, in which they sent actors to financial advisors. They found that the financial advisors did not challenge the assumptions that supposedly made these "clients" put all their money in one kind of investment. Which psychological phenomenon has been cited to be responsible for this behavior?
Points = 2.0
The financial advisors did not want to stir up cognitive dissonance feelings in their "clients".
The financial advisors were overconfident about their own ability as financial advisors.
The financial advisors were influenced by Kahneman's and Tversky's probability weighting function, which lead them to overweight very small probabilities.
The financial advisors suffered from Antisocial Personality Disorder.
5
.
What is the main point of Anna Bernasek's Economics of Intergrity?
Points = 2.0
She outlines that a sense of personal integrity has dominated what people do in the business world much more than we thought recently.
She points out that that the manager of a company shouldn't be underestimating the importance of shared value creation with society.
She states that most of the things that happen in life are just chance.
She claims that there's a tendency for people to think that CEOs are geniuses.
Status
Submit
Close


1 instantiation of InternalHost
System.Management.Automation (1)
engine\ExecutionContext.cs (1)
1569
EngineHostInterface = hostInterface as InternalHost ?? new
InternalHost
(hostInterface, this);
20 references to InternalHost
System.Management.Automation (20)
engine\CommandBase.cs (2)
174
Diagnostics.Assert(_context.EngineHostInterface is
InternalHost
, "context.EngineHostInterface is not an InternalHost");
175
_CBhost = (
InternalHost
)_context.EngineHostInterface;
engine\ExecutionContext.cs (3)
690
internal
InternalHost
EngineHostInterface
702
internal
InternalHost
InternalHost
1569
EngineHostInterface = hostInterface as
InternalHost
?? new InternalHost(hostInterface, this);
engine\hostifaces\InternalHost.cs (1)
42
Dbg.Assert(externalHost is not
InternalHost
, "try to create an InternalHost from another InternalHost");
engine\hostifaces\InternalHostRawUserInterface.cs (2)
15
InternalHostRawUserInterface(PSHostRawUserInterface externalRawUI,
InternalHost
parentHost)
613
private readonly
InternalHost
_parentHost;
engine\hostifaces\InternalHostUserInterface.cs (2)
19
InternalHostUserInterface(PSHostUserInterface externalUI,
InternalHost
parentHost)
1024
private readonly
InternalHost
_parent = null;
engine\hostifaces\LocalPipeline.cs (2)
564
InternalHost
internalHost = InvocationSettings.Host as
InternalHost
;
engine\MshCommandRuntime.cs (2)
39
internal
InternalHost
CBhost;
104
this.CBhost = (
InternalHost
)context.EngineHostInterface;
engine\remoting\commands\InvokeCommandCommand.cs (2)
1367
System.Management.Automation.Internal.Host.
InternalHost
chost =
1368
this.Host as System.Management.Automation.Internal.Host.
InternalHost
;
engine\remoting\commands\PushRunspaceCommand.cs (2)
252
System.Management.Automation.Internal.Host.
InternalHost
chost =
253
this.Host as System.Management.Automation.Internal.Host.
InternalHost
;
engine\remoting\common\WireDataFormat\RemoteSessionCapability.cs (2)
441
else if (host is
InternalHost
)
444
host = ((
InternalHost
)host).ExternalHost;


Here's what's new in Release 1.1.1 (20 October 2017):
Bug fixes
Fixed a bug with apostrophe characters. PixieApps can now publish to the web with aposthrophes in the the page's title. Previously, using an apostrophe within the page title field of a PixieApp's Publish Configuration dialog ( example ) would cause the web publishing process to fail ( #464 ).
Enhancements
An alpha release of
PixieDust chart sharing
is now live. PixieDust's
display()
function has long been a key feature of the library, allowing developers to automatically render charts from DataFrames. Now, PixieDust-rendered charts have been extended to automatically publish as web pages at the click of a button.
See the announcement blog
for more details (
#474
).


@* * Call the `main` template with two arguments. The first * argument is a `String` with the title of the page, the second * argument is an `Html` object containing the body of the page. *@ @main("Tips") {
#1 Can You Commit?
 Will you remember to exercise your cat every evening?
Get to know the breed you are interested in and be open to changing your mind if it doesn’t fit your ability to provide for its temperament. Ask lots of questions from the people adopting the animal out, maybe even find a breed specific group to ask questions of some of the members. A great example is the recent Chihuahua craze. Sure, they’re adorable and can live in any size home, and they’re very low maintenance. The catch is that they are not usually very tolerant of children and are one of the breeds that are known for biting children without much provocation. A pet cat should also match your personality. Some cats, for instance, require a lot of attention and interaction while others are mostly independent. Do your research and choose wisely.
#3 Make Your Home Pet-Friendly
Did you know that something as simple as chewing gum can be deadly for dogs, or that ibuprofen is toxic to cats? It is highly important to go through your home now, before you bring a new pet home, to search out hazards and get them out of the way or out of the house. This includes cabinets at pet level, counter tops, bottles of chemical on the floor, small toys, electric cords and curtain cords. And it doesn’t stop there. You will also need to check your home and yard for toxic plants for dogs or cats, and if you carry a purse or bag, you will need to find and discard any potential dangers – like sugar-free gum, which often contains xylitol.
#4 Choose an Age and Breed Appropriate Food
Not all pet foods are alike. Some are better than others, and some make claims that are not always backed by facts. It would be easy to just grab the pet food bag or can with the nicest design on the cover, but that is not what is going to guarantee our pets’ long term health. Choose the best food for your dog or cat and always look for a diet labeled complete and balanced. From the time they are young until the time they are seniors, your pet food choices should be guided by the pet’s specific needs, life stage, and lifestyle. You can do some cursory research to get a good idea of why it is important and what to look for, but for the best advice, consult your veterinarian.
#5 Train Your Pet
If your happy home is going to remain a happy home, the housetraining will need to start immediately after bringing your pet home. If you are adopting a kitten, introduce him to his litterbox as soon as you get him inside. If it is a puppy, leash him up and take him outside to start getting to know his neighborhood. Most puppies will be intimidated by their new surrounding, and you don’t want to put a fright into your puppy. A very short walk on the first outing is all that is needed. Begin training on that first outing. When the puppy relieves himself outside, while he is doing it say, “Go now.” Repetition of this command will eventually make it so that you will be able to take your dog out in any kind of weather without worrying about how long your dog will take to relieve himself.


Scheduled Server Downtime 28.05.2015 13:00 UTC+2 - Better Battlelog Forums #140009
Sitemap
27. May 2015 16:48
Topicstarter
BrainFooLong
Administrator
The maintenance will take place on Thursday, 28th of May 2015 at 13:00 UTC+2.
The offtime is expected to last no longer than 30 to 60 minutes.
Greetz Roland


WAL-PHED- pseudoephedrine hydrochloride tablet, film coated
WALGREEN CO.
Disclaimer: Most OTC drugs are not reviewed and approved by FDA, however they may be marketed if they comply with applicable regulations and policies. FDA has not evaluated whether this product complies.
if you are now taking a prescription monoamine oxidase inhibitor (MAOI) (certain drugs for depression, psychiatric or emotional conditions, or Parkinson's disease), or for 2 weeks after stopping the MAOI drug. If you do not know if your prescription drug contains and MAOI, ask a doctor or pharmacist before taking this product.
| adults and children 12 years and older |
take 2 tablets every 4 to 6 hours; do not take more than 8 tablets in 24 hours |
| children ages 6 to 12 years | take 1 tablet every 4 to 6 hours; do not take more than 4 tablets in 24 hours |
| children under 6 years | do not use this product in children under 6 years of age |
croscarmellose sodium, dicalcium phosphate, FD&C red #40 aluminum lake, FD&C yellow #6 aluminum lake, hypromellose, magnesium stearate, microcrystalline cellulose, polydextrose, polyethylene glycol, silica gel, titanium dioxide, triacetin
Well at
Walgreens
WALGREENS PHARMACIST RECOMMENDEDǂ
NDC 0363-0112-22
NON-DROWSY
MAXIMUM STRENGTH
Wal-Phed®
D Nasal Decongestant
Pseudoephedrine HCl 30 mg
• Relieves sinus pressure & congestion
48 TABLETS
Actual Size
Compare to Sudafed® Congestion
active ingredientǂǂ
DOES NOT CONTAIN GLUTEN
ǂWalgreens Pharmacist Survey Study, November 2010.
ǂǂThis product is not manufactured or distributed by McNeil Consumer Healthcare, owner of the registered trademark Sudafed® Congestion.
50844 REV0712B11222
DISTRIBUTED BY: WALGREEN CO.
200 WILMOT RD., DEERFIELD, IL 60015
Walgreens
100%
SATISFACTION
GUARANTEED
walgreens.com ©2012 Walgreen Co.
TAMPER EVIDENT: DO NOT USE IF CARTON IS OPENED OR IF BLISTER UNIT IS TORN, BROKEN OR SHOWS ANY SIGNS OF TAMPERING
Walgreens 44-112
|
WAL-PHED
pseudophedrine hcl tablet, film coated | ||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
|
| Labeler - WALGREEN CO. (008965063) |
| Establishment | |||
| Name | Address | ID/FEI | Business Operations |
|---|---|---|---|
| LNK International, Inc. | 832867894 | MANUFACTURE(0363-0112) |
| Establishment | |||
| Name | Address | ID/FEI | Business Operations |
|---|---|---|---|
| LNK International, Inc. | 038154464 | PACK(0363-0112) |


This section specifies the interaction between MPI calls and threads. The section lists minimal requirements for thread compliant MPI implementations and defines functions that can be used for initializing the thread environment. MPI may be implemented in environments where threads are not supported or perform poorly. Therefore, MPI implementations are not required to be thread compliant as defined in this section. Regardless of whether or not the MPI implementation is thread compliant, MPI_INITIALIZED, MPI_FINALIZED, MPI_QUERY_THREAD, MPI_IS_THREAD_MAIN, MPI_GET_VERSION and MPI_GET_LIBRARY_VERSION must always be thread-safe. When a thread is executing one of these routines, if another concurrently running thread also makes an MPI call, the outcome will be as if the calls executed in some order.
This section generally assumes a thread package similar to POSIX threads [39], but the syntax and semantics of thread calls are not specified here --- these are beyond the scope of this document.


Reports lambdas whose body is an expression and suggests converting expression bodies to code blocks.
Example:
n -> n + 1
After the quick-fix is applied:
n -> { return n + 1; }


|
||||||||||
| PREV LETTER NEXT LETTER | FRAMES NO FRAMES |
Album.java
) sorted without duplicates.
ListView
.
FormFillLib
in order to
process the results of the dialog
semantics
with the semantic.
processResultsFromStatistical
.
initiateQuery
|
||||||||||
| PREV LETTER NEXT LETTER | FRAMES NO FRAMES |


Home
(current)
Tutorial
About
FAQ
{% if request.user.is_authenticated %}
My Repositories
My Repositories
My Published Ontologies
Status (last run)
Past Jobs (see what is going on)
Syntax Validator
{%if manager%}
Profile
{%endif%}
Logout
{%else%}
Login through Github
{%endif%}
{%block body%} {%endblock%}
{%block slim%} {%endblock%}


Your Books
You don't have any books in use.
Title
Author
Release Year
Edition
Return Date
Fine
Times Extended
Extend


Perform queries on collections in the manner of C#s System.Linq in JavaScript
Collections of values are common objects to deal with in JavaScript. The most widespread Collection is by far the Array, allowing us to store data in an easy manner: [1, 2, 'hello world', new Date()]
. Now, with ES6 we got the iterable interface, which enables even Strings to get iterated over (interpreted as an array of chars). Additionally, we were gifted with new ways of storing data: Maps and Sets are two of them.
Common tasks a JavaScript developer performs on those Collections are accessing specific indices, checking weather or not a value is included, aggregating the values (sum, average, minimum etc.), split the Collection into parts or even grouping the values according to specific attributes.
System.Linq in C# is a great way to deal with operations alike. Unfortunately, JavaScript developers don't have tools such that. That's why you should start using linq.js starting today.
With npm installed, run
$ npm install linq.js
Let's see a (very basic) example of what is possible by querying collections using linq.js:
const Collection = require('linqjs');
const pets = [
{ Name: 'Barley', Age: 8, },
{ Name: 'Boots', Age: 1, },
{ Name: 'Whiskers', Age: 1, },
{ Name: 'Fluffy', Age: 2, },
];
Collection.from(pets)
.orderByDescending(p => p.Age)
.take(2)
.sum(p => p.Age);
This will yield
10
59 Methods aggregate, all, add, any, average, concat, conditionalWhere*, contains, count, defaultIfEmpty, distinct, elementAt, elementAtOrDefault, empty, except, first, firstOrDefault, flatten*, forEach, from, groupBy, groupJoin, indexOf*, insert, intersect, join, last, lastIndexOf, lastOrDefault, max, min, orderBy, orderByDescending, range, remove, repeat, reverse, select, selectMany, sequenceEqual, shuffle, single, singleOrDefault, skip, skipWhile, skipUntil*, sum, take, takeWhile, takeUntil*, thenBy, thenByDescending, toArray, toDictionary, toLookup, union, where, zip
* Not an original method of System.Linq but pretty awesome though
Including all possible methods/overloads
Our test cases include original examples taken from the System.Linq documentation, tending to support every edge case Linq does. For example, groupBy
allows you to use six different signatures.
Lazy-evaluation Most methods of C# Linq are lazy-evaluated and so are these methods in linq.js. In general all methods are as lazy as possible, meaning: Elements will only be evaluated if they are actually used somewhere. Elements are accessed (and therefore evaluated) under following conditions:
first
),toArray
),reverse
is used (sadly it has to evaluate the collection),For getting a idea of what that means and why it's useful, have a look at the example
const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
Collection.from(numbers)
.select(n => {
console.log(n);
return 2 * n;
})
.take(5)
.toArray();
The code will output [0, 2, 4, 6, 8]
, but, what's more interesting, will only log the numbers 0 to 4 to the console. That's because select
is implemented lazy; it will return a new Collection containing just the information of how to evaluate the values if requested (for instance using toArray
). It is worth mentioning that linq.js can even handle infinite sequences:
function * naturalNumbers () {
let i = 0;
while (true) yield i++;
}
Collection.from(naturalNumbers).take(5).toArray();
// -> [0, 1, 2, 3, 4]
Short-handed syntax for well-known iterables
const numbers = [1, 2, 3, 4, 5];
const m = new Map([['a', ['Abraham', 'Alabama']], ['s', ['Sven']]]);
// These are equal
Collection.from(numbers).Select(n => 2 * n).toArray();
numbers.select(n => 2 * n).toArray();
// So are those
m.select(x => x[1]).flatten().toArray();
Collection.from(m).select(x => x[1]).flatten().toArray();
Working with any kind of iterables
About 14kB minified, 4kB gzipped
linq.js supports a few scenarios for loading and using the module:
See the documentation for tips and an overview of available methods and signatures.
toJSON
method (use, e.g., JSON.stringify(collection.toArray())
).===
operator (use the custom comparator argument if a different behaviour is desired)../dist
now have an updated naming scheme.extendIterablePrototype
and extendNativeTypes
Methods for manual prototype patching).Please feel free to contribute! If you haven't installed gulp yet, you may need to install it by running
$ npm install -g gulp gulp-cli
Then you can clone and build linq.js:
$ git clone https://github.com/SvSchmidt/linqjs linqjs
$ cd linqjs
$ npm install
$ gulp
See the issues page for bugs and project goals. I also invite you to start a discussion.
I would be grateful if every new or changed code includes associated tests and appropriate typedoc notation. Thank you!
Generated using TypeDoc


Welcome to Sunny Pie Up Pizza!
Select an Option Below to Begin Ordering:
Single Meat + $2 / Double Meat + $4 /Mystery/Vegeetables +$1
Candle = $10 / Streetlight = $12 / Sunny = $14 / Supernova = $18
What Size?
Candle (Personal)
Streetlight (Med)
Sunny (Large)
Supernova (X-Large)
Please Select Your First Topping
None
Bacon
Vegee-tables ©
Mystery Meat
Pepperoni
Please Select Your Second Topping
None
Bacon
Vegee-tables ©
Mystery Meat
Pepperoni
Please Select Your Third Topping
None
Bacon
Vegee-tables ©
Mystery Meat
Pepperoni
Order Again? Select new options above to add!


--- title: (BFConceptsAPI) slugFromString keywords: documentation theme, jekyll, technical writers, help authoring tools, hat replacements last_updated: July 3, 2016 tags: [getting_started] sidebar: matlab_docs_sidebar permalink: bfconceptsapi_slugfromstring.html folder: mydoc ---
lowercase and strip of whitespace
| Access | public |
| Sealed | false |
| Static | true |