Michael Buffington

Scroll Wheel Application Selection in OS X

Tuesday, January 31 2006

I’m trying to force myself to stop using the OS X Dock again in favor of using Quicksilver to switch apps. I was doing pretty good for a while but fell back into bad habits, even when I removed everything from my dock and made it as small as possible (actual size shown) or hid it.


Miniscule Dock


Today while hitting command-tab a lot, I thought it’d be really cool to use my middle mouse button to trigger command-tab, then use the scroll wheel to select the application I wanted to switch to. Unfortunately nothing in OS X lets you do this kind of mapping. After nearly giving up, I saw something in my Logitech Control Center. It was able to select “Switch Application” as the assigned action for the scroll wheel. I was about as elated as I could be over this (which, on a scale of elation from 1 to 10, I hit about a 2.3) until I actually used it.


Logitech Control Center


I think my concept is sound and quite intuitive, but the way Logitech makes it work produces awkward results. Scrolling the mouse wheel brings up the open applications overlay, just like command-tab would, but then it only very quickly switches to whatever app the scroll wheel has selected. In order to really switch an app, you have to keep the wheel moving until you see where your app is and then you have to quickly select it. If Logitech simply let you adjust the amount of “idle wheel” time to be a bit longer, I think it might work really well. Ideally I’d still like to be able to click my mouse wheel, scroll to my app, then click to select it. I’ll keep my eye out for a solution.

Ban Pomeranians

Tuesday, January 31 2006

Jason linked to a Malcolm Gladwell article where Gladwell talks about generalizations – the article is good and has some pretty meaty things in it, including what kind of dogs kill. Despite what the article seems to make very strong, Jason says "I hate “pit bull-type” dogs and I still think they should be banned." (emphasis mine). And so I have to ask – did you really read the article Jason?

Malcolm cites breed counts behind the numbers of fatal dog bites in the article – pit bulls lead the killers sometimes, but just as often so do German Shepards and Huskies and mixed breeds. The entire article points out how you can’t simply say “pit bulls are killers” – the historical data doesn’t support the claim.

Making the claim that all pit bulls are killers is as unfounded as saying that all terrorists are young Arab men – while true for the September 11th attacks, in subsequent attacks throughout the world it’s not the case any more (which the article also supports). There are far too many unstable factors that ultimately end up resulting in fatal dog attacks, the least of which seems to be the dog breed.

So Jason’s comment has me a bit riled for two reasons – the first is that the article is pretty strong in suggesting you can’t make generalizations on unstable data, yet he does just that (perhaps sarcastically, but you can never tell for sure). The specific dog breeds involved in fatal dog attacks is unstable. Fatal dog attacks tend to follow the popularity of aggressive dogs. If Great Danes are all the rage for a few years, you’re going to see Great Danes take the top slot, and so on. What is stable about fatal dog attacks is the kind of treatment the dog had leading up to the attack. Aggressiveness was reinforced, the dog was neglected or abused, and the owner was generally not a responsible dog owner. So to say that “pit bulls should be banned” borders on crazy, especially when the data suggests otherwise.

The second reason I’m riled is that based on my own personal experiences, I’ve never known kinder dogs than pit bulls. And according to the data we have from people who study dog breeds, my experiences are consistent with the norm.

When I was three or four, my Dad’s roommate owned a pit bull named Sandy. Sandy was a smallish dog with a sweet demeanor. She never jumped on you, always obeyed (even three year olds), and was as soft and gentle as a dog could be. Rather than use a collar on Sandy, her owner would use a harness. My brother and I used to take turns climbing onto Sandy’s back, holding onto the harness, while she ripped around the house. If we fell off, she’d stop and let us get back on, continuing the game.

Sandy had puppies, and if you sat down and told her to come, she’d bring every puppy with her, setting them in your lap as she ran back to get the other. This sort of affection and comfort level for her “master” (despite my only showing up on the weekends and being just a little kid) has had lasting effects on what I find desirable in a dog, or even people for that matter. Unabashed affection and loyalty are traits anyone would be wise to learn about at an early age.

When I was a teenager I was working on a car in the driveway of our house, and I was underneath it on my back. I heard the jingling of a dog collar and it sounded like it was approaching rapidly. As I began pulling my head out to see what was happening I saw a very large pit bull making a bee line from across the street to me in full sprint. I was pretty much terrified, knowing that any unknown animal torpedoing towards your head could be a Bad Thing.

Before I could get out from underneath the car the pit bull attacked – with licking that is. I was smothered by a dog who was absolutely enthralled at the chance of licking my face. He was practically floating in his wild excitement as he expressed his instant infatuation with me. The owner came quickly, and the dog was reprimanded for getting loose, but was obviously taken care of well by his owner and showed every sign of a very happy and healthy dog.

I fully support Gladwell’s notions that generalizing based on unstable factors is foolish. In the case of pit bulls and aggressive dogs in general, fatal death counts are more related to the owner and the conditions of the dog and their levels of socialization that matter most, not the dog breed itself. As a researcher in the article suggests, even Pomeranians have been known to kill, so why not suggest a ban on Pomeranians?

Enough

