Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2013/07/30

Telling One Liners

I don't do a lot of Perl one-liners. In general, I think if you're writing Perl, you're going to want to repeat it so you should put it in a file.

I say in general, because I ran into a specific situation. For a plot-generating process, we 1) pointed to the version of the plot-maker that didn't use libcairo, so it couldn't be used without X11, and 2) accidentally removed lots from the completed file, where we list the plots we've done so we don't redo them, which lead to 3) remaking lots of plots that exist with a plot-maker that couldn't make plots, meaning files that existed got replaced with zero-sized files.

Once we figured out what the problem was, I wrote this one-liner, which ran for over an hour and 40 minutes.
for i in {1..100} ; 
do (
    ls -lS */nanodrop/*png | perl -lane ' print $F[8] if 0 == $F[4] ' | wc -l 
    ); 
sleep 60 ; 
done 
Basically, it looped over and over again to keep constant watch (the for loop), each time taking an ls -l (the -S, order by size, not strictly being necessary but left over from my initial checking), breaking it apart with Perl, printing the file name ($F[8]) if the file size ($F[4]) was 0. I pipe the output into wc -l,  which counts the number of lines. I then sleep for a minute (as the number of zero-length files was over 7000 at first run, the ls-l took quite some time, so the reports were much longer than a minute apart), and do it again.

Granted, I could've done it all in Perl, but why re-implement tools that exist in the shell when you don't have to? I could've done the Perl stuff in Awk, if only I knew Awk better, but I could get to the point where I knew the damage and the rate of repair much faster with tools I knew. Really, the only thing I needed to learn was that perl -lane was what I needed to get the lines broken easily.

2013/07/29

Making a CarPuter to step into the New Car

It's been a while since I've written on car computing — over two years, it seems — but that doesn't mean I've stopped thinking about it. The top reasons I would've wanted one in years past would've been for Entertainment and Communication, and I think everyone would agree that today, it's far better to just carry a smartphone than to embed one into your car. And, seeing how smartphones are changing so much so fast, doing more than adding the ability to interface with Bluetooth and/or USB to your vehicle seems silly, at least in short-term.

Navigation doesn't fare too much better, so although it's a toss-up whether dedicated units like Garmin and TomTom are better than smartphone navigation like Google Maps, both are accepted as better (more current maps, better interfaces) than in-dash choices.



I think the use that is least considered is recording. Dash cams are common in Russia because they're used for legal protection, but have given YouTube a great catalog of amazing video. I think there's reason beyond "Hold my beer and watch this" for Americans to have dash cams, and I do want one.

But, ultimately, I think the best reason to get into "Carputers" is Diagnostics, getting into the data that is available from your car's OBDII port. The obvious way is to use an OBDII-to-Bluetooth adapter like the ELM327 or Garmin EcoRoute, but it strikes me that there are enough security vectors in to the New Car that adding more is not a wise route. So, I'm thinking that the Raspberry Pi and an OBDII USB cable might be the better way to handle it, except I'm not sure how to export the data, and while it would be useful to keep track while driving, ultimately, off-the-road analysis is where the usefulness of the process comes in.

I'm thinking that a Raspberry Pi, a cable, a small monitor with composite video and maybe a few other things could be easily turned into a car-monitoring system, and I could pretty easily set something up to only sync with my home network when it's close. I'm not sure whether that's more cost-effective than just getting an ELM327 and an ELM327 app from the Play Store, but I think I'd end up learning more that way.

Anyway, I'm still undecided on the phone/Pi issue, but I think this is something I need to do.

2013/07/23

I've got a standing desk, and boy are my legs tired!

Borscht-belt comedy aside, I converted my desk to a standing desk configuration a week ago last Friday, making this the seventh workday where I've spent most of my day standing.

Yes, compared to other standing desks, this is pretty janky. It works for me, though. The tops of my monitors are only a inch or so above eye level, which is pretty close to Hoyle according to ergonomic standards I've seen, and the box put the keyboard at a good typing level. I'm happy with it.

My feet, on the other hand...

My left foot is a bit pronated, which is to say that the ankle turns in a bit and the big toe turns out a bit and the arch is a bit flat.

My right foot? Take every a bit from the previous sentence and put in extremely, and it also lacks the range of motion of my right. I first figured out the issues with my ankles when I noticed I could make fart noises with my foot on the bathroom tile, without trying, but the time I took a hike with my son's Cub Scout pack was when I realized I had a problem, not just an issue.

Since then, I have become much more active. Last year, I did Couch-to-5K, and actually did a 5K. I did it in 45 minutes, finding that I do a mile in 15 minutes or so whether I run or walk, but hey, I got the t-shirt. This year, I've been focused on other activities, but plan to do it again. When I started running last year, I got the same foot pain, which eventually subsided the more I worked. Internet lookup makes me think it's the Extensor Digitorum Brevis muscle that was giving me problems last year, and this last week, this is the pain I've been having again, except this time, in both feet.

The previous pain tells me that I'm doing the right thing, that I'm strengthening my feet and ankles by standing. My recent experience with Cross-Fit tells me that I had better start exercising and strengthening my feet and ankles or this pain won't go away soon.

In terms of productivity, I don't know that I've noticed a difference. I'm in a position at the moment where there's a lot of sit-and-think (or rather, stand-and-think) and not so much great code generation. I don't currently quantify my work, but would be interested in finding a way to do so. Of course, it would've been good to have a body of sitting-desk work in the dataset to use as a comparison....