Apr 30 2009

Updating to Ubuntu 9.04 (Jaunty) in 4 easy steps

One of the cool features about Ubuntu is the way you can maintain your installed packages. And what about updating a whole distribution? It is pretty much as simple as it is with normal packages.

Yesterday I updated my Intrepid (8.1) development server to the new Jaunty (9.04) release with 4 easy steps:

  1. Install the core of update-manager and the release upgrader (not aptitude) with the following command:

    sudo apt-get install update-manager-core
  2. So now you’ve got the release upgrader installed, let’s upgrade your system:

    sudo do-release-upgrade

    Now the installer is might gonna ask you a couple of questions, depending on the installed packaged on your system:
    “Running services and programs that are using NSS need to be restarted, otherwise they might not be able to do lookup or authentication any more”

    Services to restart for GNU libc library upgrade include “rsync” and “cron” as defaults. If you don’t do too much of crazy things on your server, you can probably use the default values.

    NOTE: When it comes to remote server administration (through SSH), as Rugmonster pointed out at the #slicehost channel on Freenode, the ssh service will keep working as it is used to be. Also, even if sshd restarts, your existing connection won’t be killed.

  3. After the upgrade process is done (took me about 15 minutes from Intrepid to Jaunty – this may vary depending on your connection speed and the number of packages installed) the installer will finish and reboot your system.
  4. Log in to your system again through SSH (use your previous settings, those have been kept) and check your system information:

    lsb_release -a

    You should see something like this:

    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 9.04
    Release: 9.04
    Codename: jaunty

NOTE: I have to add that some people had to re-compile their MySQL binaries after the release upgrade. This happens when you have manually compiled binaries and not the official releases through apt-get. Then you might gonna need to recompile those after the upgrade process. I haven’t expected any problems myself, tho.


Mar 11 2009

Things to watch out for in Rails 2.3

Recently I was asked on IRC what are the main traps if you want to migrate your application to Rails 2.3.

(NOTE: At the time when I’m writing, Rails 2.3.1 is available which is actually Rails 2.3 RC2. This is a release candidate beta, so even if it is fairly stable, you need to consider using it in production environment or not.)

I am going to collect the list of changes to watch out for with Rails 2.3:

1: Renamed Application Controller

If you have and old Rails project and you are already using Rails 2.3, you may encounter the following problem when you are loading up your console:

$ script/server
Loading development environment (Rails 2.3.1)
/opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/activesupport-2.3.1/lib/active_support/dependencies.rb:443:in `load_missing_constant':NameError: uninitialized constant ApplicationController

This is because DHH introduced a backwards incompatible change with the Application Controller. He renamed application.rb to application_controller.rb and removed all the special casing that was in place to support the former. You must do this rename in your own application when you upgrade to this version.

Another NOTE: Please do me a favor and leave your comments if you encounter other non-obvious changes while you’re working with Rails 2.3.


Mar 4 2009

The Rails Magazine

There are a lot of really great resources about Ruby and Rails on the web but the community was missing resource and articles an offline. In print. In something what you can hold in your hands and read on the tube/plane or wherever you want without the need of a computer.

Until now. The first issue of the Rails Magazine (titled ‘The Beginning’) is out now. Rails Magazine is a real, printed journal covering Rails and the Rails community. Continue reading


Feb 11 2009

Weird Loader event error after declaring RSS XML namespace

Can`t really get my head around this, I`ve used a code snippet from an Adobe RSS reader example to sort the namespace of an RSS feed:

if (rssXML.namespace("") != undefined)
{
default xml namespace = rssXML.namespace("");
}

Then tried to load an image using a URL from it with a listener for load completion:

var ldr:Loader = new Loader()
var url:String = item.enclosure.@url;
var urlReq:URLRequest = new URLRequest(url);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete)
ldr.load(urlReq);
contentHolder.addChild(ldr);>
public function onLoadComplete(event:Event):void
{
	trace(event)
}

But this kept on throwing me an annoying error:

ReferenceError: Error #1069: Property namespace not found on flash.events.Event and there is no default value.

Only solution was commenting out the namespace bit. It might work with a different namespace declaration, but not with this, so beware :)


Feb 2 2009

How to enable touch screen / stylus support in Adobe Device Central CS4

I recently got myself a shiny Nokia 5800, which to my knowledge is the first (mainstream) touch screen, Flash Lite (3.0) enabled phone. If you decide to create stuff for it and use Device Central CS4/CS3 to test it, soon enough you`ll realise that:

  1. Nokia 5800 is not in the online device library yet
  2. there`s no generic device with 360 * 640 resolution
  3. but most importantly you can`t use your mouse in Device Central.

This annoyed me to no end as I`m using a few fscommand2 directives, which when you sneakily try to test your content with Flash 7/8 profile will throw errors and won`t even let your .fla compile. So after some commenting/uncommenting these lines I`ve decided to look at the bottom of the problem :)

Enter duplicating and hand-editing .xml device profiles tucked away in your profile :)

For the daring, the single most important line to edit is this:

<mouseType value="None"/>

which should be set to:

<mouseType value="Stylus"/>

There are also 10s of instances of resolution to edit, so for the lazy types out there I`ve attached my freshly hacked custom profile to live with until Adobe/Nokia releases the official one. You have to download the .xml and put it to either of these folders depending your OS:

