– we create awesome web applications

I was frustrated by ⌘Q and ⌘W proximity for a long time. Long, long time. Seriously, long time.

It hits me the most with browsers since I usually open and close quite a lot of tabs during the day. And I tend to do it from keyboard, so sometimes I just hit ⌘Q when I only intended ⌘W.

It just happened again.

But this time I suddenly realized that I can easily remap it. I was using this OSX feature for other things, like remapping useless since the typewriter days Caps Lock key, but somehow missed that I can fix this annoying problem too.

If not universally then at least in Chrome (or any other application if needed).

This is really easy:

  1. go to System PreferencesKeyboardKeyboard Shortcuts and choose Application Shortcuts in the left panel.

    Keyboard Shortcuts

  2. click on the + icon to add another shortcut.

  3. Choose Google Chrome as the application and type in exactly, including case Quit Google Chrome as Menu Title. Generally, it should be the exact menu command name in the application that you want to map.

  4. Now, click inside the Keyboard Shortcut field and then press on you keyboard whatever the new shortcut you want. I chose ⌥⇧Q so that it will stay at the same place but wont be as accidentally press-able.

Quit Google Chrome shortcut

⌘Q will not longer work, and the new shortcut will be correctly displayed in the Chrome's menu:

Chrome Menu

LaunchBar is one of the tools I can't live without.

Basically, it's an application launcher, but besides actually launching an application it has lots and lots of features that help me complete tasks on my laptop while staying in the flow.

Ever since I installed it on my MacBook my workflow changed quite dramatically to the better.

Most of the time I no longer use ⌘-Tab to switch between the applications.

⌘-Tab requires looking at the list of running applications, and I almost always run more then 10, up to 20 of them, so I need to search for the one that I need and then either Tab to it or choose it with a mouse. A major hit to the flow.

With LaunchBar, if I want to switch to Google Chrome I just do Alt-Space, g, Enter. No need to think, its already in the muscle memory.

Itunes? - Alt-Space, i, Enter. Done.

iTerm? - Alt-Space, t, Enter.

The best part? It learns as you use it. if you type t and its top suggestion is Terminal and not iTerm just use your arrow keys to choose iTerm and after a couple of times it will remember your choice.

This is how I got g, i and t to choose what I need the most.

But this doesn't stop with running applicaitons, starting applications is equally easy. I no longer search in the /Applications folder. If Google Chrome is not running when I hit g it will just start it for me. If I need to run Numbers I just type num, or key for Keynote etc.

Same for directories or mounted volumes. I just type Qdo to go to my Qnup Qdownload volume mount, doc for ~/Document, etc.

Oh, and it can reach inside directories easily. To open our contract with AcmeWidgets Inc. I can do this: drop to choose ~/Dropbox, space to limit the search to its content, ast, space to choose astrails.com subfolder, then acme, space, le, Enter to open the directory that holds all our legal documents with them or space instead of Enter to get a list of the documents and choose a specific one.

In short, I forgot when I had to manually drill down to commonly used directories, LaunchBar is a much better and faster tool for that.

It also integrates with lots of apps i use daily on my laptop, like Itunes, Address Book, iCal and others. So you can play specific track in iTunes, or pause currently playing track, or email someone from your Address Book to name a few.

Also, please, don't even mention Spotlight, its not even close in terms of features, speed and convenience.

Go check it out, you'll thank me later.

UPDATE: After checking out Alfred as was suggested in the comments I actually loved it so much I switched and I'm a happy user for a couple of months now. Recommended!

I just recently reinstalled my MacBook Pro, this time with Snow Leopard.

So I'm again going through various installation problems I already forgot about from few years back when I installed Leopard.

Anyway, just had to hunt down a problem with mysql gem installation on Snow Leopard.

Apparently if you just do 'gem install mysql' it seems to install fine, but doesn't work.

You get "uninitialized constant MysqlCompat::MysqlRes" error when trying to run rails.

The solution is to pass it some arguments for installation:

ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Oh, and of course install 64bit mysql version before that. I usually just download the binaries from mysql.com.

We just started a project for a client that involves Cassandra.

If you've been living under a rock and don't know what Cassandra is let me tell you :)

Cassandra is a "second-generation distributed database" that was built for web scale.

Its is one of the many distributed nosql databases that appear everywhere lately like mushrooms after a heavy rain :).

What sets Cassandra apart is that it comes from a recognizable entity - Facebook.

But I digress.

This is not meant to be a Cassandra introduction, there are enough of those on the net. I Just created a new nosql section on this blog where I'm going to post various tidbits of information about cassandra (and probably others) as I learn them while working on this new project.

Here is the first one: Cassandra gem is just an installer

If you are on Mac OSX and interested in Cassandra you probably know that its just a gem installation away (almost):

gem install cassandra

First thing to note though is that this will not install Cassandra. It will install cassandra installer!

I got bitten by this when I took my laptop with me to my doughter's dancing class. You see, parents are not allowed "in the room" to not interfere with the process :), so I have 45 minutes to find myself something to do each time. I installed cassandra gem at home and intended to play with Cassandra while there.

