Posts Tagged ‘gem’

Deploying your Qt on Rails apps on the N900 (Maemo)

Monday, June 21st, 2010

Qt on Rails is a framework to let you turn your Rails sites in desktop applications and harness the power of Ruby! It’s not at production level yet but it’s certainly possible to have a good play with it and a bit of a hack! If you’re not familiar with Qt on Rails then a good place to start is this blog post covering the v0.1 release. Also, check out the github repo for more info on installing Qt on Rails on your desktop and building an application with it. Here we show you how to deploy Qt on Rails based apps on your N900. One of the goals of Qt on Rails is to provide an easy way for you to develop apps faster for Maemo and, down the road, hopefully MeeGo too!

Note: This blog post may help you figure out how to install any QtRuby application on the N900, not just Qt on Rails apps. Also, this QtRuby Maemo wiki article was particularly useful when I was stumbling along this path!

One thing you will need to install as part of this guide is Easy Debian. Easy Debian greatly expands what you can do with your Maemo device. It basically sticks a full-featured version of Debian on your device. This means 2 things – firstly, for the uber-geeks out there it let’s you fire up a Linux desktop on the N900; though it’s important to note that your normal Maemo desktop isn’t affected by Easy Debian. Secondly, having a full-on Debian available let’s you run Linux apps such as Open Office! Sweet! And what rocks is that you can even run these programs without invoking the Easy Debian Linux desktop – in a seamless manner. It’s important to note that the user interface to these Easy Debian-based apps behave a differently to a typical native Maemo program; rather they work like a traditional desktop application with a mouse pointer on screen.

Install Steps
  • Note: For simplicity, this guide assumes you are installing an application which stores data using sqlite3. Also, the steps here have been tested against the N900 firmware update PR1.2. If you are using an older version of the firmware you may want to consider updating it.
  • Firstly, install Easy Debian with the N900’s Application Manager
  • Install the Easy Debian image via the new Deb Img Install application added to your list of applications
    • Note: This is a 1 gig download, but comes with cool stuff like OpenOffice and intergrates pretty seamlessly with your desktop
    • Takes an hour or so to download and then extract itself
  • Open the Debian Chroot terminal (not the usual N900 terminal), which should now be in your list of applications
  • Install rubygems, qtruby and  sqlite3 with ruby bindings
    • sudo apt-get install rubygems
    • sudo apt-get install libqt4-ruby
    • apt-get install libsqlite3-ruby
  • Install the bits we need need from Rails (without installing documentation)
    • sudo gem install activerecord activesupport activeresource –no-ri –no-rdoc
  • Zip up your Qt on Rails application and copy to any directory on to the N900. Note that the Qt on Rails application consists of the entire Rails directory directory including the vendor/plugins/qtonrails directory intact and  a sqlite3 database already created under the db directory).

    If you don’t have your own Qt on Rails application to hand then you can create the RadRadio app discussed in the “Make it so, Jim!” section of the v0.1 release blog post

    In the Qt on Rails v0.1 release there is a bug that accidentally introduces a dependency on a korundum library, which is not needed in this case. An issue is logged against this in the Qt on Rails Issue Tracker As a workaround, find and remove any occurrences of require 'korundum4' in files under the vendor/plugins/qtonrails/app directory

  • Once transferred, simply unzip it on your device. Note: If you saved the zip to the Documents folder on your N900, this can be found under /home/user/MyDocs/.documents when poking around the filesystem
  • Finally, via the good ol’ Debian Chroot terminal, change directory to the vendor/plugins/qtonrails directory of your app and execute

    ruby1.8 run

  • Boom! You should see your Qt on Rails app in all it’s glory!

Note there is a bug where you cannot input into a text field when running a Qt on Rails app on the N900 using above technique (seamless mode). As a workaround, open the Qt on Rails app inside of the Debian LXDE desktop (rather than in seamless mode). You can find Debian LXDE in the list of applications on your device. Inside Debian LXDE, open a terminal and run the application as above. Just a quick heads up, sticky keys don’t work like you’d expect – you have to hold down the Shift and Fn keys to use them.

Santa’s got Gems baby! Ruby Ireland Christmas Meetup 2009

Friday, December 18th, 2009

Ho ho ho! The month’s Ruby Ireland meetup sprag right out of the traps with early adopters showing up at 6pm in the lobby area of the Trinity Capital Hotel, Wed Dec 16th. Easing into the evening with a 4 euro pint and talk of Android phones – seemingly the top item of everyone’s Christmas shopping list – the latest crop of gems in the Ruby world was in hot debate, gemcutter in particular.

