In goodstuff, music, osx, ruby, technology on
20 April 2009 with no comments
So I was hacking on some Android stuff this weekend and I was immediately distracted by constantly having to flip the song on iTunes party mix DJ bullshit marketing name for shuffle mode. What I wanted was the equivalent of seek mode on car stereos. Where you basically press a button and every 10 seconds, it auto-flips to the next song until you tell it to stop.
OK, this can’t be that difficult right? Right. http://github.com/zackola/itunes-scan/tree/master
A few things. This is basically just a inline script written in Ruby. It uses RubyOSA as an event bridge to interact with iTunes. Although RubyOSA is pretty early, it worked great. You will also need Growl as this makes use of growlnotify to tell you what the track is on change. Also, this is best launched from Quicksilver, but before you do that, you need to turn on the “Run tasks in background option” under “Extras”.
To control the starting/stopping of scanning I’m just saving a text file in ~/.trackscanner with the PID of the process that started the scanning. Sorry for littering your home directory and if anyone has a better idea of where to store this info I’d love to know. Sorry only tested on OS X at the moment.
In uncategorized on
24 February 2009 with 1 comment
Quick Ruby tip. Shame on me for not knowing this but in irb
>>>_
That’s the underscore character, is always equal to the last expression that was evaluated. Thanks @sd.
In astronomy, goodstuff, linux, osx, programming, technology, what i learned today on
15 January 2009 with no comments
Been so busy there’s barely been any time to think about blogging. Today’s edition of What I Learned Today covers two totally separate topics. The first is:
Ack
Ack you say?! Yes. ack. Ack is a command line utility that searches through files for patterns of text. It’s like grep except…it’s more friendly, has some options turned on by default, as far as I can tell its faster too. Oh, and as the ack page points out, its one character shorter than grep. Plenty instructions over there on how to get it installed. I had macports running already to i just:
?>sudo port install p5-app-ack
and I was done in a minute.
Ephemerides
Right. So as some of you might know I’ve been working on this android app for my G1 that displays stars and constellations given the current date, time of day and your geographic location on Earth. I’ve gotten to the point where the stars are showing up, the constellation lines are being drawn, and shit generally looks correct. And then one of my co-workers of course says, “Hey, where’s the moon?”. At which point I throw miniature beach ball at him and say, fuck, I don’t know.
The star data had been pretty straight forward, given out (after some searching) with a RA and Declination that just worked (once you did some gnarly calculations). Data for planets and other objects in our solar sytem (ahem, Luna you ass) however was much harder to come by. I’d been looking on and off for the last week, and just couldn’t find the right information on how to calculate a RA and Declination I could use for the moon. Until today. I needed an Ephemeris. Which is just a fancy way of saying data table. Now if only someone could tell me how to calculate an Ephemeris, eh, maybe I don’t want to get into it. That’s OK, go fucking NASA! They’ll do it for you. Awesome, exactly what I needed. Mad props to ‘jim m’ on the astronomyforum.net moon forum for the tip.
In uncategorized on
26 October 2008 with 5 comments
Apparently you need the:
<uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION”></uses-permission>
<uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION”></uses-permission>
<uses-permission android:name=”android.permission.INTERNET”></uses-permission>
in your manifest file. Wasted a day on that INTERNET one! I swear it was working yesterday without it, but today I was just getting a blank map grid.
Other gotchas about MapViews:
- In the manifest file, those <uses-permissions> elements should come before your <application> element
- In order to define a MapView in an XML layout file, you can’t use a <MapView> element. Instead, you must have a <com.google.android.maps.MapView/> element, and you need to have a android:apiKey attribute in there as well, with a valid android maps api key. Not intuitive.
- Activity.findViewById is a very useful function
- The only type of Activity that can show maps is a MapActivity
In uncategorized on
22 October 2008 with 1 comment
- I worked at Microsoft
- I worked at Juno
- I learned stuff about software
- Buy my software
In goodstuff, programming, technology on
5 October 2008 with no comments
I’ve been a longtime subversion user and before that Visual SourceSafe (ew gross), but at the new jobby job, it’s all git all the time. Being very used to the pretty awesome TortoiseSVN and ZigVersion gui clients for svn, I’ve been a bit hesitant to really dive into git, not really knowing what to expect out of the experience of using shell only tools, and in general understanding why git was designed, and what the big deal was vs. svn, cvs, and other traditional source control management tools. Now that I’ve spent some time making Terminal.app my bitch (fodder for another post I’m afraid), I realize (not fully yet of course) how awesome getting into git can be.
So here’s a quick list of why git rocks, or why I think it does anyhow, and why it’ll be my tool of choice, at work and at home for quite some time.
- When you initially start working on a project someone else has started, already in a repo somewhere, you need to clone it. This is approximate equivalent of svn checkout, pulling the project down to your machine. The really big deal though, is that you now have, on your machine, a complete copy of the repository, not just a checked out working directory, but a full repo! Yes! The entire history of the entire project, and every file in it on your little old machine. Because most work is done locally, git is fast.
- It’s pretty space efficient and smart about diffs. Check this quote ripped from the Peepcode PDF on git: “The Ruby on Rails Git repository download, which includes the full history of the project – every version of every file, weighs in at around 13M, which is not even twice the size of a single checkout of the project (~9M). The Subversion server repository for the same project is about 115M.”
- No muss no fuss. With svn, you end up littering your working directory with tons of .svn directories. With git, there’s just one .git directory in the root of your project.
- Rebasing interactively. Re-order, split, edit commits and then send them on their way. Sounds pretty odd right? Check out the interactive mode section over at the git doc page.
- Branching, for the win. If you’re used to svn, sourcesafe, cvs, or most other traditional systems, when you hear “branch”, you probably want to curl up into a little ball and die. Nightmares of manually resolving hundreds of conflicts, cats and dogs living together, fire and brimstone! Blah! First of all, git was designed to reduce these headaches so almost every bit of development you do ends up being done in your own little branch. You can freely commit to your own branches and switch back and forth between branches at your leisure (git checkout), pull everyone elses recent commits into master, while not at all disrupting your own branches. Files that have been modified but not committed to any particular branch will follow you around as you checkout different branches. This threw me off at first, but makes life so much easier.
I highly recommend that Peepcode PDF, and if you are looking for something a bit shorter, Git Magic by Ben Lynn is wonderful.
In goodstuff, osx, technology on
4 October 2008 with no comments
Well, it’s been a few weeks of working fulltime with Ruby, Rails, on OS X and I must say, I know so much less than I thought I did about OS X, Ruby, and Unix-like systems than I could have imagined. I have taken for granted that in the last seven years of experience I had come to intimately know the Windows stack, and could bend it to my will and bring it back from the brink of death at a moment’s notice with the flip of a switch. I believe educators would say I had fully internalized this knowledge, and not having that foundation to rely upon is really quite scary.
Happily though, I’ve commited myself to doing the same for Linux, OS X, Ruby, Rails, MySQL and host of other great tools. The follow couple of posts will be dedicated to some of the things I’ve found most difficult about switching over from a Windows environment, and how to effectively use some powerful tools that I’ve come across on the way. I think others in the same position will find this info quite helpful. Either way, nothing quite reinforces what you learn like writing it down, so even if it doesn’t help anyone else, it’ll still be useful to me. I’m lucky enough to have the support of some extremely smart, talented, patient, and helpful people, and to everyone I work with, Afshin, and Katie, thanks for putting up with me as I get aclimated.
In horseshit, idiocy, linux, microsoft, technology on
6 September 2008 with no comments
When you are working in XP, and you need to view a calendar to see what day of the week a particular date falls on, how do you do it? Well, if you are like 95% of non-corporate windows users (not getting your time from a domain controller or time server), you probably double click on the little date/time thingamajig on the taskbar. This takes you to the computer’s date/time settings, which allows you to you know, change the system date/time. This is idiotic. Really, what you want is a calendar application to pop up. Some mystical application that lets you view upcoming dates, which is iCal on OS X and non-existent on Windows. So, if you want to see what day of the week the 30th of next month falls on, you have to actually change the system date/time to next month. Now of course, if you just hit Cancel, it won’t apply your changes, but sadly, my parents and many others aren’t that savvy and just hit OK when presented with any non-threatening looking dialogs. Additionally, there is no warning that you are making a system wide change.
This ends up, ridiculously, having a pretty terrible impact on the user’s web browsing experience. When my parents attempted to access their bank/credit card website after accidentally setting the system time to a month ahead, all of a sudden, their PC thinks that Amex’s security certificate is invalid and blocks them and warns them that the site is not secure because the system time is ahead of when the certificate expires. This is so incredibly dumb. OS X and most Linux distros gets this interface wrong too. Settings to change the system time should be buried somewhere in system preferences, and arguably, you should be required to have Admin rights to change it. When an end user clicks on that little date/time thingamajig, they should get a calendar application (non-existent in windows), not a date/time settings dialog.
UPDATE: Making this even more ridiculous, I checked out the time sync properties, and it was actually set to sync automatically wint time.windows.com or what have you, and a successful update had been performed on 9/26/08. Awesome. Syncing time from the future!
In goodstuff on
4 September 2008 with no comments
KL and I went to the US Open last night and saw some great tennis. The Williams sisters beat the crap out of each other until Serena prevailed, and M. Fish put up a great fight with Nadal for a while. We’ve been lucky enough to have a great ticket hookup over the past several years, so we’ve gotten quite adept at navigating the area, dealing with the crowds, and generally getting the most bang for our bucks while there. Here’s a few tips I think are worthy of sharing.
Prep Work
- Money. Use your bank’s ATM before going. I recommend $100 bucks. Should get you enough beer to drown in.
- Your own food. Dinner and snacks. Get some good sandwiches from somewhere. Food and drink here is an even bigger rip-off than at most events. All brought in items must be in a non-sealed container.
- Water.
- Bring this stuff in disposable plastic bags, or better yet, some sort of cloth bag that you are positive will get through their stupid bag requirements. (No med-large backpacks)
- Sunscreen
- Sweatshirt
- Hat
- Sunglasses
Getting There
The train is the only acceptable way to get there if you live in NYC. If you are driving, you are out of your mind, and I can’t give you any applicable advice besides, “Stop it!”. While living in NYC, you somehow need to get yourself to the 7 express train. Local is not a good option for getting there. We live downtown, so for us, the preferred route is the 4/5 to grand central. Here are our specifics.
- 4/5 Stop at Wall St.
- Enter at southern most entrance.
- Once through turnstiles, walk 15 feet to the right.
- Upon getting to Grand Central, you will magically be right in front of a staircase leading to the 7 train.
- Take it.
- When you get to the final set of stairs before the 7 platform, turn right.
- Up ahead, towards the eastern end of the platform, there is a newstand.
- Move about 10 feet east of that.
- Wait for the express train. It is incredibly faster than the local, and you are going way out there. 7 Express is denoted by a diamond on the side of the car.
- When you get to Shea, magically, you will be exiting the subway exactly at a staircase that leads down and off the platform. You should be able to get ahead of the rest of the train crowd, which will be important for the next part.
My father swears by not bringing bags, and zipping though the security check. I don’t agree. It has never taken more than 15 minutes, and the amount of money and indigestion you save by bringing your own food more than makes up for it. Say hi to the guy dressed as a giant doublestuffed Oreo, commiserate with the grounds staff. The bag check is cursory and quick once they start moving.
Getting Drinks
Congrats! You got there! Ahead of the crowds even. Now what? Want a drink? Pass the initial stands at the entrance and head inwards, toward Arthus Ashe stadium and you should get to the second set of drink stands. If you are lucky, there won’t be a line yet. Whose sponsoring this year? Grey Goose? Nice. The signature cocktail this year is a $13 Grey Goose Honey Deuce. Vodka, Chambord, Lemonade and a trio of melon balls on a stick. Pretty pricey, but a good way to start off the night. Step up and order yourself one. Tip the bartender before he starts making your drink and make sure he sees you do so. They don’t have the ridiculous auto-measure doohickeys that most sporting events have, they get to actually use a jigger/pony so, if they are feeling appreciative, they might dump an extra half shot in for you
Now, look to your left, tons of tables. Why is no one sitting there? Because they’re all stuck in the subway mire which you smartly avoided by being a subway ninja. Grab a table, or pop a squat anywhere in this area, settle in, eat your non-ridiculously priced food, enjoy your drink and relax until your matches start.
Once inside the stadium, during the match, the only thing worth buying is the commemorative $9.50 extra novelty sized beer. Generally crap beer, but hey, you get to keep the crappy cup too. You can use the same cup for the rest of the night and get it refilled. Good for the environment and your drunkenness!
Closing Thoughts
Well, you made it. Sit back, relax, and enjoy the awesome tennis. Hopefully. Last words of advice are use the bathroom and go for refills during a game, not in the space in between sets or games. Oh, and if you are at the night session, good luck getting back! The 7 is now most likely running local, but still for $2.00 or, you know, free if you have a monthly card, you can’t beat it.
In technology on
28 August 2008 with no comments
I really like these two examples of designing web UI elements that blend right into the browser’s chrome.
First we’ve got Google’s Firefox start page, which has probably been my default page for the last n years or so. The simplicity of this trick is great, basically just color matching with a little gradient, but it gives the nice illusion that the Google service links are actually part of your browser. Provides some one of the main benefits of a Firefox extension, without the extension. Sweet.

Next up, we have the little notifcation/chat controls on Facebook. Once again, they’ve disguised their controls to blend right in to an interface that users are comfortable with and have been using for quite some time. Pretty slick. I bet many users don’t even realize that this is part of Facebook.

Anyone else seen some cool examples of this type of thing? Is there a design term to describe this? I guess it’s just attempting to do the something GUI toolkits have done for years and provide a familiar, consistent interface. Neat to see the browser as the target, and maybe (but probably not) warrants some consistent definition and description. I’d like to propose a new term Chromulent Interface Design to describe interfaces built in HTML that attempt to seamlessly blend into the browser’s chrome. Yes, I’m making a Simpson’s reference that has nothing to do with the original joke, but so what. It’s a perfectly cromulent term.
UPDATE: Afshin makes the really great point that this kind of sucks because it makes it quite easy for malicious web developers to build chromulent interfaces that look trustworthy.