Reminiscing About the Old Times

Remember how your Dad used to tell you that he could go to the movies, buy a packet of cigarettes, and still have change from a pound/dollar/other currency (delete as applicable) to go home on the bus? Trouble is, as you get older, you find yourself starting to do the same thing (telling people about it I mean, not actually going out with only one pound/dollar/other currency).

I seem to remember being young when I started working with this Internet stuff about six or seven years ago, and I reckon that I've been living in "Internet Time" along with my Web sites and Web applications since then. Yes, I can still remember when you could open your email client, read all the messages (including all the junk mail - we were pleased to get it in those days), and still have time to do some work the same day. Doesn't happen like that now... come back the old days...

Anyway, enough rambling - let's talk about the subject we came here to discuss. All those years ago, when I started working with Wrox Press on Web stuff, we decided to publish the examples for the books we were writing on the Web. We plugged an old 486-133MHz box into our 64Kb leased line, and played like sand-boys. Ah, those were the days.

As time went on, the server became the focus for the growing "Web Team" at Wrox, and turned into the "Wrox Web Developer Community" site (you may remember it). We upgraded to a shiny new Dell 330MHz box and a 256KB line, and used the site to test all kinds of interesting new techniques. We had dynamic content, browser-specific collapsible menus, weekly news items, lists of books and samples, and all kinds of things.

Of course, to justify the cost of all this we had to start measuring traffic loadings, and so I built a complicated series of stored procedures that analysed the IIS logs and produced summary data that we could display. At the same time IE4 appeared, and I started playing with the Structural Graphics Control. Before long we had fancy pie charts showing the breakdowns by browser type, language and O/S for our visitors - all publicly displayed on the site.

Then along came IE5 with its built-in VML support. Now I was creating line graphs and other stuff - and having a great time. Of course, if you were using Navigator all you got was a table of the results (well, at least we didn't tell you to throw out Navigator and install IE, like some sites still do!)

The world changes, and now the Internet is the focus of almost everything in the publishing world and the developer community. There's no more "Web Team" hiding in a cupboard under the stairs furiously writing about this quirky and unknown Internet thing. The whole organization is now that team. And, as things changed, our little Dell box gradually lost its reason to exist as a separate entity.

But all is not lost - this site (DaveAndAl) rose from the ashes to take over as a test bed for our current experiments in Web technology (as well as a place to rant about the world in general, of course). And all that complex traffic analysis came along with it. The same system is running on our server now, seamlessly logging and analysing traffic patterns day in and day out.

Well, I'm pleased to say that, at last, it's done. As of this week, we have started to take advantage of the magic of ASP.NET to generate GIF images of the charts and graphs dynamically (except for the two that use stretched single-color GIFs to create bar charts, and always did work in all browsers). Check them out and see what you think.

And what about the problem with knowing what week it is? I know I'm gradually going senile (I blame the stress caused by editors for this), but, yes, I can still read the little numbers on the calendar on our kitchen wall. The problem I came up against was - how do I get ASP.NET to read my calendar? The procedures in our database store the results by year and week number, so I need my code to figure out what the current week number is to be able to select the correct set of rows. In ASP 3.0 with VBScript, it was easy:

            iThisWeek = DatePart("ww", Now())

However, try as I might, I couldn't find anything to do the same in .NET without resorting to the VB.NET-specific replacement for the original VBScript function (it's still called DatePart). Like many people, I'm trying to avoid using language-specific features, and instead stick to the methods exposed by the standard language-agnostic classes in the .NET Framework. It makes conversion to other languages like C# (something I seem to be doing regularly now) much easier.

Anyway, after consulting with my colleague (the Dave of DaveAndAl), I ended up using this:

            Dim dNow As DateTime = Now()
            Dim oCalendar As New System.Globalization.GregorianCalendar()
            Dim iThisWeek As Integer = oCalendar.GetWeekOfYear(dNow, Nothing, Nothing)

I can kind of understand why it's become this complicated, as there are different calendars in use around the world. Well there must be, because my local pub (bar) doesn't stay open after midnight when they say on the TV that it's Chinese New Year. However, as I seem to get the correct results, I assume we must use a "Gregorian" calendar here in England. OK so I'm no historian, but the calendar on our kitchen wall says it's a "Bon Jovi" calendar. Maybe Gregory was one of his musical inspirations...

Email: feedback@daveandal.net         Privacy and Acceptable Use Policy