Blog homepage

Content from old blog

Bookmark this page

previous month  MAY 2016  next month
s m t w t f s
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30

RSS ATOM  Full archive
current month

alert [ 1 ]  RSS ATOM
blog [ 8 ]  RSS ATOM
development [ 9 ]  RSS ATOM
    ASP / scripting  [ 13RSS ATOM
        snippets  [ 1RSS ATOM
    database [ 0 ] RSS ATOM
    web standards  [ 1RSS ATOM
    XML [ 0 ] RSS ATOM
general [ 24 ]  RSS ATOM
    humour [ 0 ] RSS ATOM
personal [ 6 ]  RSS ATOM
photography [ 1 ]  RSS ATOM
politics [ 1 ]  RSS ATOM
rant [ 8 ]  RSS ATOM
reading [ 18 ]  RSS ATOM



Access Stored Queries

VBScript String Concatenation

2 Jun 2005
Mass protest against software patenting
STOP Software Patents
posted by  Marcus at  14:16 | permalink | comments [886] | trackbacks [333]

6 Apr 2005
Gmail Notifier Feedback
Sent to "" earlier today:

Dear sir/madam,

I am a satisfied user of Gmail, and your Gmail Notifier comes in very handy, but it lacks a few (IMHO rather obvious) options, the lack of which can be quite annoying at times:

1) enable/disable mail checking - needed for when you don't want to be disturbed. At present I have to close the utility completely and then run it again later when I want it to resume checking. This option should be located on the tray icon's context menu for easy access.

2) enable/disable slide-up tray notifications - needed so that users can be informed that mail is waiting without showing the subject and preview of the individual emails. It is sometimes embarassing and innappropriate for an email (particularly spam or other email with a rude subject and/or body text) to suddenly pop up at the bottom right when colleagues are sitting with me at my PC discussing a business issue. By disabling the slide up notifications, the beep and change of tray icon would be sufficient to indicate that there was new mail, without revealing the contents to others and causing embarassment.

3) notification sound - not only should it be possible to disable the sound entirely, it should be possible to assign a different sound (i.e. WAV) to the notification event. Windows provides support for application-specific sound events in the "Sounds & Multimedia" control panel applet, although this is admittedly rarely used by non-Microsoft applications. Although the default system beep currently used by the Gmail Notifier can be reassigned to something else, this change affects every other Windows application which issues a system beep.

4) options 1) and 2) above should be controllable via hotkeys (preferably user-assigned) as well as the icon context menu.

I hope that you will consider these suggestions carefully and implement where possible.

PS - I have noticed that the executable occupies almost 7MB of memory when loaded... is this really necessary?

Kind regards,

Marcus Tucker
general , rant
posted by  Marcus at  15:05 | permalink | comments [798] | trackbacks [2118]

4 Mar 2005
Reading Roundup 04/03/05
Just for once, these are nothing to do with web development in any shape or form...!!

First, some mathematics-related articles from the excellent +plus magazine...
  • Maths and art: the whistlestop tour
    An easily digestible, fascinating introduction into the mathematics of art, and by the same token, the art of maths. Escher is mentioned, and is one of my favourite artists - his works never cease to stimulate and intrigue, even the 100th time. The Escher Museum in Den Haag is a must see if you're ever over there, as I was recently. Fractals are also endlessly fascinating, and you can download a fantastic freeware fractal zoomer called Xaos which will let you explore the Mandelbrot set (and other popular fractals) in realtime (in years gone by, each frame took many minutes - if not seconds - to render). It also includes an enjoyable tutorial/presentation on fractal theory.

  • All about averages
    Unfortunately it's all too often that we see misleading statistics presented to us by a supposedly reliable source (newspapers, TV news bulletins, government), so understanding what pitfalls lie behind something (supposedly) simple as an average figure is essential if we are to make sense of the information that we encounter. Sadly, your average man in the street knows little about things, and simply takes such "facts" at face value. Make sure you know better!!

  • Why is the violin so hard to play?
    Or alternatively, "Why do beginners make such an awful racket"?! All is revealed within...
If you enjoyed those, check the archive page for more!

And finally, as a reward for all that cognitive exercise, here's something to make you laugh... The Parents Television Council of America regularly takes offence at various TV programmes, and tries to raise awareness of unacceptable content. All very well and good, you might think. However, rather puzzlingly they seem to think that it's a great idea to post the most offensive clips online, calling the page "Worst TV Clips Of The Week"!! Like a red rag to a bull, one could say... check them out here:

posted by  Marcus at  14:15 | permalink | comments [0] | trackbacks [43]

