For a project of mine, I needed to implement a live reload mechanism for an HTML file. The problem was, it was a local file, which of course was a big no-no for every type of fetching data from another location.
Just so we are on the same page, by local file I mean every HTML document that is opened from a location that has a file:// protocol.
The mechanism was supposed to work as follows:
- My tool would re-create the HTML file and update a JSON file every time that happened.
- The HTML document, if previously opened in the browser would in some magical way read the JSON data from disk and check the content. If the content had a property with newer date than the one that the document already possessed, then the document would reload itself.
- Boom, magic.
Some time ago I wanted to play an old-school game and I wanted to use my game pad, and of course I could not find it. The solution? Create my own game pad, but with limited hardware related skills that would be quite difficult. The next best thing - to use a touch capable device. But it turned out quite quickly that it would not be so easy. It’s not a problem when the HTML5 game pad controls an HTML5 game on the same server/browser, but what about native games? A driver would be needed for that and my level of expertise in that area was the same as the level in hardware building mumbo-jumbo. My experimental “driver” had two main goals: to run on Ubuntu and be build in Node.js
The following Post is not a tutorial, so I’m not covering the subject from top to bottom, but I’m providing, a great starting point. This should give you some idea how things work and what to expect from such a device. At the end I’m linking to a Node.js application which acts like a device driver. This app is not in any way a production ready solution, but only an experiment, so keep in mind that there are many bugs, and that there is a high possibility that it will not run on your system (I’ve created it and tested only on Ubuntu 13.10)
What is it?
It's a small HTML5 based EPUB document reader. I’ve created it partially for my fiancee’s writing blog, and partially because I have never done anything with an EPUB format, and I didn’t know anything about it.
Right now the reader is in an early alpha stage and works on Google Chrome and Mozilla Firefox. The next step is to get it working on IE9/10 and other browsers.
For those who don’t know what an EPUB document is - EPUB is a standardized open format for electronic publications. It is based on XML documents compressed together as a single zip file. The most important properties of this format are:
- An EPUB document is not divided into pages, the reading software decides how to divide the content into pages and how to display it,
- It supports CSS,
- Support for SVG and raster images.
Right now the goal for me is to create a simple reader that supports as many simple EPUB documents as possible, so anyone (e.g. a writer) can embed an EPUB document on his blog or page.
Time for some short technical summary.