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.!

A candid interview with Society !!

It feels so great !!! Amitabh bachchan in Hindi movies or clint eastwood in the 70s and 80s revolting against a society !!!

Wow, I hope I can be such a hero too ! Speak dialogues in front of an idol like vijay or fire a gun like eastwood does !!

Was it only the greatness of Salim-Javed and sergio leone( not related to sunny leone i presume!!) or we need such rebellions ??

I think like our economy , our society and our value system is at an all time low !!! We are  in midst of a moral recession.

Look in the mirror ! What are we doing ? Where are we headed ? Whats our objective ? whats with us ?? This is what I felt.

So, I decided to take an interview of the society on four basic factions of life. Childhood, youth, parents and old age. Here are the views of society on these factions in a summary:

We first talk about childhood. O ! childhood is an age of innocence. It is that period of life when everything is so beautiful. What are your views ?

O yes, child hood is a great phase of life. Probably the greatest. Now, what I do with childhood is very simple. For me , childhood is not a phase, to enjoy, childhood is a phase where I can impart value system in that small brain , or thats what people call that first floor of humans. I impart the knowledge like we believe in only a particular god. The choice of god varies depending on my wish. If I am Christian, I say, jesus is the true god and others are not. If I am a hindu, I say Shiv or Krishna is a true god nothing else. If I am islamic, I say Allah is path to salvation and nothing else. So I impart this invaluable knowledge to them. See, I am doing this for them . I am training them to fight for rest of their lives. If this is not taught, how will they fight ? What will they do ? Then I also somehow manage to convince them that the scriptures are very very true. They are very literal and you have to believe in miracles. That actually easy as they do not much about science at that time and to tell you a secret, I also tell them that of they ever ask me a question, they will be punished !! Isnt it cool ?  Then, I send them to school ! There I give information and tell them that this is knowledge. Those poor little beings believe it !! They actually think school and college is a place where they get knowledge. This is a greatest failure of knowledge isnt it ?? (hehe). Then when they say they have gained knowledge , I ask, how do I know. Prove it by getting good grades in the exams. Memory is the path way of knowledge for them and this I think is a very innovative idea by me. This is imparted in the human brain and is executed through out. Humans, stupid humans actually believe that intelligence is knowing things. In IO test, they ask some questions regarding who was who and who did what and when etc ! And they test their intelligence !!! (Hahahahahahha). Anyways, then is gradually expose them to outside world. I show them movies, give them books etc. I show them shows like “mahabharat” or “jesus story” and tell them television is true. But this has a side effect, when they see things like “original sin”, “ma mere” or “munni badnam” and “sheila jawan”, I scold them. I say thats not what you should learn. Though I allow the makers to make it and elders to watch it, but not for children.Some say what is does is confuses a childs mind, but I say, no, the only rule is follow my rules without question !! Thus, in childhood, I impart qualities like competition, rivalry, winning spirit and also gifts. I give gifts when you are successful and punish when you fail !!!

Then comes youth. Another good phase. Human at his/her prime in the life. Full of energy and enthusiam ! What about it.?

Well, yes, youth is a good stage. Its a good platform to teach advanced things now. Now, in this stage, I introduce them to money. I give them money but  not the permission to spend it. So, they are confused. Then I tell them whats good and whats bad without reasoning ! I say, drugs are bad. Not why are they bad. Ofcourse, as god has made humans curious , they wanna know why are drugs bad and hence consume it. Thats it, as soon as they consume it, I proclaim them as sinners. I punish them and I isolate them. The result, they take more drugs. And computer scientists thought recursion is their invention !!! Then for someone who has escaped this devious and brilliant plot, I surely trap them in marriage. See, I am a humanitarian, I allow you to love. But, as usual, the catch is you cant marry the person you love. There are things like cast and creed that I have to take care of. And then, I fill the human mind with the root cause of all troubles. “Expectations”. I teach them to expect from the person they wanna marry.I teach them:

We are the invincible ones. We are the most popular ones.Each and everyone needs us you see.But ofcourse, we are also humans and we have our requirements. We look into some basic qualities in our partner. Common, they are not very difficult. We are good people you see. All we expect is that the partner should be good looking. Have a good figure/physique. They should have style you see. We need it as when we introduce them to our friends, our style and status should be maintained. He/she should know how to behave in a 5 star hotel and  should know how to speak in english full of accent, How to drink wine and how to hold hands and dance in a party. He/she should like my friends and appreciate my habits. Even If I smoke, He/she should not. Even If I flirt with someone else, he/she should be faithful. Even if I do not give a damn about my parents, he/she should. Even If I courier her/him a gift, he she should be happy ! Thats all we ask for. Nothing more. And ya, ofcourse, they should not be married before. You see we need “fresh” people. And ofcourse, I many cultures, marrying a divorcee or widow is a crime. And kinda Post script: Their fathers must be rich. They should be able to fulfill our dreams ! I dream of buying a car and since I am a divine being, he should full-fill it as a duty !! Thats all, see how nice we are !!

