I Use This

October 26, 2012

At usesthis.com they interview a bunch of people to ask about their current computer setup and their dream setup. Most of them are using aged machines, ultraportables (Mac Air is popular), and Emacs/VIM for editing (a few slickedit fans). Most of them have little to add in their dream setup (more battery life, better cloud sync). Are our tools finally good enough? Not for me.

Current setup: A 4 year old Sony Z laptop, 8GB RAM, SSD. I have a 6 year old homebrew desktop w/ a few terabytes of storage and 2 old monitors. I use Windows 7 and do most development in Ubuntu within VMware player (using Unity). When I need it, I’ve got instances running in AWS. I’ve got an ancient jailbroken iPhone, an iPad 1, and an older Kindle. Everything I own is old and works just fine. I use Emacs, bash, Chrome, and the usual grab-bag of software. I even use Visual Studio.

Dream setup: We all own a suite of devices that work OK in isolation. Each device does some things well for certain use cases. But when those devices are together, they should work together much better. Bluetooth and AirPlay are steps in the right direction, but ad-hoc and incomplete. When I sit in my car, my music and phone calls are routed through the car’s sound system. However, I can’t sync the map, listen/send text messages with my voice, nor ask Siri for help. AirPlay is really nice if you have Apple TV. You can send music, video and photos to the TV when you wish. You can send music to the stereo w/ Apple’s AirPort. Google Voice has a feature that allows you to move a call to another phone without hanging up. The Kindle can sync my current location in a book to every device, but I have to move papers and articles over manually.

I want more of this sort of slick integration between my devices. I’d like to group my work into virtual workspaces that have the same intention. Development stuff in one workspace, entertainment in another, communication in another, and so on. If I have 3 monitors, it should spread my workspaces across them. If I get a call while at my computer, I should be able to route the call to my computer’s speakerphone. When I’m reading something in Chrome on my desktop, I should be able to move it to my iPad. When I set my laptop down next to my desktop, it should allow me to move my work seamlessly to my desktop (and vice versa). File syncing is only the first step. I want my activities synced and moved across devices based on what I want, what the device is capable of, and what my work modality is (reading, typing, watching, listening, talking). Some of this can be done now in an ad-hoc way, and I’ve tried to glue the pieces together. But there’s enough friction to still make it fail in irritating ways.

We’re all going to accumulate more and more smart devices. We need to them work together better.


September 5, 2012

Python code to generate k-combinations from N numbers. Included is a recursive and an iterative version. It’s easy.

def choose_rec(n,k):
  a = range(k)

def choose_rec_aux(col,n,k,start,a):
  if col == k:
    print a
  for i in range(start,n-k+col+1):
    a[col] = i

def choose_iter(n,k):
  a = range(k)
  f = range(n-1,n-k-1,-1)

  print a
  while True:
    i = k-1
    while i >= 0 and a[i] == f[i]:
      i = i - 1
      if i < 0:
        a[i] = a[i] + 1
        for i in range(i+1, k):
          a[i] = a[i-1] + 1
      for j in range(a[i], n):
        a[i] = j
        print a

Bloom Filter in C#

July 17, 2012

Here’s a simple implementation of a Bloom Filter.

    public class BloomFilter
        HashAlgorithm hash;
        int m, n, k;
        BitArray table;

        public BloomFilter(HashAlgorithm h, int size, float falsePositiveRate)
            hash = h;
            double bits = -(size * Math.Log(falsePositiveRate)) / Math.Pow(Math.Log(2), 2);
            double hashes = -Math.Log(0.7) * bits / size;
            n = size;
            k = (int)hashes;
            m = (int)bits;
            table = new BitArray(m);

        IEnumerable<int> Probe(byte[] input)
            int chunks = hash.HashSize / 32;
            for (int i = 0; i < k; i++)
                byte[] val = hash.ComputeHash(input);
                for (int j = 0; j < chunks && i < k; j++, i++)
                    yield return Math.Abs(BitConverter.ToInt32(val, j)) % m;

        public void PutValue(byte[] input)
            foreach (int index in Probe(input))

        public bool Exists(byte[] input)
            foreach (int index in Probe(input))
                if (!table.Get(index)) return false;
            return true;


Microsoft Surface

June 19, 2012

On the day the iPad was announced my first thought was to stick a thin keyboard on the case. Two years later Microsoft has implemented the idea exactly as I had imagined it on their new Surface tablet. I agree with Microsoft that it’s important for them to have a tablet with Windows, especially for the enterprise market. So they’ve come out with two versions. Surface is an ARM-based tablet that competes directly with the iPad. Surface Pro is an Intel-based tablet that runs the full Windows 8 OS. This appears to compete with ultraportables.

I assume Microsoft will ensure their hardware and price points are competitive with the iPad. The keyboard is a nice addition, but you can now get a thin keyboard case for the iPad. So the only thing to distinguish the Surface is the OS and software. Well, iOS has a ginormous lead in apps and developer interest. This may be insurmountable in the short-term. If a consumer has $500-$800 to blow on a tablet, which should they buy? I think the iPad still wins.

The Surface Pro is like the Asus Transformer Infinity, an ultraportable laptop with a detachable keyboard. However, the Surface Pro is the only tablet to run a full OS. I don’t think the typical iPad customer will care. It’s not for people who use their laptop intensively, like developers or video editors or designers. It’s for business users who use Office a lot, which is a large chunk of ultraportable customers. This is an important segment because Microsoft does not want the iPad to get a foothold in enterprises. MS owns the server and desktop business market. It should be easy to extend that dominance to tablets. The killer feature is how easy it is to deploy and manage apps within the enterprise. I don’t know how well Apple’s enterprise program works, but I believe Microsoft should easily trounce them by integrating with everything else in the enterprise.

