Today I wrote my first MsBuild script that uses sqlcmd.exe to execute SQL Server commands remotely. It is awesome. Although it is fairly limited, for tasks like backing up databases, it is very simple and easy.
<Target Name="Backup">
<Exec Command='sqlcmd -S $(server) -q "$(sql)"' />
</Target>
Matt: I wonder if SPAM is good, I have never had it before (while holding up a can of SPAM).
Me: Ya, haven’t you ever fried SPAM before?
Matt: Only at the gateway level.
Oh the joys of working for an email company.
I downloaded Amazon’s Unbox this weekend to watch some BSG (yes I am a nerd). Unbox is Amazon’s video download service. I say service because it is much more than just another download. Amazon allows me to re-download videos or transfer them to multiple machines. Obviously, the Unbox player doesn’t allow burning to DVD, but I am over my purist-open-world days.
As with any service, there is room for vast improvements. The software is slow and buggy, but not bad enough to piss me off, which means it is still very usable. Also, the software only works on Windows XP or Vista, which is annoying for me because I run Ubuntu and Windows. In the future, software for linux that could be integrated with MythTV would be stellar-sweet. (Something tells me the suits are worried about the ability to rip the videos easier in linux).
All things considered, it is exactly what I wanted when my craving for season 4 of BSG got the best of me. I can’t compare it to similar services, but it is worth trying if you don’t care to hook your laptop up to your TV and pay $1.89 an episode.
Today I found some odd behavior when working with LINQ. It is hard to describe, so here is the code.
public void Foo(IEnumerable<string> strings)
{
IEnumberable<string> stringsInDb = strings.Where(s => this.QueryTheDbAndTakeALongTime(s));
foreach(string str in stringsInDb)
{
//Where clause in LINQ is actually executed
}
foreach(string str in stringsInDb)
{
//Where clause in LINQ is actually executed AGAIN
}
}
Luckily, some unit tests detected this behavior. It actually isn’t surprising when you think about it though. The proper thing to do for this case is actually call ToList() after the Where().
IEnumberable<string> stringsInDb = strings.Where(s => this.QueryTheDbAndTakeALongTime(s)).ToList();
Don’t let this behavior bite you.