Cookie Notice

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


What Is False Laziness?

I have code. It takes data from an instrument, copies it to a local filesystem, and, under certain circumstances, makes an R file, runs it, and copies the resulting image into a directory.

Then I got another instrument. It ran similarly but on another machine. What's the easiest way to get this working? Copy the code, make changes relating to the specifics of the second instrument, add a new line into the crontab, and go onto the next project.

Now, we have three different outputs that we want to relate this data to, and none of it was around when I first started maintaining the first code, much less forked it into the second code for the second instrument.

So, now, if I want to make a change to handle a case for the first instrument, I have to copy that change into the second instrument. I failed to honor DRY, "Don't Repeat Yourself". I can justify it by saying I didn't remotely understand how to write libraries then, but I know that is only justification. I was falsely lazy, not truly lazy, and gave myself problems that are just now coming to view.

If you'll excuse me, I have to read up on Mouse and OOP on MetaCPAN.

Quantified Self on C-Span

Well, yes and no.

I am currently watching Eric Topol talking about his book, The Creative Destruction of Medicine, on Book TV. I put it on my DVR this weekend. I can't say I'm too impressed by his delivery, but the message is really powerful. I can drop a tl;dr, but you owe it to yourself to get into the video. He ties QS (naming the tools, but not so much the movement) with social networking and gene sequencing into all the changes that are transforming medicine. Really brilliant stuff.


Learned some SQL today

Had to skip out of TEDxPurdueU today.

Which sucked.

There was a problem with my code at work, a problem I really couldn't handle from the front row.

We create runs. Each run has many regions. Each region has one or more accessions. Each accession has a well identifier to tell what part of the region it is in, and barcodes, which are identifiers. Problem is, barcodes associate with accessions, while wells associate with accessions, regions and wells. So, if you are putting one accession into several regions and wells, in a format like this


You now have set the barcodes twice for accessions 123123-123-126. Not good at all.

I first thought "I can check to see if that barcode is set, and skip it if it is". Then I thought, I could add some SQL to ensure it can't write again. That looks  a bit like this:

ALTER TABLE accession_barcode ADD CONSTRAINT accession_barcode UNIQUE ( accession , barcode )

Makes me wonder why I didn't do that in the first place.


Unboxing Porn: Logitech TouchPad


Still in the box
I have just recieved a Logitech Wireless Touchpad for my desktop at work. I've been thinking about trying one for a while, but hadn't decided to make the jump until just recently. Honestly, I didn't need the wireless aspect, and if a wired variant was available, I probably would've jumped much sooner. Alas, there isn't.

Unboxed with USB interface
 The unit is roughly 5"x5 and glossy black, and it behaves how laptops have taught us to expect touchpads to behave, with tap-and-hold mapping to click-and-hold, etc. I work with two computers on my desk, sharing desktops between Linux and Windows via Synergy, with Linux being my primary desktop. I use an IOGear KVM to allow me to switch to the Windows machine for logging in. Linux accepted the TouchPad immediately, but when I switched to Windows, it took a little while for it to install the drivers.

It is good that those drivers come in, though, because one finger moves and two scrolls, but three fingers moves back and forward through your web browser history and four fingers switches between windows. That is, if you run it on Windows. If you're running it on Linux, or through Linux and Synergy to Windows, you only get one and two fingers. I think I'll live without, but that would be nice to have on Linux.

ETA: Some three and four finger swipes work, and I understand there are means to move newer kernels to allow more. Will have to try some.

I still have the Logitech TrackMan Wheel connected, via a USB hub, so I can mouse the way I'm used to, but so far, I'm finding it easy to do everything I need to with the TouchPad.  I like it.

With quarter for size comparison


Request for Assistance: R Graphing Script for my QS project

Here is the R source for my QS weight graph. I get the data in Perl, run it through Template Toolkit, and run it out through here.
It is my code. I like my code. But I know it could be better, even without doing the database query in the R, which I believe it can do.

