Archive | June, 2007

SIMILE Timeline: Manually Adding Events

28 Jun

Introducing SIMILE Timeline’s documentation

A few months ago, I began to use the SIMILE Timeline JavaScript control for a project. It’s really a handy control to visually show – you guessed it – a timeline of events.SIMILETimeline

However, there’s not a lot of documentation for it. As you can see on the documentation page, in pure Open Source spirit, you will see many “for now, read the code” references for parts of the API where the documentation is the source code. There’s also a Wiki documentation page where you can find a bit more information, which is handy to find a few more things, like how to change themes.

Because of this, I though I would write a few posts with a few tips and tricks I discovered. Now, that the introduction is made, let’s start with my first post…

Why would you want to manually add events in the Timeline?

One thing you might want to do at some point, is to use Javascript to manually add events to the Timeline.

There are methods to load data in a Timeline through XML with the Timeline.loadXML method, as described in the How to Create Timelines tutorial. Also, for more efficiency over the wire, you might discover and want to use the Timeline.loadJSON method. So, why would you want to add events manually?

Well, the are many reasons why you might deem this necessary and most of these are for efficiency reasons:

  1. You already loaded the Timeline through XML or JSON, but you want to add new events to the Timeline without refreshing the Web page. You want to use your AJAX skills, don’t you?
  2. You are already using a JSON (or XML) Web service for other things on the Web page and you don’t want to make a second call to load the Timeline.
  3. You want to process your JSON’s Web service data to, for example, generate the HTML for the pop-up through JavaScript from the data instead of sending the whole HTML thru the wire.

How to manually add events in the Timeline?

 It’s not that hard to add an event manually. When browsing the source code, you will see the definition for a new event in sources.js. The constructor is Timeline.DefaultEventSource.Event.  It accepts the following parameters: start, end, latestStart, earliestEnd, instant,text, description, image, link,icon, color, textColor.

Knowing this, here’s some code to generate 50 random events up to 20 days in the past or the future. Compared to the code on the official tutorial page, the important differences are in bold.

<html>
  <head>
    <script src=”http://simile.mit.edu/timeline/api/timeline-api.js” type=”text/javascript”></script>
    <script>
var tl;
function onLoad() {

  var eventSource = new Timeline.DefaultEventSource();
  //Generate 50 random events up to 20 days in the past or the future
  for(var i=0;i<50;i++) {
      var dateEvent = new Date();
      dateEvent.setTime(dateEvent.getTime() + ((Math.floor(Math.random()*41) – 20) * 24 * 60 * 60 * 1000));
      var evt = new Timeline.DefaultEventSource.Event(

         dateEvent, //start

         dateEvent, //end

         dateEvent, //latestStart

         dateEvent, //earliestEnd

         true, //instant

         “Event ” + i, //text

         “Description for Event ” + i //description

      );
      eventSource.add(evt);
  }
  //create the timeline
  var bandInfos = [
    Timeline.createBandInfo({
        trackGap:       0.2,
        width:          "70%",
        intervalUnit:   Timeline.DateTime.DAY,
        intervalPixels: 50,
        eventSource: eventSource
    }),
    Timeline.createBandInfo({
        showEventText:  false,
        trackHeight:    0.5,
        trackGap:       0.2,
        width:          "30%",
        intervalUnit:   Timeline.DateTime.MONTH,
        intervalPixels: 150,
        eventSource: eventSource
    })
  ];
  bandInfos[1].syncWith = 0;
  bandInfos[1].highlight = true;
  tl = Timeline.create(document.getElementById(“my-timeline”), bandInfos);

}

var resizeTimerID = null;
function onResize() {
    if (resizeTimerID == null) {
        resizeTimerID = window.setTimeout(function() {
            resizeTimerID = null;
            tl.layout();
        }, 500);
    }
}
    </script>
  </head>
  <body onload=”onLoad();” onresize=”onResize();”>
     <h1>Creating Events Manually in a SIMILE Timiline</h1>
     <div id=”my-timeline” style=”height: 150px; border: 1px solid #aaa”></div>
  </body>
</html>

You can see a working example here.

Yesterday’s Yulbiz Montréal event

27 Jun

Yesterday, Tuesday June 26th, I went to a Yulbiz event with Kim.Yulbiz20070626

We wanted to go quite a while ago since we read about it, but it slipped or mind. Thanks to social networks, I luckily was reminded.

