Archive for January, 2007

Modern Bombs Don’t Tick

“The sky is falling!” – City of Boston

If you haven’t heard the news, today the City of Boston ground to a halt as streets were blockaded, the subway’s Red Line was shut down and bridges were closed for hours. The cause? Turner Broadcasting, as part of an advertising stunt, placed magnetic light-up displays in various places around the city, featuring a cartoon character giving the finger. Some pictures here.

Apparently, a subway worker and some other morons saw the ads, which were magnetically stuck to the sides of bridges and a support pole in the subway, among other places, and started calling in bomb scares. The city mobilized its entire police force, calling in bomb squads and reporting “safely” disposing of one of the devices by blowing it apart (with some form of water cannon, apparently) in Sullivan Square, noting that it contained an electronic circuit board with some components that were “consistent with an improvised explosive device”. Menino vowed his undivided vengeance against whoever was responsible; sound bites were collected from the Department of Homeland Security.

Now to be honest, this is a pretty stupid marketing stunt, even among marketing stunts. But twenty four cop cars and the bomb squad? Give me a puppy-buggering break. I’ve already done my ranting on the chicken littles prattling on about a “post 9/11 world”, code fuchsia terror alerts and all things Homeland Security, so I’ll spare you that. What really bothers me about this is that when a big media company pulls a stupid stunt like this, they put out a press release containing an apology, and maybe if they’re really unlucky, pay a fine (littering, disturbing the peace?), and that’s pretty much the end of that. But if a freelancer or everyday citizen pulled the same stunt, they’d go to jail and not come back.

“Authorities said some of the objects looked like circuit boards or had wires hanging from them.”

