SQL Server backup and ‘operating system error 5′

Whilst trying to backup a SQL Server 2005 database on Windows 2003 I was given an error which said, amongst other things operating system error 5. That didn’t help a great deal, but the resolution was relatively simple: give the SQL user on the server access permissions to the folder I was trying to back up to. On my server the user was along the lines of SQLServer2005MSSQLUser$…..

More information can be found on Microsoft’s knowledge base.

‘Object reference not set to instance of an object’

The “Object reference not set to instance of an object” error in ASP.Net has to be one of the most annoying of all error messages giving, as it does, almost no clues as to what the error can be about. And yes, I know it’s easy to get more information, but it doesn’t really provide any more help than just saying “It broke” would.

It has to be up there with “Object expected” in PHP and the old favourite “Error on line 0 character 0” in JavaScript.

FCKEditor and 500 server image browser error in asp.net

The apparently XML derived “500 server error” problem with FCKEditor’s image upload tool and asp.net seems very common, and there seem to be half a million different confusing solutions on the web. In my case, it turned out the problem was paths and was fixed by adding a new key entry in web.config:

So nothing to do with XML at all really and the error was simply the result of an incorrect URL resulting in a 500 server error that returned invalid XML… A helpful error code could be added to FCKEditor, perhaps?

Events and postback with dynamic ASP.Net user controls

I’ve been trying to build an editable organisation chart for an intranet project and have built up a structure of nested dynamic user controls. This was all working well for displaying the information but wasn’t working so well for posting back and registering events.

A bit of Googling later and I found this article on the 4 Guys From Rolla site called Dynamic Web Controls, Postbacks, and View State which explained the general gist of it.

The cause of the problem was that if you bind the data that loads the controls in page load then the events don’t fire, but if you don’t bind it there’s no data to register the event on. The solution? Do the binding in the init function instead. It worked a treat.

Dynamic Web Controls, Postbacks, and View State

Regular expressions: a misnomer

Why are regular expressions called regular expressions? Two regular expressions that achieve the same result can often look completely different, so what’s so regular about that?

And also: they’re not even expressive. Who can really understand what /(<[^href]*href=(\"|'))([^(\"|')]+)(\"|')/ does off the top of their head? (Okay, I admit it's semi-obvious that it's something to do with links.) I guess it could be 'expression' in terms of expressionism in art, which tends to look pretty crazy too.

This is a mystery that I fear will remain unsolved.

Programmers are brain surgeons

Programmers are brain surgeons is a blog post I was sent that looks at how programmers are perceived in the pecking order of job titles. The basis of the argument is that programming in itself should be valued, that programmers should not aspire to be managers who then leave programming behind, and that the programmer may be best placed to manage projects. It draws analogies with professions such as law and architecture where the expert is also the manager.

There are certainly things I do agree with there and it’s part of the ethos of Exponetic to value what programmers can add to a project beyond the ‘man hours at a desk’ commodity approach. (This is something that’s sometimes reflected in the way work is presented: “We’ve got about two weeks work to do.” The question is, two weeks of a good programmer or two weeks of an average one? There’s a big difference.)

I recently explored comparisons with another profession I’m familiar with (architecture) and where it might lead to in an article in New Media Age. It’s certainly one of those areas that’s fraught with trouble. An analogy made to highlight one point can, simply by association, lead people to assume that there’s a direct comparison being made. In fact, authors often make the same mistake. Although Programmers are brain surgeons doesn’t do this there are a number of areas where I think even the ‘programmers as managers’ point can break down.

Firstly, I do want to say that the underlying message, that programmers shouldn’t need to think of programming as a stepping stone to something better, is something I agree with. I don’t think too many programmers would disagree with that either, although the commercial career ladder may tell them otherwise.

The truth of the matter, though, is that some people are suited to being programmers in the same way that some people are suited to being managers. To say something like “and you’ll be reporting to a project manager with maybe a quarter your skills and experience…” as the article does is to make the same mistake as the author is accusing those who denigrate programming of making.

There are, of course, some people who are suited to both to a lesser or greater degree but market forces are surely dictating that projects need a range of skills, otherwise a range of jobs wouldn’t exist. If companies could save on staff numbers they would. Bringing back the analogy to professions again: a lot of professional practice firms aren’t particularly well run as businesses. The growth in construction managers is testament to that in the building industry.

The article, if it does have validity, seems to me to only apply to either a relatively small cross-section of people (those who fit the profile of programmer + manager), or a distinct type of project (those that can be completed by a single person).

Being a programmer is indeed a worthwhile career aspiration in itself but I can’t see programmers ruling the world any time soon.

Del.icio.us API timeout and 503 response headers

Three days after building a little bit of code to publish posts from this blog directly to del.icio.us, I still haven’t got every post on there. Despite following the “don’t hammer our server” guidelines and waiting over a second between API calls, my process is still being kicked off after about 20 posts and can’t get back on for a good half hour or so.

Any concrete information about what can and can’t be done at what frequencies with this lame API would be good to see as it’s something that may be useful to integrate a client’s site with but is too flaky to think about using commercially at the moment.

The del.icio.us API

ASP.Net del.icio.us API integration with C#

I’ve been playing around with getting my blog to automatically post to del.icio.us when a new post is added (just because I can) and it’s actually very easy to talk to the del.icio.us API. To get any communication going, just create a WebRequest, add authentication, and away you go. The bit of code below reads an XML document of all posts into a string:

HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(“https://api.del.icio.us/v1/posts/all”);
myReq.Credentials = new NetworkCredential(username,password);//Both as strings
HttpWebResponse response = (HttpWebResponse)myReq.GetResponse();
myReq.UserAgent = “K-blog del.icio.us adder”;//Optional
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader (receiveStream, System.Text.Encoding.UTF8);
string deliciousResponse = readStream.ReadToEnd();
readStream.Close();
receiveStream.Close();
response.Close();

And now all my blog posts are linked on del.icio.us. There are a few problems linked with having to use the API sparingly (otherwise they start sending 503 headers back) so you can’t post too much at once, but it works as well as it’s going to.

Problems with the semantic web

I was pointed towards Ontology is Overrated: Categories, Links, and Tags by Clay Shirky and decided to read a few more posts. This one about the semantic web is interesting too. I particularly like this section on proposed uses for the semantic web:

“This example sets the pattern for descriptions of the Semantic Web. First, take some well-known problem. Next, misconstrue it so that the hard part is made to seem trivial and the trivial part hard. Finally, congratulate yourself for solving the trivial part.”

This quote could apply to a lot of issues programmers are presented with. Also this:

“the Semantic Web is divided between two goals, one good but unnecessary, the other audacious but doomed.”

The Semantic Web, Syllogism, and Worldview

Categorising content on the web

This article entitled Ontology is Overrated: Categories, Links, and Tags is interesting for any programmer who’s had a client say they want a taggable/searchable/categorisable system of some kind. They’re all the rage at the moment, apparently. The interesting ideas reall start in the mind reading section.

“One of the biggest problems with categorizing things in advance is that it forces the categorizers to take on two jobs that have historically been quite hard: mind reading, and fortune telling.”

Ontology is Overrated: Categories, Links, and Tags