R (15) Admin (12) programming (11) Rant (6) personal (6) parallelism (4) HPC (3) git (3) linux (3) rstudio (3) spectrum (3) C++ (2) Modeling (2) Rcpp (2) SQL (2) amazon (2) cloud (2) frequency (2) math (2) performance (2) plotting (2) postgresql (2) DNS (1) Egypt (1) Future (1) Knoxville (1) LVM (1) Music (1) Politics (1) Python (1) RAID (1) Reproducible Research (1) animation (1) audio (1) aws (1) data (1) economics (1) graphing (1) hardware (1)

26 November 2013

The Art of the Album

When I'm working, I'll easily listen to 6 or more hours of music a day. Ten years ago, I listened to a *lot* of public radio, which broadened my ear a lot and introducing me to genres ranging from classical jazz to Native American and New Mexican music. Internet radio gave me more choice of stations (I'm now a happy KEXP micro-donor). Finally, there was Rdio (or Spotify, take your pick). Residents of the U.S. got to hear about the wonders of these all-you-can-eat music-as-a-utility services years before they became available here. Complex licensing agreements had to be signed with our musical overlords. But the future has finally arrived, and for $10/month I now have an internet full music (including offline access on phone, $5/mo for just wired computer).

The magic of a high-quality, easily searched and streamed music archive has transformed the way I listen to music. When I hear a song I like, it now takes me less than 30 seconds to find the album and begin playing on my office computer or phone.
There are a few drawbacks - not every album or artist is available (Joanna Newsom is a particularly galling example), and occasionally I find myself without a reliable cellphone or WiFi signal. But these are minor issues. Overall, the ultimate convenience, the *modern-ness* of it all still blows my mind. To me, this is better than a flying car (of course, I don't even own a normal car). And this convenience has, in the last few years, rekindled my love of the art of the album.

It seems to me that independent music in general has benefited from digital distribution by allowing artists to more easily break from the more conventional constraints of genre. I see a lot of experimentation here, running all the way up to the Dirty Projectors' avant-garde classical composition style. Growing up in the 90's, I enjoyed Pearl Jam and Nirvana well enough, but much of the "alternative" music that I listened to at the time sounded (and still sounds) rather similar to my ears, e.g. Grunge. The ones that sounded different really stood out, and I still cherish them for it (I'm looking at you, Pixies). Maybe I'm biased now by access to more music and better DJs, but I find the modern American music scene incredibly vibrant and diverse. Every month, I can look forward to new releases from favorite artists, as well as finding something or someone new to open my eyes and make my day.

What follows is an unordered list of albums that I've recently developed a strong relationship with. These albums cover a wide range of the acoustic/electronic spectrum. I enjoy repetitive, energetic music when I'm working or juggling or cleaning; I love the emotion and classic song-writing of "folk" and "country"; and I love the driving anthems of modern indie. Consequently, I like to think there's "something for everyone" here. And each of these is an *album*, a free-standing work of art worthy of repeated enjoyment in its uncensored, unedited entirety.


Macklemore & Ryan Lewis - The Heist (2012)

I'd like to find more music like this: the crossroads between pop and hip hop, independent music that gets radio play, catchy but meaningful. I can think of half a dozen song lyric lines that make great life slogans. Tis is a great album to blast in the car on a warm spring day.

alt-J - An Awesome Wave (2012)

I think of alt-J as the Neutral Milk Hotel of this decade: where the hell did they come from? It's such a beautiful, subtle album that came out of nowhere and bears repetition very well. I beg the gods for more in the future.

Daft Punk - Random Access Memories (2012)

I never really got into Daft Punk before this album, and I didn't even like it that much the first few plays. The songs on this album tend towards longish, some of them are slow, and I found myself getting bored. Then I began getting lines stuck in my head, and began dipping back in. In the end, I find this an immensely satisfying sort of pop-EDM-concept-album: a soothing mix of repetitive riffs that aren't too fast or insistent with a backdrop of pop anthem melodies. It strikes me as easy-listening Moby? This album is a little slow form me to "sit down" and listen to, but I find it excellent clean-the-house/driving music.

Phosphorescent - Muchacho (2013)

Rainy day + hot coffee. Sunset and a beer. Just got dumped, fired, graduated, engaged? This is such an extraordinarily luscious, eloquent album. It makes me remember that I have emotions. Lots of them.

Santigold - Master of My Make-Believe (2012)

I always perk up when I hear Santigold singles on the radio, but I was slow to listen to the albums. I like her self-title 2008 album, but it never really got under my skin. The second or third listen of Master, though, and I wanted to know more about this artist. After digging around a bit, I feel like I have a better idea of where she's coming from, and where she's going. The comparison to M.I.A. is inevitable, while the album art for Master suggests something more like Outkast. Master has tons of energy and is packed with pop-friendly riffs. But it's complex, and strikes me as walking the "don't define me" tightrope (or slackline, if you will; you can push *back* on a slackline). I enjoy that it doesn't settle down into a niche and stay there.

Less Obvious:

Shovels and Rope - O' Be Joyful (2012)

In my mental map of Americana, I file this near Wilco and Drive By Truckers. Sometimes slow and sweet, sometimes fast and rambunctious, but always melodic, this album is full of luscious 2-part harmonies with a low-fi, intimate feel. I'm always sad when it ends; I always want more.

First Aid Kit - The Lion's Roar (2012)

Can I call this indie-Americana? Less of the overt Southern influence of Shovels and Rope, but still full of tight vocal harmonies of country/folk. Apparently they're sisters, and apparently they're young, but this album has a big sound, full of driving melancholy. Playing two or three of their albums back-to-back is particularly satisfying. They seem to be growing as they go, and I'm excited to hear what comes next.

John Grant - Queen of Denmark (2010)

A very good anthem album. I don't often listen or pay attention to lyrics, but Grant has a John Prine-ish storytelling quality, a dark sense of humor and playful irony. Musically, it's tends towards simple, with a fast, light quality that reminds me of Paul Simon's Graceland. Thematically, though, it's a dark album. A far-off hint of redemption shines at the end of the tunnel, but just barely. Whistling in the dark.

Sharon Van Etten - Tramp (2013)

A powerful voice, and a powerful song-writer. This album is mature and intimate, and Van Etten's voice is strong and clear. Tight harmonies and vocal stylings that are luxurious without being excessive. The utterly enrapturing quality of controlled liquid of her voice reminds me a little of the Cowboy Junkies' Margo Timmins, with a bit of Joni Mitchell. In short, she's good.

Matthew Dear - Beams (2012)

My first introduction to Matthew Dear, this album is driving. Repetitive, almost grinding, the samples remind me of smoothed-out, slowed down industrial, or gears-and-grease voodoo. It reminds me of being in the belly of a very large machine. The tone palette is less pure than, say, Daft Punk, with lots of glitches and grinding noises. It's also harmonic, full of discordant melodies. And I *love* it. There are songs that I would love to hear on a dark dance floor in a small, crowded night-club. It's sexy as hell, with a floating touch of loss and nostalgia.

Jagwar Ma - Howlin (2013)

This is a somewhat confusing album. A mix of upbeat chorus-driven pop tunes and beat-and-sample driven pop-EDM, I find it a little schizophrenic at times. In the space of two songs, it goes from an drivingly upbeat guitar-and-vocals sound akin to Django Django's recent album, to something more akin to Caribou's hypnotic samples, with little in the way of transition. The situation reminds me a little of Hot Chip's recent album In Our Heads (which I still find deeply confusing). But Howlin is infectious throughout, with several singles that belong in the "party mix".

Dirty Projectors - Swing Lo Megellan (2012)

Beautiful melodies with a glorious sheen of tightly-controlled noise and discord, this approaches classical composition in broad-scale interest and ability to scare off pedestrians at a first listen. There's just enough rhythm and melody, though, to reel a music-lover in until one gains some familiarity with the subtleties. Then the album really starts to open up. To my ear, it's the opposite of a show-stopping dramatic pop album. It's playful and light, and strange, and curious and coy, going from simple to huge and back. It's complex and, sometimes subtly, very satisfying. This is real sit-down-and-listen music, kind of like going to see the symphony.

Junip - Self Title (2013)

It's not unlikely that you've already heard "Your Life Your Call". I'm sure it's in some movie or another, or will be soon. I get shivers every time I hear this song - like the soundtracks of the Breakfast Club and Trainspotting had a mutant child. Jose Gonzales has a number of solo albums (I'm quite fond of his 2005 Veneer - see below), though I never made the connection with Junip myself. His voice is as clear and emotional as ever, but the sound is bigger and more nuanced, a wonderful blend of semi-acoustic and smooth electronic sounds. This is an emotional album - not any *particular* emotion, but all of them, simultaneously, and a lot. Much like Muchacho, listening to it makes me feel decidedly and acutely human.

Yppah - Eighty One (2012)

Driving indie dream-pop, Yppah's sound is reminiscent of Heliosequence with drum machines. Something to get the shoe-gazers moving around!

Less new

but recently discovered or especially noteworthy, albums follow.
I'm ready to wrap this post up, so these get just a brief mention, but they're all worth a good listen.

Caribou - Swim (2010)

Smooth, fast, steady electronic. A masterful album.

Jose Gonzales - Veneer (2005)

Contains a cover of The Knife's song "Heartbeats" that I adore. Close and intimate and lush.

Crystal Castles - Self Title (2008)

One of my current favorite albums. I think of it as glitch-rock. It's more syth-y than punk, but has a lot of similar aesthetic sensibilities: loud, abrasive, driving, and inspiring. I particularly like to cue up all 3 Crystal Castles albums and listen to them in a go. Loudly.

Gold Panda - Lucky Shiner (2010)

Very smooth, incredibly-produced electronic music. Deeply satisfying, good work music.

Franz Ferdinand - Self Title (2004)

Anthemic indie-pop. I'm familiar with most of these songs, and was amazed that that they all came from a single album. Buddy Holly meets Lou Reed?

Jolie Holland - Escondida (2004)

Lead singer of The Be Good Tanyas, Jolie Holland's solo album is intimate and enwrapping.

Juana Molina - Tres Cosas (2004)

Quiet and playful yet insistent percussion is the constant backdrop against which Molina's voice plays. And is it ever playful. Her unassuming Spanish is hypnotizing. She has a new release out that I haven't digested yet, but here's another case where I happily queue up 2 or 3 albums in a row and let them blend effortlessly from one to the next.

23 August 2013

Faster, better, cheaper: what is the true value of a computer?

One thing I've had a lot of time to think about over the last 15 years is what exactly does faster & more powerful mean? After a decade of clockspeed wars, we've moved on to more cores, more RAM, longer battery life, less weight, backlit keyboards, etc. A new computer still costs about the same as it did 15 years ago... is it any better?

The more time I spend with the machines, the more I think about usability. A machine is only as powerful as the tasks it can accomplish. I have a $200 netbook (w/linux, of course) that excels at being light. It works great for travel but not netflix. I could not write a paper on it, but I can check email, upload photos/files, etc.

In our computer cluster here, we upgrade as we hit limits. Ran out of RAM? Buy more... it's cheap (for a desktop, at least). Chronic, awful wrist pain? Get an ergonomic keyboard. I find a 2-screen setup a very cost-effective productivity boost, whereas the idea of paying 20% more for a 10% bump in speed strikes me as silly.

The whole state of affairs reminds me a little of mean and variance. We always hear about the expected values of things, the mean, but rarely is variance ever reported, and variance is often the most important part. Things like weather, lifespan, salary, time-to-completion? The variance may be more important than the mean. Speed/power tells something about the "maximum potential" of a machine, but not how much use one might get out of it.

I see two different directions --

First, unexpected developments. Examples include multiple cores and SSD. No one really expected these to change the aesthetics of computers. Nonetheless, the reduced latency of SSD is pleasantly surprising, as is the increased responsiveness under load of a multi-core machine. I don't hit enter and wait. My machine flows more at the speed of thought than it used to, even if I have a browser with 50+ tabs open, music playing, etc.

Second, human interface. My new phone is just a little too tall, which makes it just a little more difficult to use, since I can't reach across the screen with one hand. Again, I never expected this to matter, but it's a human-machine interface question rather than a pure machine capabilities question. Backlit keyboards, ergonomic keyboards, featherweight laptops, and long battery lives are all about the human-machine interface. Which is more important than speed, since the human is the whole point....

The aesthetics of interface is how Apple came to rule the world. Their hardware is beautiful, intuitively responsive to human touch. Hell, even their stores are clean & informative and intuitive and full of fun toys. Personally, I can't stand their walled-garden approach to hardware, and I have the time and energy to coax my machines into greatness through a commandline interface (which remains one of the most powerful human-machine interface ever developed), but I *like* Apple hardware. They've dragged the PC industry kicking and screaming into the 21st century of "Humans matter more than machines".

Which they rather presciently highlighted in their 1984 Superbowl commercial:

Finally, a mind-blowing historical view on the subject, including a 1983 Bill Gates pimping Apple hardware, and Steve Jobs describing how machines should help people rather than the other way around:

Everyday revision control

This post has been a long time coming. Over the past year or so, I've gradually become familiar, even comfortable, with git. I've mainly used it for my own work, rather than as a collaborative tool. Most of the folks that I work with don't need to share code on a day-to-day basis, and there's a learning curve that few of my current colleagues seem interested in climbing at this point. This hasn't stopped me from *talking* to my colleagues about git as an important tool in reproducible research (henceforth referred to as RR).

I find the process of committing files and writing commit messages at the end of the day forces me to tidy up. It also allows me to more easily put a project on hold for weeks or months and to then return to it with a clear understanding of what I'd been working on, and what work remained. In short, I use my git commit messages very much like a lab notebook (a countervailing view on git and reproducible research is here, an interesting discussion of GNU make and RR here, and a nice post on RR from knitr author Yihui Xie here ).

Sidenote: I've hosted several projects at, and used their git archives, particularly for classes (I prefer the interface to github, though the two platforms are similar). I've also increasingly used Dropbox for collaborations, and I've struggled to integrate Dropbox and Git. Placing the same file under the control of two very different synchronization tools strikes me as a Bad Idea (TM), and Dropbox's handling of symlinks isn't very sophisticated. On the other hand, maintaining 2 different file-trees for one project is frustrating. I haven't found a good solution for this yet...

As far as tools go, most of the time I simply edit files with vim and commit from the commandline. In this sense, git has barely changed my work flow, other than demanding a bit of much-needed attention to organization on my part. Lately, I've started using GUI tools to easily visualize repositories, e.g. to simultaneously see a commit's date, message, files, and diff. Both gitk and giggle have similar functionality -- giggle is prettier, gitk is cleaner. Another interesting development is that Rstudio now includes git tools (as well as native latex and knitr support in the native Rstudio editor). This means that a default Rstudio install has all the tools necessary for a collaborator to quickly and easily check out an repository and start playing with it.

09 August 2013

Adventures with Android

After months of dealing with an increasingly sluggish and downright buggy Verizon HTC Rhyme, I finally took the leap and got a used Galaxy Nexus. First off, I think it's beautiful. The rhyme isn't exactly a high-end phone, so the small, unexciting screen isn't particularly surprising. By comparison, the circa 2011 Nexus is a work of art. My first impression of the AMOLED screen is great. Dark blacks and luscious color saturation (though I have found it to be annoyingly shiny -- screens shouldn't be mirrors!). It even has a barometer!

One big motivation for a phone upgrade (asides from the cracked screen and aforementioned lag) was being stuck at Android 2.3.4 (Gingerbread). As a technologist, I don't consider myself an early-adopted. I prefer to let others sort out the confusion of initial releases, and pick out the gems that emerge. But Gingerbread is well over 2 years old, and a lot has happened since then. The Galaxy Nexus (I have the Verizon CDMA model, codename Toro) is a skin-free, pure Android device. Which means that I am now in control of my phone's Android destiny!

How to go about this? I hit the web and cobbled together a cursory understanding of the Android/google-phone developer ecosystem as it currently stands. First off, there's xda-developers, a very active community of devs and users. There's an organizational page for information on the Galaxy Nexus here that helped me get oriented. This post made installing adb and fastboot a snap on ubuntu 12.04 (precise). There's also some udev magic from google under the "Configuring USB Access" section here that I followed, perhaps blindly (though is a good primary reference...).

Next, I downloaded ClockworkMod for my device, rebooted my phone into the bootloader, and installed and booted into ClockworkMod:

## these commands are from computer connected to phone (via usb cable)
## check that phone is connected.  this should return "device"
adb get-state
## reboot the phone into the bootloader
adb reboot-bootloader

## in recovery, the phone should have funny pictures of the adroid bot opened up... reminds me of Bender.
## the actual file (the last argument) will vary by device
fastboot flash recovery recovery-clockwork-touch-
## boot into ClockworkMod 
fastboot boot recovery-clockwork-touch-

This brought me to the touchscreen interface of ClockworkMod. First, I did a factory reset/clear cache as per others' instructions. Then I flashed the files listed here (with the exception of root) via sideloading. There's an option in ClockworkMod that says something like "install from sideload". Selecting this gives instructions -- basically, use adb to send the files, and then ClockworkMod takes care of the rest:

## do this on computer after selecting "install from sideload" on phone
## the ROM, "", varies by device
adb sideload
## repeat for all files that need to be flashed

I rebooted into a shiny new install of Jelly Bean (4.3). It's so much cleaner and more pleasant than my old phone. I was also pleasantly surprised to see that Android Backup service auto-installed all my apps from the Rhyme.

In the process of researching this, I got a much better idea of what CyanogenMod does. I'm tempted to try it out now, but I reckon I'll wait for the 4.3 release, whenever that happens.

I also found, which offers the prospect of unlocking and upgrading the HTC Rhyme, though I haven't found any ROMs that work for the CDMA version...

13 June 2013

Secure webserver on the cheap: free SSL certificates

Setting up an honest, fully-certified secure web server (e.g. https) on the cheap can be tricky, mainly due to certificates. Certificates are only issued to folks who can prove they are who they say they are. This verification generally takes time and energy, and therefore money. But the great folks at have an automated system that verifies identity and auto-renders associated SSL certificates for free.

Validating an email is easy enough, but validating a domain is trickier -- it requires a receiving mailserver that startssl can mail a verification code to. Inbound port 25 (mail server) is blocked by my ISP, the University of New Mexico (and honestly, I'd rather not run an inbound mail server).

I manage my personal domain through They provide full DNS management, as well as some great dynamic DNS tools. They're wonderful. But they don't provide any fine-grained email management, just MX records and the like.

The perfect companion of is They have mail servers that will conditionally accept mail for specific addresses at personal domain, and forward that mail to an email account. This lets me route specific addresses, things like, to my personal gmail account. E4ward is a real class-act. They manually moderate/approve new accounts, so there's a bit of time lag. To add a domain, they also require proof of control via a TXT record (done through

This whole setup allowed me to prove that I owned my domain to without running a mail server or paying for anything other than the domain. The result is my own SSL certificates. I'm running a pylons webapp with apache2 and mod_wsgi. In combination with python's repoze.what, I get secure user authentication over https without any snakeoil.

Hat-tip to this writeup, which introduced me to and their mail servers.

Finally, there are a number of online tools to query domains. was one of the better ones I found. It takes longer to load, but gives a detailed report of domain configuration, along with suggestions. A nice tool to verify that everything is working as expected.

11 June 2013

Learning new fileserver tricks: RAID + LVM

I've finally gotten comfortable with linux's software raid, aka mdadm. I've been hearing about LVM, and I finally took the plunge and figured out how to get the two to play together. Of course, a benefit of RAID is data security. The big benefit I see from LVM is getting to add/remove disk space without repartitioning. Once RAID is working, stacking LVM on top was easy enough, especially for my use case of a single-big-filesystem. I was able to move all my data onto one RAID array, built a new filesystem on top of a logical volume, move data to the new filesystem, and then add the final RAID array to the logical volume and resize the filesystem. Thus, I end up with 3 separate RAID arrays glommed together into a single, large filesystem.

## Tell LVM about RAID arrays 
sudo pvcreate /dev/md2
sudo pvcreate /dev/md3

## Create a volume group from empty RAID arrays
sudo vgcreate VolGroupArray /dev/md2 /dev/md3

## Create a logical volume named "archive", using all available space 
sudo lvcreate -l +100%FREE VolGroupArray -n archive
sudo lvdisplay 
## and create a filesystem on the new logical volume 
sudo mkfs.ext4 /dev/VolGroupArray/archive

## mount the new filesystem
## and move files from the mount-point of /dev/md1 to /dev/VolGroupArray/archive
## then unmount /dev/md1

## Add the last RAID array to the volume group
sudo pvcreate /dev/md1
sudo vgextend VolGroupArray /dev/md1

## Update the logical volume to use all available space 
sudo lvresize -l +100%FREE /dev/VolGroupArray/archive
## And resize the filesystem -- rather slow, maybe faster to unmount it first...
sudo resize2fs /dev/VolGroupArray/archive

## Finally, get blkid and update /etc/fstab with UUID and mount options (here, just noatime)
sudo blkid

I probably should have made backups before I did this, but everything went smoothly...
Also, I discovered this python tool to do conversions in-place. Again, this appears non-destructive, but back-ups never hurt. Also of interest for a file server is Smartmontools to monitor for hardware/disk failures: a nice review is here.


07 June 2013

Symmetric set differences in R

My .Rprofile contains a collection of convenience functions and function abbreviations. These are either functions I use dozens of times a day and prefer not to type in full:
## my abbreviation of head()
h <- function(x, n=10) head(x, n)
## and summary()
ss <- summary
Or problems that I'd rather figure out once, and only once:
## example:
## between( 1:10, 5.5, 6.5 )
between <- function(x, low, high, ineq=F) {
    ## like SQL between, return logical index
    if (ineq) {
        x >= low & x <= high
    } else {
        x > low & x < high
One of these "problems" that's been rattling around in my head is the fact that setdiff(x, y) is asymmetric, and has no options to modify this. With some regularity, I want to know if two sets are equal, and if not, what are the differing elements. setequal(x, y) gives me a boolean answer to the first question. It would *seem* that setdiff(x, y) would identify those elements. However, I find the following result rather counter-intuitive:
> setdiff(1:5, 1:6) 
I personally dislike having to type both setdiff(x,y) and setdiff(y,x) to identify the differing elements, as well as remember which is the reference set (here, the second argument, which I find personally counterintuitive). With this in mind, here's a snappy little function that returns the symmetric set difference:
symdiff <- function( x, y) { setdiff( union(x, y), intersect(x, y))}
> symdiff(1:5, 1:6) == symdiff(1:6, 1:5)
[1] TRUE

Tada! A new function for my .Rprofile!