Beware of sudden upgrades!

Posted by h3rald Thu, 20 Dec 2007 14:41:00 GMT

Yesterday I got a rather annoying early Christmas present: when visiting my site, I noticed that the raw source code of my dispatch.fcgi file (yes, I’m on shared hosting with FastCGI, for now) was displayed “as it is” instead of being interpreted.

After the initial moment of anger and stress (I immediately realized it was BlueHost’s fault, not mine), I opened two tickets and went to bed, hoping to see everything solved in the morning.

Unluckily it wasn’t the case, so I posted on BlueHost forum trying to be as polite as possible complaining because the issue wasn’t being dealt with. It turns out that for such issues you’re supposed to use the “Live Chat” feature instead of the tickets, so that’s what I did.

After a quick chat with “Christian”, it turns out that BlueHost decided to perform a server upgrade “silently” upgrading to Apache2, PHP5, MySQL4.1, etc. etc. Cool, pity that nobody told me that!

I was expecting some sort of PHP upgrade (not that I care like that), which was supposed to happen according to the last BlueHost newsletter:

“To alleviate any issues in the future with certain scripts that only run on one version of PHP we have developed the ability to run PHP4 and PHP5 on the same server simultaneously. This will be rolled out to all users in the next couple of weeks. Some servers already have this ability while most will see it in the next two weeks.”

But… hang on? Does it say anything about migrating to Apache2? I don’t think so! What’s worse, is that quite a few things changed with Apache2, in particular the way FastCGI handlers are declared:

# Apache 1.3:
AddHandler fastcgi-script .fcgi

# Apache 2:
AddHandler fcgid-script .fcgi

See? Different. This is due to the fact that mod_fcgid is used instead of mod_fastcgi on Apache 2.

The fix was easy, of course, and now my site is up and running again (and actually running faster)… but, I wonder, why the hell wasn’t I informed? Is it acceptable? It sounds like I might end up on a VPS sooner than expected, unless BlueHost doesn’t roll out some new exciting feature soon, as I think it might…

Posted in  | Tags ,  | 6 comments | no trackbacks

Book Review: Mongrel Digital Shortcut

Posted by h3rald Sat, 15 Dec 2007 10:42:00 GMT

If you ever considered about developing an deploying a Rails application in the last year or so, you must have heard of Mongrel before. If you didn’t, I’d recommend you learn more about it because up to now it proved to be one of the few essential ingredients for deploying scalable Rails applications.

Mongrel is a creation of Zed Shaw who started writing a replacement for FastCGI to use with Rails, and ended up creating a brand new, HTTP web server who turned out to be one of the best things the Rails community ever saw happening.

It was created to be simple to use and configure, nevertheless it does require some skill to set it up and tune it. Documentation is there, along with plenty of blog posts, but there’s also an interesting book from Addison Wesley Professional which is definetely worth a read.

“Mongrel: Serving, Deploying, and Extending Your Ruby Applications” – that’s the title of the book. A Digital Shortcut, 100-odd pages long, in landscape format to make it easier to read on a computer, straight to the point with no added sugar for just 15$ (PDF only). I must say Addison Wesley got it right: the book’s format is, as a matter of fact, optimized for web developers, especially those who can’t afford to read a 500-pages book covering everything about a subject just to find that one thing they don’t know about. This shortcut can be seen, essentially, as an expanded cheatsheet which will teach you the basics about Mongrel and also give you plenty of advice on how to learn more about it.

Let’s have a closer look at it.

Read more...

Posted in  | Tags , , ,  | no comments | no trackbacks

Text Link Ads sidebar for Typo

Posted by h3rald Sat, 17 Nov 2007 11:47:00 GMT

I thought it would be nice to share the code of the sidebar I created to display Text Link Ads sponsor links on my Typo powered blog.

There’s actually another plugin which was made for Typo 2.6, but unfortunately it doesn’t work with Typo 4.1.1.

Installation

Just unzip it inside your vendor/plugins directory. The new sidebar should appear in the list of your available sidebars in the Typo’s administration area.

Configuration

In Typo’s administration area, configure the following settings for this sidebar:

  • Title: The title of the sidebar
  • KEY: Your TLA’s XML key
  • Affiliate ID: Your TLA’s affiliate ID
  • Advertise Here: A message shown when no links are displayed.

Download Text Links Ads Sidebar v1.0