See, isnt it good ?? Isnt it correct ?? I know I am a master, I can make it from your expression kid !!!

Then comes parenthood. gift of god! A birth of human life. How do you deal with that.

I start by seeing them cry. They cry when in the hospital, they hear the crying of the baby. But, for me , its an important phase. I start early. I say, if the baby is a girl, then you ought to cry you idiot ! How can you do this. Girls , I somehow manage to convince the people , are not creation of god. The idiots believe me.  They know their mother is a girl still in many times and cultures I have convinced man to kill girl !! I love it.  But I do not stop there.  Then there is a simple course for parents. Thats actually a result of what I thought in childhood. Rivalry, competition etc. Now the concepts are applied to children. The average guy is always told “learn from your brother/sister”. Isnt it ?? Now, I dont see anything wrong in it ! Ofcourse, studies and grades are everything ! People not good at studies or those who do not get good grades should understand that they have a responsibilities toward their parents ! What will their parents say to the relatives and neighbours ?? What do they talk if you do not top or you do not win a trophy on your sports day ??  ow will they say ” see this is my sons certificate” with a proud laugh on their face and a hidden feeling a achievement as the relatives son stood second !! Guys , we have to understand that world war 3 is all parallel ! Each house and family has its own version of world war 3 !!! Common, you cant be average !!   But what do we actually learn in school, college ? Its just information anyways. Knowledge is long lost when we used memory to test intelligence. How great of me that we expect our students to understand information !! One may ask how do you understand that a flight AI-103 is going from Bombay to London !! Isnt it same as teacher after teaching a chapter on Gandhi asks “Understood ” ???? Today I care more about translation of gita rather than understanding it !!

Then comes old age ! Probably the most difficult phase of life.

All traditions and religions in the world say we should respect our elders ! So I do. We make better old age homes ! I give them better facilities. I give them a garden to have an evening walk with those artistic looking sticks I gave them as birthday present and those arthritis inflicted legs which nature gave them. I give them library. Books to read with those armani glasses I  gave them and those eyes that cant see clearly which nature gave them. I give them cozy beds and heaters or Air conditioner so they can sleep properly forgetting that only closing eyes is not sleeping. I give them smart phones to stay in touch ! So they can contact us when in need ! Knowing that those shaking hands cannot dial or remember the number !! We give them good medical facilities so they do not feel any pain. I give them medicines  as their blood pressure increases when going to a doctor. They say, they need their children. Are they mad ? They are  busy ,they have a meeting to attend otherwise their company would go bankrupt. they have their car to be serviced,  they have wine to be purchased, they have extra language classes to attend, they have gym to go , they have to go to the temple or church for worship ! They are  so so busy! common, tell oldies to handle themselves. And then they say, all we need is your smile and I say, na I cant, I have to mourn for a train accident victim you see !. All they ask is can you spend one hour on a sunday and I say no,I have to go for mass and feed the homeless !! The old people must understand, I dont have time for their stupid emotions. I will talk to you only if the talking helps my bank balance in any way ! I do this much for them , be content with what you get. You get free money. What else do you need ??

Mr. Society, Arent you afraid of god ?

God ? Hahaha, tell me whats god? How did you came to know about the concept of god ? Its through me child. I created god. And god, where is he ? Can he do anything ? I am the one who stays with you everyday, every minute !! I am the one with you, always. I have been with you for ages and I will be with you forever. I am a parasite which eats you, which consumes you and you do not have a medicine for me. You cannot harm me. You cant live without me you see. After all, you are a social animal !!!

The Mayans said that world will end in 2012. While factually incorrect, I suppose they understood the parasite I am talking about.

A cancer, my interviewer friend kills you. I on the other hand give you life. Its true that I have now grown so so strong that living with a parasite like me is more difficult than getting killed by a cancer !!

Fixing Ubuntu GPG BADSIG error

Recently, I faced a error while updating my Ubuntu system.

When I ran “sudo apt-get update”,

it gave me the followinf error message:

 