Yeah, I guess unpackaged circuit boards* are a deadly threat to society, unlike, say, a big package of nitroglycerin. Looking at the pictures, these are not crudely hand-soldered parts on a hunk of Veroboard, but actual professionally manufactured, machine-populated boards. If you look carefully, they even masked the boards with black solder mask, which costs extra (most boards are coated in boring green mask). Clearly the work of well-funded terrorists. (And brazen ones, at that. Only an audacious criminal mastermind would, rather than disguise a bomb as a pile of garbage or innocous empty cardboard box, instead make it light up and blink: “hey, look at me! I’m vaguely suspicious and clamoring for your undivided attention! Please find and safely defuse me, thus foiling my master plan!”

* * *

Something is seriously fucked in this country.

If I were to stick some perfectly legitimate prototype, such as a micropower data logger, onto a bridge, roadside or similar field-test scenario where they’d actually have an environment to log**, and got noticed, I’d spent the next five to ten keeping criminals out of my cornhole. A couple years ago, an electronic prototype (this one, which totally does not look like a bomb at all) nearly got a colleague and I thrown off a plane, which was delayed half an hour while the TSA opened it up and poked around inside. Not too incredibly long ago, I was riding the subway to the airport while wearing my Terrormouse t-shirt (featuring the text “TERRORMOUSE” under a large mouse with glowing red eyes), and an ashen-faced older gentleman actually asked me, dead-serious, “are you a terrorist?”

The whole point of TERRORism is to instill TERROR on a populace – have them jumping at shadows, unable to sleep at night and suspicious of their own countrymen. Under the dictionary definition, the terrorists are in City Hall, and they’ve already won.

* a surprising number of electronic devices for small volume, industrial, or laboratory use are left intentionally unpackaged, or sold with a separate “you put it together” enclosure, because electronics without an enclosure are considered industrial rather than consumer devices by the FCC, and so are subject to much less stringent certification procedures (which would otherwise totally kill the budget of many small projects).

** as opposed to leaving it powered up on a shelf in the lab, where there’s no environment to log, or rather no environment [rain, sleet, dark of night, vampires] at all to speak of, so it’s not really much of a test at all.

It’s Not You, It’s Me (or my flapjack of a customer)

So, I pop up from the lab and this horny sales rep has left me a voicemail. “Er, a while back I sampled you an LCD for a project you were working on, ah, just wanted to know, um, how that’s working out you, what the status of your project is, ok, I guess just give me a call at…”

I fucking hate calls from sales reps. Not just because they want to be my buddy and call me for a year trying to set up meetings with “their guy” who’s going to be in the area next Tuesday, but also because, as a small R&D company and with a dozen similar parts out there, we (a) probably didn’t go with their part for our design, and (b) probably aren’t going to ever, in our lifetime, buy more than 10 units anyway. So, after the HSR has (without my asking) pulled some strings to send me $50 worth of free samples, I have to break him the news that we are not going to be using his part for our design. Some of these guys work so hard to get us on board…it’s hard to break the news to them; it’s like making a break-up call. I’ve only had to do one breakup letter in my lifetime, and it fucking hurt. Anyway, now I have to callback these various reps, and deliver them the ol’ Dear John:

“Hun…It’s a really great part, and has been a pleasure to work with. It’s just not what I’m looking for at this stage in my design… it’s just…my needs aren’t being met by this part. I hope you understand. It’s not you, it’s me.”

Sure, I suppose I could just dodge them indefinitely, and not return their calls, hoping they get the hint that I’m just not that into their component, but after $n in free samples (whether solicited or not), I figure I at least owe them a call.

I tried to explain that despite his repped product’s technical superiority, they were undercut by CrapCo in Shenzhen ’cause they were half the price. Then my customer is being a bitch and wants a complete redesign for free (at an estimated cost of $5k, this is a no-go), so production has not gone forward anyway, and at this point I don’t expect it to. Well, no names were named, but I was probably more honest with Horny Sales Rep than I should be under NDA. I thought the direct approach would dissuade further advances, but no. I laid it out bare: “hey, I don’t want you to do all this work and then find out this project never continued…”, but he insisted. So, I’ve got Horny Sales Rep scavenging to get me a part from his rep’d company at CrapCo’s price for a part that still, in all likelihood, will never be bought. I love R&D, but sometimes it leaves me pissed off.

Using a Peltier cooler to refrigerate a terrarium

Executive summary: Didn’t work as well as I had hoped. Lowered the temp in my tank by about 4 degrees F – and it’s a pretty small tank.

As a long-overdue followup to my climate-controlled terrarium, i.e. the actual climate control part, I bonded heat sinks to both sides of a Peltier device (thermoelectric “heat pump”) embedded in a Lexan terrarium cover. The Peltier looks like a thin ceramic pad about 1″ square. When electricity is applied to it, one side gets hot and one side gets cold. Each heat sink also has a fan (just like a CPU) to efficiently move the hot/cold off the sink and into the surrounding environment.

This lid is cut for a small terrarium (actually a 5-gallon Betta tank) I’m using to winter over the stuff that requires a dormancy period. Apply the lid, apply the power, and watch it become Instant Arctic inside the tank, right? Wrong…

It turns out the inside temperature doesn’t drop very much at all – I was averaging a drop of maybe 4degF, applying 12V @ 3A to the Peltier and both fans running. Although the Peltier can produce a maximum delta-T of almost 80degC, it just can’t pump a lot of heat very fast, and air (no matter how hard you blow it past a heatsink) is a good insulator that doesn’t give up its heat that easily. My guess is that between the less-than-ideal mating of the lid and tank (you want to have *some* airflow to the outside, right?) and conduction through the Lexan and thin glass walls, heat is just pouring back in from the outside too fast for one small Peltier chip to keep up with. Maybe with some good insulation this will be a viable approach, but it doesn’t seem feasible for most real-world terraria (in direct sunlight, etc.)

Possible improvements:
The idea is to keep the “wintering” terrarium in e.g. my nice warm bedroom without having to do something like try to rig it to sit halfway out an open window, heat the entire outdoors and freeze my ass off. During winter, an alternate approach would be to stick the tank in a *cold* (quite possibly below freezing some days) area, like the unheated porch, and reverse power to the Peltier so that the warm side is inside the tank. Unfortunate fact is, Peltiers do a much better job generating heat than pumping it around, and at 3A being cranked through it, will be generating a fair amount (about as much as an average computer CPU). On the bright side, electric heating is by definition 100% efficient (P = I*V = I^2*R = V^2/R)…so you could just look at it as having a teeny tiny electric space heater going.

I was also using one of the smallest and cheapest Peltier chips available – only 30mm on a side, max power handling of ~ 38W, about $9 from AllElectronics. There are certainly beefier ones. Except that the power they suck increases exponentially with size, and I don’t feel like feeding it enough juice to drive a window A/C (because then I could just use a window A/C). Maybe it’s time for a proper insulation experiment…

Humidity control redux
Lest you think science is all about trying things that do not work :) a revised approach to humidity control turned out very well. If you’ll remember, I was using an aquarium air pump and Coke bottle full of water to humidify the tank. Problem with this is, it adds humidity (relatively) slowly, and works primarily by splashing water all the hell over your tank where it eventually evaporates. Anyway, I found a relatively cheap ($18) ultrasonic fog generator from Artistic Delights and sank it into the bottle in place of the bubbler. Instead of just splashing water all over (when properly covered of course!) and making constant noise, this atomizes it into a dense fog that disperses throughout the volume of the tank, raising it to ~ 95%RH in minutes. Not that any of the stuff in my tank is this picky, but with no fans/etc. blowing your air around, the fog will naturally sink toward the bottom of the tank, probably allowing you to leave the lid off your terrarium for extended periods (for maintenance, pruning, whatever) without stressing your plants. I highly recommend this approach over the air pump.

