Tuesday 25 September 2012

Reworking www.mov.ie

My mov.ie website has been neglected for a number of years. Its main issue is that it was not kept up to date and with Official Movie websites coming and going a lot of the links that it holds are no longer valid. Even worse, when a movie producer lets the domain lapse it is quite often grabbed by a domain camper and potentially redirected to some nefarious site. This had led to the unfortunate situation where the site is now blocked by certain net filtering sites.

I have therefore decided to rework the site and at the same time bring it up to more modern technologies.

Links:

Mov.ie provided service

The idea is to provide a domain for official movie web sites but with a twist - it uses sub-domains to perform searches on registered movie names. So, if you want to go to the web site for "Total Recall (2012)", you could just visit:
As long as "recall" is unique you will be taken directly to the official movie web site. If you use a search term that's not unique then you will be given the movies that match your search. Eg:
Will display:

  • Get Him to the Greek (2010) GetHimtotheGreek.mov.ie
  • How to Train Your Dragon (2010) HowtoTrainYourDragon.mov.ie
  • Journey to the Centre of the Earth (2008) JourneytotheCentreoftheEarth.mov.ie
  • Preaching to the Choir (2006) PreachingtotheChoir.mov.ie
  • Total Recall (2012) TotalRecall.mov.ie

Of course, you can use the full movie name just stripping out all non-alphanumeric characters.


That's it - no other adverts, reviews, trailers etc as there are already excellent sites for these things - the idea is to just get people to the official site.

Mov.ie maintenance

Spotting decommissioned sites

As mentioned above, the big problem with the current site is that Official Movie Sites tend to only be maintained for a limited time. Movie producers tend to register a special catchy domain name for their movie site before release but then let it lapse after a number of years - preferring instead to just use their own sites to host the movie dvd and merchandise information.

The way of solving this is to include Host IP Address verification. On insert into the DB, the IP Address(es) for the host is also stored in the movie record. If the IP Addresses change then the movie redirect will not occur and the change will be notified to an administrator to fix. This effectively removes the movie from the system. The administrator will find the real site and fix the redirect URL.

Checking and notification will be done on access but will also be run regularly by a scheduled job - probably run off line.

Enabling Adds and Edits by other Users

At the moment, movies can only be added or modified by registered users. Also, the maintenance is not that straight forward using custom old fashioned forms. The idea is to use the users of the site to help maintain the site. The movie list will include an "Add new movie" and "Edit" on existing movies.

There will be a few simple rules (Official sites only etc) and normal users will be required to provide an email address. This will be then be sent to a moderator/administrator to verify the data and enable the change. In order to verify the email and avoid robots we will need to:
  1. Use a captcha
  2. Capture the details in a pending request table and generate a unique request id on the site
  3. Throw the user in to an email client with the appropriate content to request the change
    (If the user has no auto-email set up then give them instructions)
  4. On receipt of email by moderator, verify stored email address and request Id details with from header of email and if request is for a valid Official site redirect then enable the update.

Mov.ie technologies

The system is currently using php3 and mysql rendering html with very little dynamic aspects.

The web site will still be kept very simple but will be re-worked in to a more modern theme to work well with touch devices as well as desktop PCs. It does not need to be too fancy but will need:
  • Heading
  • Add button (that opens a popup dialog for add)
  • Search Box
  • List of Movies matching search term (Updated dynamically)
  • Index Listings
  • Contact/About/Copyright etc.
  • Each Movie entry will be clickable to get to official site and hold:
    Title / Year / Full ".mov.ie" name
    Edit Button (that opens a popup dialog for edit)
    (and possibly "Search IMDB" button).

The goal is to get it in to the cloud and I am currently leaning towards Google App Engine as I have experience of writing Java / GWT and we all know Google's infrastructure and hosting technologies are rock solid. App engine also supports Custom Domains, Wild card sub domains, authentication, Internationalisation etc etc.

.Movie Top Level Domain

The ".movie" Global Top Level Domain has been promised for some time (since before 2000) but has never materialised. Even if this does happen this site will still be viable as it will be seen as an alternative searchable site.

Tuesday 11 September 2012

Alzheimer Reminder Device

A friend of the family has an elderly Mother who is still living alone but has early onset Alzheimers. She now needs to be reminded when to take her normal medication but often forgets  the time of day and what she should be doing. Thus we need a device that cycles through the significant events of the day with pictures, prompts and time of day.


Reminder App Running on Chumby8

Hardware Choice

His suggestion was to use something like a Digital Photo frame  and have a Reminder application running on it. Such commercially available frames are reasonably priced (Around EUR80) but, unfortunately, they are low capability and are generally running some kind of RISC chip with specialised firmware rather than a generic OS. Thus, to replace the functionality you would have to flash a new Firmware. The cost saving is outweighed by the effort involved in developing to the platform.

You would not use something like a Kindle, Android or Apple Tablet for this application as you will find that the target user would get confused by the other things that the device does and also by the accidental triggering of other functions via inadvertently pressing the other buttons. My Mother was once given a Kindle but just by holding it with her arthritic fingers she would accidentally touch the various buttons on the side or she would point it at the light and the screen would rotate. They are just too generic and too complicated.


Chumby

