Skip to content
Jun 20 / Mike Ward

Compose Music From Entropy in /dev/urandom

I used to do things like mess around with cat something > /dev/audio now and then, just to see what various non-media files sounded like (log files were kind of neat – there’s a lot of repeated patterns in there).

I even once started trying to make a shell script that would perform the Moonlight Sonata using just the beep command I didn’t get very far before exams or something came up, and I hit a slight roadblock because I had one computer in the room, and multiple voices for the music, and I just never got around to convincing other people in the office that this was worth the time to do. I can’t imagine why.

Neither of those things is as cool as this this recent blog entry I came across, where they use entropy from /dev/urandom to make music: Bash One Liner – Compose Music From Entropy in /dev/urandom. They even do a good job breaking down the parts of it to explain what exactly they’re doing.

Jan 8 / Mike Ward

Notification LED in Android

Note: The device I was testing this on was a Motorola Moto G (XT1045) running Android 4.4.4 (API 19).

I’ve never had to do Google Cloud Messaging on Android before, but it’s fairly straightforward. I did have problems with one minor thing, though – for some reason, while I could make the Notification sound chime and the vibrate go when I created a notification to show the message I received, I couldn’t seem to get the notification LED to blink. I could hard-code it with setLights, but I didn’t want to do that, I wanted to be able to make it behave like any other notifications received on the device.

So, what I was trying to do was build it normally with NotificationCompat.Builder, and then just doing this:

Notification notif =;
notif.defaults |= Notification.DEFAULT_SOUND;
notif.defaults |= Notification.DEFAULT_VIBRATE;
notif.defaults |= Notification.DEFAULT_LIGHTS;

But as I said, the sound and vibrate worked, but lights didn’t. Asking in #android-dev on Freenode, it was suggested I try using .setDefaults(Notification.DEFAULT_ALL). Amusingly, even though it seems like it should be the same thing effectively, it works.

Searching around, I hadn’t found anything that would have led me to this, so I thought I’d share in case some other poor soul out there faces a similar problem.

Feb 12 / Mike Ward

Free as in Grain

In the Free Software world, there’s a pair of terms to describe software freedom. There’s Free as in beer, which means that the software costs no money to use or download, and there’s Free as in speech, which is related to the freedom of the source code of the program, and the freedom to change that code, redistribute it, and examine it. Often these two coincide – Linux is free as in beer, and it’s free as in speech – it costs nothing to get, and you’re free to make changes to it and redistribute those changes according to its software license.

In the past years we’ve seen something else though, with things like Facebook and Gmail and really, most of the top-visited websites. They’re free as in beer to the user, but there’s a non-monetary cost – your privacy and your control over the data you generate. You give up many rights and even ownership to most sites when you upload an image, sites collect and mine data on you with every click you make, every ad you hide or follow, and every post you make. You might not pay money, but that is a cost in other forms. Free as in beer still technically describes it, but it’s not quite telling the whole story.

Fortunately, a coworker recently coined a term that I love, and I’ve already told him I’m stealing it. He’s referred to these services as Free as in grain. You get the food and lodging free, just like cattle in a factory farm, but there’s a cost, even if it’s not obvious on the surface. You can log in and talk to your 1,935 best friends on Facebook and never pay a dime, but you’re not the one being served. That’s the grain being fed to you, so you can be harvested later, behind the scenes. I love the analogy.

Mar 5 / Mike Ward

Missing Totals in Magento, and Mage_Tax

This is a pretty simple problem, but when I was searching around for it, I didn’t see any reference to my particular resolution, so this is mainly to help in case anyone else experiences the same problem.

I recently had a problem with Magento in which it seemed in the Cart and during the onepage checkout, the area showing the subtotals and the grand total had suddenly gone missing. After more hunting around than I care to admit, I ruled out a problem with the store’s theme, since another store set to the same theme had no such problem. Most configuration options were also identical, which ruled them out as the cause as well.

So, assuming it was a configuration problem, I started going through and comparing. In the problematic store, several modules are disabled, so I started turning them back on, just to rule out that as a possibility. The working store had everything still at the site defaults. It turns out that the problem was simply that Mage_Tax had been disabled. Re-enabling it immediately made the subtotal and grand total reappear. To me, at least, this doesn’t seem very obvious or intuitive, but that’s what it was.

Feb 17 / Mike Ward


Someone, anyone – please improve the PerlMonks website.

It’s such an invaluable resource, with with major names in the Perl community like chromatic and Randal Schwartz and brian d foy. It’s one of the best places to go to just read about in-depth Perl questions people have, to see what other people are doing with Perl, and to generally learn about Perl.

The site, in terms of content and community, is incredible. The site, in terms of the software itself, is deplorable.

It’s not just hideous, it’s built on old, bad design. It wasn’t long ago they even had plaintext passwords leaked. Plain text passwords. On one of the most important sites for one of the biggest languages on the web. If that isn’t indicative of the problem alone, I don’t know what is.

Perl is a great language, it deserves better.

Nov 2 / Mike Ward

CSS Counters

Sometimes I forget how useful the little-used parts of CSS can be. I happened to see a quick screencast about the usage of CSS Counters in my RSS reader today though, and immediately was surprised I hadn’t seen this more often. It’s definitely something I’ll be keeping in the back of my mind.