Not so fast.

When I tried to run cassandra_helper cassandra which is supposed to start a test cassandra instance it went to connect to a github repository to download and install the actual database.

Duh!

and the 2nd one: Use java preferences

When I got back and finally built Cassandra I got the following message when starting it for the first time:

~ > cassandra_helper cassandra
Set the CASSANDRA_INCLUDE environment variable to use a non-default cassandra.in.sh and friends.
(in /Library/Ruby/Gems/1.8/gems/cassandra-0.5.6.2)
You need to configure your environment for Java 1.6.
If you're on OS X, just export the following environment variables:
  JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"
  PATH="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:$PATH"

First thing to note is that just typing JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home" in the terminal wont help.

You need to export it:

export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"
PATH="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:$PATH"

No need to export PATH as its already exported.

But there is a better and simpler way!

Start "Java Preferences" (find it in /Applications/Utilities, or just use spotlight):

Java Preferences: Java 6 2nd

Then reorder the entries in the bottom "Java Applications" section so that Java 6 will be the 1st:

Java Preferences: Java 6 1st

Now cassandra starts right away w/o any exports:

~ > cassandra_helper cassandra
Set the CASSANDRA_INCLUDE environment variable to use a non-default cassandra.in.sh and friends.
(in /Library/Ruby/Gems/1.8/gems/cassandra-0.5.6.2)
CASSANDRA_HOME: /Users/vitaly/cassandra/server
CASSANDRA_CONF: /Library/Ruby/Gems/1.8/gems/cassandra-0.5.6.2/conf
Listening for transport dt_socket at address: 8888
...

Cool, now go write your killer application!

I just did something pretty stupid. I edited /etc/sudoers file directly from within my non-root user account.

I did

sudo vim /etc/sudoers

and added the following to it:

Cmnd_Alias GEM_INSTALL = /usr/bin/gem install *
Cmnd_Alias GEM_UNINSTALL = /usr/bin/gem uninstall *
vitaly ALL=NOPASSWD GEM_INSTALL
vitaly ALL=NOPASSWD GEM_UNINSTALL

The intention was to grant myself permissions to install gems w/o entering password. I know its insecure, but this is security-vs-convinience kind of thing and I only intended to leave it there for a couple of hours while I do some heavy gem development.

Anyway, experienced unix users might have spotted the syntax error in my sudoers edits. I forgot the : just after the NOPASSWD. But the problem is even more basic then that. I shouldn't have beed editing the file directly. I should have known better. And now I'm paying the price:

$ sudo
>>> sudoers file: syntax error, line 36 <<<
>>> sudoers file: syntax error, line 37 <<<
sudo: parse error in /private/etc/sudoers near line 36

$ sudo vim /etc/sudoers
>>> sudoers file: syntax error, line 36 <<<
>>> sudoers file: syntax error, line 37 <<<
sudo: parse error in /private/etc/sudoers near line 36

OOPS!

Now the sudoers file is broken and I can't even fix it since I was using sudo to edit it!

Never do that! :)

Use the visudo command. it will check the file syntax before 'commiting' it.

Now what?

I looked at the net and the general consensus is that you need to boot into a single-user mode to fix it. I really really didn't want to do it. I have 4G of RAM and so I'm usually running dozens of programs and its a pain to close and reopen them all after boot. I'm lazy :)

Then I thought there might be a better way.

First I checked the permissions on the sudoers file:

$ ls -l /etc/sudoers 
-r--r-----+ 1 root  wheel  1302 Sep 28 17:20 /etc/sudoers

and only 'root' is in the group wheel, so no luck here.

I also couldn't 'su root' since my root user doesn't have a password. duh!

But then it appeared to me that I might be able to circumvent this protection by leveraging my OS X 'admin' status. After all it ought to count for something :).

I opened "/etc" folder in finder (Go -> Go to Folder...), then opened sudoers file properties. Opening the lock there doesn't require to be a root. Its enough to be an Admin and my Admin user does have a password! So I was easily able to grant myself permission to edit the file:

locked

unlocked

after that I just edited the file with vim again to comment the edits

vim /etc/sudoers

Then I did what I was supposed to do from the beginning, I used the 'visudo' at last:

sudo visudo

Last thing was to restore original permissions on the file in finder.

DONE

RRDtool is the OpenSource industry standard, high performance data logging and graphing system for time series data. Use it to write your custom monitoring shell scripts or create whole applications using its Perl, Python, Ruby, TCL or PHP bindings.

Let's run it with Ruby on Leopard.

sudo port install rrdtool

Default ports installation comes without ruby bindings.

We recently moved our DNS to dnsmadeeasy.com from godaddy.com name servers.

After the transfer some internal CNAME records had a problem. So after fixing the problem and checking in the terminal that the changes propagated to the DNS server (host xxx.astrails.com) I tried to type the address in the browser, but it kept giving me the "can't find host" error.