Archive for August, 2006

Custom Rails Scaffold

Wednesday, August 30th, 2006

A short while ago I mentioned creating custom scaffolds for Rails to cut out all the tweaking you need to do to the layouts for each object in the project. It was pretty easy to do, but I put off uploading the scaffold for a while because there were a few tweaks to do and then that massive bug in Rails was discovered so I’ve just gone through and made sure the code doesn’t clash with anything in 1.1.6

What I’ve done is largely changes on the semantic HTML / code neatness side of things. That is:

– Switched a lot of the tables (semantically fine, but not flexible) for lists
– Added a “confirm” action which replaces “destroy” and provides a seperate page with the confirm form on it
– A lot of things are now list items – navigation etc
– Added some useful class names to elements
– Dropped the H1s at the top of each page to H2s
– Created a layout with header, footer, main. Header contains the H1
– Hidden the flash element unless it’s actually used
– Removed nearly all of the default stylesheet. Styling happens after coding! 😉
– Made forms more semantically correct (labels and fields)

These are all changes I would have done manually after the default scaffold.

To use this, download the custom scaffold archive and unzip it to a folder next to the default scaffold. On my machine, at the time of writing I have it in: C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\rails-1.1.6\\lib\\rails_generator\\generators\\components\\custom_scaffold.

Then, instead of running script/generate scaffold, you run script/generate custom_scaffold.

You might want to edit the file layout.rhtml as it currently says “Site by Iain” at the bottom of every page.

let me know if this ends up being useful to you. (I’ve really got to get on and add a decent comments system to my site).

Recursive RSS feeds

Monday, August 7th, 2006

RSS is ace at what it does. It takes the thought out of syndication formats and countless applications support it. The thing is, as far as keeping track of all those feeds go, I’ve got my work PC, my home desktop, a laptop, a podcast aggregator and a bittorrent client aggregating vidcast feeds and TV shows from all over the ‘net. To make matters worse, as soon as I think that I’ve finally remembered which feeds I’m subscribed to and I’ve got them all subscribed in the various places that they’re needed, I see another one I need and they’re all out of sync again.

What I need is an RSS feed *for* my RSS feeds.

Someone has already thought of this, and come up with an XML schema called OPML, sadly it doesn’t seem widely supported either as a data source or by aggregator applications, plus it doesn’t seem all that well designed. Why have a feed of RSS feeds, which is effectively a two-level hierarchy when you could have n-depth and describe any number of feeds-within-a-feed and have just one point of subscription in your clients.

Anyway, until that happens I’ve come up with my own personal stop-gap solution. Using I track which feeds I’m subscribed to. I can then subscribe to the RSS for that page, and any time I pick up a new feed I can add it to the list and the addition will be mirrored in all the applications which are subscribed to it.

Of course, using tags you can slice those feeds any way you want, depending on what the feed is used for, for example I’ve got my podcasts, news and videos which are used by three seperate applications.

Azureus PHP gets CVS server

Thursday, August 3rd, 2006

Ages ago someone asked me if Azureus PHP had a CVS he could subscribe to and get in-development files so I applied to have the project added to Sourceforge. I awaited my project confirmation email from SF and never got one. Assuming that my project had been rejected I forgot about it until a few days ago nosing around the DOPAL project pages and other Azureus-related projects I noticed that I was actually on there!

I’ve just added all the relevant files to CVS, which is one step towards making the project more Open. If you’d like to develop on it, let me know.

I am actually working on an update right now, BTW.