Archive for the ‘Apps’ Category

Ruby on Rails with CSS Frameworks

Monday, June 18th, 2007

I’m no designer. This webpage is perhaps proof of that. However, taking that into account, I have to create webpages with at least some design to them. Notably business apps and admin control areas.

Now in this day and age we all should be using CSS to control layout and typeface definitions, none of that inline stuff too. This however can be a rather tedious and painful business for somebody such as myself.

The problem with this perhaps is that the only help rails give you in the term of CSS is a helper method that creates the html head CSS import and a standard and slightly ugly scaffold.css document. So my overriding issue is that whilst rolling around in Ruby joy, my CSS is gets messy. It ends up in an near unmaintainable heap, laden with IE hacks and unorganised in nature. Grr horrid.

What I really need to do is make some code that I can reuse over and over again.

A CSS FRAMEWORK if you will, which can be extended and reused for each project.

So I’m exploring this right now. There are a few lying around the net, including one by the behemoth that is Yahoo!

Content with style CSS framework - http://www.contentwithstyle.co.uk/Articles/17/
Yahoo! CSS Grids - http://developer.yahoo.com/yui/grids/

Now if Rails could help with its scaffold function, producing something of more than scaffold.css, that would be swell.

Ruby on Rails with Google Gears

Thursday, May 31st, 2007

Prelude
This post is just my head throwing ideas about. Non of which are fully formed, nor fully investigated.

Intro
Today Google labs spitted out an early “plugin” for Internet explorer and firefox to make websites viewable and interactive offline. This isn’t entirely new as Apollo offers something similar. However, this is interesting considering Google is one of the kings of webapps. With Gmail, Google Calender and Google Docs all obviously the target for this technology I doubt that it would fail spectacularly.

Very brief and rubbish Gears overview
First off, there are two main components to Gears. The webserver and the database. The webserver is pretty simple to get our heads round, it essentailly caches pages that us as developers tell it to. For me the most interesting parts is the database.

The Gears Plugin that the user installs includes a fully relational SQLite database. As developers we can interacted with it by passing SQL commands via javascript. Yes thats right… we interact with it by using javascript code such as

var rs = db.execute('select * from Demo order by Timestamp desc');

The benifits of this are pretty interesting. For example webservers technically don’t have to store information at their end, ever, just relying upon the users own store.

I feel however the most use of such an app would be for something like gmail, where when you are offline you write and send an email with gears facilitating the actual sending of the email when the internet becomes available.

So how would Rails fit into all of this?
I love writing webapps in rails. Its quick, easy and Ruby is lovely to write. So could developing a Rails app with gears functionality be a possibility without having to drop into insane javascripty-SQL-type goo every time?

The answer in my opinion is yes, but it won’t be easy.

Here are the major barriers in the way to making a my ideal acts_as_gears type plugin.

  1. The plugin should be able to convert Ruby into javascript for offline controllers and model interactions. A massive undertaking (possibly recreating active record in javascript.. shudder).
  2. Creating the user’s local database and linking each column with the live database columns would be essential if we wanted to do any sort of syncing.
  3. The automatic creation of database syncing methods in javascript and ruby.
  4. Creating a seamlessness of data origin in views. For example, a table of information should be able to be printed out on one page irrespective if data came via the live or local database.
  5. The views should only have to be writen once, with of cause different javascript payloads.
  6. Loading and unloading of data needs and state management.

Anyway that’s what’s on my mind right now, a half baked whirlpool of rails, javascript and gears.

Reading
Google gears
Adobe Apollo
Firefox offline info

Multi threaded Ruby on Rails actions?

Thursday, March 22nd, 2007

I’m currently making an app that will spit out pdf reports all over the shop. These reports will get kinda big, doing loads of database calls and rendering images. As such it could take 15 seconds or more to render. Making the reports on the fly therefore could be a horrid user experience with unexpected waits and halts (and a nightmare for a server admin).

So my first attempt was batch the process, as the majority of the data that the pdfs render only changes about once a day. The batch process would go through our database and render all the reports and dump them out to file. User access then would be instantaneous. Wonderful!

The problem is that some bits of data can change at any time. For example these reports display a contact name and email address at the top. So if that changed, the pdf wouldn’t reflect this. Not very professional.

To combat this I added a spooling table, where if some data changed a request was added to a table. A script would then run every minute that would process the pending requests.

This is a slightly dumb approach, I know. What I need is two threads. So when the user updates the contact information, one thread would render the html page as usual and the other to render the pdf. The benefit being that the user doesn’t have to wait for the pdf thread to complete.

Ruby can deal with threads but finding information about doing a task like this is tough, let alone with Rails. Any help out there?

Readings
Rails wiki on threads
Ruby Reliable Messaging Gem
Reliable Messaging Rails example

Opera and iTunes

Sunday, September 11th, 2005

Well I am still using Opera as my primary browser. It is just notably faster that Firefox (that is due for an update this soon). There are a few things which may take me back to Firefox though, the first is the was Opera handles RSS. To view a feed in Opera its opens up a new tab and lists them all, like how you read would read an email in outlook. I kinda got used to the drop down, ‘title’ only feature of Firefox, great for checking things regularly. Plus with opera being ranked 3rd in popularity, some websites can mess up a little bit (digg.com in particular). I also kinda miss some of my firefox plugins, like adblock and the Athens Toolbar (for higher education services) but hey, for day to day browsing Opera is faster.

What else, well iTunes has updated to version 5.0 with a nice new interface. It’s a little more stable and less buggy in the windows version at least. It’s also interesting how you can search for just video located on your hard drive. It can’t be long now before iTunes Music Store sells video, surely.

Speaking of music things, I was thinking of making a podcast but not having me saying a word on it because I sound like a 13 year old and I lack studio/equipment and anything of worth to waffle on about (the major short comings of many many many podcasts). But anyhow, I wouldn’t mind going to local pubs and recording those 1 pint a song nights or even some of the local bands that do the rounds. These people are normally shite, but for a small pub having a podcast searchable in iTunes would be something pretty cool and may even encourage custom. Just a thought anyhow, feel free to copy and use it, but if you do remember to get anybody on it to sign a Creative Commons Licence or something.

And still no BBC iMP invite *grumbles and gives up hope*.

BBC iMP Site

Friday, September 2nd, 2005

The trial for the BBC’s Interactive Media Player (IMP) is due to start sometime this month. The system is basically legal Peer 2 Peer downloading of video content for licence payers. Today however, the website seems to have gone down, very strange. Perhaps they are readying it for trial launch.

/tech blog

Opera browser ad-free for free

Tuesday, August 30th, 2005

The Opera browser became ad-free for free for today only, grab it while you can. So as I had it installed anyway, and actually quite like the speed of things I’m going try and use for the whole week and see if I stick to it rather than my trusty Firefox install.

So far I love the Sessions feature and it is noticeably quicker at rendering pages compared to Firefox and, I assume, IE (who uses that anymore?). It’s also very smooth at scrolling especially over pages with loads of images, something that tended to stutter in Firefox. Anyhow Ill report on it in a week’s time.