This page has been archived. For the latest news on FormAssembly, go to: http://www3.formassembly.com/blog

Type-Ahead Script Updated

One of the feature I decided early on to include in the Time-Tracker application was a type-ahead tool, akin to the famous Google Suggest. You can take a look at the old demo do get an idea of what I’m talking about.

After just a few weeks into the development of the Time-Tracker, the Type-Ahead script was ripe for refactoring. I needed a way to handle private suggestion lists as well as shared lists. I also wanted to use the same Type-Ahead object for several input fields.

The new version now runs smoothly in the Time-Tracker. Here’s how to use it in your own projects (licensed under the CC-GNU LGPL).

Source Files

Writing the server-side script in a different language is quite trivial. You’re welcome to share your version in the comment form below (or send me a mail).

Usage Notes

Add the following javascript code to your page to add the Type-Ahead behavior to any text field.

/* Wait for the page to finish loading */
XBrowserAddHandler(window,'load', function() {

/* Instanciate the TypeAhead object */
var typeAhead = new TypeAhead('listName', 'groupName');

/* Assign the TypeAhead Object to an input field */
typeAhead.initInput('inputFieldID');

} );

The listName / groupName pair identifies the list of suggestion in the database. If you omit the groupName parameter the list will be shared by everyone. If you set the groupName to something unique, like a username or userid, you’ll have a distinct list per user (or group, whatever…).

The second line binds the object to an input field. As a reference, here’s the HTML markup for the input field. Note that the value of the id attribute is the one used in the binding above.
<input type="text" id="inputFieldID" name="..." ... />

The Type-Ahead object can be binded to only one input at a time, but it can be reassigned to a different field easily and quickly, for instance when the field gets the focus:

document.getElementById('inputFieldID').onfocus = function() {
typeAhead.initInput('inputFieldID') };
document.getElementById('anotherFieldID').onfocus = function() {
typeAhead.initInput('anotherFieldID') };

Database Structure

The ‘USER’ column has been added to the SUGGESTIONS table since the last version . Here’s the SQL statement for MySQL:

CREATE TABLE `SUGGESTIONS` (
`ID` int(11) NOT NULL uto_increment,
`FIELD_ID` varchar(100) NOT NULL default '',
`VALUE` varchar(255) NOT NULL default '',
`USER` varchar(255) NOT NULL default '',
`FREQUENCY` int(11) NOT NULL default '1',
PRIMARY KEY (`ID`))
TYPE=MyISAM AUTO_INCREMENT=1 ;

You’ll need to create a database with this table and change the connection settings in the PHP file (database name, username and password).

Browsers Supported

The type-ahead functionality works with IE5.5+, Safari 1.2+, Gecko-based browsers (Firefox, Mozilla, Netscape 7+, … ) and Opera 7+(*).

(*) Prior to Opera 8.1, user inputs are not recorded in the database.

Note: Comments are now closed. Please visit the discussion board if you want to discuss the subject of this post. Thank you.

Technorati Tags: ,

More Time-Tracker Updates

Updated Sept. 2nd 2005

The two updates are (1) a save status indicator and (2) an improved time-slices view.

The save operation in the Time-Tracker happens behind the scene and automatically. It is so transparent that even when to operation fails, you can keep working with the application without realizing it. This, of course, can cause the loss of information if you navigate away from the application before a successful save can occur.

Save StatusThe new indicator, in the top right corner, will help you feel reassured that your data are safe when its time to leave the application. If the icon shows a black floppy disk, you’re good. If the icon is animated, that means that the save operation is still in progress. You can still work with the application, but you shouldn’t close it. If the animation doesn’t stop, or if you get the red icon, then we have a problem. The server or the database maybe down and your last changes have not been recorded. In this case, you can keep the application open and try to force a save later (by creating or editing a task for instance).

