Archive for February, 2007

Rails: #28000Access denied

Tuesday, February 27th, 2007

I’m continuing to mess around with Ruby on Rails on WinXP. I just ran into another problem that took me over an hour to figure out. I set up a database in MySQL, configured my database.yml file, created a model and a controller and launched WEBrick. I put the scaffold line in the controller to generate auto-magical interface and I kept getting this error message:

#28000Access denied for user ‘root’@'localhost’ (using password: NO)
RAILS_ROOT: ./script/../config/..

This was driving me crazy, because my yml file specified to use the “webuser” account instead of the root. And yet, rails insisted on fucking around with the root account. I checked it about a hundred times, changed access privileges on my table every possible way, and scoured the web for similar problems. It seems that quite a few people are running into the same damn issue, and almost no one knows hot to fix it.

Finally after reading through the comments here, I found the solution. Simply run the server in production mode:

ruby script/server -p80 -environment=production

This worked for me just fine. I’m not sure why this was happening. Any ruby experts out there can explain this behavior to me? Oh well, for now I guess that as long as I stay in production, I can avoid that stupid error.

Btw, rails is pretty amazing when it works. It only takes one line of code, and you get a simple, yet surprisingly custom complete interface allowing me to populate, edit and remove stuff from your database table:

Rails Scaffold

How awesome is that?

Strange WEBrick Error

Monday, February 26th, 2007

I was messing around with ruby on my Windows box and for some reason WEBrick kept crashing on me with the following output:

ruby script/server
=> Booting WEBrick…
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with –help for options
[2007-02-26 03:14:11] INFO WEBrick 1.3.1
[2007-02-26 03:14:11] INFO ruby 1.8.5 (2006-08-25) [i386-mswin32]
[2007-02-26 03:14:11] WARN TCPServer Error: Bad file descriptor – bind(2)
c:/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `initialize’: Bad file descriptor – bind(2) (Errno::EBADF)
from c:/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `new’
from c:/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners’
from c:/ruby/lib/ruby/1.8/webrick/utils.rb:70:in `each’
from c:/ruby/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners’
from c:/ruby/lib/ruby/1.8/webrick/server.rb:75:in `listen’
from c:/ruby/lib/ruby/1.8/webrick/server.rb:63:in `initialize’
from c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize’
from c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/webrick_server.rb:58:in `new’
… 7 levels…
from c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/commands/server.rb:39
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
from script/server:3

A quick google indicates that I’m not the only one having this issue but it does seem very rare. Curiously enough the solution turned out to be using a different port for the server. For example I did:

ruby script/server -p8080

That seemed to work just fine. Strange… I’m wondering if this might have something to do with my AV or Firewall blocking connections on port 3000 for some reason…

Update 02/26/2007 12:48:56 PM

It seems that Rich found an explanation for this behavior. The workaround is really simple:

Take that fucking PocketPC out of the fucking cradle and run WEBrick again.

It appears that the wcescomm.exe hugs the port 3000 when Microsoft ActiveSync is running.

How to build a Crawler

Sunday, February 25th, 2007

This made me chuckle:

#732536 +(361)- [X]

<El_Pompo> what would be the best language to build a crawler in?

<Emetri> jawa.

It’s a quote from bash.org of course. It might take you few seconds, but you will get it. Or not. Either way, I’m not explaining it.

Ok, here is a hint:

Hint

Get it?