Tuesday, October 22, 2013

Use curl to get picture from Kogan ip camera

curl  http://10.0.0.90:90/snapshot.cgi -u admin: > x2.jpg

Thursday, May 9, 2013

Paleo twaddle


Menu:

2 Poached eggs
Baby spinach
Bacon
Mushrooms
Tomato
Avocado.
+
Regular coffee.

How much of this is really part of a Paleo diet?  From wikipedia: "The Paleolithic..., is a prehistoric period of human history distinguished by the development of the most primitive stone tools discovered... and covers roughly 99% of human technological prehistory. It extends from the earliest known use of stone tools, probably by hominins such asaustralopithecines, 2.6 million years ago, to the end of the Pleistocene around 10,000 BP"

So; 10,000 years ago what parts of these menu items would a paleo eater have to eat?

Poached eggs?  Nope, chickens were domesticated in southeast asia only a few thousand BCE.  And chickens are native to southeast Asia, so no way they could have been eaten on the African savanna.

Spinach?  Dunno.  Seems to have been from Persia, so maybe.

Bacon?  Same situation as chickens.  Another southeast asian native.

Mushrooms? Very probably.

Tomato?  A native plant of south America, so no, not available.

Avocado.  Ummm. The avocado (Persea americana) is a tree native to Central Mexico. FAIL.

Coffee; it was only harvested in Ethiopian highlands in the last few thousand years.

Yumm, a big plate of mushrooms is what you need to keep authentic paleo.

Saturday, March 2, 2013

dojox charting tooltip function



Want to have a custom tool tip on your dojox chart?  The easiest thing to do is to use a custom function when creating the Tooltip object.

First: Add the require for the tool tip.

dojo.require( 'dojox.charting.action2d.Tooltip' );

Second: define the function to be used when a tooltip is required.


new dojox.charting.action2d.Tooltip(chart1, "default", {
text : function(o) {
return ( o.run.name +'<br>' + o.y ); 
} );

As you can see the tool tip function is passed the o object.  This object describes the chart, series and plots you'll need to make a nice tool tip.  What you need is the o.run.name, which is the name of the series and o.y, which is the value of the data point on the y axis.  Combined with <br> you'll get a two line tool tip.

Well, this is a three liner, but it looks much the same.  That's because I used a more complicated tool tip function that uses the label function to add the x axis label to the tool tip. 

Sunday, February 3, 2013

ArcGIS quakes example unexpected token < error

I have been playing with one of the example ArcGIS samples from the 'Building Web Applications Using the ArcGIS API for JavaScript' and kept getting an annoying error:


esri.request failed: SyntaxError: Unexpected token < quakes.js:164

  1.  

Which stops the quakes layer loading.

The esri.request method requires a web server running hosting the example and a proxy page to call the quakes XML service:


function requestQuakes(){
esri.config.defaults.io.proxyUrl = "proxy.php"; //relative - if proxy.php is in the same application as the web page

var requestHandle = esri.request({
 url: "http://earthquake.usgs.gov/earthquakes/feed/geojson/1.0/week",
 load: requestSucceeded,
 error: requestFailed
}, {
 useProxy: true // changed from True
});
}



When I run it under the EasyPHP server that error came up. 

I chased the error down to the proxy.php script echoing out error messages due to uninitialized variables and missing keys from arrays.  Once I had eliminated those errors the page loaded correctly.  It seems the error messages were getting returned with the usgs earthquakes JSON and messing up the dojo JSON parser.

The new proxy.php