Here are the things I want to be able to do:

  • I should have dates corresponding to the points. I have the data. I should put them in.
  • Because I take measurements in the morning when I get myself together, I do not always remember to weigh or upload my weight. I want the graph to show this.
  • I also know how many data points are averaged to make the red line. I want to overlay that over the graph, to show the quality of each rolling average point.
Suggestions and patches are accepted. I should say I want to do this with ggplot2 with Cairo as the image library, so I don't have to rely on X11 for rendering and can crontab this.


What's Up With All That Quantified Self Stuff, Anyway?

The way I normally present myself is as a large land mammal. Part of that is my height: at about 6'4", I'm well into the tallest %1 of the population. But that metric is not the crucial one, and as an adult, any attempt to hack my height would require surgery and be painful.

The crucial one is that I am, as of about 8 this 9:14am EST and by the measure of my scale, 265 lbs. This is not the worst I've been; through my second degree and my first IT job, I was up to 330-350 lbs. I don't recall exactly how heavy I was at worst. Understandably, I wasn't too encouraged to keep track, because those are not numbers to be proud of. 265 is a number to be proud of only in context of being some 50 lbs away from it, but I am somewhat proud of it. 265 lbs means I can shop in the Men's section and not the Big-and-Tall section for jeans. I was ecstatically happy when I got jeans that had a waist size of less than 40".

You might say "50ish pounds is pretty impressive. How did you do it?"

I honestly don't have an answer.

I have some ideas. As mentioned, my top weight came with my time in school. During this time, I was running myself ragged, where I would go to campus about 8am and come home and break fast somewhere between 10pm and midnight, then crash out and start again. Many times, I would go to company presentations where students traded pizza for resumes with recruiters, and that would serve as my food for a day or two. Eventually, it got to the point where today, I eat breakfast when I get to my desk and usually have several microwave lunches in the office freezer. A large contributing factor for my weight loss is that I eat more meals.

During this time, there were a few times when I joined a health club and tried to keep up. There's the promises they give, like "You'll feel healthier, you'll have more energy". I can't say that any of that ever happened. It was more bored and sweaty. "You'll be stronger" is also a promise, but you know, I honestly don't want that. I have broken a number of things unintentionally, putting my strength and heft at things that couldn't take it, and I was embarrassed each time. There is not a single thing I have to do, either personally or professionally, that taxes the strength I have. My relationship to my body is a bit like Communism and the State, in that I had hoped that it would wither away, but instead it grew and became a problem.

I'm happy to be down to 265 lbs. but I'm not satisfied. That just means I'm down from "morbidly obese" to "obese" on the health graphs, that I can buy clothes at Wal-Mart. (For all the obesity jokes about Wal-Mart customers, their clothes selection certainly doesn't cater to that demographic.) I've plateaued at 265 for a while, I think, but it might be that weight loss is still ongoing but my method (eating slightly better but more regularly, drinking water, adding slight more walking into my life) is just slow. I just don't have data, and you can't accurately judge effectiveness without data. I'm curious to get more, and I've put a FitBit onto my Christmas wish-list. Once I get a baseline, I can start adding activities or changing my diet, and judging them with some objective measure of effectiveness, rather than what I feel.

Which is why I'm looking into this, and want to learn more and do more. I want to track and analyze the habitat of this large mammal.


More with the Quantified Self stuff

This is me. Specifically, my weight over the last 20 or so days. That's the red line.

The blue line is the average of the weights reported over the seven days previous. There's only one weight recorded at first, so the starting points are the same. I'm told this is an excellent way to normalize the data, to even out the peaks and show the trend. It seems to work.

I was asked "Have you lost weight?" today, but conversation changed before I was able to explain that I can quantify the weight loss, and it's four pounds. That's probably a good thing.