Save StatusThe new time-slices view now shows the duration of each time-slice (an oversight obviously… thanks David). From the comments I’ve got, people are not crazy about the way the clock works. A simpler slider might be the way to go. On the other hand, I have finally tracked down and eradicated (I think) the bug I had with the Javascript / Flash integration, so I’ll give a second chance to the clock. Let me know if you like it or not.

Update - Sept. 2nd 2005 : I added a warning message if you try to leave the Time-Tracker while a save operation is still in progress. This should help with those who reported timers running all night.

Also, I had to work around a bug in IE6 /Windows XP. Basically, creating a date object, translating it into a textual representation in the local language and then converting it back to a date object usually works fine (at least with french and english date formats) but fails with russian regional settings, where it returns NaN (not a number) … go figure. Thanks to Andrey for pointing out this problem.

Update: Comments are now closed on this entry. The discussion continues here: Time Tracker v1.2.

Technorati Tags: , ,

Time-Tracker Updated

The version 1.1 beta is out. There are several interface changes, a few new functionalities, some bug fixes and of course some new bugs as well.

Thanks to Tom, David, Jay, Mari, Kaniz and the others for their feedback. Not everything has been taken into account yet, but here’s the short list of what made it into Time Tracker v1.1.

Improvements

  • You can now adjust the time of the start/stop events.
  • Most of the interface buttons are now regrouped in a contextual menu.
  • You can set user preferences:
    • visual effects [on/off]
    • starting a task stops all other task [yes/no]
    • contextual menu behavior [click/hold down]

The visual effects are based on the script.aculo.us library, and to the credit of its author, Thomas Fuchs, it was a breeze to integrate.

Time Tracker
The clock adjustment functionality relies on the Javascript / Flash integration kit. It is still buggy and you should use it with caution. Make sure it display the right time before you start dragging the clock’s hand around (you may have to wait a little bit after selecting a date).

As always, your feedback is appreciated.

Technorati Tags: , ,

Introducing Time-Tracker: A personal time management solution

Genesis

I had a boss whom, when receiving my time estimate for a particular project, would always multiply my numbers by two. You would think that was his way to include overhead costs and still make profit, but no, he simply knew that despite my most honest and informed analysis, I always underestimated the task at hand.

This multiplication formula still applies today, so I decided to start gathering some reliable data about the time I spend on my freelance and personal projects. And that’s how the Time-Tracker was born.

The Time-Tracker Application

Time TrackerTime-Tracker is a very simple application that helps you keep track of the time you spend on any given task. It’s like having a timer at hand that you can start and stop in a couple of clicks (literally).

This is a beta version. It does the job well when it comes to recording the start & stop events and compounding the total time accumulated on a task. It still needs more advanced reporting statistics, like work distribution over time, average consecutive time spent on one task, etc.. but the first improvement coming will be the ability to adjust the timers (because you will forget to start or stop the timers at some point).

If you think of other stats or features that could be useful to the application, please share them in the comment form below.

Under the hood

On a technical note, Time-Tracker is a single-screen application relying extensively on Ajax technologies (DOM Scripting, XmlHttpRequest and client-side XML/XSLT).

It currently works with Gecko-based browsers (Firefox, Mozilla, Netscape, Camino), Internet Explorer (PC 5.5+) and Opera 8.01. I am still tinkering with the javascript for Safari, but hopefully it will be supported as well soon.

The developpement process was outlined in this series of articles:

Low level XML/XSL functions are provided by the Sarissa library.

Opera and Safari lack native support for XSLT, so the processor is emulated using Google’s brand new AjaXSLT open-source library. The downfall being that the application will feel a bit slow compared with Firefox/Internet Explorer.

Alright, you can check it out now: Time-Tracker - A Personal Time Management Solution

Technorati Tags: , ,

You are currently browsing The Form Assembly weblog archives for July, 2005.

Search the Blog Archive

 

The Form Assembly blog is powered by WordPress ~ Entries (RSS) and Comments (RSS).