Wednesday, October 28, 2009

Getting the sound to work on Ubuntu Jaunty

After installing Ubuntu 9.04 (jaunty) on my new HP DV6-1280us machine, my main problem was that the sound is complete dead. I see no errors when I try to play anything. there is just no sound.

taking a closer look at my Sound Card:

~$ lspci | grep -i audio
00:14.2 Audio device: ATI Technologies Inc SBx00 Azalia (Intel HDA)
01:00.1 Audio device: ATI Technologies Inc R700 Audio Device [Radeon HD 4000 Series]

After a while of googling around, I came across this post on ubuntu forums
If you have the same sound card. (which is in most DV6, DV7 series of HP) This will probably be useful to you as well.

Briefly, you'll need to download, compile and install the alsa driver. and modify configuration of alsa-base.conf as follows:

wget -c
wget -c
wget -c
tar xvf alsa-driver-1.0.21.tar.bz2
tar xvf alsa-lib-1.0.21.tar.bz2
tar xvf alsa-utils-1.0.21.tar.bz2
cd alsa-driver-1.0.21/
./configure --with-cards=hda-intel
sudo make install
cd ..

cd alsa-lib-1.0.21/
sudo make install
cd ..
cd alsa-utils-1.0.21/
sudo make install

Now append the following to /etc/modprobe.d/alsa-base.conf

options snd-hda-intel enable_msi=1
options snd-hda-intel model=dell-m4-2

Now restart your system and enjoy the drumbs of ubuntu start :)

Sunday, July 19, 2009

Patron: a Ruby HTTP client library

I was just trying out Patron, the new ruby client library, by Phillip Toland.

Patron is based on libcurl. and providing nice usable interface, which allows you to make http requests easily and with as much customization as you need. Let us take a quick usage sample here:

irb(main):036:0> require 'rubygems'
=> false
irb(main):037:0> require 'patron'
=> false
irb(main):038:0> sess =
=> #<Patron::Session:0xb7a9f878>
irb(main):039:0> sess.base_url = ""
=> ""
irb(main):040:0> resp = sess.get("/intl/en/about.html")
=> #<Patron::Response @status_line='HTTP/1.0 200 OK'>
irb(main):041:0> puts resp.body

Checkout the documentation for more samples and usage notes.

Tuesday, June 23, 2009

problems connecting to yahoo server with pidgin under ubuntu

Few days ago I noticed that pidgin is unable to connect to my yahoo account. I decided to have a look at the matter and realized that Yahoo has changed the way of the authentication as part of upgrading their software.
pidgin released a new version that uses the new method (2.5.7). so I had to upgrade my 2.5.2 to the latest version.

There was something wrong when i tried to follow the instructions on pidgin website. So I went to downloading the source code, following the instuctions in the INSTALL file to compile, build and install pidgin.

I needed also to upgrade libpurple to 2.5.7 by:

apt-get remove --purge libpurple0
apt-get install libpurple0

Finally, I was able to connect to my yahoo account :)

Tuesday, March 31, 2009 The unofficial google shell

As a linux user, I spend most of my time using the shell to do most of the work. I am a command line fan like a lot of people out there. is a command line based (Ajax web based) interface for google, created by Stefan Grothkopp. You just write your search query and the results will be listed for you in a very similar manner to command line programs.

Searching using goosh will still need you to use your mouse to open the results and continue browsing. Not a very suitable shell mode. Well, this haven't been the main usage of goosh (for me).
Instead, I have been using it heavily as my translator.

Instead of:
  1. Going to in the browser
  2. Writing the text to be translated
  3. Choosing the from/to languages from the drop down lists
  4. Clicking "Translate"
Goosh lets you get this by:
  1. Going to
  2. typing the command following command and hitting Enter
    translate src dst sentence
    for example:
    translate en ar my name is mahmoud
    to get "اسمي محمود"
There are short aliases for the various commands to use. translate (also trans and t).

Goosh is pretty much easier and more comfartable to use once you know your commands and its arguments.

Type help (or its alias man) while you are at the goosh shell to see the list of available commands. (example: man translate)

You can use the up key to get the last command to reuse it in a similar manner of using the shell. This is quite usable.

Tuesday, January 13, 2009

Adding Custom Routes for Radiant Projects

While integrating simple_captcha into the guestbook extension of radiant, I had to add a special route for the simple_captcha to work properly.

Unfortunately, the routes file of a radiant project does nothing but loading the routes file from radiant gem itself:

load File.join(RADIANT_ROOT, "config", "routes.rb")

Calling ActionController::Routing::Routes.draw again will clear all the routes that have been defined in the gem routes file. So you have to either modify the code of the gem, or copy the code from routes.rb of the gem radiant to the projects route file.

Or you can append your new routes using add_named_route instead of draw. And since the simple captcha route is supposed to be defined before radiant routes. you can manipulate the routes array as in the last line of the following sample.

load File.join(RADIANT_ROOT, "config", "routes.rb")

       :controller => 'simple_captcha')


add_route is another method similar to add_named_route but doesn't require a name parameter. It also can be used. Note that both aren't documented well in the rails api documentation.

The Previous add_named_route call is equivalent to map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha' at the end of the routing block that is passed to draw.
add_route('/path', {options}) is equivalent to map.connect '/path' , {options}.
They can be very usable sometimes.