Showing posts with label development. Show all posts
Showing posts with label development. Show all posts

Sunday, September 21, 2008

Installing Ruby on Rails on Ubuntu 8.04

I've been exploring web app frameworks lately in hopes of starting work on a new site. I first looked at some PHP implementations, namely CodeIgniter and CakePHP. I mostly looked at those thanks to all the cheap and easy hosting available for PHP. I also thought some about a Java framework like Spring or Struts but I mostly write Java these days so I wanted to branch out. What I finally decided on was Ruby on Rails. I have dabbled with Rails a little in the past and have started working on a few real projects recently that are also using Rails so I will be learning it anyway.

So far all my development in Rails has been on Windows. Rails is rather Mac centric and I am a little unsure of the Linux support. I know that the one other project I am working on is deployed on Ubuntu 8.04 server so surely I can develop on it too.

First thing is first. Install ruby:

$ sudo apt-get install ruby
And then ruby doc:
$ sudo apt-get install rdoc
(If you don't install ruby doc, you are going to get an error later when installing ruby gems.)

Now you could at this point install rails and ruby gems using apt-get or synaptic but you don't want to. Rails is currently at version 2.1.1 and ruby gems is version 1.2.0 but the Ubuntu repositories only have versions 2.0.2 and 1.1.1 respectively. If Ubuntu backports had newer versions we would be set but I don't see rails in the mix. Having a package manager built into the OS is not something that Windows and Mac have available to them natively so ruby has gems as a package manager. Unfortunately this can conflict with the OS package manager so that is why we aren't going to install ruby gems or rails with apt-get.

So now you want to download ruby gems here. Extract it (anywhere), fire up a terminal, change to the directory you just extracted and run:
$ sudo ruby setup.rb
If you happen to get the error message: ./lib/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- rdoc/rdoc (LoadError) then you skipped over my point to install ruby doc above. Go back and install that and you will be caught up again.

After a minute or so you will have ruby gems installed. To install rails run:
$ sudo /usr/bin/gem1.8 install rails
After a few minutes more, you are ready to start developing with rails. You may also want to consider using Eclipse and Aptana.


Also, if after this when trying to fire up WEBrick you get the error: /usr/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/initializer.rb:229:in `require_frameworks': no such file to load -- openssl (RuntimeError) You will need to install libopenssl-ruby:
$ sudo apt-get install libopenssl-ruby
You may need to install mysql too even if you are only accessing a remote database so keep that in mind too.

Sunday, May 11, 2008

Web pages looking bad in Linux? Install msttcorefonts.

I'm doing a little work on a website at the moment but the menu looks terrible in Linux. On Windows it is nice and fits on one line. On Linux the menu breaks to a second line and looks TERRIBLE!

Before Microsoft's TrueType core fonts

The reason for this is I am using 'Trebuchet MS' as the font in my style sheet. Since Ubuntu Linux does not have that font installed, it goes with my backup of sans-serif. The best way to fix this is to install the package msttcorefonts. That will install a number of MS fonts including: Andale Mono, Arial Black, Arial, Comic Sans MS, Courier New, Georgia, Impact, Times New Roman, Trebuchet, Verdana and Webdings

After Microsoft's TrueType core fonts
If you are designing a web page you can, and should, pick another backup font too because you can't expect most people running Linux to have these fonts installed. In my case, I went with Helvetica as the backup and then sans-serif as the final failsafe. That at least keeps my menu on 1 line.

And for a much more in depth read on all the fonts and what looks like what on Linux, check out this great article: Linux Font Equivalents to Popular Web Typefaces

Tuesday, January 8, 2008

EasyGPS in Linux Using Wine

Update: Read my EasyGPS in Linux tutorial to get it working. This is for an older version of EasyGPS though.

I haven't posted as much lately because I've gotten into a side project. I am now the Wine AppDB maintainer for EasyGPS. EasyGPS is an application used to manage and transfer waypoints to and from GPSs. I use it all the time for Geocaching.

Unfortunately in Linux, there aren't any great solutions that I have found that are like EasyGPS. Linux has an assorted set of tools, the most useful and well known being gpsbabel, but I have not found an EasyGPS replacement. GPSBabel runs on Windows too by the way.

So I decided I would try EasyGPS out on wine. The latest version, 2.7.5, didn't work very well. It locked up and threw errors all over the place. There are definitely some implementations missing or wrong there. I was able to eventually ignore those problems, connect to my GPS and transfer waypoints from my GPS but then it threw errors again. I am guessing part of the problem is the use of the XML based GPX format and the incomplete msxml3 implementation. After downloading waypoints, nothing shows up except for error dialogs.

I also found an old version of EasyGPS that is the last supported version on Windows 98 or earlier. This version, 1.3.7, works great. Everything works except the crucial part of transferring waypoints to and from your GPS. This is because the code that finds the available serial ports always returns empty. I emailed support and had a very helpful email dialog with developer Dan Foster who clued me into some of the api calls that were breaking on me in both versions.

In my investigating, I haven't figured out exactly why no serial ports are showing up but I did figure out a great work around to get the older 1.3.7 version working almost perfectly. I plan to post detailed [EasyGPS 1.3.7 in Linux instructions] to that in a later post this week.

I also hope to get to working on getting all these issues resolved so Linux Geocachers can easily use the latest EasyGPS and its sister products ExpertGPS and GeoBuddy.

I've already installed git, gcc, flex, bison and several dozen -dev packages so that I can build wine myself. I was surprised how easy getting and building the latest wine was. Now all I have to do is figure out some of these little pieces of the Windows API.

And because I can, here are my Geocaching stats: View my Profile

Sunday, January 6, 2008

Collaborative Debugging Tools Eh?

I spent a good bit of time yesterday playing with wine and a few applications I'd really like to get running like EasyGPS. I figured the wine irc channel would be a good place for help. While in there, I was noticing people kept posting urls to configuration files. Turns out there are numerous sites that allow you to upload snippets of text from code, to config files to debug output for sharing over email, irc, im, etc. You can also select the text type on most of these sites and it will format it and use colored syntax highlighting. I am really wondering why I have never seen these sites before??

And if you want to use some of the collaborative debugging sites, you can find them here, here, here, here, here, here, here, and here. Many of these are running the same software too by the way.