WiFi issues on Ubuntu 12.04

Hey ,

Recently installed ubuntu 12.04 on a fresh and clean system. While it works like a charm, a very irritating issue was that the inbuilt wireless card was not working. The ethernet connection using wire worked fine. Googled a lot and wasnt able to figure things out. Finally, backports saved my day. Here is the procedure I followed incase someone finds it useful.

 

Installing backports:

sudo apt-get install  linux-backports-modules-cw-3.8-precise-generic 

Some generic headers and libraries:

sudo apt-get install linux-headers-generic build-essential

Download this file and extract it at a location of your choice.
Navigate to the extracted directory using terminal and try:

make defconfig-ath9k
make
sudo make install

Reboot the system and ideally wireless should work!

Hope it helps.

Guake – Annoying feature of renaming tabs

I am a huge fan of guake terminal and after having used it for quite a while, I am literally addicted to it.

Recently, I encountered a very annoying feature which is when I rename a tab and perform any operation on that tab, the name I gave disappears and the absolute path is shown.

This was very painful because I am used to work with multiple tabs open and naming helps navigation.

After some googling, I found a solution which I present below.

Install gconf-editor.

sudo apt-get install gconf-editor

Start gcong-editor

gconf-editor

Browse to apps/general/guake/general.

On the right hand side, uncheck the “use_vte_titles” item and close it and restart guake.

All tabs would be named “Terminal” and renaming would preserve it.

The technical reason for doing this is the following piece of code:

def on_terminal_title_changed(self, vte, box):
    use_them = self.client.get_bool(KEY("/general/use_vte_titles"))
    if not use_them:
        return
    page = self.notebook.page_num(box)
    self.tabs.get_children()[page].set_label(vte.get_window_title())

As we can see ‘use_vte_titles' key prevents the autorenaming feature

Hope this helps and enjoy using guake.

I have a question !!!

I of-course know the fact how unfortunate I am. It is something I do not think I can change. Its a quality I have , like my blood group !  Cannot do anything about it.  Do I regret it ? …

I clearly remember the precise moment when I realized the exact nature of of my misfortune. I was told the unfortunate news in front of the world ! Ofcourse, its my humble duty and desire to inform the user that world for me at that time was the class I was studying in. Admitted in a reputed university, I was merry making in the cold weather of this glorious and wonderful city.The lecture hall location in the university, I promise were built by a student as the view was impeccably astounding. Breathtaking I must say ! The glorious mountains stood on one side of the building and on the other side, was a vast and deep ocean. As enigmatic was its nature, it was mystifying. Who knew , what ,lies beneath the deep fathoms of the water body. I was wondering , the same thing as how the mountains must have risen and these enigma of the ocean , we see everyday ,created.

On this precise moment, a stern, knowledgeable  voice fell on my ear. He asked “Do you agree?” . As human instincts are, and more on work here were the student instincts and I gave the most obvious answer “yes…ofcourse sir”, fearful, that if I said otherwise, I have to answer many more questions !

But as brilliant these highly developed , all knowing beings called “teachers” are , they , like the elves , know whats in the subjects mind. So, this voice (more sarcastic than stern now), enquired in a very curious tone, “why so ?”( I wish teachers saw some movies, they would know how to act curious !). Having no clue what to say,I found myself doing the most polite and thinking voice acting I can  , and saying “because the book says so”. I think I mist have surpassed “tom and jerry” in making my audience laugh their hearts out ! I suddenly found myself, in the vast and luxurious office of the man having the stern voice and heard him “son , you are a good guy. But unfortunately, I do not find you curious for knowledge. To gain knowledge, one has to ask questions. Never take anything at face value. Ask whether what the author says, makes sense ?”. I was inspired ! I truly was. And that moment, in that office, I was a changed man ! I was a inquisitive person now.

I went home. Like my habit of many years, I started watching cartoon(yes, i love them!) and to my delight, tom and jerry was being aired. I , usually laughed and had a great time watching this show , till today. I asked myself, can a cat fly an aeroplane ? Can a mouse build a bed of matchstick ? Holy crap! Can a mouse and cat walk on 2 legs and smile and own flats ? Can there be a city where cats stay in hotels ? Frankly, It made no sense and I switched it off ! Worst meal in years for me !!!

I ofcourse had no intention of reading my favorite books as I had anticipated the questions my newly reformed, inquisitive brain would ask. Superman, how is the discovery of a planet possible. Aliens with super powers ,  na, current science does not approve of it. Similar cases with Batman, arabian nights and all other books and stories I loved ! Even the great Tolkien was not able to answer my questions like how can a wizard live forever and where are the hobbits now.

