Xively

Cosm (originally Pachube) has now left Beta and been rebranded (again) as Xively. In the process they have removed some of the functionality on their front page which allowed you to view the data you were sending to them. I presume this is to encourage others to write applications for their API. So, to enable access to my own environmental data that I log to Xively from my Freetronics Etherten I wrote a quick sketch in Processing to format an html file showing the four main plots of my data. All you have to do is enter your feed ID and the names of your datastreams and it will write the appropriate file for you. 

I wanted to write this in Javascript so that I could incorporate the code into the html but I’m still working that out so this is a stop-gap solution for now which still lets me see my data nad easily change things like the range of data requested. 

// Xively html file writer.

// Chris Pook

// May 2013

// This sketch writes a text file with current links to Xively .png plots from your feed

// set up the file to output to

PrintWriter output;

String folderPath = “”;   // enter the path to the folder where  you want the html file to be saved

String file = folderPath + “” + “Xively .png feed.html”;                                 // name of the text file to save to

int write = 1;                          // if you want to write to file set this to one, if you just want to debug the output in the terminal set it to zero

output = createWriter(file); 

println(file);

// feed ID

String feedID = “”;  // put your feed ID here between the quotation marks

// duration

// set this to the appropriate variable from the array ‘duration’, below

int e = 3;  

String[] duration = {“60minutes”, “6hours”, “24hours”, “5days”, “30days”};  // five time scale options. Specify which on the line above

String[] interval = {“0”, “0”, “60”, “300”, “1800”}; // the relevant resolution of data to request, relates to the duration

String[] datastream = {“light”, “DSt”, “DHTh”, “BMPp”}; // enter your datastreams here, I have four but you can use as many as you like

String[] title = {“light”, “temp”, “humidity”, “pressure”}; // these are the titles for each .png plot, doesn’t seem to work currently, not sure why

String[] colour = {“000000”, “ff4f00”, “008a00”, “00ABA9”};   // you can edit the colou rof each datastream

// some variables if()s for assembling properly formatted time stamps

String mnth;

String dy;

String hr;

String mns;

String scs;

int range;

String URL;

if(month() < 10) { mnth = “0” + str(month());}

else {mnth = str(month());}

if(day() < 10) {dy = “0” + str(day());}

else {dy = str(day());}

if(hour() < 10) {hr = “0” + str(hour());}

else {hr = str(hour());}

if(minute() < 10) {mns = “0” + str(minute());}

else {mns = str(minute());}

if(second() < 10) {scs = “0” + str(second());}

else {scs = str(second());}

// assembling the timestamp

String now = year() + “-” + mnth + “-” + dy + “T” + hr + “:” + mns + “:” + scs + “+12”;

println(now); // output the timestamp to terminal for debugging purposes

// writing the URLs

for(int i=0; i < 4; i++) {  // this writes four different datastreams because that’s how many I want, edit your appropriately

URL = “https://api.xively.com/v2/feeds/&rdquo; + feedID + “/datastreams/” + datastream[i] + “.png?” + “duration=” + duration[e] + “&s=1&b=true&g=true&scale=Datastream&w=1000&h=299&c=” + colour[i] + “&t=”” + title[i] + “””;

println(URL); // output to terminal

if(write > 0) {  // if we’re not debugging output the URLs to file

output.print(“<IMG SRC=””);

output.print(URL);

output.println(“” WIDTH=1000 HEIGHT=299>”);

}

}

output.flush();

output.close();

exit();

earthlynation:

Giant, fluorescent pink slugs found on mountain 

It would seem to be something you’d see only in a cartoon or at a Phish concert, but according to park rangers in New South Wales, Australia, dozens of giant, fluorescent pink slugs have been popping up on a mountaintop there.

“As bright pink as you can imagine, that’s how pink they are,” Michael Murphy, a ranger with the National Parks and Wildlife Service, told the Australian Broadcasting Corporation. “On a good morning, you can walk around and see hundreds of them.”

The eight-inch creatures have been spotted only on Mount Kaputar, a 5,000-foot peak in the Nandewar Range in northern New South Wales.

Scientists believe the eye-catching organisms are survivors from an era when Australia was home to rainforests. A series of volcanoes, millions of years of erosion and other geological changes “have carved a dramatic landscape at Mount Kaputar,” the park service wrote on its Facebook page, and unique arid conditions spared the slugs from extinction.

They “probably would have long since vanished, if a volcano had not erupted at Mount Kaputar about 17 million years ago,” Ben Cubby wrote in the Sydney Morning Herald. “The result of that eruption is a high-altitude haven for invertebrates and plant species that have been isolated for millions of years, after Australia dried out and the rainforests receded.”

And they’re not the only unusual inhabitants on the mountain.

“We’ve actually got three species of cannibal snail on Mount Kaputar, and they’re voracious little fellas,” Murphy said. “They hunt around on the forest floor to pick up the slime trail of another snail, then hunt it down and gobble it up.”

source

analytical chemistry

I’d like to observe that there’s something wonderfully zen about analytical chemistry. Compared to biology it is even more repetitive and simplistic. Instead of measuring the functions of whole organisms or even cells, you are intent upon the analysis of a collection of frequently inert molecules (biologically active material aside).

 I spent much of Friday extracting a particular compound from grapes. The process was repetitive, simplistic and, for someone who routinely plays with feisty invertebrates and hundred thousand dollar instruments, unglamorous. I can’t deny, however, that I found the process rewarding. Admittedly the experience was enhance greatly by an audio book of a Discworld novel and frequent trips to my office to sample a thermos of tea and a large bar of Whittaker’s dark chocolate. These ingredients may provide pleasure in themselves, however, together with the long hours spent pipetting, rinsing, washing and weighing the entire experience proved far more rewarding than its individual components might suggest. I found that the routine nature of the work allowed me to achieve a meditative state of mind whereby I was simultaneously entranced by my audio book entertainment and yet utterly focused upon performing the tasks at hand. These would individually have been mundane and collectively been dull but repeated in sequence over and over again became hypnotic. 

  • remove pre-weighed grape from fridge
  • put grape in mortar
  • add 400ul solution A
  • add 1ml solution B
  • add 2ml solution C
  • grind grape to sludge with pestle
  • add 1g reagent X
  • grind sludge to paste with pestle
  • use glass pipette to transfer paste into vial
  • cap vial and move to fridge
  • wash glass pipette, pestle & mortar with hot water
  • rinse glass pipette, pestle & mortar with deionised water
  • rinse glass pipette, pestle & mortar with solvent
  • rinse glass pipette, pestle & mortar with solvent
  • rinse glass pipette, pestle & mortar with solvent
  • rinse glass pipette, pestle & mortar with solvent
  • rinse glass pipette, pestle & mortar with solvent
  • goto start

The first ten grapes took me four hours. After that the students, who had been distracting me intermittently, left and things sped up. I got another thirty grapes done before midnight. 

This was not a piece of work which I could have achieved in normal working hours. The first few hours were a struggle as any question put to me by students would inevitably distract me from my count of solvent washes or which reagent I was adding. Good chemistry is relient upon consistentcy of process. I hope to record my results on these pages both for posterity and as an example of this principle. 

RT @SciencePunk: One day I will write a furious op ed about how badly the baby boomers f**ked over my generation. For now, there’s this: …

RT @danielh_g: There is only one key question our art should try and answer: how can I live in a world in which I am doomed to die? All …