Archive for the ‘Productivity’ Category

Change your terminal theme when you ssh into a server

I am in a tough spot. I am a technician, but I also am a design whore, so when I had to find a solution to one common problem (forgetting that your terminal tab is not on localhost), I couldn’t just solve the problem, but I had to find a good looking solution to that.

A #lazytweet only partially helped me, directing me to this useful post. I liked the approach, it was close, but not there.

I played with shell functions for a bit and came up with this:

The way it works is simple, it tells terminal to change it’s theme before ssh-ing and changes it back when ssh quits.

You might be wondering what Solarized Dark and Light are. It’s quite simple, they are two flavors of the best theme ever made.

If you’re still reading, a shameless plug: use my version of git-prompt for the best command prompt ever made :)

Sudoless Rails Stack on OSX

More and more of my developer friends are switching to OSX as time goes by, and they keep asking me for directions on the best setup for rails development: how to install ruby, how to install the missing libraries, and so on.

My professional development life started on a PB Titanium running OSX 10.2, and continued through a PB Aluminium and a Macbook Pro. Each time I changed laptop I also reinstalled everything again, and each time I tried to come up with a better setup.

Now I’ve finally found a setup I’m comfortable with, and it has the following advantages:

  • Sudoless: everything runs from my user directory
  • Non-system-tampering: doesn’t touch files in the original osx installation
  • Crash-proof-easy-reinstall: you can just delete everything and reinstall without fear of rendering your system unstable
  • Fink based: uses everything it can use from the fink repositories

Now that I’ve sold you on my setup :) it’s time to explain how to implement it.

Step one: XCode and Developer Tools

If you don’t have XCode already installed you can install it from the disks you got with your Mac or, better, download the newest version from Apple Developer Connection. Once you got it installed you can proceed to the next step.

Step two: Fink

Go to the Fink Download Page, and get the package that works best on your Mac (intel or powerpc). Follow the installation instructions and install the base fink system. After you’ve done that add these lines to your /.profile

# Dev Enviroment
 
LDFLAGS=-L/sw/lib
export LDFLAGS
 
CPPFLAGS='-I/Users/your_username/unix/include -I/sw/include'
export CPPFLAGS

_/Users/your_username/unix/include_ doesn’t exist yet, but we’ll create it when installing ruby.

Step three: Ruby from Sources

This is the first tricky part. Before OSX 10.4.6 the Ruby version shipped by Apple didn’t work with rails, so you were on your own. Now it works, but I prefer to have ruby in my home directory so I can mess with the sources and with the gem files and upgrade painlessly. So download the latest ruby sources and unpack them wherever you wish (I like /src).

Now you’re ready to go. First make sure you have readline and readline5-shlibs installed via fink so you can have a comfortable irb environment:

user$ fink install readline readline5-shlibs

After that it’s time for ruby:

user$ cd <sub>/src/ruby-1.8.6
user$ ./configure <del>-prefix=/Users/your_username/unix
user$ make && make install

The whole magic (and it’s not a big magic btw) is in -prefix. Installing ruby will create the /Users/your_username/unix path. Now it’ time to add the unix dir to $PATH. Edit /profile once again and add these lines:

PATH=/Users/your_username/unix/bin:/usr/local/mysql/bin:/usr/local/sbin:$PATH
export PATH

Step four: MySQL

Quite simple with the packages from mysql.com.

Step five: Last but not least, rubygems

Fetch the gem package from RubyForge and install it:

user$ cd src/unpacked-rubygems-directory
user$ ruby setup.rb

Step six: This is the real last step :) – Rails and a little hack

Now you’re free to install rails (and friends) using

user$ gem install rails --include-dependencies
user$ gem install mysql-ruby
user$ gem install capistrano --include-dependencies
user$ gem install mongrel --include-dependencies

The small hack I was talking about is a symlink:

user$ sudo mv /usr/bin/ruby /usr/bin/ruby-apple
user$ sudo ln -s /Users/your_username/unix/bin/ruby /usr/bin/ruby

This way applications that insist on using /usr/bin/ruby (TextMate’s RubyMate for example) will work fine.

Have fun with your self-made rails stack :)

Why we need to stop designing and start delivering

Lately I’ve been very unproductive. Lost in business discussions and dreaming about the next big thing, I couldn’t finish two paid projects, and that sucks™.

The invisible shackles that didn’t allow me to finish those jobs have been holding me back so that I wasn’t able to do any real work even on personal projects.

I’ve tried finding the cause for this, blaming my lack of self discipline or the fact that I was not doing GTD as strictly as I was six months ago, but I knew there had to be something else, and the whole situation was getting on my nerves.

Last week I bought a game for the Nintendo Wii, Mario Strikers Charged, and while playing I remembered a pet project I started more than an year ago and never completed.

The project name was ICCFriends, a repository of Nintendo Friend Codes for the usenet it.comp.console community.

This time I had to finish it, so I went and looked through my code: awful. There was as much BDUF in there as in Windows Vista, and while wandering through the models and controllers, suddenly I got it!

I knew why I wasn’t delivering: I was designing things that were not useful. I lost so much time preparing for refactoring, or moving code around or laying the ground for future extractions or features that when the time came to implement the real thing I grew tired or got bored.

I then did the only thing I could possibly do to complete ICCFriends:

$ rm -rf ~/src/iccfriends
$ rails ~/src/iccfriends

I then focused on the simplest and shortest set of features I could imagine and in a couple of hours ICCFriends.net was up and running, and with more interesting features than those I was bduffing.

It looks rushed out because it is, but once again I was able to think and deliver and the rush of energies that came with it is a nice feeling I really missed.

Yesterday I learnt an important lesson, and from now on I will always strip my feature list before even start thinking about the implementation.

The results of a micro iteration: Planet Nimboo

Following the announcement on bard’s blog, I would like to show you the result of the micro iteration I wrote about a couple of days ago: Planet Nimboo.

We use it to aggregate our blogs, and it’s quite simple, it’s only a ruby script with an erb template (how long since you last saw .rhtml files without rails? :) ), and bard has also cleaned up the code and made it available so you can play with it and make it better:

Code: script, template

Micro Iterations: How to boost your productivity

I have found a way to boost my productivity, and I can say without doubt it works very well :)

Like most of you I have dozens of pet projects that can be done very quickly but require focused time, and time is the scarcest resource of them all, so together with my friend bard, and the other nimboo guys we decided to dedicate a hour, two or three times a week to work together on some project, with the condition that we have to choose something that can be done in a hour, no more.

The results have been staggering and yesterday we met together to work on planet.nimboo.net, an aggregator for the nimbooers’ blogs. In half a hour planet was up and running :)

If you have a couple of friends to do this kind of exercises together please try creating some small product together, you’ll be happy you did.

Twitter: good or bad?

I just read a wonderful post by Kathy Sierra about twitter, and how it is almost the proverbial last straw among the forced interruptions to our flow.

I suggest you go and read the post. It is well written, as usual for Kathy, and it really made me think about twitter / im / email / ...

Sometimes I can’t do any real work because I’m swamped by external inputs, and I usually turn off most of my IM accounts when working.

Starting next monday I will try a strict no-interruption policy from 9am to 5pm and see if I’m able to be more productive than I am right now.

Do you have the same problems I have with intterruptions?