Archive for the ‘software’ Category

Waterfall 2006

Tuesday, March 14th, 2006

I was having a bit of a think about my current work project, and I remembered hearing about a conference that would be quite appropriate - Waterfall 2006.

I’m a member of the “build” team, which started “work” about 4 weeks ago. That would be “work” because we’ve basically had very little we can actually do, due to the fact that the design isn’t finished (and doesn’t look like it will be for quite a while).

Perhaps the fact that the detailed design document for our project requires the sign-off of 38 people could have been an indication of the way things were heading…

Be sure to register today!

Michael’s book announcement!

Friday, August 26th, 2005

Congratulations to Michael for the announcement of his new book Ajax Design Patterns!

Michael has been beavering away working on ajaxpatterns.org for a while now, and it’s nice to see all the work paying off for him. The book is still in progress, but you can follow along (and even contribute) on the ajaxpatterns.org wiki. I look forward to reading the finished book!

iTunes/gmail dynamic counters…

Sunday, July 10th, 2005

Michael has an explanation of how the itunes sale counter works using AJAX.
This reminded me of the storage space count on the gmail page (if you have an account on gmail you may not see the dynamic counter unless you logout).

I won’t give a full walkthrough, as I’ve only spent about 30 seconds looking at the code. But the gmail counter is a bit simpler than the apple version, probably due to the fact that google completely control the rate of growth. This allows them to rely only on static data served with the page (they’ve scheduled/estimated the amount of storage that will be available at some times in the future), and then they simply use linear interpolation based on the current time.

For example, my page was served with the static data defining the [time, capacity] pairs:


    var CP = [
         [ 1117609200000, 2250 ],
         [ 1120201200000, 2350 ],
         [ 1122879600000, 2450 ]
    ];

For the curious, these entries correspond to the start of June, July and August respectively. I expect as it approaches August, they will start serving pages with an entry for September.

The update code simply finds the relevant entry in the CP array, and then interpolates based on the current time.


    function updateQuota() {
      if (!quota) {
        return;
      }

      var now = (new Date()).getTime();
      var i;
      for (i = 0; i < CP.length; i++) {
        if (now < CP[i][0]) {
          break;
        }
      }
      if (i == 0) {
        setTimeout(updateQuota, 1000);
      } else if (i == CP.length) {
        quota.innerHTML = 'Over ' + CP[i - 1][1];
      } else {
        var ts = CP[i - 1][0];
        var bs = CP[i - 1][1];
        quota.innerHTML = format(((now-ts) / (CP[i][0]-ts) * (CP[i][1]-bs)) + bs);
        setTimeout(updateQuota, 1000);
      }
    }

This is a good illustration how precomputation can avoid trips to the server.
Although, since it doesn’t use a roundtrip, I guess it doesn’t count as AJAX at all…