The absurdity of this is just plain hilarious. “I’m on a horse.”

Old Spice - The Man Your Man Could Smell Like (via oldspice)

User Agent Detection in Java

I was looking for a way to detect mobile devices in Java and hoping someone had done the heavy lifting for me. It turns out someone had. There’s a port of a PHP script I found at Hand Interactive that looks like it does what I need.

Basically if I detect a mobile device I want to use a different stylesheet on Quote Crate but I didn’t want to have to find all the user agent strings myself. This should work nicely. I’ve loaded the file into a Gist on Github and plan to make some improvements to it.

functional programming ftw

harryh:

Simple, but fun:

def partition[T](items: List[T], p: (T, T) => Boolean): List[List[T]] = {
  items.foldRight[List[List[T]]](Nil)((item: T, items: List[List[T]]) => items match {
    case (first :: rest) :: last if p (first, item) =>
      (List(item)) :: (first :: rest) :: last
    case (first :: rest) :: last =>
      (item :: first :: rest) :: last
    case _ => List(List(item))
  })
}

If you understand what this does, or know someone who does, I’m hiring. Send me an e-mail.

It took me a bit but I did sort this out. I like Scala and how it lets you express powerful things concisely but I have to give my brain time parse stuff like this still.

Task Queue Java API Overview - Google App Engine - Google Code

Coming and Crying