Configuring my workspace

Ok, so trying to get back into the (programming) swing of things, been spending my day re-configuring my laptop to become a lean, mean, programming platform. Of course my life would be easier with Mac OSX, but I’m stuck with my ThinkPad X60s laptop for now. (When is Apple going to come out with a truly lightweight ultraportable??

My setup so far

  • cygwin – for Linux-like interface (making sure to install bash, screen, xrvt, vim, X11, etc.)
  • vim – my favorite text editor (using gvim.exe Win32 edition for use out of cygwin)
  • ruby – downloaded a Win32 edition (can also use InstantRails as a “shortcut”); also installed rails
  • mysql – everyone’s favorite (free) database, right? (postgresql is cool too)
  • apache – installed it, but haven’t had time to configure that one (correctly) yet

Why screen?

Screen will allow me to have a few vim sessions open, plus a ruby console, and mysql console, and yeah, mongrel running from a command line all within one (or more) terminal window. I can toggle between screens with a simple key-command. Plus, I can “detach” the screen, close the terminal window and the sessions will persist in the background. Once I’m done with “other work” I can tell screen to “reattach” and all my files and applications will still be there.

Yeah, there are other IDEs out there I could use (such as Eclipse, etc.), but since I hardly have time to learn ruby as it is, I’m sticking to what I learned “back in the old days”, which was not that long ago anyway 😉 I’m a big fan of learning how to program on UNIX using command line environments. It may not be “user-friendly” but learning to operate in a lean environment like that comes in handy later on. Plus, I haven’t seen any text editor that truly rivals vim or emacs. 😉

Some early challenges

So, I had some trouble running ruby scripts within cygwin’s bash shell. Something about bad file extensions, missing ruby gems, and other random crap. Given I have ruby installed in both “regular” Win32 version and in cygwin, and can’t get rails installed in cygwin, I probably shot myself in the foot. It works perfectly fine using windows xp’s dos shell (cmd.exe), so i’m calling cmd within a bash shell and running ruby from there. Not pretty _at_all_ but it gets the job done, and with Duo Core + 1.5GB in RAM, I have plenty of memory and CPU to spare.

Also, couldn’t get screen to work correctly in cygwin’s bash. Seems like a bug, but thanks to this site, I found a work around using xrvt: when reattaching to a screen, need to use screen -D -RR and it works.

Here’s my shortcut for C:cygwinbinrxvt.exe -fn “Lucida Console-14” -geometry 160×60 -sr -sl 1000 -e /bin/bash –login -i

Resources

I found this site after working through this, wish I had found it earlier: http://infrablue.tripod.com/cygwin.html

I agree with the author, quoting him,

For many, including myself, the shell environment is the most critical part of a system and graphical applications and utilities are often superfluous, distracting, wasteful of resources, and even dangerous. Most of the command GNU command-line utilities are practically universal and can be used on everything from supercomputers to small handheld devices.

Advertisements

3 thoughts on “Configuring my workspace

  1. David January 14, 2008 / 1:32 am

    Seems like running mysql with rxvt is not going to work. After some web research found this: “It’s not a bug. When you use rxvt/xterm Cygwin has to emulate a pty (pseudoterminal) which is a unix concept that does not exist natively in Windows. Native windows apps such as the mysql binaries that you’re using often get confused by this, becase they only know about a Windows console, which is probably why you saw the text on the original cmd.exe prompt.” Oh well. I can still run from a cygwin terminal without any problems. Better start saving up for a mac…

    Like

  2. David January 14, 2008 / 1:56 am

    Also couldn’t get around the cygwin – ruby issue. Had to uninstall ruby (win32 version) and keep cygwin’s ruby instead. then had to manually download and install RubyGems, and then ran “gen install rails” to get a local copy of rails installed to my cygwin ruby installation. Argh, the pain!

    Like

  3. David January 14, 2008 / 2:06 am

    What Marcin said works – I just wanted to simplify the steps:
    cygwin and rails.. more drama: rails can’t find urandom, so need to do add this little one-line hack to the script:

    http://www.ruby-forum.com/topic/135028

    1. locate the file secret_key_generator.rb inside cygwin directory (in
    my case – c:cygwinlibrubygems1.8gemsrails-2.0.2lib
    rails_generator)
    2. find “def generate_secret_with_urandom” (line #85 in Rails 2.0.2)
    3. copy the line just below “def generate_….”:
    puts “Before Read”
    4. save the file and it should work

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s