So, I thought about watching some movies. I saw some “philosophically heavy” movies. I had assumed that atleast Shakespeare wont disappoint  me. But alas! Richard , the third, never provides the answer to as how can a mother hate her own child, however he is. How can a hump back impress a beautiful lady and how the hell he can do his corrupt things without anyone knowing ?

Atlast, I went to my granny. I told her, I cannot sleep and tell me a story , as you did when I was a child, so I can sleep. She readily started,”once upon a time, there was a king”. I stopped and asked her, who was this king, where was he born,  where and how many years he reigned , how many queens she had, how was the political situation in his kingdom ? Needless to say, I was thrown out of the room !

Next day, I  was in the class of the same stern voiced “teacher”. He was teaching us mathematics and I interrupted him as asked “why is the number one written as 1 ?”. I can clearly see his puzzled face (with linearly growing anger and irritation!). But I never got an answer.

Years have passed since and I have never got an answer to any of the above question. But I have the answer to one thing. Sometimes, not asking question and believing the person is helpful and enjoyable. We all enjoy the fairy tales and cartoons without asking questions. Try asking and see how it ruins the show !

I personally think, knowledge is not about knowing the right answer but the is about believing. Understanding. Asking questions and gaining answer will only add to information we have. Believing the thing and enjoying it will give us happiness, enjoyment, satisfaction. Knowing this is what knowledge is. We often confuse knowledge with curiosity and feel , if all our questions are answered, I will be knowledgeable.

Sometimes, the most knowledgeable are the ones who know nothing !

 

Resetting a Database in Heroku application

Recently I faced an issue when  I wanted to delete an existing database in an application deployed in heroku and create a new one.

I tried using

heroku run rake db:drop

 

I got an error saying “USER does not have connect privilidges”

The way to solve it is

heroku pg:psql

This logs in to your database and then type:

drop schema public cascade;
create schema public;

After this exit the prompt and type:

heroku rake db:migrate:reset

Hope it helps.

 

Editing a form in nested_form gem

This is a very very naive and simple thing but I quite lost my time on this so I thought might be helpful.

Recently I was using the ‘nested_form’ gem by the great Ryan Bates (https://github.com/ryanb/nested_form). The form to create a new form works like a real gem without any effort.

Now, when I clicked on ‘edit’ link, it created some issues as the nested models didnt come.

I had a simple thing like each question has many answers. When I created a question, I added 5 answers to it but when I edited the question, no answers were visible.

The simple solution for this would be that the <% f.fields_for :answers do |an| %> line in your form would be without an equal to sign so just add it.

Thus, it looks like

<%= f.fields_for :answers do |an| %>

Thats all and it works like a charm!

Hope it helps.

Install apache web server and passenger on Ubuntu 11.04(Natty)

I just Installed apache and passenger on Ubuntu 11.04 to run and deploy my ruby on rails applications Passenger is a gem and can work with apache as well as nginx…

The reason for choosing apache is that its an industry standard.

Also one thing I did with apache was created virtual hosts and ran my apps on local machine with domains like http://www.application1.com

In this post I will list the steps I followed in order to setup apache web server and passenger.

Here is my stack:

  •  Ubuntu 11.04
  •  ruby 1.9.2 via rvm
  •  rubygems 1.8.10

I will be using rails 3.1.10(lastest this morning).!!

So lets start !!

  • Install rvm

To install rvm just type the following in the terminal(ctrl+alt+t)

 user$ bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

You can find more information about rvm on Here

  • Install ruby via rvm

Once rvm is installed you can install the latest or desired version of ruby by typing the following in terminal

rvm install 1.9.2

This will install ruby 1.9.2 on your system.

More information on how to make it your default ruby is available on here

  • Install rails.

just need to do

gem install rails

  • Install passenger

just do

gem install passenger

  • Install apache web server.

To install apache web server type:

sudo apt-get install apache2 apache2-mpm-prefork apache2-prefork-dev
  • Install passenger apache module.

Once this is done, we must install passenger , an apache module thats hepls us to rub rails apps on apache.

sudo passenger-install-apache2-module
  • Configure.

Finally everything is done.

When you run the passenger apache module, there would be some instructions that installer will give you.

The last thing it will tell is to paste some text in apache configuration file

The configuration file is located at /etc/apache2/apache2.conf

Now once this is done, we are ready to deploy.

This has a lot of information about deploying.

In my next post, I will show how to start rails apps on local machine with apache.

Hope it helps.!