W: GPG error: http://archive.canonical.com intrepid Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key

 

The way I fixed it was:

 

$ sudo -i

# apt-get clean

# cd /var/lib/apt

# mv lists lists.old

# mkdir -p lists/partial

# apt-get clean

# apt-get update

 

Hope it helps. !!

Changing the text color of your Icons on Desktop in Ubuntu

Recently. I encountered a weird requirement.

I had changes my background image to a white colored image due to which the text on the icons was not visible.

Thus I wanted to change the text color of the icons on Desktop to black.

It turns out that is fairly simple.

Here are the steps :

Go to

 /usr/share/themes/Radiance/gtk-3.0/apps/

NOTE: I use the radiance theme and hence this path. In case you are using a different theme, replace “Radiance” with your theme name.

Here open a file called as “nautilus.css” in a simple text editor.

Somewhere near line 8-10 , there is a desktop mode where you can make your changes.

Find the line

color:@bg_color

Instead of removing it, comment this out and below that, copy the same line and use the hex code of the color you want to use.

For example, in my case it looks like:

color:#000000

Not a big deal but hope it helps !!

Compiling a LaTeX Document.

So having prepared your first tex document I was pretty excited to see the out put. But there was one daunting question !!
Whats the next step ??

Fortunately , I was using KILE so I got my PDF in a click but I wanted to figure out how get the same pdf using command line.
So here is the procedure to do the same:

—————————————————————————————————————————————

STEP-1:

Suppose the file ``my_report.tex” is the file that contains all the author’s work, i.e., her actual typed words and formulae. It was typed using the text editor vi. Similar text editors include emacs, pico, Notepad (in Windows), and TextEdit (on Macs).

First navigate to the place where the tex file is located using terminal.

Then run the command:

latex my_report.tex

This produces a bunch of files. One of them would be my_report.dvi.
The dvi stands for “device independent”.

The file my_report.dvi is the same regardless of

(1) which computer is used to compile the document,

(2) what kind of printer it is headed for.

In fact, it is too universal to be printed in this form; it must still be translated to a form suitable for a specific kind of printer. (Different printers speak different languages…) You can’t even view the DVI file unless you use a special “DVI Viewer”, such as xdvi on ucsub.

 

The files“my_report.aux” and  “my_reoprt.log” are two by-products of the compiling command.
The aux file is used if the document contains more complicated stuff, like bibliography and cross-references.

The log file contains a full record of the compilation, including errors you need to correct, e.g., misspelled macros, missing bracket or parenthesis, missing references, etc.

—————————————————————————————————————————————

STEP-2:

The file “my_reoprt.ps”, a PostScript file, the kind understood by most laser printers.
A printable PostScript file is created from the dvi file by the translating program dvips. On computer run the command

dvips my_report.dvi

—————————————————————————————————————————————

STEP-3:

The file ``my_report.pdf” is the PDF form of the document.
This is as web-friendly a document as possible. Using Acrobat Reader, any computer can be used to view the document and/or print it. On computer run the command the command

dvipdfm my_report.dvi

translated the DVI file to PDF form.

 

Thats it !!

 

Hope it helps. !!

Special Characters and Symbols in LaTeX

Following is the way to use special characters and symbols while creating a document using LaTeX:

 

 