Methinks somebody wants grandkids…
This is for picking up geek chicks, compliments of discover magazine!
Give it a try.

Whither TrashAmp?

The TrashAmp, a project I started while living in Chicago (to give you some idea how long ago that was – late 2003), was to serve as a subtle testament to a disposable society by building a high-power car audio amp entirely out of trash (specifically, electronics waste scavenged from the curb). Things started out well, but I ran into a long-term shortage of a few specific parts, and had to choose between “have it now/soon” and “suffer with my crappy stock radio for possibly years, but adhere to the original design goal (all trash)” – so I broke down and ordered the last couple parts online.

A little over three years later, the TrashAmp has been built, broken, and rebuilt with even more new parts (though with some performance issues it would take a substantial redesign to fix).

Meanwhile, I have also come to the following realizations:

  • I’m an engineer, I have money now
  • I’m an engineer, I don’t have copious freetime (like I did as an unemployed hobbyist / trash parts scavenger)
  • I can get a substantially better unit for ~ $60 off-the-shelf, with all new parts

So I think I’m gonna do it – give up on TrashAmp and just get a COTS unit from Ye Olde Internet Gadget Store.

(Anyone disappointed? Speak now or forever hold your peace! :P)

Geek Christmas carols – answered

“The First Noel”

for k=[1:3]; it=snow; end;
“Let it snow, let it snow, let it snow…”

0 0 12 25 * cd ~
“I’ll Be Home For Christmas” (Unix crontab entry)

tree -i O ./xmess
“O Xmess Tree” (okay, that was a bit of a stretch)

nice@town# adduser -e 12/26/06 Santa
“Santa Claus Is Comin’ To Town”

mv -f reindeer Grandma
“Grandma Got Run Over By A Reindeer”

chmod 777 Joy
“Joy To The World”

midnight = (unsigned char *) calloc(bufSize,1); memcpy(midnight, it, bufSize);
“It Came Upon A Midnight Clear”

diff /dev/dsp /dev/audio
“Do You Hear What I Hear”

“O Holy Night” (technically “holey”)

cat | woods > river
“Over The River And Through The Woods”

cat night > /dev/null
“Silent Night”

which child
“What Child Is This”

gzip ~/merry_christmas
“Have Yourself A Merry Little Christmas”

smixer vol pcm 100; cat angels.wav /dev/mixer
“Angels We Have Heard On High” (mine goes up to 11!)

Scott got all but two; I am highly impressed.

I go shooting my mouth off and…

Dammit, I should know better than to tempt fate by blogging about things in jest, like extremely localized global warming (or for that matter, medical industry conspiracies).

I think GK said it best.

For those of you not around here, it is January 6th and 70 degrees in Boston. It’s actually warmer outside my house than inside (I’m opening some windows), and I spent the morning barbecuing in short sleeves. I’m liking this…but it’s kind of eerie.

The last few weeks in review

Woo, long-ish hiatus from blogging. Anyway, since last “real” entry (non roommate rant, geeking, meme, etc.) some or all of the following have happened:

Did the company Christmas party thing; dragged LE out to it this time to meet these nut-jobs I work with. She humored me, even though we all got toasted and I tried to get her to dance :-P Had to explain about ten times to various too-interested co-workers that no, we are just friends and not an Item (and get the “why-not-you-dickless-idiot” about the same number of times). It might be fun to bring a dude next year.

Spent half a week in CT testing a self-balancing-blade technology at Unnamed Helicopter (a.k.a. My Life with the Spin Grin Cult) with CL and AL. This meant waking up at about 4-5am every day, which ranks right up there in my book with, say, having my kajongas amputated. The first day out, the bottom dropped out of my x-large Panera Mocha-Frapp-Latte-Ccino-wake-up-dammit-juice just as I was about to enjoy the first orgasmic sip, drowning the interior of AL’s Beamer in coffee of unknown quality (he even stopped grinning momentarily), but other than that, not much eventful happened, which is good. E.g. no electronics caught fire, no blades delaminated and became shrapnel bombs at 1,000RPM, all our data channels (mostly) worked, and the testing was an overall success.