Enter the Chumby (http://www.chumby.com/). I have owned an early Chumby Classic (http://www.chumby.com/pages/chumby_classic) for some time now and have been waiting to find an application for it. It is an open Hardware, OS, Software platform developed by Chumby Industries in San Diego, CA. It is a networked (WiFi) ARM based device, running Linux and has a small touch screen with tilt sensors and a few pressure switches on the case. It has two USB ports, Speaker, headphone socket and built in microphone. It runs Flash widgets loaded from the Chumby site. It doesn't hide its internals for those who know (You can easily gain root ssh access) yet still provides an easily configurable and secure user experience - a hard thing to get right.

Overall a great device well designed, with great infrastructure behind it. A big, Thumbs Up to the Chumby guys for their early innovation in this space that is now filled with many ARM based linux devices including Android devices, Arduino (http://www.arduino.cc/) and lately Raspberry Pi (http://www.raspberrypi.org/).

The cream on the top - and this is what makes this device ideal for this application - is that there are hooks in the boot process that allow you to configure and even replace the standard chumby console. Its as simple as creating a .swf application, loading it onto a root of a USB Stick or Flash memory card (For the later devices) using the name "controlpanel.swf". The device will then boot and only run your application.

Software

Thus, using only Open Source tool chain mtasc (.as to .swf compiler) swfmill (.swf resource linker) and gnash (GNU's Flash runner) I wrote a prototype application using simple Flash Action Script 2 that takes a schedule from an XML text file and displays reminders with pictures. It's early days but a running version can be seen online here: http://www.cregganna.com/ReminderApp/ReminderApp.html

Here is a little video of it running on my Chumby 8 in test mode.



As I say, an early prototype but it displays the basic idea. Note - it is running in test mode so the schedule is not running true time - it is just ticking every minute to start with then I trigger the changes myself by touching the screen.

The Schedule for this example is here: http://www.cregganna.com/ReminderApp/ReminderSchedule.xml


Going beyond a Prototype

The best target device would seem to be the Insignia Infocast 8 or Chumby 8 (which I think is no longer produced) as it is an 8 inch frame with a memory card slot.

Improvements and moving it forward to a fully usable application would possibly include:
  1. Providing audio to play for each message - set up in the same way as the pictures.
  2. Changing the idle screen - it is currently a pure white screen with the Hour:Min of the next schedule in the top right. We could have a black screen or just show pictures from a folder on the memory card.
  3. Allow a cancel / confirm action when the chumby top button is pressed or the screen is tapped. This would be used to dismiss the message and go back to the idle screen. We could even have a better way of confirming that the pills have been taken etc.
  4. Allow for pill sequences instead of pictures of all pills - ie take red pill, hit button, take red pill, hit button, take blue pill hit button, With Audio this might work quite well. It could repeat audio if it gets no confirmation
  5. The chumby device is actually networked - there would be opportunities to remotely review the user's responses, alter the schedule and even talk to the user directly.
  6. ...
To use the application one would have to:
  1. Purchase a compatible device - Insignia Infocast 8 seems ideal as it is a Chumby clone. I used a Chumby 8 and Chumby One.
  2. Purchase a USB Key: Any size would be OK - but if we were to make it do the Picture display in idle then the bigger the better. I went for a 4Gb Cruzer Fit as it is compact and does not extend beyond the back of the device.
  3. Unzip the application (ReminderApp.zip)  on to your usb key.
  4. Take pictures of the events and pills that need to be taken at each time and put them on the usb key - probably best to give them relevant names.
  5. Edit the ReminderSchedule.xml for your schedule and refer to the pictures you've taken.
  6. Boot and configure your device to connect to your network - you'll need a network to allow the date/time to be set correctly initially.
  7. Turn the device off.
  8. Stick the usb key in the device and boot.

More Pictures:


Scrolling text in Flash

Interestingly this proved hard to implement. There was lots of rubbish implementations on the internet using timers and the like so here is the implementation I put together base on MovieClip.scollRect.
function createScrollingText(container:MovieClip, fieldName:String, depth:Number,
    x:Number, y:Number, width:Number, height:Number,
    content:String) {

    container.createTextField(fieldName, depth, x, y, width, height);
    var field:TextField = container[fieldName];

    field.multiline = false;
    field.wordWrap = false;
    field.autoSize = "left"; // Needed to force render of whole string
    field.antiAliasType = "normal"; // Needed to allow scrolling whole string
    field.gridFitType = "none"; // Needed to force scrolling whole string
    field.text = content;

    var format:TextFormat = new TextFormat();
    format.font = "sans";
    format.size = height;
    format.bold = true;
    format.color = 0x000000; // Black
    reduceToHeight(field, format, height);

    // Utils.traceTextField(fieldName, field);

    if (field.textWidth <= width) {
        // trace("No Scroll required");
        // Just center it
        field.autoSize = "center";
        return;
    }

    // Double up text to make it look smoother
    field.text = " -- " + field.text + " -- " + field.text;
    // Reapply format
    field.setTextFormat(format);

    // Scroll by using horizontal scroll rectangle
    var scrollRegion:Rectangle = new Rectangle(x, y, width, height);
    var scrollLimit:Number = -1 * (field.textWidth / 2);
    container.onEnterFrame = function() {
        var newX = field._x - 1;
        if (newX < scrollLimit) {
            newX = 0;
        }
    field._x = newX;
    }
    container.scrollRect = scrollRegion;
}