rebuilding an array without unused elements

the weath­er station/software gen­er­ates a csv file of that col­lects val­ues from the sen­sors every 20 minutes.

it’s not a very nice file — it con­tains all the pos­si­ble val­ues (if you where using all the avail­able sen­sor chan­nels) for me that means that 49 of the fields are unnec­es­sary and do not exist in the track­ing database.

some­how i have to clean them out.

i do this by read­ing the por­tion of the file that i need into an array and then after clean­ing up a few fields that are stored in the wrong type I have to move every­thing into a new array so that i can write it to a file that i can feed to MySQL.

(in the fol­low­ing exam­ple $rawRowArray is the array that holds of all of the fields from the csv after the lit­tle prob­lems have been corrected.)

$cleanRowArray = array();

for ($i=1; $i=14; $i++) {
$k = $i — 1; // to get the array keys right
$cleanRowArray[$k] = $rawRowArray[$k]; //add the field to the array
}
//skip ele­ments 14 — 18 (not used)
for ($i=19; $i=37; $i++) {
$k = $i — 1; // to get the array keys right
$cleanRowArray[$k] = $rawRowArray[$k]; //add the field to the array
}

//skip ele­ments 38–46 (not used)
for ($i=47; $i=66; $i++) {
$k = $i — 1; // to get the array keys right
$cleanRowArray[$k] = $rawRowArray[$k]; //add the field to the array
}
//skip ele­ments 67 ‑103 (not used)

there has got to be some­thing more ele­gant but I like this. there’s no mis­tak­ing whats going on and it will be easy to change if we add more sen­sors to the sys­tem. (just change which ele­ments are skipped.)

Moving house

Intellectually rather than phys­i­cal­ly. That is. 

It no longer makes sense to have two blogs. 

All the tech/info design/geeky stuff that I’ve been involved in the past three months has been tied to my art, Jim’s pho­tographs, or the small bits of the web for which I am the cus­to­di­an. Making it most rel­e­vant to my more “artis­tic” blog and leav­ing lit­tle to post here.

Further adven­tures of the mag­pie can found at the site of her alter ego ms. shoes.

Cooking and Design

John Maeda is one of my heroes. He’s tak­ing a new job at RISD in June. In one of his blog posts at our.risd.org he had this to say:

Also, some of the best artists and design­ers are great cooks. There is some­thing to cook­ing that is not only inher­ent­ly inven­tive, but also exem­pli­fies the very nature of unselfish giv­ing from the heart. What you could eat your­self, you choose to give to anoth­er as the most mean­ing­ful sus­te­nance for survival.

Link

no more polaroids

Boingboing Crunch Gear report­ed this morn­ing the planned clo­sure of the last plant to man­u­fac­ture Polaroid “film”.

We had a Polaroid instant cam­era when I was a kid. Instant pic­tures being of course a big hit with the munchkin crowd and then lat­er mess­ing about the emul­sions and mak­ing “spooky” pic­tures being a hit with the larg­er kids.

One of the coolest uses of Polaroid film has been for tak­ing ver­i­fi­ca­tion pho­tos for var­i­ous con­tests and races. My favorite of those being the Iron Butt Rally.

Arrival at var­i­ous bonus loca­tions was ver­i­fied by tak­ing a Polaroid pic­ture of your “ral­ly tow­el” with some named mon­u­ment at the loca­tion. For exam­ple: A pic­ture of the Lincoln Monument — the one in Laramie Wyoming. 

Polaroid pic­ture ver­i­fi­ca­tion offered the triple advan­tage of being:
1) Cheap.
2) Light weight (rel­a­tive­ly.)
3) Difficult to spoof.

So here’s the challenge: 

What tech­nol­o­gy (com­bi­na­tion) can you use to prove that a per­son was in a par­tic­u­lar place at a par­tic­u­lar time.

Remember this sys­tem has to be car­ried on a motor­cy­cle through just about every god awful envi­ron­men­tal con­di­tion you can imag­ine and oper­at­ed by a prob­a­bly dog-tired and cer­tain­ly dis­tract­ed rid­er. It has to be cheap enough to deploy a cou­ple of hun­dred units and secure enough that the con­tes­tants trust its results.

Details of the plant clo­sures and Polaroid’s search for a licensee are avail­able 0n the Boston Herald site.

scrolling direction matters

I final­ly fig­ured out what it is about the behav­ior of the new (vista) ver­sion of win­dows explor­er that is odd. 

When you look at the fold­er con­tents in the right side pane, if there are more fold­ers than will fit WE extends the list to the right (with a scroll bar on the bot­tom of the win­dow) rather than down (with the scroll bar on the right side.) 

scroll bar in windows explorer

This is counter to the way extra con­tent is han­dled in every oth­er part of the com­put­er uni­verse. Users expect to scroll down, not right.