Errors using AttachDBfilename and SQLEXPRESS when migrating dev code to production servers

One of the developers at work had used the Visual Studio web authentication tool thingy, which created an SQL Server Express database which was configured in his web.config to attach the file for use.

When migrating this to a server that has SQL Server (not SQL Server Express) this obviously doesn’t work; you get connection errors.

As this useful post says:

AttachDBFilename is unique to SQL Express, it spins up a user instance of SQL Express attached to a specific DB Filename for single user mode. Database is simply the name of the database to use, it has no additional connotation. For any production server, you would most likely not be using AttachDBFilename. It is strictly useful for development and experimentation in single-user mode.

The answer is to attach the MDF (database file) to SQL Server. You may want to change the database name; it seems to just plonk in the original filename (with path) there, which is pretty unwieldly.

Create an SQL Server login, and a database user (linked to the login) for it (I gave it the dbowner role, though it’s probably possible to restrict it a bit more), and then change the web.config:

  • “data source=.\SQLEXPRESS;” becomes “Server=(local);”
  • “AttachDBFilename=|DataDirectory|\aspnetdb.mdf” becomes “Database=[databasename]; User=[username]; Password=[password]”
  • “User Instance=true” needs to be removed

Cross your fingers and hopefully that’ll work.

Blogger introduces country domains, breaks some addons

Blogger has split itself into separate country domains, such as blogspot.com for US, blogspot.co.uk for UK, blogspot.com.au for AU.

But what’s really puzzling is that these apply to the user, not the blog. The blog may be visible on a multitude of different blogspot country domains, dependent on where the user is located.

This has broken a number of addon tools, such as commenting and social networking.

More details at Girl Does Geek

Google’s information on this

How to override it (though it only lists a few of the country domains; you’d need to find as many as possible to add in to make it work for everybody)

— It rather appears that Google/Blogger didn’t think too carefully about this.

Greens MP Adam Bandt had a Commodore 64

I rise to speak on the Classification (Publications, Films and Computer Games) Amendment (R 18+ Computer Games) Bill 2012. I am sorry that I cannot join in the debate about slide rules and slates, but, like the member for Solomon, I do remember having the Commodore 64. I do remember that, to play a computer game, you had to sit and wait for a tape player to load a game for about half an hour, and hope that it did not get caught some way through it, so that you could play a game of Aztec Challenge or Soccer. The most violent it got then was that a gorilla might throw a barrel at your head while your character was playing, but that was about it. But things have moved on enormously since then. There have been advancements in technology, advancements in innovation and advancements in people’s creativity, and that is a good thing. It is extraordinarily to be welcomed. But it is time for the law to catch up.

Greens MP Adam Bandt in Parliament, 15/3/2012

VirtualBox could not open the medium: you’re not the old you

I recently had reason to restart an old virtual machine on VirtualBox running on my Ubuntu machine, and was presented with the error:

Failed to start the virtual machine XP Install 2.

Medium ‘/home/net2/.VirtualBox/Machines/XP Install 2/Snapshots/{70eab271-a63d-4bff-aa7b-8ac8b713e3b6}.vdi’ is not accessible. Could not open the medium ‘/home/net2/.VirtualBox/Machines/XP Install 2/Snapshots/{70eab271-a63d-4bff-aa7b-8ac8b713e3b6}.vdi’.
VD: error VERR_FILE_NOT_FOUND opening image file ‘/home/net2/.VirtualBox/Machines/XP Install 2/Snapshots/{70eab271-a63d-4bff-aa7b-8ac8b713e3b6}.vdi’ (VERR_FILE_NOT_FOUND).

I figured that somehow the backup had been hosed, as it had been through a couple of restores and system migrations. A ls of the above failed with

ls: cannot access /home/net2/.VirtualBox/Machines/XP: No such file or directory
ls: cannot access Install: No such file or directory
ls: cannot access 2/Snapshots/{70eab271-a63d-4bff-aa7b-8ac8b713e3b6}.vdi: No such file or directory