An aside to talk about Tempur-Postur-Pedic fancy pants mattresses. The place I stayed for this trip had one. I can and have slept on just about any horizontal surface, including, but not limited to, flat rocks, concrete, larger members of the opposite sex, hardwood floors and wet tent dirt. But I couldn’t get much sleep on this thing. Imagine a tired old college-dorm mattress with a huge sagggg in the middle that you keep rolling into…now imagine that wherever you roll to escape it, the sag follows you. Wake up with the sensation of drowning, and find that the man-eating mattress has swallowed you down to your topmost ear. With a great and valiant effort, you succeed in rolling out of the deep pit that formed around you, find a nice firm spot elsewhere, and resolve to get some shuteye. Slowly begin to sink… repeat this process throughout the night. All right, that’s my rant for the day.

Got home that Thursday to find that some co<implausibly long string of profanity here>ucker busted the driver’s side mirror off my car while I was gone. I found the smashed carcass of it laying next to the door, and little pieces of mirror all over the street, with a few that managed to get on top of the car. Maybe time to get cracking on BumperCam/EtcCam*.

Found that after 2+ months of acting all lifeless and dead, my blueberry seeds sprouted! Only 3 more years until sweet, delicious blueberries in my room.

Procrastinated like a mofo on writing out holiday cards (I think they went out christmas eve, although who knows when the mailman actually collected them) and getting crap for peoplegift shopping.

Picked up a Nintendo DS; voided the warranty on the first day. It’s now a Linux-based intarweb and wardriving appliance. Of course, it plays games too.

Rang in the holidays with meat. Xmas eve, tasty roasted chicken and stuffing at JR’s. Xmas day, grilling dripping-red steaks at my place with JR, LE and SA. New years eve, at LE and company’s place, a quart over full with a delicious roast pork shoulder, which we followed up with some mild drinking activity and a bunch of movies (some in human sofa mode :P) . Oh, and crashed there until the following day too, and discovered evidence that there is a God.

Now… hiding from the world and catching up on this bloggy thing. It’s SBIR season again and I procrastinated to the last minute, so expect me to stay a bit scarce for the next week or so. (And become an instant expert on artificial neural networks! Yyyyyeah…)

*although if used for more worthwhile purposes, I guarantee they’d come up with some excuse why a dated, cryptographically signed video of a cop hassling you is not admissible as courtroom evidence, or worse

Doosh: Incremental database-backup script gets around PHP execution-time limits

The premise: You have a database full of many very important things. However, the server it’s on is owned by some goofus who doesn’t give a damn, on a dusty PII box under his bed. You don’t have shell access and can’t dump it that way. You can’t install utilities. Maybe phpMyAdmin doesn’t even work due to missing libraries (on a Windoze box this is almost certainty). Even if it did, your databases are too big to dump with it. What do you do?

* * *

There are many, many PHP scripts out there that will export (dump) your SQL databases, but all that I have found (even my favorite, phpMyAdmin) suffer a critical flaw: they fail at dumping very large or complex databases. So you wait, and you wait, staring at a blank screen, and within a few minutes your script dies quietly leaving you with an incomplete dump (if that).

To keep a single user or a runaway script from permanently hogging the server’s CPU, PHP enforces an execution time limit (default of maybe 30 seconds). If your script takes longer than that to run, it gets killed, end of discussion.
Depending on the system, spitting out the file (or writing to disk) takes a significant amount of time that may count against you. On some systems, the time used by the SQL server itself may count against the PHP execution time limit too. Additionally, your database dump may get killed partway through because the SQL server’s response exceeded PHP’s memory limit, since PHP is trying to slurp the entire query result into a variable.

Enter the Doosh:
This script makes a list of all the tables in your database, and starts dumping them one by one, a few hundred records at a time to a backup file(s), recursively calling itself until the job’s done. The number of rows dumped in each iteration can be changed depending on the speed of your server. This way, you can dump out your entire database even if some joker set PHP’s execution time limit to 10 seconds and there’s nothing you can do about it.

The script gets its name from the sound of a large hunk of data being flushed to disk. Some theories suggest the script is named as it is because “usyr_illus_is_a_giant_douche.php” would be too long (and the lawyers would have a field day), however, this is just a rumor.


Directions: Make the obvious changes in For example, set your own username and password, the name of your database, etc. Start script running. Make tea. Take a nap. Wake up, your database is backed up to a set of text files full of SQL statements. You can now import these right at your SQL server console (consult the manual) to recreate the database… if the files are too large, you can use something like BigDump to split up the import too (it’s sort of the inverse of Doosh).