The Rails Widgets plugin is our most successful open-source effort so far. Lately its development has been put a bit aside and hasn’t got the love it surely deserve. This is mainly because this little piece of software is pretty stable and just suits our needs.
But of course it could be improved, more widgets could be added and the code could be refactored. Why should our own needs stop its development? There are many people on the Widgets Users Mailing List who come up with great ideas about its development so we finally decided to open up the repo and let this plugin find its way through the community!
We’re willing to find new committers who share our vision about the plugin and help us take it to the next level, so if you’re interested, feel free to join us!
After examining the poll results at www.railsworkshop.it, it was pretty clear that the workshop location wouldn’t be that far from our office this time…
A lot of people voted for Padova or Brescia, and a timely coincidence made possible to have a gorgeous conference room at Quadrante Servizi in Verona, right in the middle of those two most voted locations, not that far from both of them.
Expect it to be a great event! The workshop has been upgraded to cover all the new stuff introduced with Rails 2.0, and will be exciting like never before! You’ll find all the informations you need at www.railsworkshop.it, or just feel free to drop us an email. See you there then :-)
Yesterday we spent all day dealing with a strange bug… something I want to share with you.
Basically we have an app which runs from CDROM and stores its data in a sqlite3 database file inside the user home. We manage the updates from a remote website downloading and swapping the sqlite database file on the fly.
What we do is something like this:
# download the new DB file
new_data = URI.parse('http://foo.com/new.db').read
File.open("#{home}/new.db", 'w') {|f| f.write(new_data)}
# connect to the downloaded DB file
ActiveRecord::Base.estabilish_connection :adapter => 'sqlite3',
:database => "#{home}/new.db"
# do something with the updated DB
# eg: read data for your updates and use it
# reconnect the original DB
ActiveRecord::Base.remove_connection
ActiveRecord::Base.estabilish_connection :production
# remove the downloaded DB file
rm "#{home}/new.db"
We tought that calling remove_connection would suffice to disconnect the new.db database, but when we tried to delete the file (the last line) we sadly discovered that under Windows it was kept locked by our own process even if no database connections were active on it. The problem seems to be inside the sqlite_adapter that once connected to a sqlite database, never calls the close method, leaving it locked forever.
So how do we close those open connections?
Thanks to ObjectSpace we can inspect all the sqlite database descriptors (SQLite3::Database instances) in our application and close them by hand. VoilĂ , this way we can safely delete our temporary database files, without cluttering our user’s home dir.
def disconnect_all_sqlite3
sqlite3_descriptors.each {|c| c.close }
end
def sqlite3_descriptors
open_descriptors = []
ObjectSpace.each_object(SQLite3::Database) {|x| open_descriptors << x}
open_descriptors
end
Just put a disconnect_all_sqlite3() call before the ActiveRecord::Base.estabilish_connection :production and everything will start working as it should!
Wow, what an honor!!! I’ve been interviewed a week ago by the great guys at ICTV.it and today I’m on the HTML.it homepage.
Well, the interview is nothing special and sadly it’s in Italian only, but is always good to promote the language and framework you love! Go Rails Go!!!
You guys just cannot Imagine how cool this JavaDay has been.
On my four hours trip to Rome I was revising my speech and felt a bit skeptical about this event.
I know a bunch of the staff people and I know they are great guys, but you know, we’re towards a 2008 drenched in a very mature web-two-oh environment. Java just doesn’t seem that cool anymore.
At least this was my feeling. I’m working a lot with Ruby and Rails and in the Ruby community everything containing the word Java smells old, if doesn’t even stink.
I didn’t expect to find great enthusiasm around this meeting, I thought It would have been just a little JUG meeting on steroids.