Once I have some things together, I'll definitely put it up on Github. I'm even considering the next step, doing something -- gasp! -- commercial with it! The commerical version will be different, because I've coded this for one person, and I'll have to rejigger it for many parallel users.

  • It's in MySQL, and I'm happy with it. I've been told by someone in the Perl community that I should really go with PostgreSQL, which I don't have a problem with, either. 
  • I've been able to put all the logic in the query and just get the numbers, which I grab using Perl.
  • Using Template Toolkit, I take the numbers and generate an R script. I'm not particularly happy with the means of running it, a system call in the Perl, but I'm happy that it runs, and I'm happy that I can mess with the view, more or less,without having to worry about the model. Metaphorically speaking, as this really isn't MVC. And you can write R that looks much better than this.


Why I'm Gobsmacked By Chrome

Yesterday, I put together a rant against Chrome's failure to handle tabs in Javascript. I was going to spend some time this morning developing a test I could use to demonstrate the problem, but first I had to get some work done.

While doing it, I had reason to use the application where I noticed the problem. Of course, I had to get everything going, because my machine went down for the usual Tuesday updates. And I went through the process and clicked OK before I realized that I was doing this in Chrome not Firefox.

And it worked.

For hackers, it is frustrating to have something fail to work when you don't understand why, but it is also frustrating for something to begin to work when you don't understand why. Chrome is on the update fast-track. Did they find my blog post and fix it overnight? Was my machine well overdue for a reboot, leaving my code encrusted in bit rot that needed a complete restart to clear out? Was it sunspots? Was it a hex? Was I just doing something stupid before? If so, what? I have no way to know why the problem is fixed, so I have no way of knowing when and if it will come back.

The fact that my code suddenly worked will probably be keeping my up nights for a while.

Granted, it is better for things to suddenly work for unknown reasons than for things to suddenly not work for unknown reasons, but both are a problem.


Why I Hate Chrome

Pretend you have a spreadsheet, for example an Excel spreadsheet. You want to do something with it online, because that's what everyone wants to do with stuff.

What's the simplest way? The simplest way is to make a TEXTAREA, and paste it in. If you don't want to make all sorts of subpages for every thing you'd want to put into a TEXTAREA, you make a thing with Javascript and AJAX it up to the server. You only have to reload the page if it works, which is cool. AJAX is cool.

Excel is kinda cool, in a way, in that, if you copy several columns and rows of a spreadsheet and paste it into a non-spreadsheet area, you get newlines for the end of a row and tabs to delimit columns. This is useful, because then you know that, when you have to turn that chunk of spreadsheet into a data structure, you can split on newline to get every row, and then you can split on tab to get every column.

That splitting is something I usually prefer to do on the server side. I write my server-side in Perl, and it can very easily split on newlines and tabs. I write my client-side with the help of jQuery, which I do not believe to be at fault.

I wish to send it up using jQuery's post, sending a JSON object. I put the TEXTAREA's value as a value in an object, and send it to the server. But, as early as I can tell in the process, Chrome's Javascript ignores the tabs, so if you had data that looked like AtabBtabCnewline1tab2tab3, it will pass it up as ABCnewline123.

I'm using Chrome 18.0.1025.56 beta-m right now. I also use Firefox. I mostly use Firefox for Facebook, because I can't load some Facebook games with Chrome. I don't normally mind that: it reminds me not to play around when I'm busy doing something else. Here, Firefox proved to me that Chrome is the problem, not my code. And I'm saved some, because my users for this tool use Firefox.

Still, it makes me mad.


Why I Hate Ruby

I'm taking the Software Engineering for SaaS course through Coursera, and that course is teaching Ruby.

Including the OOPier and LISPier parts. And I don't think like that.

Perl programmers should know $_. Consider $x = my_subroutine(). We see where the return value goes here, it goes to $x. Now, consider my_subroutine(). You know there's a return value. Now, where does it go? It goes into $_. Which means you can follow my_subroutine(); with print ; with no problem, because the first line drops it into $_ and the second line picks it up. New Perl programmers get infuriated by that magic until they understand it.

Ruby has a lot of magic. I understand very little of it.

This is making me cross. And it will make me cross until I start to understand the wizardry of it.