RoR: WARN TCPServer Error: Address already in use

I got the following error, when I started the rails server:

anmol@anmol-laptop:~/workshop$ ruby script/server
/usr/lib/ruby/1.8/xmlsimple.rb:275: warning: already initialized constant KNOWN_OPTIONS
/usr/lib/ruby/1.8/xmlsimple.rb:280: warning: already initialized constant DEF_KEY_ATTRIBUTES
/usr/lib/ruby/1.8/xmlsimple.rb:281: warning: already initialized constant DEF_ROOT_NAME
/usr/lib/ruby/1.8/xmlsimple.rb:282: warning: already initialized constant DEF_CONTENT_KEY
/usr/lib/ruby/1.8/xmlsimple.rb:283: warning: already initialized constant DEF_XML_DECLARATION
/usr/lib/ruby/1.8/xmlsimple.rb:284: warning: already initialized constant DEF_ANONYMOUS_TAG
/usr/lib/ruby/1.8/xmlsimple.rb:285: warning: already initialized constant DEF_FORCE_ARRAY
/usr/lib/ruby/1.8/xmlsimple.rb:286: warning: already initialized constant DEF_INDENTATION
/usr/lib/ruby/1.8/xmlsimple.rb:287: warning: already initialized constant DEF_KEY_TO_SYMBOL
=> Booting WEBrick…
=> Rails 2.1.0 application started on http://127.0.0.1:3000
=> Ctrl-C to shutdown server; call with –help for options
[2009-01-25 20:42:49] INFO  WEBrick 1.3.1
[2009-01-25 20:42:49] INFO  ruby 1.8.7 (2008-08-11) [i486-linux]
[2009-01-25 20:42:49] WARN  TCPServer Error: Address already in use – bind(2)
/usr/lib/ruby/1.8/webrick/utils.rb:73:in `initialize’: Address already in use – bind(2) (Errno::EADDRINUSE)
from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `new’
from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners’
from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `each’
from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners’
from /usr/lib/ruby/1.8/webrick/server.rb:75:in `listen’
from /usr/lib/ruby/1.8/webrick/server.rb:63:in `initialize’
from /usr/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize’
from /home/anmol/workshop/vendor/rails/railties/lib/webrick_server.rb:58:in `new’
from /home/anmol/workshop/vendor/rails/railties/lib/webrick_server.rb:58:in `dispatch’
from /home/anmol/workshop/vendor/rails/railties/lib/commands/servers/webrick.rb:66
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require’
from /home/anmol/workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require’
from /home/anmol/workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in’
from /home/anmol/workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require’
from /home/anmol/workshop/vendor/rails/railties/lib/commands/server.rb:39
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require’
from script/server:3

It seems that port 3000 is already in use . Try using the command mentioned below and see if it works :

ruby script/server -e production -p 3001

if the server starts then go the page : http://yourhost:3001/ .

I hope this will solve the problem.
Advertisements

Skid Software launch and my Presentation at India International Centre(IIC),New Delhi

On 10 October 2008, Skid software was officially launched at the India International Centre, New Delhi, India. In this launch Dr.Arun Mehta told people about the problems with which an Autistic child suffers from and also about the inaction on the government’s part.

All the people who had gathered there were shown the video of Arpit (whose blog is in my blogroll),an Autistic child, using the Skid software with the help of a gaming wheel. You can see the video below

You can see Arpit using the gaming wheel in the above video.

Arpit was also there at the function.

I was also given a chance to demo my cropping and picedit modules at IIC, main hall . First, I gave demo of my crop module and showed them by cropping a picture . Next I demonstrated the picedit module and as soon as people saw the border being added to the picture i realised  they understood the whole working as there were reactions from the audience.

One autistic girl from the audience came up the stage and tried her hand at the Skid software. The girl did some typing with the help of the gaming wheel and looked very excited and happy with the software.

All in all it was a great learning experience as it was the largest gathering in front of whom I have given a presentation and also an honour to speak at the India International Centre, Main Hall .

Anmol Anand : Web Designer

In my last post I had written code for cropping an image using Ruby and Rmagick and I had mentioned that I was working upon a simple picture editor for Skid software, which is a software(web site) designed for people with Autism,cerebral palsy, dyslexia or anyone who has a problem with keyboard or mouse. .

I have not written any post on my blog for quite some time now, as I was waiting for something significant to happen so that I can talk about it. So, I have completed my share of work for Skid software and developed two modules, instead of one, which was planned earlier.

My first module is “Crop module” which was developed in the Expert Guidance of Prof. Arun Mehta. The crop module allows you to have some fun with pictures, It allows you to crop a picture from all sides i.e. ‘left’,’right’,’top’ and ‘bottom’. The crop module works in conjunction with picbrowser module. First, you have to select a picture from the picbrowser module and then move to the crop module. On moving to the crop module, first select the side from where you want to crop the picture i.e. ‘left’,’right’,’top’ and ‘bottom’ and by the help of up and down arrow buttons increase or decrease the amount of cropping. After doing the desired cropping, save the picture by clicking the smiley and your picture will be saved in the relevant directory.

There is a special way in which we save the names of the files that are cropped and finalised by the users.For example:

If you select a picture of ‘Football.jpg’ and then you go to the crop module and perform 40% cropping from right and save it, the name of the new cropped file will be ‘Footballcr40‘.jpg, meaning Football.jpg croped 40% from right. Each time you perform a new operation on a picture, it’s abbreviation is appended to the name of the orignal file and saved.

left crop – cl

right crop – cr

top crop – ct

bottom crop – cb

A picture of crop moule on www.skid.org.in

A picture of crop moule on http://www.skid.org.in

Above picture cropped 60% from left with help of crop module

Above picture cropped 60% from left with help of crop module

Now, let me talk about the second module which was made independently by me, after Prof Arun Mehta taught me how to go about the process, during making of crop module. This module is the ‘picedit’ module. This module lets you to have even more fun with pictures by allowing you to add effects such as border, wave, blur, radialblur, rotate and charcoal effect to the picture you have selected. The methodology is the same, first go to picbrowser, select the picture on which you want to add picture effects. Once you have selected the picture, move on to the picedit module and select the effect which you want to add to the picture. Once you have selected the effect, increase or decrease the amount of effect with the help of up and down buttons on the left side of the page. When you are done with your work, save the picture by pressing the select button.

Again, there is a special way in which we save the name of the files that are cropped and finalised by the users. For example: If you select the picture of ‘Football.jpg’ and then you go to picedit module and add a border of 40 pixels to the image and save it, the name of the new file will be ‘Footballb40.jpg’ meaning Football.jpg has been added with 40 pixel border. Each time you perform a new operation on a picture, it’s abbreviation is appended to the name of the orignal file and saved.

border – b

wave – w

rotate – rot

blur – bl

radialblur – rdb

charcoal – co

picedit module showing wave effect in the flower image

picedit module showing wave effect in the flower image

You can go and try the software on http://www.skid.org.in and apart from this module there are wikipedia module, email module etc.

I would like to thank God and my Parents who have helped me and supported me throughout the period of making of these modules and also given me strength when my spirits were down.

Once again I would like to thank Prof Arun Mehta for giving me a chance and making me part of this noble mission to help Autistic Children and also giving me guidance and support throughout the period of making these modules and also when I was struck with errors in the program .

Thank you all !!!!

Ruby and Rails Tutorials

I am giving url of sites that are either books , tutorials or simply a help in form of video , audio and refcards to learn Ruby and Rails.

Ruby :

Online Guide : The Pragmatic Programmers Guide (Picaxe Guide)

Site-point

Book : The Ruby Cookbook

Ruby Learning through flashcards : YoYoBrain

Online Tutorial : Meshplex Tutorial

Rails : In this section I have been able to find video tutorials only .

Video tutorial : Learning Rails

Video Tutorial : Railscasts

PS : I will try to update the list if I am able to find other good tutorials . Otherwise , there are very good books available in the market which help the cause of learning ruby and rails and I will try to name a few which I know in one of my following posts

Enjoy Learning !!! 😀

Web Programming Lecture in Second Life

On 10 August 2008 , I ,Anmolanand Inshan*, got an oppertunity to attend a Live lecture on Web Programming through Ruby and Ruby on Rails in my Second Life . The lecture was delivered by Professor Arun Nighfire* (Arun Mehta) at the Kaosome hub . Apart from me other people who attended the lecture were Al Supercharge* , Freemason Magic* and Pechkin Lavochkin*. Both Al and Freemason were familiar with web programming , Al knows PHP and Freemason knows LSL i.e Linden Scripting Language . Pechkin Lavochkin is a SOMA Intern and Site Manager.

Basically , Professor Mehta told us about the beauty and simplicity of Ruby and Ruby on Rails . He also showed us his framework Skid (Special Kid) which has been designed for Special children(example : those with Cerebral Palasy , Autism etc ) to help them to communicate easily and help them to come into the mainframe of the life .

One of the things which I noticed when I was hearing to the lecture was that there was an amplification in the voice when I went towards Professor Mehta .

So , this lecture was aimed to give an Insight into Ruby , RoR and Skid , so that people can learn Ruby and RoR and also help in making new modules for Skid , if they want .

I am making a module which will help children with simple Picture editing . 🙂

The next lecture is scheduled for 17 August 2008 , 2230 hrs by IST and round about 10 am by Second life time . You can check the Second Life Events for correct timings and Venue as there can be a change .

To know more about Second Life , click here

* Names in Second Life

Installing MySQL Server on Linux (Ubuntu and Kubuntu) for Ruby and Rails

I have installed MySQL on my Hardy Heron KDE4 remix after repeated efforts and that is why I thought that I should list the steps showing how to go about the task.

First of all open the terminal/konsole and type there “sudo apt-get install mysql-server ” and then press enter. You will be asked for your password and after providing password the installation will begin . In this you will also have to set up your MySQL password , so that your database remains secure .

Post installation type ” mysql -u root -p ” , you will be asked for your mysql password and after providing password , You should see the following :

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.0.51a-3ubuntu5.1 (Ubuntu)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

If you see the above lines ,it means you can now work on MySQL, as far as i have understood this .

Installing MySql driver :

In konsole type “apt-cache search libmysqlclient ” to find out the different library versions available.You will see text similar to the following :

libcrypt-mysql-perl – Perl module to emulate the MySQL PASSWORD() function.
ser-mysql-module – contains the MySQL database connectivity module
libmysqlclient15-dev – MySQL database development files
libmysqlclient15off – MySQL database client library

Next install the library by typing ” sudo apt-get install libmysqlclient15-dev ” on the konsole . Library will depend on the version of MySQL you are using , you can select your library from the output which comes after writing  “apt-cache search libmysqlclient” and then pressing tab two times .

Install MySQL driver with the Ruby ” gem install ” command . Type ” sudo gem install mysql ” on the konsole , here you will get various options choose “mysql-2.7” or any other latest version and install it . On successful install you will get a message stating that mysql-2.7 has been Successfully installed .

Your Installation of mysql is complete .

If you are new to MySQL , like me , you can install MySQL Query Browser and MySQL Administrator from the Adept Manager or Synaptic both of which are default package managers for kubuntu and ubuntu respectively. I have installed Query Browser and Administrator from Adept Manager as I am a Kubuntu user .