Archive for September, 2008

‘Missing the Rails x.x.x gem’? Even though you have that version.

Myself and many other people in the office have been getting this problem, particularly when using Applications like Textmate. I have finally found the answer to this thanks to a Ruby-Forum post.

Type type rails in your console to find out where Rails is stored. This will give you something like the following: rails is /usr/local/bin/rails.

Edit your .bash_profile file and add the path returned, like PATH=/usr/local/bin/rails:$PATH or whatever your equivalent may be. Make sure there is an export PATH line somewhere underneath that, and no more errors!

3 Comments

Undergoing a Live Redesign

As a designer, it is my duty to get bored of my own blog designs after a few days of creating it.

I wanted to redesign my blog as the design was getting old and did not fully represent my skill-set anymore. I decided as I am snowed-under at work and don’t have time to go through the whole redesign process, that I’d just slowly redesign my website while live. It’s a risky maneuver as it can leave bugs but as always I am up for the challenge.

I have quickly thrown together something and now will slowly refactor the design depending on what I like and what I don’t (one of the bonuses of doing a live redesign is you can see it in action and grow fond or tired of something quickly).

If you see any sudden style changes, you will now know why.

0 Comments

Rails is for Developers, Django is for Designers: Part 1

I started a draft of a Rails vs Django post a few weeks ago. It has been something I have been meaning to do as Django is turning into the designer’s language of choice. This is absurd to me, Ruby is a far more aesthetic language. I have many arguments as to why I think Rails is far superior to Django. It is proving tasking not to post all my notes. I will give arguments on both sides (if you do Django and have something to contribute, please contact me).

I will start this series off with a very simple comparison of the codes. Taking the number #2 Top-rated snippet and then convert it to Rails code.

Thanks on this series go to Sandro Turriate, Cal Henderson and Jeff Croft

Edit- After talking with a friend, who was apparently offended by this post, I thought I’d go into more detail about this. This series of posts were not meant to offend anyone but merely give light to other languages. My friends that have forayed into Python have been both designers and developers. This post was to the designers out there who have chosen Python. I wanted to show them that there is still better. Even if they kept with Python, I wanted to show them where Django could improve so they could make their life easier even if they stick with their language. When designing, I love hearing what I do wrong, so I can do better. Same goes for programming. Others apparently do not share this with me.

13 Comments

Tell your co-workers they should be reading feeds!

I keep hearing “I don’t read feeds, if there is important news, my co-workers/friends will tell me about it”. I completely disagree with this thesis foremostly for it’s lack of prudence. If everyone didn’t read feeds, no one would be able to tell each other the news. Secondly, but not least importantly, because your friends will only tell you the really cool or exciting stuff.

I learn more about Ruby and how to solve certain obstacles (due to discovering libraries or tutorials) than other who do not read feeds. I spend less time researching issues, because I often have solutions to the encountered problem that I have encountered.

A lot of people find it distracting, opting out to allot a period of time to it every day rather than constantly checking it which I agree is good, however I do consider that I am one of the sole few that advocates to be distracted from work sporadically. I find that if I do not spend 5 minutes every hour reading twitter or replying to an email my quality of work starts to decay from too much concentration.

I suggest you tell your co-workers what you have read here, as after all they won’t be reading it as they “don’t read feeds”. I recommend you to read feeds in moderation and to advocate it, after all; you can only be better for it.

0 Comments

Extending your irb

As a Ruby developer, you probably spend a reasonable amount of time in script/console or irb. What you may not have known was that you can extend and give your irb more functionality and make your life easier. I’d like to introduce you to ~/.irbrc.

Let’s add tab method completion as well, that’ll make life more simple.

    require 'irb/completion'
  

One thing that had always annoyed me about irb is the lack of colour differentiating objects, strings, classes, etc. The Wirble gem solves this. I also installed utility_belt which has a bunch of extra features for your irb. (Don’t forget to install it via: sudo gem install wirble utility_belt)

    # load rubygems, wirble and utility_belt
    require 'rubygems'
    require 'wirble'
    require 'utility_belt'    

    # load wirble
    Wirble.init
    Wirble.colorize
  

utility_belt allows us to do a lot of great things, such as editing irb in Textmate, pastie-ing (OS X only), grep methods and classes, Google the last output (good for errors), only having to type x for quit

When debugging, I use ‘pp‘ (aka pretty_print) for examining my objects in Ruby. It’s annoying that I have to require it every time. Instead of having to constantly type in the require command, I have just added it to my irbrc file.

    require 'pp'
  

You can also add methods to the file for later use . I have extended the Object class, to simulate the following: Post.methods - Class.methods

    class Object
      def non_class_methods
        self.methods - Class.methods
      end
    end
  

I also added q as my exit command so i can exit by typing q and hitting return. utility_belt provides x for me, but I am more familiar with q.

alias q exit

You can see this file and all my other dot-files on Github.

7 Comments