Writing a record to PouchDB is as simple as including a Javascript file in your HTML:
<script type="text/javascript" src="js/pouchdb-3.0.6.min.js"></script>
and writing a few lines of code
var db = new PouchDB("myfirstdatabase");
// parse BlueMix configuration from environment variables, if present | |
var services = process.env.VCAP_SERVICES, | |
url = require('url'), | |
http = require('http'), | |
credentials = null; | |
// load BlueMix credentials from environment | |
if(typeof services != 'undefined') { | |
services = JSON.parse(services); |
#!/bin/bash | |
# find the sensor_id by looking for a suitable device | |
sensorid=`find /sys/bus/w1/devices/* -type l | grep -o '[0-9]*-.*$' | head -n 1` | |
# extract temperature from file | |
filename="/sys/bus/w1/devices/$sensorid/w1_slave" | |
T=`tail -n 1 "$filename" | grep -o "[0-9]*$"` | |
# change units to celsius |
#!/bin/bash | |
DEST="mydb" | |
DOC="mydoc" | |
# create destination database | |
ccurl -X PUT "/$DEST" | |
# loop 1-->10 | |
for i in `seq 1 10`; do | |
A sheet of A4 weighs 0.005 kg and has an area of 0.06237m² (210mmx297mm). | |
The earth's area is 5.10072 × 10^14 m² | |
So a map, at 1:1 scale, would weigh: | |
5.10072 × 10^14 | |
--------------- x 0.005 | |
0.06237 | |
= 4.1 x 10^14 kg | |
or 410 billion tonnes |
Writing a record to PouchDB is as simple as including a Javascript file in your HTML:
<script type="text/javascript" src="js/pouchdb-3.0.6.min.js"></script>
and writing a few lines of code
var db = new PouchDB("myfirstdatabase");
# h1 | |
## h2 | |
### h3 | |
#### h4 | |
Lorem _ipsum_ __dolor__ *sit* **amet**, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. | |
* List item level 1 | |
* level 2 |
Apache CouchDB has started. Time to relax. | |
2015-02-05 08:57:50.553 [info] node1@127.0.0.1 <0.230.0> Apache CouchDB has started on http://127.0.0.1:15986/ | |
2015-02-05 08:57:50.556 [info] Undefined <0.7.0> Application couch started on node 'node1@127.0.0.1' | |
2015-02-05 08:57:50.559 [debug] Undefined <0.277.0> Supervisor rexi_sup started rexi_server:start_link(rexi_server) at pid <0.278.0> | |
2015-02-05 08:57:50.561 [debug] Undefined <0.277.0> Supervisor rexi_sup started rexi_server_sup:start_link(rexi_server_sup) at pid <0.279.0> | |
2015-02-05 08:57:50.563 [debug] Undefined <0.277.0> Supervisor rexi_sup started rexi_server_mon:start_link(rexi_server) at pid <0.280.0> | |
2015-02-05 08:57:50.566 [debug] Undefined <0.277.0> Supervisor rexi_sup started rexi_server_sup:start_link(rexi_buffer_sup) at pid <0.281.0> | |
2015-02-05 08:57:50.568 [debug] Undefined <0.279.0> Supervisor rexi_server_sup started rexi_server:start_link('rexi_server_node1@127.0.0.1') at pid <0.282.0> | |
2015-02-05 08:57:50.570 [debug] Undefined <0.277.0> Supervi |
#!/bin/bash | |
home=/home/pi/couchdb | |
/usr/bin/erl -args_file "$home/dev/lib/node1/etc/vm.args" -config "$home/rel/files/sys" -couch_ini "$home/dev/lib/node1/etc/default.ini" "$home/dev/lib/node1/etc/local.ini" -reltool_config "$home/rel/reltool.config" -parent_pid "$$" -pa "$home/dev" -pa "$home/src/*" -s boot_node | |
# gives error message | |
# {"init terminating in do_boot",{{error,{"no such file or directory","ioq.app"}},[{boot_node,start_app,3,[{file,"dev/boot_node.erl"},{line,134}]},{lists,foldl,3,[{file,"lists.erl"},{line,1261}]},{init,start_it,1,[]},{init,start_em,1,[]}]}} |
var cloudant = require("cloudant")("https://MYUSER:MYPASSWORD@MYUSER.cloudant.com"); | |
var obj = { | |
method: "POST", | |
path: "_api/v2/user/virtual_hosts", | |
body: { host: "vhost.glynnbird.com"} | |
}; | |
cloudant.request(obj, function(err, data) { | |
// null { ok: true } |
// Copyright (c) 2015-2016 Oraclize srl, Thomas Bertani | |
function parseInt(string _a, uint _b) internal returns (uint) { | |
bytes memory bresult = bytes(_a); | |
uint mint = 0; | |
bool decimals = false; | |
for (uint i = 0; i < bresult.length; i++) { | |
if ((bresult[i] >= 48) && (bresult[i] <= 57)) { | |
if (decimals) { | |
if (_b == 0) break; | |
else _b--; |