Yes, its out there on the web; a SQL Server Database Version Database. Or, to put it differently, a Database of SQL Server Versions.

Here  you can find a list of all the versions of SQL Server that have ever been released. It even goes right back to version 6.0, released in 1995. Check out the SQL Server Release History if you are interested.

I was drawn to this list when I had two database connections open in my object explorer:

SQLDatabase01 (SQL Server 8.0.2050 – Context/UserName)

SQLDatabase02 (SQL Server 8.0.2039 – Context/UserName)

I was curious as to what the difference was, so investigated further and found the SQL Server Version Database. I found the information I wanted with ease:

2000 (GDR) SP4+Q941203 / 948110 – 8.0.2050

2000  SP4 – 8.0.2039

And looking at the hundreds of different versions available, its not surprising that something like this is needed.

,

Recently, Sky continued its series of adaptations of books from Terry Pratchett’s Discworld series by commissioning ‘Going Postal‘. This is a tale of a conman coerced into running the city postal service, locking horns with the dominant competitor who had a monopoly in sending messages using semaphore towers located across the continent (A system whimsically call the ‘Clacks’, a mechanical version of Email).

Going Postal
Image via Wikipedia

The Clacks system started as a few towers to prototype and demonstrate a communication mechanism as a proof of concept. This prototype never got ‘thrown away’, and instead grew, carrying with it the flaws and problems encountered in its constructions.

The same is true for many software systems. Fred Brookes tells us that you should ‘plan to throw one away‘, as you invariably will have to do this anyway. The escalating costs of maintaining the system built on the prototype will be at least as large as the cost of throwing the system away.

So, what was the attitude of the directors of the ‘Grand Trunk Semaphore Company’ that controlled the Clacks? Grind the system into the ground by cutting corners, scaling down maintenance while subsequently raising charges. This attitude in relation to software systems will be familiar to many onlookers.

This neglect had cause the system to ‘crash’ so frequently that its emerging rival, the post office, had established a foothold in the now substantial niche that was left by these system failures, and was taking substantial business from the ‘Clacks’ company.

The directors called an emergency meeting, in which they invited the chief engineer, Mr George Pony, to advise on fixing the endemic problems precipitated by the years of neglect.

Pony: ”Do you want it fast or cheap or good, gentlemen? The way things have gone, I can only give you one out of three…”

Director: “How soon can we have the Grand Trunk working properly?”

Pony: “Nine Months, shut down”

Director: “Don’t be a fool, man!”

Ring any bells?

Reacher Gilt

The mere use of a software system does not physically wear it out in the same way that use of a mechanical system like the Clacks does. The wear and tear on a software system comes in the form of updates, upgrades, extensions, etc.

Mr Pony goes onto insist on the restoration of the ‘Hour of the dead’, which had been done away with by the management.

Pony: “Could we have the Hour of The Dead back, Mr Gilt?”

Gilt: “I really wish you would use that fanciful term”…”it really does not present the right image”

Pony: “Sorry, sir, but I still need it”

Gilt: “That’s revenue flow we’re talking about. the board won’t be very pleased with me if I-”

‘Pony: “I think I’ve got to insist, Mr Gilt.”

The hour of the dead was a time at which the communication towers were shut down, and simple maintenance performed. Small problems that would eventually lead to large problems were addressed, and the whole system kept manageable.

The same concept can apply on a larger scale with our software system. Consider a ‘Month of the dead’ each year,or an allotted time in our software lifecycle to maintain areas of the system. Technically, we don’t even have to write any code; for example, we can simply document what is out there and identify areas for refactoring/improving.

And that month goes for everyone, requirements gatherers, business analysts, developers and testers to name a few.

, ,

Yes, you from Ljubljana, Slovenia.

Don’t think I haven’t noticed you poking around my draft blog postings:

While I’m grateful that you’re showing an interest, I would be curious to know how you’re getting access to the drafts (if indeed you are).

Feel free to let me know by posting a comment below.

Many thanks :-)

,

There have been a number of occasions recently where I have wanted to recompile, rename or delete a DLL, only to be thwarted by some locking problem:

I had no idea what was locking it.

My first investigations took me to this MSDN Blog Site. To summarise, you can utilise the little-known tasklist command-line interface. Typing tasklist /m thelocked.dll will list all processes that are locking your DLL.

Microsoft has also made available a tool that (probably) hooks into this. Process explorer provides a more visual overview of processes and dependencies. It’s also useful for tracking down DLL-version problems or handle leaks, and provide insight into the way Windows and applications work.

Screenshot of Unlocker 1.8.8
Image via Wikipedia

But the most useful tool for me by far was a tool called Unlocker. Upon installing the little application I was automatically prompted of processes that were locking a file when I get the access denied error.