So based on very little information, my guess is the iPad still wins against Surface. In the ultraportable market, the Surface Pro might grab a chunk of enterprise customers who are primarily Office users. Also, they will do ok with enterprise customers who want specialized devices for certain jobs.

Ubuntu is too much work

May 17, 2012

I’m returning my laptop’s SSD for a replacement drive. In the meantime, I loaded Ubuntu Precise on my Sony Z. I usually run Windows w/ Linux in a VM. The installation actually went just fine. It looked good, it appeared to work and all was well. Unfortunately, my laptop has a switch to manually choose between Intel’s integrated graphics and an Nvidia GPU. It took tons of searching to gather clues from cryptic emails and blogs to learn that it probably doesn’t work on Linux 3.2 for some reason. And it turns out it was using unity-2D rather than Intel’s drivers and unity-3d. It took a lot of searching to figure out how to load the right drivers and get unity-3D. It finally works, though the 3D is underwhelming. And I still can’t use Nvidia.

The problem with Ubuntu, and Linux in general, is that it always requires some magical incantation to make things work. And it takes a while to find the right commands because searches often lead to unhelpful threads on Ubuntu’s forums. I’m not a Linux newbie. However, I detest sys admin drudgery because I’d rather work than waste time figuring out how to get hibernate turned on. Linux fans are like gearheads who love to work on cars. For me a car is an appliance, as is my computer. Frankly, I am happy to pay the Windows (or Apple) tax because it means I’ll always get the right drivers and my computer will just work. That is certainly worth $100.

I am willing to pay an Ubuntu tax for a service that makes it dead simple to install and maintain my laptop. Someone could curate all the shit needed to get my laptop working, including memory cards, fingerprint readers, etc. I would pay to subscribe to their PPA. Also, they could run something like AskUbuntu specifically for my laptop model. That way I can be sure the solutions are appropriate for my hardware. I don’t want vague instructions to run some commands; I want a script from them just does it for me. For example, double-tap-and-drag doesn’t work well. Turns out I need to adjust a variable with synclient. But it doesn’t persist across reboots, so I have to add a script to change the value every time I restart. This is not how I want to spend my time. I’d pay for someone else to do this for me.

When my SSD comes back I’ll be reloading Win7 and running Ubuntu in VMware. This setup works perfectly fine for me. I should say, though, that Ubuntu Precise is actually pretty good. If it ran smoothly on my laptop, I might have stuck with it. Maybe.


Ubuntu Software Center UI issues

April 11, 2012

I’ve loaded Precise into VMware (2GB, 2 cores). In 30 minutes I’ve run across so many UI idiosyncrasies in Software Center that I can’t remember them all. Here’s a short list:

  • When I installed git, it didn’t change it’s status to installed until I moved to another screen and back.
  • When I went back to see git, it had a “Buy…” button. When I clicked elsewhere and back again, it changed to “Remove”. 
  • It’s so slow. I doubt it’s VMware because other GUIs respond just fine. 
  • It’s constantly bringing up a new debconf window that appears for a few seconds in my launcher. 
  • The back/forward arrows don’t work sometimes. I did a search, clicked a package, then I couldn’t go back to the result page because the history disappeared (back arrow no longer clickable). 
  • It’s always refreshing the screen. I queued the removal of all default games. While I was looking at another package, it kept refreshing the whole screen again and again. 
  • The window just uses space poorly. A search gives you a list of packages on the left side, leaving a vast amount of lonely white space on the right side. They could have used that to show more info, improve search (tags cloud, refine search), list dependencies, whatever. 

You’re throwing money away!

January 30, 2012

I am for the first time seriously considering making a bid on a home. Coincidentally, two seemingly intelligent women chattering next to me at lunch today agreed that when renting “you are throwing money away”, whereas buying a house means you will (somehow) get that money back. It’s bizarre that most people don’t understand the true cost of owning a home.

Read the rest of this entry »

PyPy is fast

January 28, 2012

I wrote a small Python program that maintains a heap. It took 20 minutes to process a very large data file with Python 2.7. On a whim I tried PyPy. It finished the task in 1 minute. That’s 20X faster without making any changes to my code. Why isn’t everyone using PyPy?

Weather Prediction Error

December 30, 2011

I wrote a Python script to download the 1 through 5 day predictions for the weather in the top 50 American cities from the Weather Underground. I’ve got almost 2 years of data now. Here are the RMSE for predictions for all cities. I believe the RMSE for all cities is 2.24, 2.89, 3.68, 4.29, 4.92 degrees F for 1 through 5 days respectively. I put the data up here, but I don’t yet know how to add visualizations. Unfortunately I have forgotten what little statistics I’ve ever learned. I tried a naïve prediction: tomorrow will be the same as today. This scored a RMSE of 6.11, which is significantly worse than even the 5 day forecast. I’ll try some machine learning algorithms on the data. In addition to the temperature, I stored things like weather condition (rain, snow, cloudy, etc) which may help make better predictions. Overall, I guess the weather underground does ok.

Upgrading Ubuntu to 11.10

December 16, 2011

I run various versions of Ubuntu within VMware. Every single time I let it do a full upgrade to a new version it fails. This time an upgrade from 11.04 to 11.10 failed to reboot. Here’s the problem and solution. This is my first look at Ubuntu’s Unity. Generally I don’t care about the desktop because I live in Emacs. However, this is a colossally bad UI experience. Suddenly the firestorm of complaints about Unity make a lot more sense. I’ll keep trying it for a little while. If I still hate it in a week I’ll switch back to Gnome.


Get every new post delivered to your Inbox.