Length: 190 cm
Navel height: 114 cm
Ratio head/navel = 1.66667
Divergence from Phi: 1.66667 – 1.61803 = 0.04864
Personal Divine Divergence:
pdd = ((length/navel)-1.61803)*100/1.61803=3.006%
Send a multipart/form-data request in PHP
GET
To List your current indexes with ‘standard’ flavor use a GET request to the List Indexes API.
$url_listindexes = 'https://api.idolondemand.com/1/api/sync/listindexes/v1';
$params1 = 'flavor=standard&apikey='.$apikey;
$response = file_get_contents($url_listindexes .'?'.$params1);
if($response) { $json = json_decode($response); if($json){ $indexes = $json->index; } return $indexes; }
POST
POST multipart/form-data with native PHP
function send_multipart_post_message($sync_or_async, $json1){
$url = "https://api.idolondemand.com/1/api/".$sync_or_async."/addtotextindex/v1";
// using WordPress custom functions to retrieve index and apikey
$index1 = wp_idolondemand_get_setting('index');
$apikey = wp_idolondemand_get_setting('apikey');
$eol = "\r\n";
$data = '';
$mime_boundary=md5(time());
//
$data .= '--' . $mime_boundary . $eol;
$data .= 'Content-Disposition: form-data; name="apikey"' . $eol . $eol;
$data .= $apikey . $eol;
$data .= '--' . $mime_boundary . $eol;
$data .= 'Content-Disposition: form-data; name="index"' . $eol . $eol;
$data .= $index1 . $eol;
$data .= '--' . $mime_boundary . $eol;
$data .= 'Content-Disposition: form-data; name="json"; filename="allposts.json"' . $eol;
$data .= 'Content-Type: application/json' . $eol;
$data .= 'Content-Transfer-Encoding: base64' . $eol . $eol;
$data .= base64_encode($json1) . $eol;
// alternatively use 8bit encoding
//$data .= 'Content-Transfer-Encoding: 8bit' . $eol . $eol;
//$data .= $json1 . $eol;
$data .= "--" . $mime_boundary . "--" . $eol . $eol;
$params = array('http' => array(
'method' => 'POST',
'header' => 'Content-Type: multipart/form-data; boundary=' . $mime_boundary,
'content' => $data
//'proxy' => 'tcp://localhost:8888' //use with Charles to catch http traffic
));
$ctx = stream_context_create($params);
$response = file_get_contents($url, FILE_TEXT, $ctx);
return $response;
}
Continue reading
Vignettes of Lost Men: Stephen Crane
Stephen Crane wrote ‘we are the most successful in art when we approach the nearest to nature and truth.’ He described the inconsistent vocation of the soul of man and the incapacity of man to uphold a straight moral line. His novel the Red Badge of Honor gave him considerable success, and is perhaps a great read to reflect on the choices of former POW Bowe Bergdahl. Now forgotten and sinking to the lesser bowels of history, another unconventional thinker and a flickering light of guidance, lost to our collective memory. We are all in an open boat, at risk to capsize as soon as we shift our positions, so we stay put and drift along.
[JavaScript] Find Related Concepts as D3js Bubble Chart
The Find Related Concepts API from IDOL OnDemand returns the most relevant terms and concepts from related documents. Here’s represented as a D3 Bubble Chart. Thanks to incredibly good work by Mike Bostock. For a description of the API go here https://www.idolondemand.com/developer/apis/findrelatedconcepts#overview
For D3 Data-Driven Documents go here: http://d3js.org
[JavaScript] POST upload file with XHR FormData
This example uses the Optical Character Recognition (OCR) API from IDOL OnDemand. For details see here: https://www.idolondemand.com/developer/apis/ocrdocument#overview
HTML5 and JavaScript: Flip an Image using HTML5 Canvas
See the working code example on jsfiddle.
<!DOCTYPEÂ html>
<html>
<head>
<title>Flipping an Image Horizontally and Vertically</title>
<script src="jquery-1.11.1.min.js"></script>
<script type="text/javascript">
var imageurl = null;
//
$(document).ready(Â function()Â {
$('#loadimage').click(function()Â {
urlProvided();
});
$('#mirrorh').click(function()Â {
mirror(1,0);
});
$('#mirrorv').click(function()Â {
mirror(0,1);
});
});
//
function urlProvided() {
var userinput = document.getElementById('imageurl');
imageurl = userinput.value;
loadImage();
}
function loadImage(){
//
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
//
var img = new Image();
img.src = imageurl;
img.onload = function(){
ctx.drawImage(img,0,0);
};
//
var w = img.width;
var h = img.height;
canvas.width = w;
canvas.height = h;
}
//
function mirror(mirrorh,mirrorv){
//
var canvas=document.getElementById('canvas');
var ctx=canvas.getContext('2d');
//
var img = new Image();
img.src = imageurl;
//
ctx.clearRect(0,0,canvas.width,canvas.height);
ctx.save();
//
var w = img.width;
var h = img.height;
if(mirrorh){
ctx.scale(1, -1);
ctx.translate(0, -h);
}
if(mirrorv){
ctx.scale(-1, 1);
ctx.translate(-w,0);
}
ctx.drawImage(img,0,0,img.width,img.height,null,null,w,h);
ctx.save();
}
</script>
</head>
<body>
<div>
Your image URL: <input type="text" id="imageurl"></input><button id="loadimage">load image</button>
</div>
<div>
<button id="mirrorh">mirrorh</button>
<button id="mirrorv">mirrorv</button>
</div>
<div>
<canvas id="canvas"></canvas>
</div>
</body>
</html>
The Perception of Sea Time
she dances like bouncing particles
on top of the foaming waves
a venus rising out of passing water
from the splashed semen of Uranus
she moves like the soul a ship
a glazing stare of round fish eyes
hiding under the surface fleece
like the faring sea I see
then feel the sudden calm
before the rush of changing motion
a roaring gust of salty wind
that combs through her light blond hair
awning layers of hovering clouds
along the singing circles of air
casting a landscape of shadows
on the ocean’s running blues
CSharp: POST Request to Query API and JSON Parsing
Use the System.Net.WebClient object to make a POST request in C#. For parsing JSON, you can use Json.NET by James Newton-King. Install both packages using the NuGet Package Manager. This code example posts a search for the text ‘Dog’ to the Query API. This example uses the text parameter, if you want to use the file parameter to upload a document as a search parameter you will need to use multipart/form content type, with for instance RestSharp client for .NET.
string apiKey = "your-apikey";
string iodURL = "https://api.idolondemand.com/1/api/sync/query/v1";
WebClient webClient = new WebClient();
NameValueCollection formData = new NameValueCollection();
formData["apikey"] = apiKey;
formData["text"] = "Dog";
byte[] responseBytes = webClient.UploadValues(iodURL, "POST", formData);
webClient.Dispose();
UTF8Encoding enc = new UTF8Encoding();
string json = enc.GetString(responseBytes);
//Debug.WriteLine(json);
The JSON response is serialized using Json.NET into .NET Objects representing the JSON response as a DocumentList of Document type.
DocumentList documentList = JsonConvert.DeserializeObject
List
//
public class DocumentList
{
[JsonProperty("documents")]
public List
}
public class Document
{
[JsonProperty("reference")]
public string Reference { get; set; }
[JsonProperty("weight")]
public double Weight { get; set; }
[JsonProperty("links")]
public List
[JsonProperty("index")]
public string Index { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("content")]
public Object Content { get; set; }
}
The above code will parse the JSON response from IDOL OnDemand.
{
"documents" : [{
"content" : { },
"index" : "news_eng",
"links" : [ "DOG" ],
"reference" : "http://feeds.theguardian.com/c/34708/f/663840/s/3605393d/sc/38/l/0L0Stheguardian0N0Cchildrens0Ebooks0Esite0C20A140Cjan0C170Creview0Etom0Ewatson0Estick0Edog0Ewants0Ea0Ehot0Edog/story01.htm",
"title" : "Stick Dog Wants a Hot Dog by Tom Watson - review",
"weight" : 89.5
},{
"content" : { },
"index" : "news_eng",
"links" : [ "DOG" ],
"reference" : "http://feeds.theguardian.com/c/34708/f/663879/s/37621ce9/sc/38/l/0L0Stheguardian0N0Ccommentisfree0C20A140Cfeb0C210Cdog0Eattacks0Eon0Echildren0Etragic0Etriggers/story01.htm",
"title" : "Dog attacks on children are tragic – but we can try to understand the triggers | Deborah Orr",
"weight" : 88.010000000000005
}
]}
Access the properties as normal:
foreach (Document doc in docs)
{
Debug.WriteLine("doc.reference: " + doc.Reference);
}
To do a multipart/form-data POST request, the simplest way is to use a client like RestSharp, which you can install via NuGet:
string apiKey = @"your-apikey";
string iodURL = @"https://api.idolondemand.com/1/api/sync/query/v1";
string file = @"C:\Users\user1\Documents\iod\TheSecretSpiritualHistoryOfCalculus_ScientificAmerican.pdf";
var client = new RestClient(iodURL);
var request = new RestRequest("", Method.POST);
request.AddParameter("apikey", apiKey);
request.AddFile("file", file);
RestResponse response = (RestResponse) client.Execute(request);
string content = response.Content;
Debug.WriteLine("status: "+ response.StatusCode + ", content: " + content);
Brian Grinstead wrote a great article on a Multipart form post in C# implementation, for those who are interested.
Silhouettes (2) (Bengaluru)
A slim figure in an hotel uniform greets me, even among the aligned Indians waiting with name cards held up at the exit of the arrival hall, he looks remarkably slender. His cheekbones, his carved out, dark eyes, his black eyebrows that cover his stare, and his full mustache characterize his bony face. During the drive from the airport to the hotel, I mainly look at the strip of mirrored eyes, as he proudly tells the story of his love marriage. After five years, their child compelled his wife’s family to reconcile and compromise, but it was a long story he proudly tells.
Arduino: TMP36 temperature sensor
The TMP36 temperature sensor is an easy to use temperature sensor. With a few lines of code you can measure the temperature with reasonable accuracy.

int sensorPin = A0;
float celsius;
float kelvin;
float fahrenheit;
void getTemperature()
{
float val = analogRead(sensorPin);
// analogRead returns a 0 to 5 volts measure on a scale from 0 to 1023,
// i.e. 2*10 bits or 1024 units
val = (val * 5.0) / 1024;
// convert Volts to milliVolts
// the TMP36's linear scale is 10 mV / degree Celsius
// i.e. (* 1000 / 10) = * 100
val = (val) * 100;
celsius = val;
kelvin = val + 273.15;
fahrenheit = ((val * 9)/5.0) + 32;
}