It was or first time, but I can tell you it won’t be our last as it was a great event with a lot of interesting people! I met many interesting bloggers and others that work on Web-related businesses. It was really fun and I learned a few things at the same time. You can bet I’m a new regular.

Yulbiz is a Montreal networking event happening each month, the last Tuesday of the month. Many thanks to Michel Leblanc that unknowingly reminded me of the event.

In French, Alain Thériault that I met last night also has a some comments on the event. And Michel has just put the wrap-up (in French) for the question of the month.

Click on the on picture for more Yulbiz Montréal photos.

My best regards to everyone I met! Let’s hope will see each other again in August (Yulbiz is taking a vacation in July).

Note to self: it seems I missed some pictures for uploading. This evening, I should add a few more photos to the album.

DemoCampMontreal3 on July 26, 2007 (tentative)

23 Jun

I’ve just learned that there will soon be a BarCamp event in Montreal.

DemoCampMontreal3 has been tentatively scheduled for July 26th at the Society for Arts and Technology (SAT).
For more information or to subscribe, follow this link.

To subscribe, you need to edit the Wiki page.

For questions,  you can also visit the barcampmontreal group at Google Groups.

Tip: Get Vista’s “Open Command Window Here” on XP

20 Jun

Sometimes, we don’t think about the simplest tricks.

Steven Harman has a new post with some tips for developing with Visual Studio.OpenCommandWindowHereVista

One cool option Windows Vista has, is that in Windows Explorer, when you right-click on a folder, the context sensitive menu gives the “Open Command Window Here” option. It does what it says: you open the Command Prompt with the current directory set to the one you just clicked.

A commenter, earljon, explains how to enable the same option in Windows XP. It’s one of those things were you ask yourself why you didn’t do that sooner! Here’s his explanation:

On the Command Window context part, some of us don’t already have this but one can manually add a context menu for command prompt by following simple steps:

  1. On Windows Explorer, Tools/Folder Options.
  2. Click the tab File Types.
  3. Find the File Type “Folder” and click the Advanced button.
  4. Click the New button, and type “Open Command Window Here” (no quotes) on the Action text box and type “cmd.exe” as the application that will perform.
  5. Close all the windows and new context menu is created.

Very useful when you need the Command Prompt.

Disclaimer: the picture included with this post was ripped from Steven Harman’s post.

New 1.2.0 MobileTracker version for Blackberry improves GPS tracking and adds timestamps to tracklogs

14 Jun

For my Blackberry 8800, I recently purchased MobileTracker from Skylab Mobilesystems Ltd. after reading this review.

I was quite disappointed with its results.

To say the software was buggy is an understatement. First, there was no way to see if it was tracking anything. It would consistently track zero points in my tracklogs. The only workaround I found to make it track something was to run Blackberry Maps in the background. And even then, if the GPS coverage was lost at one point, MobileTracker would stop tracking for good. I had a few email exchange with their customer support and supplied them with some errors I found in my Blackberry’s internal log. After a few email exchanges, they said I should soon receive a new version that was almost ready.

This morning I received MobileTracker 1.2.0 in my inbox. What a difference this new version makes! Here are the new features as supplied by the vendor:

  • Recording:MobileTracker
    • Timestamp tracking
    • Traveled time from start for every position on track
    • Average Speed of track
    • Traveled time of track
    • Traveled distance of track
  • User interface:
    • Status indicator
    • Live coordinate output
    • Live distance output from start
    • Simplified User Interface
    • Adjustable altitude mode

I tested it out a few times today and during my tests, it could recover from loss of GPS coverage to continue tracking points when coverage returned. Also, because of the added indicator, I can easily see that it is continuing tracking new points. They improved the KML Google Earth export with the added recording information so it is easier to consult your tracklogs in Google Earth.

From my limited testing, it seems that it might finally be an interesting solution to keep a log of your excursions. For the traveled distance of the track, I noticed you should be careful with the settings for the interval between tracked points. At 1 second per point, maybe because I was in the city, the Blackberry GPS, which isn’t extremely precise, didn’t give a fixed position when I wasn’t moving: so, it gave the impression I was still moving. Since, you can adjust the interval, you probably can find a setting that will fit your tracking needs.

One of the things I will definitely want to use this for is for geo-tagging photos. Since we now have the time for each points tracked, it should be feasible to convert the KML file in an appropriate format to induce the location at a particular time in order to automatically match these with the time a picture was taken.

If I find an easy way to geotag pictures using this, I’ll make a new post. I am pretty confident it can become the basis to geotag photos I will take.