Posted in  | Tags ,  | no comments | no trackbacks

To REST or not to REST?

Posted by h3rald Mon, 24 Sep 2007 11:48:00 GMT

Lately I’ve been reading quite a bit about Rails’ REST approach, and to be totally honest I’m not 100% convinced it can always be a good idea. The purpose of this post is to re-evaluate the situation, and ask other people their opinion on the matter.

Let’s see…

Key Benefits

To cut a long story short, from my understanding REST can be a good thing because:

  • It introduces the powerful concept of “resources”, which is independent from the presentation. This basically means that you can have your “resources” represented in HTML. XML etc. etc. “for free”. If you are making an extensive use of web services, this is truly a bless.
  • Each CRUD action is carried out using a different HTTP command (get, post, put and delete). At present, because most browsers don’t understand PUT or DELETE requested, this is somehow simulated by Rails.
  • By thinking and modeling your application in terms of resources, everything should always be “in the right place”.

Downsides?

Let’s now try to summarize what made me think more carefully this approach…

  • While I really like Rails’ convention over configuration philosophy, this sounds a tiny bit too extreme for me. In the end it could be good, but it requires developers to completely re-think the way they develop their application in order to be 100% RESTful.
  • URLs aren’t that pretty anymore. While someone suggested a way to improve the way RESTful URLs look, that sounds like extra hassle to me. It’s subjective, I know, but I really don’t like using IDs in the url… I’d rather go for an univocal code any day (check out this site… I don’t even like dates in my blog).
  • Sometimes, it may take quite a bit to figure out how to model some functionality using resources. While it is straightforward when you want to perform CRUD operations, modeling a search action or authentication may be a bit tricky and may also feel a bit forced. Again, maybe it’s just me.
  • It may be a bit too early to take full advantage of this approach. PUT and DELETE are simulated, and this doesn’t sound right—agreed, that’s the only way for now, but it still sounds like a forceful workaround. Browsers are not RESTful (yet)!
  • All resources are virtually accessible by a URL. I’m not a security expert, but this scares me a bit.

Here are some posts which made me think a bit:

The bottom line is: is REST really worth the hassle? Especially for small and simple applications like a blog, is it really worthwhile to coerce myself to adopt a RESTful approach when I could accomplish exactly the same things with much less hassle?

In other words, is REST really the answer to everything or in some cases it is just not necessary?

And also (OK, this may sound harsh and impolite): does it really make sense to push people to adopt a RESTful approach no matter what? Sometimes someone may get the feeling that Rails is all about REST now. Is that true, or is there still room for freedom other views?

Looking forward to hear your comments, but please be nice and civilized!

Posted in  | Tags  | 8 comments | no trackbacks

Simply On Rails - Part 4: Quick and Easy Default Data Migrations

Posted by h3rald Sat, 15 Sep 2007 19:10:00 GMT

In the last post of this series I tried to find a DRY solution to deal with tables storing “ancillary” data, i.e. names of user roles, predefined categories, page state names and other similar things. I personally chose to put this kind of data to make my application more dynamic, although I could have decided to use ENUMs or simply ordinary varchar fields—that would have been easier, but less flexible. For now, I’m sticking with my original choice.

The data in these tables is kind of a prerequisite for the application to run: I must be able to have a status to assign to a user when creating it, and the same applies to roles. Sure, I could spend 20 minutes populating these tables manually, but it would be nice if there was a less tedious way, wouldn’t it?

There is indeed. The inspiration came from a technique described in the book (which I highly recommend) Agile Web Development With Rails, in which the author outlines how it would be possible to use Rails’ fixtures and migrations to load data in the database automatically from YAML files. All you have to do is create a migration to load the specified YAML files and you’re all set.

I wanted to take a little step further, allowing the migration to load data from all YAML files in a specific directory, automatically.

Read more...

Posted in  | Tags , ,  | 4 comments | no trackbacks

Simply on Rails - Part 3: LiteController

Posted by h3rald Sun, 22 Jul 2007 12:03:00 GMT

Enough with concepts, ideas and diagrams: it’s time to start coding something. Everyone knows what’s the first step when creating a Rails applications, but anyhow, here it is:

rails italysimply

