Hello folks,
I was having problems in the following scenario:

I use a web form to modify my events, and dynamically make updates to the
xml file based on user input.

When changes are saved to the xml document and user is redirected to the
timeline visual and the timeline is refreshed, the changes don't show up
inside the timeline visual.

Another thread on this board recommended loading your xml file inside the
browser and hitting refresh on your browser to manually force the browser
refresh, then to go back to the timeline visual and refersh that as well.

This is not convenient at all, and doesn't work well when someone reviews
it...

There are a few different ways to fix this probably, but here is what I did:

I created a new timestamp this is the number of seconds since 1970...
   var tstamp=d.getTime();

Now I append the timestamp to the end of the xml file's name:

   var xmlFile="timeline_data.xml?"+tstamp;

The old way:
   //Timeline.loadXML("timeline_data.xml", function(xml, url)
   //{eventSource.loadXML(xml, url); });

The new way:
 Timeline.loadXML(xmlFile,function(xml,url){eventSource.loadXML(xml,url);});


What this does:
This will append the timestamp to the end of the xmlfile name in the form of
a query string for input to the xml document. 

So it looks like this:
Timeline_data.xml?12981291823

Now everytime the browser refreshes the xml file is automatically fetched
since the browser is tricked into thinking it's a new xml file and not a
cached document.

While this fix may work for me, since I am using it internally as a
management tool at our company, it wont work well for any production site
with any kind of volume.

A better fix would be one of the following two options:
a) Use the last modified timestamp of file. However this can cause overhead
and performance degradation because of I/O disk seeks to get the filestat.

b) The optimal solution (in my opinion) involves some complexity... 
Ideally you have a revision control system like subversion to manage
subsequent updates to your xml file and check in and checkout revisions
based on user changes. Using svn hooks you can get the revision number of
the xml file and use that for the append string.

This will force the browser to download only when the file is changed and
Then the query string will be changed to the proper (latest) revision
number. 

This last method will probably be the best as far as performance, but it
will be also more complex then the alternatives I mentioned.


What do you guys think?




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of David Huynh
Sent: Friday, December 29, 2006 10:02 AM
To: General List
Subject: Re: Bubble size.

Hi Saad,

It would be best to either point us to a URL where we can see your 
timeline, or if that's private, attach the HTML file and a fragment of 
your XML file that isn't private. It's hard to debug bits and pieces of 
code.

Cheers,

David

Saad Aziz wrote:
> Ok I tried the recommendation:
>
> function onLoad() {
> ...
> ...
> ...
>         var theme = Timeline.ClassicTheme.create();
>         theme.event.label.width = 150;
>         theme.event.bubble.width = 320;
>         theme.event.bubble.height = 5000;
> ...
> ...
> ...
>    var eventSource = new Timeline.DefaultEventSource();
>    var bandInfos = [
>     Timeline.createBandInfo({
>         eventSource:    eventSour
> ...
> ...
> ...
>
> Still no luck?! What did I do wrong? 
>
> Thanks in advance.
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of V. Alex Brennen
> Sent: Thursday, December 28, 2006 8:45 PM
> To: General List
> Cc: Saad Aziz
> Subject: Re: Bubble size.
>
> On Thu, 2006-12-28 at 16:15 -0800, Saad Aziz wrote:
>
>   
>> So I modified the following function:
>> function onLoad() {
>>
>>   var months=new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun",
>> "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
>>
>>         theme.event.bubble.width = 100;
>>         theme.event.bubble.height = 60;
>>   var d=new Date();
>>
>>   var dtStamp=months[d.getMonth()]+" "+d.getDate()+"
>> "+d.getFullYear()+" 00:00:00 GMT";
>>   var eventSource = new Timeline.DefaultEventSource();
>>
>>   var bandInfos = [
>>
>>     Timeline.createBandInfo({
>>
>>         eventSource:    eventSource,
>>
>>         date:           dtStamp,
>>
>>         width:          "85%",
>>
>>         intervalUnit:   Timeline.DateTime.MONTH,
>>
>>         intervalPixels: 400
>>
>>     }),
>>     
>
> Saad,
>
> You neglected to set the theme for your bandInfos. You should include
> the line:
>       theme:          theme (<- name of a different theme)
>
> if you don't modify the default.  I'd recommend you create a new,
> different, one.
>
> That will tell the Timeline application to make use of the new theme
> object so that your resizing of the bubbles takes effect.
>
> You can create a new theme object in onLoad() if you wish for it to be a
> different theme, like this:
>
> function onLoad()
> {
>       var theme = Timeline.ClassicTheme.create();
>       theme.event.label.width = 150;
>       theme.event.bubble.width = 320;
>       theme.event.bubble.height = 125;
>         [...]
> }
>
> The Dinosaur Timeline example is a good place to look for a full
> example, IIRC.
>
>
>     - VAB
>
>
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://simile.mit.edu/mailman/listinfo/general
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://simile.mit.edu/mailman/listinfo/general
>   

_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general


_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general

Reply via email to