Wednesday, January 25 2006

Please, stop calling the internet the internets. Thank you.

Small Tweak for Typo

Tuesday, January 24 2006

I haven’t created a patch or even submitted a ticket for this yet because I’m not sure if all of the unit tests still pass, but if you’re having trouble with Typo’s requirement that all images in a theme reside in the “images” folder, and not in any subdirectories of “images”, these two simple changes will fix it:

config/routes.rb
From:

map.connect ‘images/theme/:filename’,
:controller => ‘theme’, :action => ‘images’

To:
map.connect ‘images/theme/*filename’,
:controller => ‘theme’, :action => ‘images’

Changing the symbol :filename so that the route accepts an array of the name filename allows anything after images/theme to come in without Typo getting confused about how to route it.

app/controller/theme_controller.rb
From:

def images
render_theme_item(:images, params[:filename])
end

To:
def images
render_theme_item(:images, params[:filename].join(“/”))
end

Now that params[:filename] is an array, all we need to do is format the elements in the array as a string with slashes to traverse down into the requested directory. Pretty simple.

Rails Troubleshooting Steps

Sunday, January 22 2006

One of the most difficult things for a new comer to Ruby on Rails to deal with is trying to figure out what’s wrong when your application won’t work and, even in development mode, reports the vague and dreaded “Rails application failed to start properly” error. I’ve found, after having felt the pain over the course of the last year a few times, that the problem usually boils down to one of a few things.

Eliminate Web Server Issues
Make sure your web server is running properly. If you’ve fired up a Webrick server, watch your terminal window to see if it’s indeed responding to requests. You should see some kind of activity if you’re hitting your application through a browser. If you’re using Apache or Lighttpd, make sure that these two are working properly as well by watching their access and error logs.

If you think the web server is responding, try pulling up a static file. Go to http://localhost:3000/images/rails.png or some other static, non Ruby resource that you know should be there. If you don’t get back what you expect in Webrick, it’s possible that Webrick isn’t functioning properly, and that the shebang line is incorrect (I’ll talk about that in a second). If you’re using Apache or Lighttpd, make sure your paths to your application are correct, and make sure that Apache or Lighttpd have permission to serve up the dispatch.cgi or dispatch.fcgi files.

If you’re using FCGI with either Apache or Lighttpd, watch the FastCGI crash log. If you don’t have a crash log, double check your FCGI config in your Apache or Lighttpd config file and make sure it’s logging FCGI errors.

Getting Things Right
Make sure that the first line, the shebang line, in scripts/server points to your ruby executable. This should be correct but can sometimes be wrong, especially if you didn’t use the rails executable to build the application (which can happen often if you downloaded the code from another server with different paths).

In public/ make sure that dispatch.fcgi or dispatch.cgi also has the correct shebang.

In public/ you should also make sure that you have the hidden .htaccess file if you’re going to be using Apache and that it’s sending requests to dispatch.fcgi if you’re using FCGI, and dispatch.cgi if you’re not. Note that often times when you check out applications from Subversion repositories, the .htaccess file might not be in the revision (because Subversion ignores hidden files by default on initial imports).

If you have a database built and you’re expecting to get some results back, make sure your config/database.yml file is correct, and that your database server is responding.

Execute Valid Code
It’s possible to write code that breaks a Rails application before Rails can show you a more informative error. Make sure your code is valid and that you don’t have any Ruby syntax errors.

Watch Logs
You should always be watching your log/development.log when developing, and if you begin to run into issues that aren’t clearly apparent in the development log, begin watching both your FastCGI errors log and your web server access and error logs to make sure things are working properly.

If All Else Fails
Use the Rails community page as your starting point. Check the Wiki, ask questions on #rubyonrails or send an email to the Rails email list. Make sure that people know exactly what your environment is like. For instance, I develop Rails on OS X 10.4.3 using Ruby 1.8.4 and Rails 1.0 running under Apache 1.3. Describe the circumstances that led to the error, and whether or not you saw errors in your array of logs, and anything else that might be relevant. Usually it doesn’t get to this stage, but when it does it’s good to know there a lot of people willing to help you figure it out.

Why World of Warcraft Is So Compelling

Tuesday, January 17 2006

I’m convinced there’s a single reason why World of Warcraft is so compelling, and it has nothing to do with the look of the game or the content. You could run the game in text mode and it’d still be compelling. Strip away the artwork and significant amount of unique content, and it’s all about repetition and being rewarded for repetition.

Most people on this planet are compelled to progress down some kind of track. At the most basic level, people want to get better at whatever it is that puts food on the table. But all forms of career advancement, pursuit of knowledge, becoming a better athlete, parent, spouse, humanitarian, politician, or artist all require some form of repetition, repetition that is routinely rewarded along the way.

World of Warcraft mimics this sort of real world constant in accelerated form nearly perfectly. Advancing as a player requires that you perform repetitive tasks (usually killing bad guys) that usually always have some kind of immediate reward in the form of cash or special items. As you continue to progress you gain larger rewards, both in the immediate sense and over time. New areas are open to you, more powerful items are given, and greater challenges are presented. In the process, you go from being a lowly sort of peasant wearing rags to a seriously powerful entity, commanding respect or fear wherever you go.

It’s no surprise that Blizzard has a huge subscriber base – estimates between 5 and 15 million are often quoted. They’ve figured out how to take advantage of one of the most basic human desires and turned it into a venture that captures nearly a quarter billion dollars in revenue every month.

Country Boys

Tuesday, January 17 2006

I know it’s pretty early in the year, but I think I’m safe in saying that Frontline’s Country Boys will be the most powerful and moving documentary I’ll see in 2006. It’s hard to describe why it’s so important without giving a lot away, but I think it should be required to show to 15 year old boys. Carrie and I will buy the DVD and keep it around for when Jonas is old enough to see why it’s so important.

Surprise!

Monday, January 16 2006

The other night Carrie took advantage of my newly acquired old age and threw a surprise birthday party for me. I was completely taken by surprise – Carrie’s expressions and her activities can usually be read like a book which means I go about thinking I’m smart as a whip, seeing all, knowing all. Not this time. Not even close.

The entire day I’d been sort of crabby – I was having a difficult time with some of my projects and was fighting burn out. I was grubby, unshaven, unshowered, and down to my last bits of clean clothing (which meant I was probably wearing just shorts or maybe my favorite jeans with a huge rip in the butt). Somehow she was able to convince me to take a shower in the afternoon (totally not my thing) and put some nicer clothing on.

The craziest thing is that when I look back on the entire week or two previous, the clues were there, and abundant.

- There was the huge lasagna she made weeks ago in the freezer that I kept begging her to thaw so we could eat it suddenly thawing in the fridge that day.

- Leah spent the night at her aunt and uncle’s, and Carrie feverishly cleaned the entire house from baseboard to ceiling, a task none too small. She tried recruiting me, but I saw no pressing need to detail the window sills, so kept to my crabby self while she toiled on. No doubt she couldn’t explain to me why she was unleashing the spirit of Martha Stewart in our house.

- There was the afternoon shower followed by suggestions of “you should take a nap” on a Friday afternoon, with four major work projects in full tilt.

- Ryan Carver nearly blew it by sending me an IM saying “6:00PM at your place?” that I assumed was him writing in the wrong window. The thought had been on my mind that day, as earlier I had told someone in Texas about how snowboarding was gonna rock. I used the word dude in quantities reserved only for people who would really care. So, naturally, Ryan made the same mistake as me, or at least he was able to play it off without me suspecting a thing.

- I think there was some shifting of vehicles in preparation for extra vehicles arriving that I wrote off as Carrie being weird as usual.

- Carrie tried getting me out of the house at the last second before guests arrived. “Kiera is bringing over some cupcakes and we don’t have any ice cream, go get some.” My response was, of course, “No, I’m crabby, I don’t want any damn ice cream.” She improvised by telling me to watch the kids, and she went herself, eventually gathering people in the front yard to come marching in in force.

For nearly all who visited the trip to our place was a trek. Seeing them arrive was sort of surreal and confusing. I saw Vic first and my mind first said “there’s a familiar face in my window but it seems so out of context”, and it was.

All in all, I was impressed with Carrie’s stealth, and impressed that everyone came out to wish me a good birthday. Thanks everyone!

Canada, Oh Canada

Sunday, January 15 2006

Good news. In early April I’ll be speaking at Canada on Rails about the development process behind llor.nu. It’s the first confirmed speaking engagement about the game so I’m appropriately excited and terrified. The conference is cheap as far as conferences go, so come on out if you can. There are some excellent people on the speakers list.

I probably won’t have a lot of time to get too detailed, but I will talk about the most crucial Ruby on Rails related challenges I faced while building the game, including issues of scaling, schema design, and keeping a community of 7500+ players happy (or close to happy) while in development.

Don't Tread on This Browser

Monday, January 09 2006

I’ve been running into major sites lately that either break entirely when using Safari or Firefox, or don’t make any attempt at all to work.

Tonight while trying to redeem some credit card points for my travel to Austin in March, I met up with a dead end on the Wellsfargo Rewards site. It’s really discouraging to have issues when you need to book the travel before the good flight options dry up, and you’re locked into their system. Looking at their Javascript errors suggested they never tested the application on Firefox and were content to ship the application with bad code that only Internet Explorer obeys.

Perhaps the most offensive lack of support is found at Gap.com where they expressly prohibit Safari users to go anywhere on the site. This is disgusting – it takes very little effort to make Safari work and in fact, if you support Firefox, Safari should work brilliantly. Flat out prohibiting an excellent and widely used browser used by what is likely a healthy slice of potential customers stinks of extreme stupidity. Not surprisingly the same level of stupidity is fostered on BananaRepublic.com and OldNavy.com.

While I’m stuck with having to either call Wellsfargo and redeem my points over the phone or firing up a PC with Internet Explorer, with The Gap, Banana Republic, and Old Navy I have a pretty effective remedy to the problem. It’s a revelation into my standards to find out that sweat shop labor and cheap disposable clothing isn’t enough to get me to stop shopping – messing with my online experience is what really gets me to hammer the nail into that coffin.