Not today Justin
Cosmic Funnies

#extradirty
DEAR READER
One Nice Bug Per Day
todays bird
hello vonnie
PUT YOUR BEARD IN MY MOUTH

@theartofmadeline

roma★
Show & Tell
Misplaced Lens Cap

Love Begins
almost home
Today's Document
No title available
we're not kids anymore.
styofa doing anything
AnasAbdin
he wasn't even looking at me and he found me

seen from Japan

seen from Bangladesh

seen from United States
seen from United States

seen from Malaysia

seen from United States
seen from United States

seen from Germany
seen from Italy
seen from United States
seen from Paraguay
seen from United States
seen from United States

seen from United States
seen from Finland

seen from Malaysia
seen from France

seen from Türkiye
seen from United States

seen from United States
@tlrobinson-blog
Luke, I am your recruiter.
Dale Carnegie doesn't understand thermodynamics
Pretty sure you can't add temperatures like this...
“‘Well, now look, Mr. Smith,’ I said. ‘I agree with you a hundred percent; if those motors are running too hot, you ought not to buy any more of them. You must have motors that won’t run any hotter than standards set by the National Electrical Manufacturers Association. Isn’t that so?’
“He agreed it was. I had gotten my first ‘yes.’
“‘The Electrical Manufacturers Association regulations say that a properly designed motor may have a temperature of 72 degrees Fahrenheit above room temperature. Is that correct?’
“‘Yes,’ he agreed. ‘That’s quite correct. But your motors are much hotter.’
“I didn’t argue with him. I merely asked, ‘How hot is the mill room?’
“‘Oh,’ he said, ‘about 75 degrees Fahrenheit.’
“‘Well,’ I replied, ‘if the mill room is 75 degrees and you add 72 to that, that makes a total of 147 degrees Fahrenheit. Wouldn’t you scald your hand if you held it under a spigot of hot water at a temperature of
147 degrees Fahrenheit?’
“Again he had to say ‘yes.’
“‘Well,’ I suggested, ‘wouldn’t it he a good idea to keep your hands off those motors?’
“‘Well, I guess you’re right,’ he admitted. We continued to chat for a while. Then he called his secretary and lined up approximately $35,000 worth of business for the ensuing month.
From How to Win Friends and Influence People.
Remap Caps Lock to "Search" on OS X (Google Cr-48 style)
One of the more intriguing features of Google's new Cr-48 Chrome OS laptop is the lack of replacement of the caps lock key with a search key. I wanted to try this on my Mac. Here's my hacky solution:
Install PCKeyboardHack to remap caps-lock to an unused key, for example one of the function keys (F1 is keycode 122 on my keyboard)
Create an AppleScript to open a new tab in Chrome (or your browser of choice). Here's an example AppleScript.
Assign the previously chosen key to this service. Unfortunately OS X prevents you from assigning function keys to services directly. You can either create a Application Shortcut with the same name as the service (put the script in ~/Library/Services) in the Keyboard Shortcuts panel of the Keyboard pref pane, or you can use FastScripts (I had better luck with the latter)
Unfortunately there's some lag compared to simply hitting "command-T". Edit: saving the AppleScript as a script rather than an Automator action improved the lag considerably.
If you have a better way of doing this please send it my way.
Thanks to @MSch for the PCKeyboardHack suggestion, and @ryannielsen pointing me to FastScripts.
Kindle 3
When the iPad was announced I assumed it would eat the Kindle for lunch. After all, it had a large color touch screen and could do much more than just read books, right? Well, yes, but it turns out to be not very good at the one thing a tablet form factor is perfect for: reading.
I finally picked up a Kindle 3 after reading Paul Stamatiou's great review. Here are my thoughts after a few weeks of nearly daily use with it.
Kindle does one thing, and one thing well: reading. iPad does a bunch of things mediocrely.
Extremely readable display.
Lightweight and easy to hold. Not awkward to hold at any angle. No fumbling with folding the pages over trying to find a comfortable grip. This makes reading more enjoyable.
Carry many books with you. No upfront decision on which book to bring on a trip. Read whatever you're in the mood for. This is also a downside, as I find myself buying new books before finishing the ones I've already started. Currently I have 5 unread books on my Kindle.
Satisfying mechanical click when going to the next page. No gratuitous virtual page flipping animation.
I find I've been reading much more than I used too. I never read books daily before, but I do now.
The built-in dictionary is useful, as is the highlighter feature (iPad has both of these features)
Amazon now has access to lots of interesting data. So far they've only given us access to popular highlighted excerpts. Two things I'd like to see are the average time it takes to read a given book, and my personal words-per-minute rate. A speed-reading training mode would be neat too.
Excellent battery life... if you turn off wireless. iPad's battery life isn't bad compared to a laptop, but Kindle will last a long time. It died after a few days of heavy use with the wireless turned on, but then I turned off wireless and it hasn't run out of juice yet.
Fewer distractions than iPad. With so many apps and websites just a button press away I found I had a hard time focusing on reading on the iPad. Not so on Kindle. While Kindle does have an "experimental" web browser (WebKit based) it's not very useful, so I don't find it distracting.
After several months of frustration trying to use the iPad as a travel computer I've given up. For now I'll be sticking with a MacBook plus a Kindle and recommend anyone who does serious work on their computer do the same.
Fucking telemarketers
Telemarketer: Hi. I'm calling today about your credit ca-
Me: [suspecting it's a telemarketer] Is this about a credit card I already have?
Telemarketer: Yes.
Me: Oh ok. Which one?
Telemarketer: All of them, sir.
Me: [click]
Installation log, iPhone edition
Following up on my desktop installation log, I've declared iPhone app bankruptcy and will be posting the apps I install on my fresh iPhone 4.
Twitter - formerly Tweetie 2
FourSquare - social location thing of choice
Facebook - most popular iPhone app
Meebo - multiple IM client with push notifications
Skype - cheap international calls + for when AT&T sucks but WiFi is available
Pandora - Internet radio that's actually useful thanks to iOS 4's background apps
Boxcar and Prowl - various push notifications (Twitter, Facebook, email)
Installation log.
To keep myself from installing too much crap on my freshly formatted system I'm keeping a log of what I've installed and why:
Edit: I've struck out a few applications I decided I didn't need/like
Chromium - latest builds of Chrome, includes Chrome extensions on OS X.
WebKit Nightly Build - latest builds of WebKit for Safari.
Cinch - Windows 7 [gasp] style window manager enhancement.
TextMate - text editor of choice.
Dropbox - the best cloud storage/backup service.
Tweetie - the only not crappy Twitter client for OS X.
Adium - multi-protocol IM client.
Colloquy - IRC client.
uTorrent - a slim torrent client.
Xcode - developer tools.
Homebrew - package manager for OS X. In the past I've used MacPorts, but I hear good things about Homebrew so I'm giving it a try.
git - version control of choice.
Inconsolata - programming / terminal font.
PowerMate driver - what can I say, I love shiny knobs.
VLC - video player that can play just about any format.
Pastebot Sync - copy/paste between Mac and iPhone.
VirtualBox - free virtualization software for running Windows, Linux, etc.
QuickTime Broadcaster - for HaightCam on Justin.tv.
Transmit - best FTP/SFTP/S3 client.
MacRuby - Ruby implementation on Objective-C runtime.
GraphViz - graph layout tools.
rEFIt - boot menu for dual booting.
ProjectPlus - various TextMate enhancements (version control, sidebar)
CSSEdit - nice CSS editor.
Charles - web debugging proxy.
OmniGraffle - diagramming tool.
Fluid - site specific browser (currently used for Pivotal Tracker)
Hex Fiend - a hex editor
Visor (and SIMBL) - hot-key accessible terminal. Plus pretty terminal colors.
Sequel Pro - MySQL admin interface
Kaleidoscope - A beautiful diff-ing tool made by Sofa.
CloudApp - share images, links, etc on the web
Alfred - quick launcher
TVShows - downloads TV shows torrents automatically
A nice summary of the state of affairs of server-side JavaScript by Kris Zyp.
Hello world, again!
Along with my new personal website, I’m starting a new blog, located at http://blog.tlrobinson.net.
Using OLPC XO as an ebook reader for O'Reilly's Safari Books Online
A year ago I received an OLPC XO (the “$100 laptop”) through their Give One Get One program. I played with it for a few days and found it essentially useless due to unstable and slow software (and lack of WPA support), so it quickly began gathering dust on a shelf (it has since improved).
Last week I was thinking about how cool it would be if Amazon’s Kindle supported O’Reilly’s Safari Books Online service, and I decided to dust off the XO to see if it could be used as an ebook reader for Safari Books. With a little help, it can.
In ebook mode you can scroll in all four directions, page up/down, and jump to the top or bottom of a page, but you cannot click the next/previous buttons within Safari Books. However, GreaseMonkey and a simple userscript can solve that.
The first step is to install the Firefox “Activity”, or a version of Linux that runs a stock Firefox. Then install GreaseMonkey. Finally, install this userscript:
http://tlrobinson.net/userscripts/xo-safari.user.js
This simple userscript intercepts page up and page down (the “O” and “X” game pad) buttons and maps them to “previous” and “next” actions in Safari Books, allowing you to easily switch pages in ebook mode.
ropen: Remote "open" command for opening remote files locally on OS X
The Problem —————-
Most Mac OS X power users know about the [“open”](http://tuvix.apple.com/documentation/Darwin/Reference/ManPages/man1/open.1.html) command line tool which opens the files specified as arguments in their default (or a specified) OS X application. Additionally, many OS X text editors, such as TextMate (“mate”) and SubEthaEdit (“see”), come with command line tools which can be used to open files.
These are great when working locally, but obviously do no work remotely. Often when working on remote servers you end up using command line editors which you may not be as familiar with.
ropen’s Solution ————————
The [ropen](http://github.com/tlrobinson/ropen) tool solves this problem using two simple shell scripts, which make use of MacFuse’s sshfs. You run the “ropen” program on your remote machine(s) when you want to open a remote file locally (this is equivalent to the OS X “open” command). The “ropend” daemon runs on your local OS X machine waiting for open requests, and the “ropen.php” PHP script proxies requests from ropen to ropend.
How it works ——————
1. When ropen is executed it makes an HTTP request to ropen.php with the paths to be opened and application to open them with, if any, as well as the SSH user, host, and port of the remote machine. 2. ropen.php stores this open request in a queue that is tied to ROPEN_SECRET via PHP’s sessions. 3. ropend polls ropen.php every 1 second waiting for open requests. When it receives one it mounts the remote filesystem using sshfs (if it’s not already mounted) and opens the files or directories specified.
More information ——————
See more information about ropen on the [ropen project page](http://github.com/tlrobinson/ropen).
Determining the absolute absolute path of a shell script
In the course of working on projects like server-side Objective-J, jack, and now narwhal, I’ve often had to write shell scripts that needed to know their location in the filesystem. Rather than hardcoding it, I prefer to infer it automatically at runtime. Unfortunately this isn’t as easy as you would expect.
If the script is invoked with an absolute path (“/foo/bar/baz”) or from your PATH (“baz”), then “$0” in the script will contain the absolute of the script (“/foo/bar/baz”). However, if it is invoked using a relative path (“./bar/baz” from “/foo”) then $0 will contain the relative path (“./bar/baz”). Furthermore, if the path to the script is actually a symbolic link, you’ll get the symlink’s path instead of the original.
Surprisingly, I couldn’t find a definitive solution that handles all these cases, so I took the various ones I did find and created one which I think handles all the cases I’m aware of:
If you don’t want to resolve the symlinks remove the second half.
Embedding and loading a JNI library from a jar
When I searched for ways to load a JNI library from a jar there were numerous hints of how to do it, but no code that I could find. So here’s my solution:
import java.net.URL; import java.util.zip.ZipFile; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; public abstract class UnixDomainSocket { static { try { // get the class object for this class, and get the location of it final Class c = UnixDomainSocket.class; final URL location = c.getProtectionDomain().getCodeSource().getLocation(); // jars are just zip files, get the input stream for the lib ZipFile zf = new ZipFile(location.getPath()); InputStream in = zf.getInputStream(zf.getEntry(“libunixdomainsocket.jnilib”)); // create a temp file and an input stream for it File f = File.createTempFile(“JARLIB-“, “-libunixdomainsocket.jnilib”); FileOutputStream out = new FileOutputStream(f); // copy the lib to the temp file byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) out.write(buf, 0, len); in.close(); out.close(); // load the lib specified by it’s absolute path and delete it System.load(f.getAbsolutePath()); f.delete(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } // … }
This particular example is for JUDS. It could be extended to load one of several libraries for different architectures, .jnilib or .dylib for Mac OS X, .so for Linux, and .dll for Windows. This seems like a lot of hoops to jump through, but I couldn’t find an easier way to do it. If you know of a better way, please let me know in the comments.
Game of Life text and image generator generator
I saw this image the other day on Hacker News and Reddit: It’s a Game of Life pattern that prints out “Golly”. Neat, but I wanted my own. After about 5 minutes of playing around with the Golly logo pattern in Golly (a program for experimenting with the Game of Life), I gave up and wrote a program to do it. The program takes the top and bottom portions of a template pattern (based on the Golly pattern) and positions them, then fills in the gliders between them for the correct number of columns. Then it duplicates the entire pattern for each row. Finally it “draws” some text (using the sample font from here) by deleting the gliders corresponding to empty space. This was great, but I had essentially created a dot matrix printer that could draw anything, so it would be a waste to not draw images with it. A few lines of Ruby/RMagick code later, I had a program that did just that. Here’s an example using the Reddit Logo (watch it in HD for the best results): The code is available on GitHub. It requires Ruby, and RMagick for images. Pass it “-s yourtext” to generate a text based pattern, or “-i imagepath” for an image pattern. Download Golly to open up the generated “.rle” files.
Ant Tasks for Git
Ant has tasks for CVS and Subversion, but none that I could find for Git. I threw together these simple Ant macros to get started:
<macrodef name = “git”> <attribute name = “command” /> <attribute name = “dir” default = ”” /> <element name = “args” optional = “true” /> <sequential> <echo message = “git @{command}” /> <exec executable = “git” dir = ”@{dir}”> <arg value = ”@{command}” /> <args/> </exec> </sequential> </macrodef> <macrodef name = “git-clone-pull”> <attribute name = “repository” /> <attribute name = “dest” /> <sequential> <git command = “clone”> <args> <arg value = ”@{repository}” /> <arg value = ”@{dest}” /> </args> </git> <git command = “pull” dir = ”@{dest}” /> </sequential> </macrodef>
The first one, “git” just runs git with whatever command you provide to it (clone, pull, etc) along with any arguments you pass to it. Clone:
<git command = “clone”> <args> <arg value = “git://github.com/280north/ojunit.git” /> <arg value = “ojunit” /> </args> </git>
And pull:
<git command = “pull” dir = “repository_path” />
(Other git command will likely work, these are just the ones I needed) The second one, “git-clone-pull” uses the first one to clone a repository then pull from it. This effectively clones the repository if it hasn’t already been cloned, otherwise it pulls. However, since ant is fairly limited in what sorts of conditional execution you can perform, it just does both (clone will fail if it’s already been cloned, and pull will always be executed, even immediately after a the initial clone). Obviously not ideal, but it works, and I couldn’t figure out a better way without writing actual code.
<git-clone-pull repository=“git://github.com/280north/ojunit.git” dest=“ojunit” />
There is plenty of room for improvement, but I suspect a proper Ant task written in Java is the right way to go.