My first thought while watching, in case someone gets the same idea, is that he’s just making a list. If he wants to number them… use an ordered list. The problem is that he’s using an overly simple example – you could also use these counters in a more complex chunk of HTML. For example, suppose each comment on a blog is in a <div>, with many parts of the comment (author, date, etc) in spans and divs within it. You could take an arbitrary span or whatever tag you like and assign the numbering there, rather than the more limited options an <ol> gives you. It might be possible to still do something like that with an <ol>, but while I’m far from a CSS expert, I don’t see how, and I especially don’t see how it would be as elegant, if it can be done.

Sep 12 / Mike Ward

WSULUG at Student Org Day

For those who aren’t already aware, the Wayne State University Linux Users Group (henceforth referred to as WSULUG because the full name is quite a long one) has been ramping up a bit lately, with activity on the mailing list and ideas being kicked around for meetings, presentations, and so on.

We’ll also be at Student Organizations Day, September 14, on Gullen Mall. Feel free to come stop by between 11am and 2pm  and meet some of us, find out what we’re doing, get a Linux installer (we’re planning on having some Ubuntu installers burned to CDs there), and so on. The people in our group run the range of new Linux users to enthusiastic system administrators, so don’t be intimidated if you’re just curious to learn more, or haven’t even ever seen Linux before.  A LUG is one of the best ways to get started.


Jul 4 / Mike Ward

CodeIgniter, NFS mounts, and Logging

I recently ran into a problem with a site I wrote in CodeIgniter, and I didn’t see much that mentioned it, so I thought I’d post about it in the hopes that if it came up for someone else, maybe I could be of some assistance.

When developing the site locally, everything was fine. On a testing server, it was fine at first, but as more people started testing on it, we found that now and then, the site would simply stop responding. The browser would just stay at the “waiting for server”, apparently indefinitely. We have our subversion server set up to automatically deploy the HEAD tag to the test server, and there’s a web interface to manually deploy a given revision (defaulting to HEAD) whenever. The odd thing was that this hanging problem seemed to be cured (usually, but now always) by pushing the current version out to the server. Sometimes it only cured it for a few seconds or minutes, but often, it seemed fine for hours or days. As time when on, though, it came up more and more often. Oddly, it was only with this site that the problem showed itself. While the site as unresponsive, other sites on the same server seemed fine.

At first we thought the server was just getting bogged down with some process that was using up CPU cycles, or network connections, something like that. Watching htop for a while did show a coworker’s python script coming up, but even that didn’t seem nearly severe enough to be the cause. We also had a bit of trouble with the database server while this was going on, so that was also suspect, though I would be able to connect while the site was unresponsive, so that didn’t seem likely either.

With some help from a coworker, we eventually did come up with the cause, at least in part. We did a list of all files in the site’s directory before the problem happened, and then refreshed the site rapidly using a highly technical method (we hit F5 and held it down until the site died. Then we redeployed from svn, and did another file list, then diff’ed the two. The only difference was CodeIgniter’s own log file that it generates in system/logs by default. After the deployment, the log was cleared. We also noticed that while the site was unresponsive, the log directory had what appeared to be a temporary dot file left by NFS. There was our clue – the directory that hosted sites were stored was in fact an NFS mount.

I’m familiar in brief with what NFS is and what it’s for, and so on, but by no means am I an expert or even a frequent user. It appeared that in this case, though, that maybe the mount wasn’t expected for so much writing as a web log (a fairly heavily verbose one at that, as we we still actively developing the site). It makes sense to me at least – typically you don’t log there, you log in /var/log or something, and the site itself is just a bunch of files you only read from. I wouldn’t be surprised at all if the NFS mount was, or was configured to be, set up for a lot of reads and very few writes, and when the site hammered it with file writes, it slowed to a crawl, as it turned out that if you tailed the log while it was unresponsive, lines were still written to the log, just very slowly. As in, several seconds in between lines indicating nothing more than a PHP class being instantiated.

So, regardless of the gritty technical details of the problem that I haven’t had time to investigate yet, the problem was then easily solved – I just turned off logging altogether, and the problem hasn’t surfaced since.

The lesson learned, for me at least, is to be mindful of where you’re writing.

Jun 23 / Mike Ward

The Linux kernel is now a browser.

Bad Survey Options

I always browse the web direct from the kernel, personally.

This came from a survey from a magazine that, judging from the content of the rest of the survey, is considering or planning on offering a digital edition. I’m a little amused that they did decently on including the major browsers (I wouldn’t think much of it if they hadn’t included Opera, for example), but somehow thought “Linux Kernel” was another browser.

I did check it, though. I mean, technically I’m using the Linux kernel to post this right now, there’s just a few layers in there somewhere.


Jun 16 / Mike Ward


While glancing at vim plugins today, I came across one that’s really nice so far: EasyMotion. The page there has an animated image showing what it does in a nutshell – you hit \w, and it gives you a letter of the alphabet for each possible word, then you hit whichever you want to go to. Small thing, but it makes moving around in the file much quicker, and code editing that much more fluid.

Just thought I’d share in case there’s any other vim users around here.