Symbol/Character Way to get it in LaTeX
Quotation Marks two ` (grave accent) for opening quotation marks.
two ‘ (vertical quote) for closing quotation marks.

Dashes and Hyphens L TEX knows four kinds of dashes. Access three of them with different number
of consecutive dashes. The fourth sign is actually not a dash at all—it is the
mathematical minus sign.
The names for these dashes are: ‘-’ hyphen, ‘–’ en-dash, ‘—’ em-dash
and ‘−’ minus sign.

Examples of each are shown below:

  • daughter-in-law —-> daughter-in-law
  • pages 13–67 —-> pages 13–67
  • yes—or no? —-> yes—or no?
  • $0$, $1$ and $-1$ —-> 0, 1 and −1
Tilde (∼) $\sim$demo
Slash (/) \slash
Degree Symbol (◦)

^{\circ}\mathrm{C}$.
The textcomp package makes the degree symbol also available as \textdegree
or in combination with the C by using the \textcelsius.

The Euro Currency Symbol

\texteuro

NOTE: its available in textcomp package

Ellipsis (. . . )

On a typewriter, a comma or a period takes the same amount of space as
any other letter. In book printing, these characters occupy only a little space
and are set very close to the preceding letter. Therefore, entering ‘ellipsis’
by just typing three dots would produce the wrong result. Instead, there is
a special command for these dots. It is called

\ldots

Ligatures

Some letter combinations are typeset not just by setting the different letters
one after the other, but by actually using special symbols.

These so-called ligatures can be prohibited by inserting an \mbox{} between
the two letters in question. This might be necessary with words built from
two words.
example:

1 \Large Not shelfful\\
2 but shelf\mbox{}ful

1.Not shelfful
2. but shelfful

Western european special characters and how to enter them from your keyboard

HTML Name Code HTML Number Code Glyph MacOS Windows Description
&lsquo; option+] Alt+0145 left single quote
&rsquo; shift+option+] Alt+0146 right single quote
&sbquo; single low-9 quote
&ldquo; option+[ Alt+0147 left double quote
&rdquo; shift+option+[ Alt+0148 right double quote
&bdquo; shift+option+w double low-9 quote
&dagger; option+t Alt+0134 dagger
&Dagger; shift+option+7 Alt+0135 double dagger
option+; horizontal ellipsis
&permil; shift+option+r Alt+0137 per mill sign
&lsaquo; shift+option+3 Alt+0139 single left-pointing angle quote
&rsaquo; shift+option+4 Alt+0155 single right-pointing angle quote
&spades; black spade suit
&clubs; black club suit
&hearts; black heart suit
&diams; black diamond suit
&oline; overline, = spacing overscore
&larr; leftward arrow
&uarr; upward arrow
&rarr; rightward arrow
&darr; downward arrow
&trade; option+2 Alt+0153 trademark sign
&quot; " " double quotation mark
&amp; & & ampersand
&lt; < < less-than sign
&gt; > > greater-than sign
[ [ left square bracket
] ] right square bracket
&ndash; option+hyphen Alt+0150 en dash
&mdash; shift+option+hyphen Alt+0151 em dash
&nbsp;   Alt+0160 nonbreaking space
&iexcl; ¡ ¡ option+1 Alt+0161 inverted exclamation
&cent; ¢ ¢ option+4 Alt+0162 cent sign
&pound; £ £ option+3 Alt+0163 pound sterling
&curren; ¤ ¤ Alt+0164 general currency sign
&yen; ¥ ¥ option+y Alt+0165 yen sign
&brvbar; or &brkbar; ¦ ¦ Alt+0166 broken vertical bar
&sect; § § option+6 Alt+0167 section sign
&uml; or &die; ¨ ¨ shift+option+u Alt+0168 umlaut
&copy; © © option+g Alt+0169 copyright
&ordf; ª ª option+9 Alt+0170 feminine ordinal
&laquo; « « option+\ Alt+0171 left angle quote
&not; ¬ ¬ option+l Alt+0172 not sign
&shy; ­ ­ Alt+0173 soft hyphen
&reg; ® ® option+r Alt+0174 registered trademark
&macr; or &hibar; ¯ ¯ Alt+0175 macron accent
&deg; ° ° shift+option+8 Alt+0176 degree sign
&plusmn; ± ± shift+option+= Alt+0177 plus or minus
&sup2; ² ² Alt+0178 superscript two
&sup3; ³ ³ Alt+0179 superscript three
&acute; ´ ´ shift+option+e Alt+0180 acute accent
&micro; µ µ option+m Alt+0181 micro sign
&para; option+7 Alt+0182 paragraph sign
&middot; · · shift+option+9 Alt+0183 middle dot
&cedil; ¸ ¸ shift+option+z Alt+0184 cedilla
&sup1; ¹ ¹ Alt+0185 superscript one
&ordm; º º option+0 Alt+0186 masculine ordinal
&raquo; » » shift+option+\ Alt+0187 right angle quote
&frac14; ¼ ¼ Alt+0188 one-fourth
&frac12; ½ ½ Alt+0189 one-half
&frac34; ¾ ¾ Alt+0190 three-fourths
&iquest; ¿ ¿ shift+option+? Alt+0191 inverted question mark
&Agrave; À À option+` A Alt+0192 uppercase A, grave accent
&Aacute; Á Á option+e A Alt+0193 uppercase A, acute accent
&Acirc; Â Â option+i A Alt+0194 uppercase A, circumflex accent
&Atilde; Ã Ã option+n A Alt+0195 uppercase A, tilde
&Auml; Ä Ä option+u A Alt+0196 uppercase A, umlaut
&Aring; Å Å shift+option+a Alt+0197 uppercase A, ring
&AElig; Æ Æ shift+option+’ Alt+0198 uppercase AE
&Ccedil; Ç Ç shift+option+c Alt+0199 uppercase C, cedilla
&Egrave; È È option+` E Alt+0200 uppercase E, grave accent
&Eacute; É É option+e E Alt+0201 uppercase E, acute accent
&Ecirc; Ê Ê option+i E Alt+0202 uppercase E, circumflex accent
&Euml; Ë Ë option+u E Alt+0203 uppercase E, umlaut
&Igrave; Ì Ì option+` I Alt+0204 uppercase I, grave accent
&Iacute; Í Í option+e I Alt+0205 uppercase I, acute accent
&Icirc; Î Î option+i I Alt+0206 uppercase I, circumflex accent
&Iuml; Ï Ï option+u I Alt+0207 uppercase I, umlaut
&ETH; Ð Ð Alt+0208 uppercase Eth, Icelandic
&Ntilde; Ñ Ñ option+n N Alt+0209 uppercase N, tilde
&Ograve; Ò Ò option+` O Alt+0210 uppercase O, grave accent
&Oacute; Ó Ó option+e O Alt+0211 uppercase O, acute accent
&Ocirc; Ô Ô option+i O Alt+0212 uppercase O, circumflex accent
&Otilde; Õ Õ option+n O Alt+0213 uppercase O, tilde
&Ouml; Ö Ö option+u O Alt+0214 uppercase O, umlaut
&times; × × Alt+0215 multiplication sign
&Oslash; Ø Ø shift+option+o Alt+0216 uppercase O, slash
&Ugrave; Ù Ù option+` U Alt+0217 uppercase U, grave accent
&Uacute; Ú Ú option+e U Alt+0218 uppercase U, acute accent
&Ucirc; Û Û option+i U Alt+0219 uppercase U, circumflex accent
&Uuml; Ü Ü option+u U Alt+0220 uppercase U, umlaut
&Yacute; Ý Ý Alt+0221 uppercase Y, acute accent
&THORN; Þ Þ Alt+0222 uppercase THORN, Icelandic
&szlig; ß ß option+s Alt+0223 lowercase sharps, German
&agrave; à à option+` a Alt+0224 lowercase a, grave accent
&aacute; á á option+e a Alt+0225 lowercase a, acute accent
&acirc; â â option+i a Alt+0226 lowercase a, circumflex accent
&atilde; ã ã option+n a Alt+0227 lowercase a, tilde
&auml; ä ä option+u a Alt+0228 lowercase a, umlaut
&aring; å å option+a Alt+0229 lowercase a, ring
&aelig; æ æ option+’ Alt+0230 lowercase ae
&ccedil; ç ç option+c Alt+0231 lowercase c, cedilla
&egrave; è è option+` e Alt+0232 lowercase e, grave accent
&eacute; é é option+e e Alt+0233 lowercase e, acute accent
&ecirc; ê ê option+i e Alt+0234 lowercase e, circumflex accent
&euml; ë ë option+u e Alt+0235 lowercase e, umlaut
&igrave; ì ì option+` i Alt+0236 lowercase i, grave accent
&iacute; í í option+e i Alt+0237 lowercase i, acute accent
&icirc; î î option+i i Alt+0238 lowercase i, circumflex accent
&iuml; ï ï option+u i Alt+0239 lowercase i, umlaut
&eth; ð ð Alt+0240 lowercase eth, Icelandic
&ntilde; ñ ñ option+n n Alt+0241 lowercase n, tilde
&ograve; ò ò option+` o Alt+0242 lowercase o, grave accent
&oacute; ó ó option+e o Alt+0243 lowercase o, acute accent
&ocirc; ô ô option+i o Alt+0244 lowercase o, circumflex accent
&otilde; õ õ option+n o Alt+0245 lowercase o, tilde
&ouml; ö ö option+u o Alt+0246 lowercase o, umlaut
&divide; ÷ ÷ Alt+0247 division sign
&oslash; ø ø option+o Alt+0248 lowercase o, slash
&ugrave; ù ù option+` u Alt+0249 lowercase u, grave accent
&uacute; ú ú option+e u Alt+0250 lowercase u, acute accent
&ucirc; û û option+i u Alt+0251 lowercase u, circumflex accent
&uuml; ü ü option+u u Alt+0252 lowercase u, umlaut
&yacute; ý ý Alt+0253 lowercase y, acute accent
&thorn; þ þ Alt+0254 lowercase thorn, Icelandic
&yuml; ÿ ÿ option+u y Alt+0255 lowercase y, umlaut