by Bjørn Storkholm
29. June 2009 19:25
The last year or so, I’ve had a problem just about every time, I’ve restored a database that was backed up from another server. After every restore, the applications I’ve been working with, throws an exception with authentications errors. The last project I worked on, we could solve this by deleting the user from the DB and add again. A pretty weird solution, but it worked. But today I ran into the same problem, on another application, where I wasn’t able to delete the user for some reasons. So what to do? It would be nice to find the right solution to this topic, and not just the workaround I’ve been using previously.
The last few months I’ve had the pleasure of working with Erik Ejlskov, who knows a lot about MSSQL Server, so why not just ask him? As usual he was just about, to send a mail to everybody in the office with a solution to this.
If you get the failing authentication, after restoring a database, run the following sproc:
EXEC sp_change_users_login 'Update_One', '[username]', '[username]';
I wonder what Update_One means, maybe Erik can give an answer to that tomorrow. Anyway it works, and I wish that I'd known this before, since it's really been bugging me.
by Bjørn Storkholm
28. June 2009 17:30
Who can show the worst code ? Recently I ran into something like this:
public string[] GetSomeVeryStupidArray()
{
Dictionary<string, string> customers = GetCustomers();
string[] list = new string[customers.Count];
list[0] = customers[Constants.FirstConstant];
list[1] = customers[Constants.SecondConstant];
list[2] = customers[Constants.ThirdConstant];
return list;
}
private Dictionary<string, string> GetCustomers()
{
string[] customers = new string[]
{
Constants.FirstConstant,
Constants.SecondConstant,
Constants.ThirdConstant
};
Dictionary<string, string> values = new Dictionary<string, string>();
foreach (string name in customers)
{
values.Add(name, name);
}
return values;
}
internal class Constants
{
internal const string FirstConstant = "FirstConstant";
internal const string SecondConstant = "SecondConstant";
internal const string ThirdConstant = "ThirdConstant";
}
Obviously I rewrote this a bit, so I don't offend the person who accually wrote it, but what the f*** is going on ??? I found code similiar to this, in accual production code. The worst part is, that I saw, that some other developer has been copy pasting these methods into new areas of the application we're working on, without even thinking about, what it is he's pasting.... Only two days left...
by Bjørn Storkholm
20. June 2009 14:46
About a year ago, I saw some quite awesome videos on youtube, demonstrating how cool Ubuntu is. Looks really really COOL.
I thought I ought to give it a shot, but apparently I'm not a very lucky man. Last year I tried to install Ubuntu 8 on my Lenovo T61P... damn display drivers not supported. Spent quite a while googling, and the only thing I found was, that others with the same laptop had the same issue.
Recently Ubuntu 9 was released, and I thought to give it another shot. This time I'd install it on my MacBook Air.... IO device error on reboot after installation.... that sucks!
Installing Windows7 on it again, since I know it works!
Update 20090622: Somebody at the office asked me, if I really do waste time on stuff like this. The answer is yes, I waste a lot of time, on a lot of ridiculous things. The youtube video, that really kicked of my curiosity on ubuntu can be found here: Vista vs. Ubuntu