On Windows XP, the default location is:

C:\Documents and Settings\username\Local Settings\ApplicationData\Adobe\AdobeDevice Central CS4\Devices

On Windows Vista, the default location is:

C:\Users\username\AppData\Local\Adobe\Adobe Device Central CS4\Devices\

On Mac OS, the default location is:

user folder/Library/Application Support/Adobe/Adobe Device Central CS4/Devices/

Enjoy :)


Jan 15 2009

Ruby Enterprise Edition 1.8.6-20090113 – another update

Only a bit more than 1 month ago I’ve blogged about another update of Ruby Enterprise Edition. Now it is time for another heads up:

Ruby Enterprise Edition 1.8.6-20090113 is released.

Man, these guys are on fire! If yo are as crazy as I am, you may already been thinking about an update (at least on your development server.) So, let’s see what you can get if you update to this release. Continue reading


Dec 5 2008

Major updates of Ruby Enterprise Edition

A couple of days ago I posted an entry about REE, Rails and Passenger setup.

Today we’ve received an email from Phusion about an updated version of REE:
Ruby Enterprise Edition 20081205 has been released.

This new update seems to address the most common problems what people have been encountering.

The main updates include:

  • Better 64-bit support
  • Better Mac OS X support
  • RubyGems updated to version 1.3.1. (So you don’t need to update RubyGems like in my previous post)
  • REE’s RubyGems no longer makes use of the existing gems (which fixes a lot of confusion and problems with native extensions)
  • Integration with the RailsBench garbage collector patches
  • A new command to track REE updates easily ($ ree-version)

Please visit the official site for more details and the announcement.

To upgrade from a previous version, simply install into the same prefix that you installed to last time. You can follow this guide in my previous post.


Dec 3 2008

How to install Ruby Enterprise Edition, Passenger and Rails 2

There are certain products which are currently shaking the Ruby / Rails community:

  • One of them is the infamous Phusion Passenger which makes deploying Rails applications a piece of a cake using Apache web servers,
  • And Ruby Enterprise Edition (aka REE) which promises better memory management and better scaleability of your Rails applications.

These are really promising projects and Passenger offers a really elegant and automated setup which makes it pretty easy to be installed. However, I still keep seeing people having problems using it with REE and Rails version 2.2.2 on blogs, RailsForum and mostly on IRC.

In this article I will describe how to set up all of them. Hopefully it will help you understand the basic ideology how a Ruby environment is set up.

You will learn how to install and set up the following products for Rails development/deployment:

  • Apache 2.2
  • Ruby Enterprise Edition
  • RubyGems 1.3.1
  • Ruby on Rails 2.2.2
  • Passenger 2.1.0 (note: this is an edge version, not recommended in production environment, you can still use 2.0.4)

What you will need:

  • Apache web server already set up,
  • Root privileges to be able to compile and set up your server
  • A basic understanding how to use the Terminal.

OK, let’s get started. Continue reading


Oct 21 2008

Installing the MySQL gem on OS X

Wanna install the mysql gem for Ruby? You’d better do it since it’s already available, and you will need it anyway from Rails 2.2 since all database adapters are going to be extracted to 3rd party gems. Take a quick look at your development.log file:

cat development.log | grep -i "DEPRECATION WARNING"

You may see a lot of deprecation warnings related to the mysql database connector like these:

DEPRECATION WARNING: You’re using the Ruby-based MySQL library that ships with Rails. This library will be REMOVED FROM RAILS 2.2. Please switch to the offical mysql gem: `gem install mysql` See http://www.rubyonrails.org/deprecation for details. (called from mysql_connection at /Library/Ruby/Gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/mysql_adapter.rb:81)

Now you’d better install the mysql gem. I know, it is not a too easy task, a lot of people seem to have problems with it. If you type sudo gem install mysql your Terminal may return with errors:

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
	ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Yea, very disappointing I know, I know. But rather then start crying like a teenage girl you could check the error log and start thinking about what you are missing.

No, no, no, I am not talking about a million dollar penthouse or girlfriend in this case… You forgot to tell RubyGems where to look for the mysql header/source files. Without them it just cannot build a native extension on your machine.

Let’s provide some more information to the package manager so it will be able to build that beast on your machine:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions.  This could take a while...
Successfully installed mysql-2.7
1 gem installed

Much better.


Oct 21 2008

Quick tip: Easily remove .svn and .gitignore

I’ve reinstalled my system a few days ago and upgraded all ports on my Mac.

Set up the new SVN server, created new repositories to store and keep my applications under version control. I’ve restored my folder from Time Machine which included the old .svn folders. Of course I wanted to remove all those ones before I import them to my new repository, so after some “googling” I’ve figured out how to do this from Terminal in the most efficient way.

Rather than going to each folder and delete all the old .svn folders and all the junk which had been left from my previous install, I managed to remove all these with one single command:

sudo find ~/Sites/myapp/ -name ".svn" -depth -exec rm -rf {} \;

If you are hardcore enough, you can also delete .DS_Store and .gitignore files too:

sudo find ~/Sites/myapp/ -name ".svn" -o -name ".DS_Store" -o -name ".gitignore" -depth -exec rm -rf {} \;

Article which helped me finding this method: find at dmiessler.com

Now you have a clean folder structure so you can start importing your application to your SVN repository :)