Archive for the ‘General’ Category

This just made me smile and giggle

Monday, June 4th, 2007

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

Fantastic angry critics

Tuesday, May 8th, 2007

With little time and money spare we need the help of critics or reviewers to help us in our choices. As a single male with a cynical slant and a hatred of being “sold” anything I tend to take comfort with critics who get rather angry in their specialist area. Here are a few I really quite like.

BBC Five Live - Mark Kermode film reviews
Kermode loves film and is the BBC’s film reviewer who appears on Newsnight review and The Culture show from time to time. His reviews are, I have to say, spot on for my liking. Of cause not everybody will agree but I like this chap for his balls in lambasting a film. His famous rants against Pirates of the Carabiean and Little Man have almost become legendary.

Reading
Kermode film page / podcast links
Wikipedia entry


4Later - Vids
Before channel four filled its nights with quiz channels or 24 hour CCTV footage of some wankers in a house 4later aired and was a gem of my pubescent years. It had odd animations and tv shows which ran on a shoe string. One of the best was Vids, a video review show which looked at the latest VHS releases. Starring Stef and Nigel as two Scottish video shop owners their reviews took place during comedy sketches which I have yet to see repeated. A classic which could make a fantastic come back on the net if somebody could track them down.

Reading
Vids fansite, long since dead.
IMDb information
Google cache of old 4later site.
Dog-Sized-Cat. Nigel’s new site with links to Vids episodes.
4later fansite.


Internets - Angry Nintendo Nerd (aka angry video game nerd)
This chap just makes me laugh out loud. His age is about mine, his subject matter old video games and his anger is constantly at about 10.

Reading
Angry Video Game Nerd Home page
Youtube videos


BBC Four - Screenwipe
The artsy BBC 4 hosting a program where the hosts states “an undercover camera show that filmed children in restaurants and calling them c**ts, thats a show I would watch” has to be worth a peek. I missed it up until now and have only caught up thanks to youtube and some chap pirating them. I would basically describe this show as like ITV’s TV burp, but funny. Plus any show that hires fat-pie.com and Adam Buxton has to get my vote. Classic.

Reading
BBC Four Screenwipe page
Loads of “clips” uploaded to youtube

The missing navigation to Daniel Kitson’s website

Sunday, April 29th, 2007

Daniel Kitson is a wonderful stand up comic and story teller, somebody who I admire as a chap trying something new and wonderful.

Alas he seems to have made his website himself, an admirable undertaking which has resulted in a site which has a “mystery meat” navigation system. So I thought it best to create a more useful navigation system for my own and possibly others use.

- - Front page
d - Landing page
a - News
n - A page with links to “i”, “l” and “e”
i - Latest stand up show details
e - List of past show
l - Story shows

. A page of broken images

k - Story show dates
i - Story show poster
t - Photos
s - Little Bits of Film
o - Film “Speed hump”
n - Film “Late”
- - Film “Stories of the Wobbly hearted extract”

Join the mailing list

Hope this is of help. As a side note I would offer to help Daniel with his website if he needs it, because it does have some wonderful content.

Re: Macs making inroads in the corporate sphere

Wednesday, April 11th, 2007

Ars Technica recently put out a post stating that “macs are making inroads in the corporate sphere”. This sparked some interesting discussion regarding on how macs can be incorporated into the hostile world of Exchange servers and Desktop policy.

A real sore point in the comments were that mac laptops don’t have docking stations. Indeed I can see why its annoying, as I write, this my little Macbook is spilling out 4 cables which are a hassle to plug in and make my desk wire hell. I would much prefer a docking type system, like IBM or Dell offer.

Personally, I *could* get rid of my mouse/headphones/keyboard and replace them with wireless alternatives (the net is already wireless). Alas there is still one major problem. If you use a secondary monitor or a projector, that is one heck of a dongle and loop of wire that as of yet lacks a real wireless solution. Most annoying.

So, I can see why people want docks. ‘One click’ simplicity sounds ace. However wouldn’t it be better is you didn’t have something resembling an octopus sitting on you desk waiting for your laptop? Or have the opportunity to carry around your laptop and be able to instantly connect to the projector to show your colleagues your fab idea. All without wires*?

I can but dream.

*well, all but one power cable

Reading
Ars Technica article
Digg comments

Tunnelling music from Ubuntu to iTunes via SSH

Monday, April 2nd, 2007

I would love to have a single place where all my music and videos are stored rather than having a bunch of stuff hanging around on laptops, PCs and iPods. So I bit the bullet and began Le Grande Media Server project.