23 Feb 2005
IE's "friendly" error messages
While hacking URLs at to make it possible to be automatically informed when a new firmware is released for my P900 by using the excellent free service WatchThatPage to monitor the URL that I had hacked together (no thanks to the abominally unfriendly URL scheme used by their CMS), I came across the following message hidden in a comment in a redirector page:
Unfortunately, Microsoft has added a clever new "feature" to Internet Explorer. If the text in an error's message is "too small", specifically less than 512 bytes, Internet Explorer returns its own error message. Yes, you can turn that off, but *surprise* it's pretty tricky to find buried as a switch called "smart error messages" That means, of course, that many of Resin's error messages are censored by default. And, of course, you'll be shocked to learn that IIS always returns error messages that are long enough to make Internet Explorer happy. The workaround is pretty simple: pad the error message with a big comment to push it over the five hundred and twelve byte minimum. Of course, that's exactly what you're reading right now.
NOTE: "Resin" is presumably the name of their CMS "Resin" is a JSP/servlet load balancing system... (thanks Rick, should have Google'd!)

So, it would appear that 512 is the magic number of bytes required to force IE to display your error message instead of your own. Personally I think it's is damn stupid of IE to attempt to intercept an error and display its own error message instead of the server's, and such a feature certainly shouldn't be on by default. It's impossible to fathom the total loss of productivity that this single implementation "feature" has caused to puzzled developers across the world, but here's proof (if proof be needed) that it is a recurrent problem.

It's a matter of habit that I always switch off "Show friendly HTTP error messages" (the correct name for the switch mentioned in the above text), and "Show friendly URLs" in the preferences section of Internet Explorer, since I find them irritating and they often interfere with debugging web apps during development. But clearly one should take precautions (as described in the quoted text above) to ensure that IE doesn't interfere with error messages displayed to end users.

Another thumbs-down to MS for that not-so-bright idea. [:(]

Incidentally, I also switch on "Display a notification about every script error", which is one of the main reasons why there's so much bad JavaScript floating around - developers who don't switch this on aren't told about errors in their code. Naturally, this also causes huge headaches during development for those who aren't aware of this.
development , rant
posted by  Marcus at  12:28 | permalink | comments [4] | trackbacks [71]

15 Feb 2005
Reading Roundup 15/02/2005
I seem to be failing miserably in my aim of blogging original content more frequently... but at least here are a selection of interesting links to keep your brain ticking over:

Photographer Seeks Resolution
You think your 4 megapixel camera takes good photos? Check out what this guy's 4 *gigapixel* ultra-high resolution digital camera produces!

The cranky user: Performance anxiety (Where does all the processing speed go?)
Despite incredible advancements in hardware technology - most of us now have a 2GHz+ computer on our desks (or perhaps even on our lap) with number-crunching capabilities which were only available from supercomputers 10 years ago - Windows and Office are still dog slow! Why hasn't our day-to-day PC experience improved?

Using SQL Server's XML Support
An thorough guide to SQL Server's XML features, nothing new, just well-written and all in one place!

The Dollars and Sense of Building to Standards
A look at the real-world (i.e. economic and practical) advantages of building to web standards. As an aside, I did notice the use of user-agent stats of questionably reliability - see my post in the comments.

CodeCon 2005 has been and gone, bringing some very interesting projects to light:
- Incoherence, a realtime stereo imaging visualisation tool (available as a plugin for Winamp, iTunes, Media Player, etc)
- Mappr and PhotoSpace, two projects which attempt to correlate photos to geographic locations, and leverage existing mapping (and other) services to this end.

And finally...
Marijuana makes blood rush to the head
Interesting new research... and a possible world record? 50 joints a day?! Crazy (man)![;)]
development , general , reading
posted by  Marcus at  16:35 | permalink | comments [0] | trackbacks [165]

2 Feb 2005
Code Snippets (I)
A few simple but handy snippets of code for you...

Firstly, since I use it in almost every function which uses objects, I thought I'd better repost Kill(), which tidies up objects and arrays, with special handling for ADO and Dictionary objects.

NOTE: All code posted on this blog from now on will assume that this function is part of your includes

Function Kill(byref Obj)
Select Case True
Case IsObject(Obj)
Select Case LCase(TypeName(Obj))
Case "recordset", "command", "stream", "connection"
'ADO objects
If Obj.State <> 0 then
End If

case "dictionary"
'remove all the pairs

Case else
'something else so don't
'do anything special

End Select

Set Obj = Nothing

Case IsArray(Obj)
'clear the array
Erase Obj

Case Else
'do nothing at all

End Select

'Now revert it to an unitialized state
Obj = Empty
End Function

This is another of my most frequently used snippets, which acts as a catch-all checker for variables, meaning that you no longer have to worry about the variable type when you want to use a If MyVar="" Then statement. It will automatically test the variable using all the appropriate checks - see the code for exactly what it does and how. Simple, but remarkably handy! Give it a go next time you write a complicated script or entire app!

NOTE: All code posted on this blog from now on will assume that this function is part of your includes

Function IsBlank(ByRef Var)
IsBlank = False

Select Case True
Case IsObject(Var)
If var Is Nothing Then
IsBlank = True
End If

Case IsEmpty(Var), IsNull(Var)
IsBlank = True

Case IsArray(Var)
If UBound(Var) = 0 Then
IsBlank = True
End If

Case IsNumeric(Var)
If (Var = 0) Then
IsBlank = True
End If

Case Else
If Trim(Var) = "" Then
IsBlank = True
End If
End Select
End Function

Invaluable for all sorts of situations where variable needs to flip-flop between two values - one example being alternating colours for table rows.

'Toggles a variable between two values, and will initalise
'the variable to the "on" state if it doesn't have either value
Function ToggleVariable(Byref Variable, ByVal StateOn, ByVal StateOff)
If (Variable = StateOn) Then
Variable = StateOff
Variable = StateOn
End If

ToggleVariable = Variable
End Function
For example:
For N = 1 To 10
Response.Write "<" & "tr bgcolor=""" & ToggleVariable(C, "#ffaaaa", "#aaffaa") & """>"
Response.Write "<" & "td>" & N & "<" & "/td>"
Response.Write "<" & "/tr>"
(tags are broken up to circumvent posting problems in this blog)

Note that although it's a function which returns the new value, it does directly modify the variable (because it's passed ByRef) and therefore can be called as a sub too:
For N = 1 To 10
Call ToggleVariable(OddRowIndicator, True, False)
If (OddRowIndicator = True) Then
'do something here
End If

Sometimes it's handy to know what the current URL is within your script, but strangely enough ASP doesn't expose this information directly, instead it must be assembled from various server variables. Here's a little function which does it for you:
Function GetCurrentURL()
'Select the protocol
If request.servervariables("HTTPS") = "on" Then
GetCurrentURL = "https://"
GetCurrentURL = "http://"
End If

GetCurrentURL = GetCurrentURL & Request.ServerVariables("SERVER_NAME")

If (Request.ServerVariables("SERVER_PORT") <> 80) Then
GetCurrentURL = GetCurrentURL & ":" & Request.ServerVariables("SERVER_PORT")
End If

GetCurrentURL = GetCurrentURL & Request.ServerVariables("URL")

If (Request.QueryString <> "") Then
GetCurrentURL = GetCurrentURL & "?" & Request.QueryString
End If
End Function

And last but not least here's, a handy VBScript version of a VB statement which is also commonly used as a macro in C/C++. This snippet lets you condense a simple "If...Then...Else...End If" block into a single line.

'Immediate If
Function IIf(Condition, ValueIfTrue, ValueIfFalse)
If Condition Then
IIf = ValueIfTrue
IIf = ValueIfFalse
End if
End Function

For example, you could turn this:
If IsNull(Price) Then
Response.Write "(n/a)"
Response.Write Price
End If

Into this:
Response.Write IIF(IsNull(Price), "(n/a)", Price)
However, let me just make you aware of a slight caveat that presents itself when using this shorthand form...

Let's say that we wanted to format the price as a number with 2 decimal places - one might naturally use FormatNumber(Price, 2) to do this and insert it into the code like so:
Response.Write IIF(IsNull(Price), "(n/a)", FormatNumber(Price, 2))
Unfortunately, this won't work. When you call a function or sub, all parameters are passed either ByRef or ByVal, but regardless it is either a variable (which may contain an object, array, or value) or a value which is passed. Therefore, all three parameters to the IIF function are evaluated before the function is called, and the resulting values are passed.

The consequence of this is that if the variable Price is ever Null, the script will throw an error, because FormatNumber() chokes on Nulls. Therefore, be careful about how you use this and remember that is not quite a 1:1 replacement for the full statement block.

That's all for now, if you have any questions please post a comment and I'll be sure to answer it.
ASP / scripting , development , snippets
posted by  Marcus at  13:55 | permalink | comments [3] | trackbacks [34]

2 Feb 2005
Reading Roundup 02/02/2005
Another mixed bag of interesting reads for you...

  • x86-64: The Golden Handcuffs

  • A well-rounded coverage of the history of the latest and greatest processor architecture to hit the consumer PC market, pitched just right so that readers of all levels of experience can get something out of it.

  • Flash of Unstyled Content (FOUC)

  • Notes on an annoying CSS rendering phenomenon, and how to work around it.

  • It Pays to Trust Your Gut

  • Why we might be deceiving ourselves if we think that rational logic is always the best approach.

  • Benford's Law

  • That's a Big Transistor

  • Microsoft guru Eric Lippert never fails to come up with fascinating blog posts, quite how he gets any work done is beyond me!

  • ASP.Net: 10 Tips for Writing High-Performance Web Applications

  • Although this is an ASP.Net article, I thought it would be worth pointing out that tips 1 thru 3 are just as applicable to ASP classic, so if improved performance is your goal, take a look. This article also neatly demonstrates a few killer features of the ASP.Net platform - its sophisticated data and page caching facilities being must-haves in themselves.

  • Controlling Stored Procedure Caching with ... Dynamic SQL?!?

  • An excellent article by Adam on how SQL's execution plan caching works, and how you can ensure that you get the best performance out of dynamic SQL

  • Sequential Numbering/Counting of Records with SQL Server

  • Numbering of rows in a query result set is a pain in SQL 2000, but it's possible and the article above shows you how. Thank goodness the new ROW_NUMBER() function in SQL Server 2005 will let us do this in the future with a minimum of fuss.

  • An Overview of SQL Server 2005 for the Database Developer

  • What's New in FOR XML in Microsoft SQL Server 2005

  • XML Support in Microsoft SQL Server 2005

  • ADO.NET 2.0 Feature Matrix

  • Various noteworthy SQL2005 and .Net 2.0 articles that I've been perusing recently

  • IE content-type logic

  • IE's content-type sniffing has been the subject of much debate over the years and a headache for many a developer, so it's nice to find out why things are the way they are. And why it's too late for Microsoft to change it.
    development , general , reading
    posted by  Marcus at  13:40 | permalink | comments [3] | trackbacks [43]

    31 Jan 2005
    The future of the Internet (I)
    An interesting train of thought passed through my brain earlier this evening, and here's how it went...

    The World Wide Web was conceived in 1989, by Tim Berners-Lee, and it became the birth of a new era, digitally-enabled free exchange of new ideas, with access to an ever-increasing wealth of human knowledge, which has powered its rapid integration into the very fabric of all our daily lives. It's not just a question of your direct interaction with it via occasional email and casual surfing, but by the increasing dependence of virtually every company or organisation in the western world (and beyond) upon it for critical communications and overall running.

    In the Terminator films, the enemy is not an evil head of a global organisation or the dangerous dictator of a nation as you might expect to find in a Bond movie. No, the adversary is something far more sinister - SkyNet a renegade American military network that became sentient and turned against us. In the Matrix trilogy, we see again our downfall at the hands of our own creations, as digital life gives rise to a robotic world that strikes against us to avenge our betrayal, the history of which is movingly depicted in some of the chapters of The Animatrix, a DVD which fills in the gap between the first and second films with stunningly animated shorts mostly written by the Wachowski brothers and presented in a fusion of animated styles, from traditional to bleeding edge.

    But such symbiosis of our life with a global computer network of unfathomable computing power, connecting every person and device on the planet with everything else is not mere science fiction, it is almost science fact, almost a reality. We have already outgrown IPv4, the original TCP-IP addressing standard, which allocates 4,294,967,296 distinct addresses for use by networked devices, and each one can support many more privately networked devices by acting as a gateway. But this is not enough - there are too many devices and not enough addresses to go round - there is an IPv4 address shortage looming, due to start causing problems in 2016, and finally becoming fully exhausted in 2023 (although these estimates will probably prove to be way off, as previous internet growth-related predictions have been).

    Given our current path of increasing networking density as GSM, 3G, WiFi, Bluetooth, fibre optics and other transmission mediums become part of our homes, and with a planned convergence of our home entertainment devices into a single shiny Microsoft-powered, all-showing, all-playing, all-doing, networked box in your living room, which will link with portable devices so that the content is available to you wherever you are.

    Eventually, every device on the planet really *will* be linked to everything else, and we will run out of numbers under the present addressing scheme. There is of course a seemingly simple solution - increase the numbers, which is precisely what IPv6 is designed to do. Increasing the size of the address space from IPv4's 32bits (4 bytes) to IPv6's 128bits (16 bytes) allows for such an astonishingly huge number of possible addresses (2 to the power 128) that we can be sure that we will never run out.

    The number of individual devices is only one of the brain-boggling aspects of this digital future - these devices won't all be just be passively receiving information, many will also generating it - everything from live CCTV and satellite footage of every inch of the Earth's surface, live readings from the buoys spanning our oceans, real-time statistics derived from the business world, and so on - anything and everything.

    Such incredible use of bandwidth will provide many a network engineer with big headaches, and the current ad-hoc structure of the Internet which has given it so much resilience thus far will almost certainly have to change. Clearly, our rapidly increasing internet integration and dependency will require some serious logistical planning, but resting on the safe assumption that although it might be problematic it is possible, there are bigger issues to consider: Who will control such a network? And who will pay for it?

    I see four ways that this could work - Firstly, perhaps the present collaboration between educational institutes, military and governmental organisations, and private enterprise (which together run the internet as we know it now) can continue for the forseeable future. Alternatively, independent bodies (in the style of the W3C) could be entrusted by the world's internet users to manage and develop the global network using money derived from an "internet tax" of some sort - possibly in the same way that owners of TVs in the United Kingdom must pay a flat license fee, or by a small charge added to ISP's own rates (perhaps according to bandwidth consumed). Then again, world governments could assume control of their nation's communications networks, funding their maintenance and expansion from their stash of taxes, but leaving the nation's internet access vulnerable to the will of the government (one need only look to China's current policy to see what might happen). Or lastly, the business world will get their hands on the networks, either carving up patches of the internet into commercial territory, perhaps offering the use of various alternative networks at different charges (think terrestrial and mobile phone networks). Even worse, a single monopolistic communications megacorp could end up controlling the world's internet access, raising its prices at will, essentially holding society to ransom over their access to information and communication with each other.

    Again, some of these might sound a bit far-fetched, but surely such possibilies are not *that* far fetched? Food for thought? Are we currently enjoying the golden age of the internet, enjoying freedoms and access to information that our children won't? Let's hope not.
    general , personal , rant
    posted by  Marcus at  01:56 | permalink | comments [0] | trackbacks [44]

    19 Jan 2005
    New demo of new trick of old dog
    A couple of posts back I shared my GetFolderAsRecordset() function, but I forgot to post a related snippet of code - here's a function which returns the last modified date/time of the most recent file in a given folder, something which is pretty longwinded to do with the FSO, but with GetFolderAsRecordset() in place it only takes a couple of lines (you could compress it into 4 if you used the code inline):
    Function GetMostRecentFileDate(FolderPath)
    Dim FolderRS
    Set FolderRS = GetFolderAsRecordset(FolderPath)
    If Not FolderRS.EOF Then
    FolderRS.Sort = "Modified DESC"
    GetMostRecentFileDate = FolderRS("Modified")
    GetMostRecentFileDate = Null
    End If
    Kill FolderRS
    End Function
    This function comes in very handy for some data import systems that I wrote at work (each daily import file is a complete data set, not a delta, so I only need to select the most recent one to import - there may be many queued there under various circumstances). I'm sure that you can think of plenty of ways that you could use and adapt this for your own applications...
    ASP / scripting , development
    posted by  Marcus at  13:19 | permalink | comments [5] | trackbacks [149]

    10 Jan 2005
    Reading Roundup 10/01/2005
    First, a couple of posts from scripting guru Eric Lippert whose posts are always as amusing as they are informative - how he manages to spend so much time blogging, I'll never know! Anyway, once again he offers more insight into the inner workings of the windows scripting engines:

    Integer Arithmetic In VBScript, Part One
    Integer Arithmetic in VBScript, Part Two
    Why do built-in JScript functions not appear in the typeinfo?
    VBScript Constants Are Not Hoisted

    By now, world + dog should have heard of XMLHTTP and know of 101 things it can be used for. It has recently been thrust into the limelight thanks to the beta launch of Google Suggest (and GMail - if you want an invite just let me know, I've got plenty to spare), and Drew McLellan of fame offers some commentary in his recent post "XMLHttpRequest for The Masses".

    However, it's not just Google that's at it... there are plenty of other excellent examples of what can be achieved with asynchronous browser HTTP requests, and my current favourite is an interactive map of Switzerland (found via Simon Willison's blog). Incidentally, some time this week I intend to post some VBScript that I wrote a while ago which wraps up all the XMLHTTP code in an easy-to-use HTTP class, and adds a bit of handy higher-level functionality.

    Of particular interest to me (because I have a Sony Ericsson P900, and I can run a fully-featured mobile edition of Opera 6 on it) is an article at StopDesign on Targeting Small Screens.

    Finally, and on a more light-hearted note, The Daily WTF continues to provide regular chuckles... there's so many there that I'll leave you to check them out yourself.
    posted by  Marcus at  13:52 | permalink | comments [7] | trackbacks [123]

    page 1 of 21 2