So there we have it. A number of ways in which you can tackle this issue, and maybe even help extract yourself from DLL Hell!

, ,
Example DOM Tree
Image via Wikipedia

jQuery does a wonderful job of traversing the DOM tree, so you might ask why you would like to do this yourself?
I recently encountered a requirement to count the maximum ‘depth’ of a DOM tree. I.e. find the level of the deepest nested element. So, I managed to knock this up in a few minutes:

function Recurse($item, depth) {
    $item.each(function() {
        depth.count++;
        if (depth.count > depth.max) {
            depth.max = depth.count;
        }
        Recurse($(this).children(), depth);
    });
    depth.count--;
    return depth.max;
}

$(document).ready(function() {
    alert(Recurse($("body"), { count: 0, max:0 }));
}

A few points to note about this

  • depth is an object with two members, count and max. We want to keep a count of the current and maximum depth, but want to avoid global variables (it’s better practice, and makes the solution more self-contained).
  • JavaScript doesn’t allow us to pass variables by reference. Using the variables within the passed depth object means we can pass values to lower levels of recursion.
  • We must pass an object in our first call. Technically the function can be improved by including a check for this.
  • The function returns depth.max. Although the return value doesn’t matter when the function is called recursively, its useful for passing our intended value out to the original calling function.

You can test this out on JsFiddle: http://jsfiddle.net/RqHzf/

Enhanced by Zemanta
,

When I starting writing this blog, I was a little unsure as to what to put in it. I knew I wanted it to be mostly programming related, with articles about things that interested me. So I named it my ‘Programming Notebook’ and put into words exactly what I envisaged I’d be putting in it. This is what I put in my About page:

My main intention was for this blog was to be a notebook for myself in a presentable format – an aid to memory of things I’ve found useful on a day-to-day basis, and little snippets I’d like to share. A lot of it won’t be ground-breaking and you’ll almost certainly find it around elsewhere on the net, but it’s presented in a way that I learned it in the hope that others might find it useful.

And later on I started fretting that I was duplicating what already ‘out there’, which is nonsense, because almost everything that anyone writes is already ‘out there’ anyway.

None of this has anything to do with Identity Inserting in SQL Server, but maybe goes some way to explaining why I am writing about something that is well documented ‘out there’.

The reason is that I had to look it up twice. I needed to look it once, and then I forgot, so I needed to look it up again. What I needed was some sort of programming noteb…. hey… I have one!

So here it is:

SET IDENTITY_INSERT [MyTable] ON
INSERT INTO [MyTable] (IDField, Field2, Field3, Field4) values (1,212,2,2)
SET IDENTITY_INSERT [MyTable] OFF

You’ll need to set IDENTITY_INSERT ‘ON’ for the table into which you are inserting, and (for good measure) set it back to ‘OFF’ when you’re done.

You’ll also need to include a field list (which is good practice anyway). The following just won’t work:

INSERT INTO [MyTable] values (1,212,2,2)

So there we are, SQL Server Identity Inserting covered….again.

,

I was wrong today.
A CSS Stylesheet had a style with a backgound-color setting of #fff:

background-color:#fff;

And another style with a color of #aaaaaa:

background-color:#aaaaaa;

My colleague commented that for consistency they should both be a six digit hex-code, to which I agreed. But I was mistaken as to what the six digit hex equivalent of #fff was.

I thought it was #fff000.

I can also see what fold might assume its #000fff.

Or even #f0f0f0;

But actually, it is #ffffff. The same is true for #aaa and #aaaaaa. And #aba is actually #aabbaa.

For a good explanation as to why this might be, refer to the following links:
http://www.fluther.com/13071/whats-the-difference-in-fff-and-ffffff-in-css-and-why/
http://stackoverflow.com/questions/2899197/does-stylecolor-fff-render-as-f0f0f0-or-ffffff

,

And I was out! Dammit!

“We have noticed from our logs that you have been downloading lots of viruses”

My wife took the call, and politely declined, which is more than they deserved. I’ve got a nice counter-scam dreamed up as well (see This Post for my thoughts on this).

So, to all the criminals responsible for perpetrating the scam that are this. Please ring back, I REALLY want technical support, as my event viewer has lots of errors, and my prefetch folder is full of viruses!

Help!

Other Articles

This is one of an ongoing series of articles that I have written following this scam. You can find them under the following tag group:

http://www.jameswiseman.com/blog/tag/windows-support-telephone-scam/

,

Have you ever been working on a bit of code, or writing a document, and then find that you need to jump elsewhere to check something out. You’ll move the cursor away from your edit position, and you’ll lost where you are and have to spend time finding where it was. Maybe not much, but enough to be sufficiently

Well, here is what I do:  control-z then control-y.

What this effectively does is undo your last change, then reapply it, and in the process return to exactly where you were editing originally. Beware, though, to make sure your IDE actually does this. Its pretty standard, but not all will support it. For example, you’ll be disappointed if you’re using VB6 IDE.

Of course, if you’re keyboard-shy, the you can always use the ‘undo’ and ‘redo’ arrow buttons in your editor.

,

One of the reasons I like Stackoverflow as a place for asking and answering programming questions is that I

  1. Almost always get what I am after
  2. Almost always learn something in the process (in answering and asking)

Case in point with a question I asked regarding hierarchy sorting in SQL Server. The question in full can be found on the adjacent link, but, in a nutshell I was looking at how I might sort a variable length hierarchy field in SQL Server 2000.

So, the field value could be 1. Or it could be 1.2.3.4. Or it could be 1.92.333.14.58.62.7.81231.

Given that I needed to sort by the last digit, then the second-last, etc, etc, AND that the length was variable, I found myself a little stumped as to an elegant solution. So I decided to call upon the generosity of the Stackoverflow community

First-up was a number of fixed length solutions, which while good, didn’t quite help. Then I got some help in SQL 2008, which was unfortunate, as I was wanting it in SQL 2000. And then user Vash popped up with an edit to his original post:

Solutions for 2000, 2005, 2008: Solutions to T-SQL Sorting Challenge here.

Marvellous! Here is the solution (modified sightly) that I adopted:

CREATE FUNCTION dbo.ufn_SortByHierarchy(@s as varchar(500), @delimiter as char(1))
  returns VARBINARY(2500)
AS
BEGIN
  DECLARE @pos as int, @r as varbinary(2500), @element as int;

  SET @r = 0x;
  SET @s = @s + @delimiter;
  SET @pos = charindex(@delimiter, @s);
  while @pos > 0
  BEGIN
	SET @element = cast(left(@s, @pos - 1) AS INT);

	SET @r = @r +
	  CASE
		WHEN @element = -2147483648 THEN 0x0000000000
		WHEN sign(@element) = -1
		  THEN 0x01 + cast(2147483647 + @element AS BINARY(4))
		ELSE 0x02 + cast(@element AS BINARY(4))
	  END;

	SET @s = stuff(@s, 1, @pos, '');
	SET @pos = charindex(@delimiter, @s);
  END

  RETURN @r;

END

And, as it turned out, I’d never heard of the varbinary data type, so right there was some extra reading and knowledge for me.

And that, I thought was it. But no! A short while later, user Martin Smith, popped up with a comment.

@James – Not sure what you ended up using. You can also use parsename for this as in this answer: stackoverflow.com/questions/3057532/

A comment! I’d have voted it up if it were an answer. So I followed the link, and voted that up.

So, I also learned about Parsename, which works in lowly SQL 2000 as well. unfortunately, it only works on a four-digit hierarchy, but still useful for me to know about.

So, lots of useful information, new things learned and a permanently documented solution to my problem. That is why I like Stackoverflow.

, , ,

Recently I encountered a business requirement whereby it was stipulated that both radio buttons in a group be left unchecked. In addition to this, a check was required to forcing the user to select one before they can continue.radio button

This struck me as being direct contradiction as to what a Radio button was trying to achieve, and that it was actually more work as you were forcing the user to make a choice without giving them a default.

It just felt wrong.

But I wasn’t sure, so I did a bit of research, and came up with the following.

Firstly (and some could say, lastly) there is the W3 Recommendation at http://www.w3.org/TR/html401/interact/forms.html#radio:

At all times, exactly one of the radio buttons in a set is checked.

And that ought to be it, but for completeness, here is quite a nice set of guidelines regarding this http://www.useit.com/alertbox/20040927.html:

Always offer a default selection for radio button lists. By definition, radio buttons always have exactly one option selected, and you therefore shouldn’t display them without a default selection. (Checkboxes, in contrast, often default to having none of the options selected.)

  • If users might need to refrain from making a selection, you should provide a radio button for this choice, such as one labeled “None.” Offering users an explicit, neutral option to click is better than requiring the implicit act of not selecting from the list, especially because doing the latter violates the rule of always having exactly one option chosen.
  • Personally, it was nice to pin this down and get some good points of reference.
    ,

    Yesterday when wanting to run some commands from the Windows Command Shell, I fired it up on my windows XP desktop, only to find things were a little strange.

    For a start it was slower – pasting something in from the clipboard seemed to take time. And then it didn’t protest too much when I started typing things I felt sure shouldn’t work. Then things I wanted to happen didn’t happen when I expected them to.

    It all left me a bit confused.

    And then I noticed, I’d typed in “command.exe” not “cmd.exe”. I rectified the mistake, and everything seemed to be just fine. But I did wonder what the difference was.

    Cmd or Command?

    Well, initially, from the above screenshot we can see that the version information has the text is ‘Windows DOS’ vs ‘Windows XP’. However there are a number of other differences:

    Cmd.exe is a command-line interface, provided so you can run command-line commands. It is not a DOS window.

    Command.com is a stripped-down version of the command processor from DOS. It is a 16-bit application which is used for older DOS compatibility and actually runs inside the NTVDM (NT Virtual DOS Machine) due to its 16-bit nature.

    With Command.com we do not have the long name support. Typing in ‘cd program files‘ yields the error ‘Too many parameters – files‘, whereas this command works fine in Cmd.exe. In fact to get this to work in Command.com, we have to type ‘cd progra~1‘.

    ,

    I don’t know, and I’d like to.

    I noticed a suspicious entry in my visitor logs from an IP in Calcutta looking at the last Scam post –  ’Scamming the Scammers’. My suspicions were confirmed when the IP linked back to one of the websites quoted by the fraudsters (http://onlinepccare.com/) . See this entry: http://www.robtex.com/cnet/203.200.180.html.

    Screenshot of Visit from IP in Calcutta

    So it looks like the criminals are reading this. HELLO, Criminals!

    After looking around a bit more, I found a forum post (http://www.dslreports.com/forum/r22222049-Scam-Supportonclickcom-scareware-scam~start=140) that lists a few more to be wary of:

    www.supportonclick.com
    www.onlinepccare.com
    www.techmyhelp.com
    www.comantra.net
    www.gogreenpc.net
    www.techisonline.com
    www.techonsupport.com
    www.fixonclick123.com
    www.virtualpcdoctor.com
    www.loginforcare.com
    www.systemrecure.com

    An Australian website has taken also  to recording info regarding this (http://forums.whirlpool.net.au/forum-replies.cfm?t=1485775). A further link from here to an article containing a response from Microsoft Australia is also an interesting read: (http://www.smh.com.au/technology/security/pay-up-or-your-pcs-toast-20100630-zm8i.html).

    The Guardian, UK, carry an article linking OnlinePCCare.com to a company called Pecon Software based in – you’ve guess it – Calcutta  (or Kolkata if you’d prefer). Their customer relationship manager, Vikas Gupta strenuously denies any involvement and states that he has an email from Mahesh Shah, head of Pecon Software, in which he is told that the company has terminated its contract with “around 30 employees in last two years

    It is interesting to note that Pecon Software still have a link on their front page to the (now shut-down) supportonclick.com through an employee login link.

    So I guess it’s important to know who is actually accepting money for this, i.e. to which company is the money on the credit card being paid to? Or, put it another way, what is the name of the company that appears on the credit card receipt?

    Any info, post here.

    Other Articles

    This is one of an ongoing series of articles that I have written following this scam. You can find them under the following tag group:

    http://www.jameswiseman.com/blog/tag/windows-support-telephone-scam/

    ,

    It’s a long while since I finally left the world of education to enter the real world. In June 1999, I finally packed my student suitcase and departed Bath University for a lifetime in software development (or something).Algorithm Animation

    I haven’t had much cause to look back over the things I did during those years, however, recently I found myself thinking back to my final year project on Sorting Algorithm Animation.

    My task was to create an application that could demonstrate and compare the common algorithms for sorting lists of numbers. This included, Bubble, Insertion, Selection, Quick, Hash and Merge.

    So this is, in short, what I did. And I did it, believe it or not, in Delphi 3!

    Ever since I set up JamesWiseman.com, I’ve included a link to it, and I even did a basic version in C# when I first started looking at the language.

    I was pleasantly surprised when I revisited it recently. It’s not perfect, but still (IMHO) not bad at all.

    Check it out here  if you are curious: http://jameswiseman.com/aa.php

    Most people who have had any cause to edit registry settings on a regular basis will probably be familiar with the registry file (.reg) file convention:

    [HKEY_LOCAL_MACHINE\Software\Test]
    TestValue“=”SomeValue
    TestValue2“=”Some Other Value

    When you double-click the registry file from Windows Explorer, the registry settings are applied quote effortlessly.

    I recently found out, however that its possible to delete registry settings in the same way by a cunning placement of the hyphen character (-).

    To delete a value, use the following:

    [HKEY_LOCAL_MACHINE\Software\Test]
    TestValue“=-

    (Note the hyphen after the equals sign.)

    To delete a whole key, use the following:

    [-HKEY_LOCAL_MACHINE\Software\Test]

    This time we put the hyphen in front of the key name.

    Read more here, (including the disclaimer on the inherent risks of registry editing): http://support.microsoft.com/kb/310516


    ,