First thing I wanted to do was to set up a music server, so this post is basically stage one. Now, as specs go, we all use iTunes at home and I use it at work, so ideally my music should be served to that piece of software. That about it for specs..

The server I’ll be using is my old desktop running a P4, 512mb ram and about 130gig of hard drive space. Of cause I could throw more hard drives in if need be. This is more than enough power for this task, but meh it was just sitting there.

Step 1 : Install Ubuntu
I chose to install the latest beta of Ubuntu, feisty fawn, as I was rather eager but I’m sure all this will work with Dapper Drake. Feisty really is an impressive operating system, much better than the XP it replaces on my old machine, and, thankfully, makes this task relatively simple.

Installation is pretty straight forward, and documented best over at www.ubuntu.com/

Step 2 : Install mt-daapd
iTunes uses Digital Audio Access Protocol (DAAP) to share content. Now this is ideal for us, as some clever chaps have reverse engineered the protocol and made mt-daapd, an open program that uses this protocol to share a media directory to our local network. So in theory our little Linux box can be seen by any copy of iTunes on our local network.

First of all install ID3 tag support (so mt-daapd can read mp3 files)

sudo apt-get install libid3tag0

Then for mt-daap itself. Its best to grab the latest debian package rather than apt-get to be sure of a working copy (iTunes changes so often).

wget http://prdownloads.sourceforge.net/mt-daapd/mt-daapd_0.2.4-1_i386.deb?download

and then install it

sudo dpkg -i mt-daapd_0.2.4-1_i386.deb

Then, once installed, you need to edit /etc/mt-daapd.conf with whatever you use (vi, nano, gedit, I don’t care). Within this file, point the server to your media directory then restart mt-daapd.

sudo /etc/init.d/mt-daapd restart

Now on another machine you should see your share appear in iTunes and will be able to play music! If not, check to see your Ubuntu box has tcp port 3689 and udp port 5959 open and that iTunes is actually listening for shared music.

Thats sorted me and my family out at home. Hurrah.

Step 3: But I wanna listen at work! *throws tantrum*
DAAP was never supposed to work over the internet. There is a way though, and below are instructions on how I did it for a mac. For windows, it will be possible with putty, but I’m not sure how to complete the entire process.

However, for Ubuntu make sure ssh is installed on your server.

sudo apt-get install ssh

Once thats out of the way check to see if port 22 (the ssh port) is open on your Ubuntu box’s firewall (firestarter is a nice tool for this). Now we want to be able to get to this port from outside our network for that on-the-go-music-server-accessness. So set up port 22 to forward to your server on your modem/router.

If all goes well you should be able to type the following on your Mac and get to your Ubuntu server.

ssh your_user_name@your_external_ip

If not, check your router/modem firewall (or that your pipes aren’t clogged) .

Now we want to set up the tunnel between the server and your shinny mac so the music can flow to you as if you were on your home network.

ssh your_user_name@your_external_ip -L 3689:localhost:3689

Once you have put your password in and agreed to accepting keys, the tunnel is now set up. This is not it though, for iTunes to see the share you need to broadcast its presence. To do this I used Network Beacon, which is set up like in this picture.

nb

Once that chap is up and going, you should be able to see your media server in iTunes.

Hope that’s of use. For me its ace, all that music, at work and at home. Bliss.

Reading
I must point out that most of this was thanks to the following so if you are lost visit these.
Matt’s Blog : Setting up mt-daapd on Ubuntu 5.10
Firefly media server
mt-daapd wiki - ssh tunnel
Ubuntu
Firestarter linux firewall
Network Beacon
iTunes

Apple TV hacking looks fun

Saturday, March 24th, 2007

The Apple TV has not been out for a week and people have opened up the little fella and have had a play with its underbelly.

So far they have ..

  • installed a Xvid codec
  • installed samba
  • installed ssh (and opened up the ports)
  • installed a 120gb hard drive

For me this is sweet. I’m thinking about setting up a media server in a wardrobe somewhere to serve daap to the family’s computers and broadcast music to me when I’m at work (through a ssh tunnel.. possibly). This little baby will be running Ubuntu on a low level PC and a few massive hard drives full of content.

Now if the Apple TV could connect via samba to this server and play my ripped DVDs, that would be so nice. It might be even better if it could connect via daap and stream video content from an non iTunes source, then it would make the most of apple tvs already buffering and caching system.

So please hack on!

Readings
Macdevcenter article
appletv hacker
appletvhacks.net
Somethingawful thread on the hacking
Gizmondo covers diy 120gig upgrade
Digg’s “OMG LOLZ H4XXORS”

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