ajax in the dark age

ajax is hot these days, since the named was coined 3 months ago. but i really have done it several years ago, maybe around 2000, when i have no idea about what XMLHttpRequest is.

back them i am still on the dark side, writing applications for MS-Windows. i am working in a company writing softwares for stock market technical analysis tools. the other guys in the company uses Visual C++ to write MFC programs of windows and dialogs and drawing sophisticated graphs with CDC things. i am working on the server side, generating all kinds of data that the client can request. my codes end rather early and i also write the test. it is a very long html file, on which many links representing all kinds of data available from the server, including quote snapshot, all observed deals, price every minute, price every day, splits, dividends, and so on... clicking on each link will show a full page of data, in the comma seperated value format. it looks ugly, full of digits. anyway, it looks enough, and i pass it to the test guys and the client side coders.

for the next few weeks, i am rather free and browse through MSDN to see what's new. they may already not be new things then, but i find 2 topics that i am really interested in, and which will be the AJAX of my days, the tabular data control and VML, which is probably the equivalence of XMLHttpRequest and SVG today. i am not sure if the 2 are still used today, but at that time i really find them so fascinating. tabular data control, or TDC, is an ActiveX control that you can set a URL which has a content of comma seperated values. the control will then retrive the content from the Net. the greatest thing is, the retrieval can be asynchronized, which is the A in AJAX nowadays. i realize that it can be used to write a data-centric fixed-page web application. for fixed-page, i mean the html page never reloads or changes to another URL, it's always the old one. on the other hand, VML is vector markup language that you can easily draw a graph with, the grammar much like the SVG, shape, path, .... VML is very tightly integrated to the IE DOM and can be manipulated very freely with javascript. having these 2 great tools, and based on my already finished csv data source, i am able to create a web based stock market technical analysis tool running in the Internet Explorer. you can show a graph with historical prices, you can zoom in or zoom out. you can also scroll it to show more data from the past. when the javascript codes thinks the data is not enough, it will set the URL of the TDC control to fetch more data from the server. when the data is complete, an event handler registered on the TDC control will be triggered and redraws the graph. the most fascinating thing is that if you configured the graph to draw mutiple moving average lines, when more and more data come, you will see the 50-days MA line, 100-day MA line, 250-day MA line appeared one by one, just like an animation. the most advanced part of the web application is that user has a textarea to input a block of javascript to create a customized technical index, just like normal technical indices like MACD or RSI or OBV.... the script will be evaluated and the indices will be drawn on the graph. for the quote snapshot part, data are automatically refreshed (thru TDC also) and new arrivals will have a special color. when the time goes on, if the price of a certain stock does not change for seveal seconds, the color will go lighter step by step and finally goes white. at the time i also have a stock chooser widget that looks exactly like google suggest. however, it's much simpler because it's totally a client side tool. all stock codes and pinyin and chinese names are downloaded to the client side in a TDC control so there is no more interaction with the server after the page starts. anyway some relugar expression calculations are still needed to match the input and show them in a list which also support up and down and ENTER.

i don't remember why it didn't finally change into a real application. maybe it needs more bandwidth than a fat client (which can use binary encoded or even compressed data). maybe the function is still far from complete. or maybe it can only be promoted as a free tool. or, maybe Internet Explorer is too reluctant to free memories allocated on a fixed page and will crash after 5 or more stocks.


that is great idea. do you have any url of your demo?

Posted by ada on October 27, 2006 at 03:35 PM CST #

sorry, it's not available on the Internet. which part are you interested in?
BTW, are you the Ada I know?

Posted by max on October 27, 2006 at 04:17 PM CST #

Regarding your description: "the greatest thing is, the retrieval can be asynchronized, which is the A in AJAX nowadays" How do I make the TDC refetch the data from the server every x seconds? Thanks

Posted by Talya on May 01, 2007 at 01:05 PM CST #

You can use the javascript function setTimeOut or setInterval to trigger a user-defined function periodically. Inside this function, call the Reset method of TDC.

Posted by Max on May 01, 2007 at 03:10 PM CST #

From what I understand the Reset method does not request the information from the server. I think I found a way: Resetting the DataURL to the same value and then calling reset - it works ok although it doesn't look great -causes the entire table to reload. dataobj.DataURL = Dataobj.DataURL; dataobj.Reset();

Posted by Talya on May 01, 2007 at 03:41 PM CST #

Oh, seems you are right. In fact, that's exactly how I reload the data 7 years ago. Just now I thought it was useless so didn't include it in my previous answer. If it looks weird, it's better to add a comment describing why.

Posted by Max on May 01, 2007 at 03:49 PM CST #

I am trying to build my TDC table so that several rows fonts will be red depending on a specific column value(I am presenting a log file using TDC - all Severity = errors should be red). Do you have a suggestion how to do this. Thanks

Posted by Talya on May 01, 2007 at 04:22 PM CST #

Well, just specify the CSS color using theDiv.style.color.

Posted by Max on May 01, 2007 at 05:04 PM CST #

At what stage should I check the value of a feild and set the color?

Posted by Talya on May 02, 2007 at 08:16 AM CST #

Inside ondatasetcomplete of the TDC. Are you binding the TDC with an HTML TABLE? I use the recordset property and manually fetch the value inside.

Posted by Max on May 02, 2007 at 09:54 AM CST #

It seams to me that the method of retreiving the full table each several seconds so that the page will update dynamically may cause alot of traffic - in case the table is very big. Is there a way using TDC to get only part of a file, maybe the difference from the last get.

Posted by talya on May 21, 2007 at 12:28 PM CST #

Yes, you're right. I think you can enhance the server side to return a dataset as small as possible. As for difference from the last get, you may need to define what "last" means, say, a timestamp, or a sequence number, so that the server can make a precise cut.

Posted by Max on May 21, 2007 at 12:48 PM CST #

Do you know were I can find info on that subject. I have a feeling that I might not be using the best technique for what I need - do you know of a better way to present delimited text file that may be big and that I want to dynamically update every 5 seconds. Many thanks

Posted by talya on May 21, 2007 at 02:11 PM CST #

Well, it depends on how your data change. If all values on the same row tend to change simultaneously, TDC is still OK. Otherwise, it may not be a good choice. Also, if I'm writing the same app today, I won't use TDC since it only works with IE, I'll choose XMLHttpRequest instead.

Posted by Max on May 21, 2007 at 02:27 PM CST #

My data is a log file - new entries are appended.

Posted by talya on May 21, 2007 at 02:30 PM CST #

and how do you want to deal with it -- in your web app?

Posted by Max on May 21, 2007 at 03:37 PM CST #

If I understand your question - I would like to present the last 10 entries at all times, with a filtering option on event severity.

Posted by talya on May 21, 2007 at 04:11 PM CST #

Why don't you do the filtering at server side? Do something like SELECT TOP 10 entry WHERE severity >= FATAL and send the result to your browser.

Posted by Max on May 21, 2007 at 04:34 PM CST #

I think you are right - Now I only have to just figure out the best way to do this on server side.

Posted by talya on May 22, 2007 at 07:23 AM CST #


Posted by guest on June 23, 2007 at 09:08 AM CST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog has a comments managing system that requires me to approve each comment manually. Please do not re-post and I will reply it (if I have an answer) when I get pinged.


Top Tags
« July 2016