Then I create a new development database, load it up with the schema I previously prepared and modify the config/database.yml to be able to connect to it. Nothing new here. I actually had to modify the schema a little bit:

  • I changed all the names for the foreign keys to something more evocative than “has_many” or “has_one”
  • I added a level column to the states, availabilities and conditions table
  • I removed the description column from the categories table

Great, but… hang on: now some of the database tables look awfully similar with each other:

  • statuses
  • states
  • roles
  • types
  • tags
  • conditions
  • availabilities
  • categories

They all have a name column, some of them have a name column as well, they’ll hold only a relative small number of records which will hardly ever be deleted. In fact, I was tempted to use Enums for some of those things… Anyhow, I’ll still have to add and modify data in those tables, so it looks like I kinda need to create 8 controllers, 8 models and about four views for each one of them. No way. Fair enough for the controllers and models, but I’m not going to create 32 views which all look exactly the same. Rails should be smarter than that!

Read more...

Posted in  | Tags  | 2 comments | no trackbacks

An Interview with the creator of the Akelos Framework

Posted by h3rald Thu, 19 Jul 2007 11:02:00 GMT

I already covered the Akelos PHP framework in the past, but for those who don’t know it, Akelos seems to be one of the few Rails-inspired PHP frameworks still worth mentioning, besides CakePHP and Symphony of course.

I recently has a look at their recently-relaunched community website and I noticed this phrase:

“Being port of Ruby on Rails to PHP Akelos is also optimized for programmer happiness and sustainable productivity”

Bermi Ferrer, Akelos creator, openly admits the framework is a port of Ruby on Rails to PHP, an attempt to help “Ruby on Rails developers who need to code in PHP, among others. Of course Akelos is not Rails, simply because Ruby is (thank God for that!) not PHP, however I decided to find out more, and I asked Bermi a few questions, which he promptly answered.

Read more...

Posted in  | Tags , , ,  | no comments | no trackbacks

Simply on Rails - Part 2: Database Design

Posted by h3rald Sat, 14 Jul 2007 17:27:00 GMT

This week I attended a course for work on how to Implement Databases with Microsoft SQL Server 2005. An interesting course indeed, which made me realize how feature-rich Bill’s product is, compared to the Open Source alternatives like MySQL. It also made me realize how nice it is to implement database-related logic (read: Models) using a proper programming language rather than using triggers, stored procedures, functions and other goodies offered by Transact-SQL.

It’s all a matter of taste and of necessities: using MS SQL Server for one of my website is simply not going to happen anytime soon, and I’m more than happy to have a database which can be used just as a database and a programming language (Ruby, in this case) which can do wonders, rather than a procedural-only surrogate.

Anyhow, back to our weekly series. After creating a concept map, it’s time of get real and try to figure out a database architecture.

Read more...

Posted in  | Tags ,  | no comments | no trackbacks

Rails to Italy 2007

Posted by h3rald Sat, 07 Jul 2007 19:15:00 GMT

So it looks like there will be a “Rails conference in Italy”, after all. In Pisa as well, and that’s maybe even less than 2 hours drive from where I live (Genoa)!

Sounds cool!

Well, the entrance fee put me off a bit, I daresay (€89 if you book before August 1st, more otherwise), but it would be great to go there. They are actually looking for speakers too, pity that at the moment I don’t have anything prepared, but who knows… There’s free entrance (and beer) for speakers, apparently, which it wouldn’t be bad, but unfortunately my girlfriend would have to pay though, of course.

We’ll see what happens, for now I’m just going to promote the thing on my site (see the banner on the side).

Posted in  | Tags ,  | no comments | no trackbacks

Simply on Rails - Part 1: Concepts and Bubbles

Posted by h3rald Sat, 07 Jul 2007 13:43:00 GMT

The first thing I do when I start developing a new application is write down some ideas.

Pen and paper normally do the job, but nowadays there are some valid online and offline applications which work as good if not (probably) better.

I’ve never been a fan of Mind Mapping. I’ve been to a seminar on problem solving and creativity and they were showing how mind mapping can unleash your creativity, but it didn’t really work for me. I found the concept-idea-concept-idea sequences a bit too restrictive for my liking.

So I decided to try something different: bubbles! Bubbl.us is an interesting online flash application which lets you create bubbles. You can create bubbles and relationships between them, change their color, their dimensions etc. And above all it’s absolutely fun to use.

Read more...

Posted in  | Tags , ,  | no comments | no trackbacks

Older posts: 1 2