Search

 


Yeah, right!

I want my eeePC!

Posted by Paul McConnon Fri, 02 Nov 2007 09:37:00 GMT

My order for a new Asus eeePC was dispatched today from research Machines.

The little fella cost me £200 squids plus V.A.T.

It comes pre-installed with Linux and is capable of running XP (although I’ll not be installing it)

For those that don’t know it’s an ultra-portable laptop. It weighs about 2 lbs and has a 7 inch screen. It has 512MB of DDR2-400 memory and 4Gb flash storage expandable with USB drives. It has inbuilt Ethernet, 802.11b/g wireless, and a 56K modem, integrated web camera and microphone.

As you can see form the pictures it’s tiny. Not big enough for your main machine, but cool for occasional / portable use.

Stuff has a nice review here

I’ve been jonesing for this for about 6 months. Ever since I got my new N95 (which I am delighted with) and ditched my old M5000 (which I loved for always on connectivity, but which was just too bulky as a normal phone) I’ve been looking for something for occasional web browsing and taking notes etc.

This bad boy along with my N95 fits the bill of being portable enough to take with me along with the phone, so that I have phone and PC functionality, but when I don’t want to carry anything bulky I can leave it behind and use the cut-down functions of my N95.

I’ll do a post when I get it with my first impressions.


Change Current Directory with Ruby script

Posted by Paul McConnon Sat, 27 Oct 2007 10:47:00 GMT

I was searching online for a method to change the current working directory of a Bash session using a ruby script.

Essentially I wanted to write a shortcut script that would take me straight to the directory of whatever Rails application I was working on.

I wanted a script called ‘go’ that I could use like this:

paul@ubuntu:~$ go plopcentral
paul@ubuntu:~/Development/Sites/PlopCentral$

The script would search a few predefined base paths for the folder and then CD to that folder.

I first tried writing in pure Ruby but unfortunately, executing a ruby script that changes the current working directory within the script, loses these changes when the script exits (this is by design and completely correct, a script should not be able to affect it’s parent process)

I came up with a workaround by making the ruby script return the location of the first folder it found and used a Bash function to change to the returned folder.

Now for the script go.rb, store this in your home folder

#!/usr/bin/ruby
# searches PATHS for a folder then cds to that folder
search = ARGV[0] #get search term
PATHS = ['~/Development','~/Documents']
result = nil
PATHS.each {|path|
    result = `ls -R #{path}/ | grep -m1 -i /#{search}`.gsub!(/:$/,'') unless result
}
puts "cd #{result}" if result

This uses the OS’s ls and grep to very quickly find a path with the search term.

This on it’s own is not enough, we need the OS to take that output and use it to change the current directory. To accomplish this we need to define a function in our ~/.bashrc file.

Add the following to the bottom of your ~/.bashrc file.
go()
{
    eval $(~/go.rb $1)
}

This function takes it’s first parameter and passes it to the Ruby script defined before, eval’s it and uses the output (if any) to change working directory of the current Bash session.

New you can jump straight to folders with

go path

where path is a partial part the folder you want to cd to.

This is a very simple use of the method but illustrates how to use ruby with Bash and could be extended so that it uses databases etc.

Imagine Activerecord or more complex Ruby libraries for use in Bash.

Note: For those very familiar with shell programming there are bound to be pure Bash ways to accomplish this. I am more familiar with Ruby and wanted to use it.


Slickrun

Posted by Paul McConnon Wed, 29 Nov 2006 16:10:00 GMT

Slickrun is a great free program from Bayden Systems that replaces the multitude of links in your Qucklaunch toolbar and saves you from navigating mutiple levels of Windows Start menu items.

It’s a free floating mini command bar. You can position it just beside the start button and any program can be launched by typing a few (in practice 2 – 3) keys, from the start of the command name you have given your shortcut.

For example I click the bar and type F then I and press enter and firefox opens.

It is easily trained, by dragging a shortcut onto the bar. I currently have about 40-50 programs in it and find that I never have to use a menu or shortcut to launch a program.

Try it, you’ll never go back!


Older posts: 1 2