And then it occured to me that I was running under a different username now. As such:

cd /home
sudo ln -s josh net2

solved the problem with the computer is completely fooled into believing that net2 is still a user on this machine. Well, for the purposes of VirtualBox anyway.

Android: Ice Cream Sandwich upgrades

Computerworld has a list (that they are continuing to update) of which devices are getting Google Android 4 (Ice cream sandwich).

Alas, there’s no news of some phones, including my HTC Desire S. (The Desire non-S is looking very iffy, apparently.) There is a hacky way of getting it onto a Desire S… if you’re willing to forego being able to use the camera. No thanks. No doubt some other devices have this option available too, for the hardcore.

The bigger picture on this is that with a myriad of phone manufacturers, Android updates are a lot more hit and miss than Apple’s, where Apple’s absolute control clearly benefits customers by making operating system updates available quickly on all recent models of phone.

Old shapes in Visio

I know I’m using an old (2003) version of Visio, but seriously… paper tape?

Visio shapes

(I suppose these days “cards” could refer to some kind of portable storage, though I bet it really means punch cards.)

Wikipedia is now blacked out

Wikipedia is now blacked-out for 24 hours.

Wikipedia blacked-out

Note that at the time of writing, clicking the “Learn more” link takes you to a page that momentarily has more information, but then itself gets blacked-out. D’oh. I’m guessing they’ll fix that soon.

I’m guessing the Google Cache will get a good workout in the next 24 hours. To use it, search Google as normal; look for the Wikipedia link, and click the right button [1] to make the cache preview appear, then click the “Cached” link [2] to look at it in full size.

Using the Google Cache to read Wikipedia

More about the SOPA protest

Top spams

The work email server spam filter does not simply reject everything suspicious – this would risk us losing legitimate emails, something made worse by some companies choosing to send invoices and remittances as PDF attachments with no accompanying text whatsoever, something the mail server considers dodgy.

So (until I work out a better, foolproof automated process, or take the time to properly tweak the spam settings on the server) I manually look through some of the doubtful messages to pluck out those that are not actually spam.

The most common types of spam messages caught seem to be…

5. Your credit card is blocked (enter all your details into our dodgy web site)…

4. Work from home and earn $$$…

3. Marry a gorgeous Russian girl…

2. Cheap replica watches (Rolex etc)…

1. Cheap medicine to help gentlemen with, err, size-related personal problems.

…though it appears cheap Canadian pharmacies are also gaining in popularity, despite this being for a .com.au address.

Remote server frustration

I can understand the principle of locking down web browsers on server machines, but there should at least be a straightforward way of overriding it.

The other week we were connected to a remote server trying to debug some ASPX code. That’s remote as in: on another continent, and not using the fastest connection. (It was designed to be fast for a remote population of users, not us.)

A good way to debug the code without switching on debug errors for everybody is to RDP onto the box and browse it from there.

This didn’t work because, despite Windows 2008 IE ESC (Internet Explorer Enhanced Security Configuration) not being enabled, it was blocking cookies, and every option I could find to try and turn it back on was either disabled, or did nothing.

‘Cos you know, browsing localhost (which has your own code on it ferchrissake) is a terrible security risk. Sigh.

In a rush to resolve it, we eventually resorted to downloading and installing Firefox on the machine. (I love Chrome, but its automatic updates and things scare me slightly; probably not good for a server. Some day I’ll dig around and figure out if it can be turned off. Come to think of it I should make sure FF doesn’t do the same thing.)

Firefox brought its own problems. Straight after installation, it decided to load up some hideously slow (on this less than ideal link) page with video. No, actually, two pages — using two tabs — and despite it proclaiming how fast and responsive it is, wouldn’t respond. Blargh. Thanks a bundle, Mozilla.

It must have taken a minute or more to come back — a long frustrating time when you’re in a hurry.

This solution did, however, work — we could finally see the debug messages, thank goodness.

Is there an official way of getting IE to behave itself?