A couple of folks had been playing around with RubyGame for visualising data as it changes on the fly – showing that this framework is for more than just gaming. The XML/HTML parser Nokogiri was also mentioned a few of times in passing, with the particularly eye-catching quote “XML is like violence – if it doesn’t solve your problems, you are not using enough of it” adorning the home page of its website. And the cracking little tool tig was also brought up, which has a dinky little ncurses interface into git repositories. Pretty cool; not least because it makes it easier for newbies to avoid being bitten when they start git’tin.

The downstairs lobby in the hotel worked out great for people to meet up and relax, with most people turning up at the scheduled 7 o clock for kick off. From there we took over the, what has to be said, pretty classy meeting room complete with old style couches and some Joan Miró paintings. Just in tune with the creative buzz we had going on. There wasn’t too much talk of Ruby for a while as most people were in stunned admiration of the room. Then the food platter arrived. Impressively, this is when everyone showed off their good manners by looking shyly at the platter for a few minutes, with that kind of “You first, sir” glint in their eye, before taking the plunge and sinking into the pakoras and wedges! Pretty much undoing any good work in the gym from earlier in the day!

One of the funnier moments of the night was when someone went to check the tweets against the (now settled upon) #rubyireland hashtag. Only to find lost rubyists tweeting from the hotel lobby as to where the meetup was on. After a quick runaround the lobby to herd anyone wielding a Macbook into the meeting room, the evening was back on track. We split up into a few smaller groups, with the main walk-through being on the qtonrails – a Rails plugin to simply developing applications on Linux and other platforms using Nokia’s Qt framework atop Rails.

To finish off we had a bit of improv comedy from everyone at different closing stages of the evening; in particular Paul O’Malley with his faithful rendition of an emotion beekeeper. And yes now we’re straying off topic so it’s probably time to go. We’ll leave you with Paul’s write up of last night’s shenanigans :-)

Thanks to everyone who showed. Have a great Christmas and catch ye all in Jan 2010 – surely destined to be the decade of Ruby domination!

Ciao,
Dec

Installing Ruby On Rails on Windows

Thursday, November 19th, 2009

There were a couple of great outcomes from the first Free Ruby Lesson we ran in the Havana cafe on Dublin’s Georges St last Monday. The first was getting everyone hacking with the Rails stack and some practical examples in double quick time. The second was managing to get RoR installed on Windows Vista as the lesson rumbled on in the background. Here’s how Rails conquered Vista.

We kicked off by following the instructions on the rails wiki. It’s worth paying careful attention to anywhere it says to set path variables. If you find that you are getting an error that says that you version of rubygems is not recent enough (and you can’t get rubygems to update itself) then you can install an older version of Rails, for example 2.3.2, using the following from the command line

gem install rails -v 2.3.2

(Note: If you have already installed a different version of rails you can uninstall it first by using ‘gem uninstall rails’).

The big problem however was getting sqlite3 working. We did install the SQLite Command Line Tool and the SQLite DLL as the Rails Wiki instructions said to – but to no avail. We kept getting a popup error saying that the sqlite3 dll was not found and to please consider reinstalling. Fortunately, we gambled on one of the answers on StackOverflow. Basically the solution was from the command line

gem uninstall sqlite3-ruby
gem install sqlite3-ruby --source http://gems.rubyinstaller.org

And with that we were away! The final thing was to get a nice friendly IDE installed so we plumbed for Netbeans on the Netbeans Downloads page. Look out for the special Ruby version of Netbeans which is one of the links around the middle of the downloads page.

Anyway, that’s all for this week. Happy Ruby hacking!

Offline Documentation for Rails (and other Ruby gems)

Thursday, November 12th, 2009

I used to pretty much always install gems with the –no-ri –no-rdoc options to speed up installation. Recently however, I’ve found myself needing to get access to documentation whilst on the move. So just in case you don’t know how that works, here’s the deal.

* Install your gems as per normal (ie. don’t use –no-ri or –no-rdoc)
* Run the command ‘gem server’ from the command line
* Browse to http://localhost:8808
* And voila! You should have all the docs you need available by clicking on the rdoc link for any given gem
* But if you really want to get fancy check out the searchable Rails documentation at http://railsapi.com – there’s an online version as well as the downloadable (the links are at the top of the page and can easily be mistaken for an advert!)