‘MSLinqToSQLGenerator’ fails with ‘Unspecified error’ in Visual Studio 2008 SP1 on a LINQ to SQL dbml files

Another day, another bug… at least this time it’s Microsoft bug and not one of ours! 🙂

Today’s bug is when working with the LINQ to SQL dbml files that have code behind them, if the uses statements are not inside of the namespace, the MSLinqToSQLGenerator will fail with ‘Unspecified error’.  The solution is simple, move the using statements into the code block that contains the namespace.  As to WHY this would fail, ask Microsoft.

Thanks to this article on Microsoft’s Connect site for this information.

How to tell if you REALLY know how to play a song!

So, I mentioned that I’ve started playing in a band.  One of the things I have to do is catch up like crazy.  We have an initial 18 songs, of which, I know about 8 or 9 reasonably well.  I’ve ‘learned’ another 8, so it’s down to two left.  But, that’s not the story here.  The story is how to figure out if I actually KNOW the song or am just following along with the band.  Fortunately, the drummer for the band had an EXCELLENT idea… and this to practice with JUST the drums.  So, we tried that on Sunday.  Whoa boy, talk about having to go back to the drawing board!  That is one VERY tough exercise.  Fortunately, there is a way to do that with GarageBand.  For all of my backing tracks that I’ve created, I just turned off all of the tracks except for the drum track.  And then try not to look at the screen when playing 🙂  (that’s cheating!)

How to get Powershell to connect to a remote, non-authenticated network share

Powershell is a VERY cool scripting language from Microsoft.  I’ve used it to build some of our internal web site deployment scripts.  Unfortunately, our MAIN web site is not accessible through the normal shares.  To get to the server, one must access the computer using the UNC name of something like: 


Powershell does NOT like trying to connect to a non-authenticated IP on the command line.  It keeps complaining that the location cannot be found.  Set-Location doesn’t work, as the FileSystem provider doesn’t accept the –Credential parameter.

Fortunately, a solution DOES exist.  Thanks to this post from eggheadcafe.com, I was able to build up a script that works to map a network drive to the remote computer

   1: $pwd = convertto-securestring password -asplaintext -force
   2: $cred = new-object System.Management.Automation.PsCredential "domainuser", $pwd
   3: $net = New-Object -com WScript.Network
   4: $net.UnmapNetworkDrive("newDriveLetter:")
   5: $net.MapNetworkDrive("newDriveLetter:", "\", "domainuser", $cred.GetNetworkCredential().Password)

Replace newDriveLetter with whatever drive letter you need.  Also, replace the IP and share name with whatever location you are trying to connect to.  And finally, replace the domainuser and password with whatever the user name and password is.

That’s it!

Overcoming FUD when auditioning for a band…

About 3 weeks ago, I ran across an ad looking for a guitar player for a band in my area.  Now, I’ve been LOOKING for a band for a while, but nothing has really grabbed me as the right situation.  What I have been looking for is a good, solid hard rock band that wants to be good and play out a bit, but doesn’t want to be ‘rock stars’.  So, this ad seems to be something interesting… I emailed my info, and to my surprise, I actually got a call back!  After talking with the drummer a bit, it sounded like we were on the same page.  Sooo… I get the list of songs that they know.  I figure out that out of the 18 that they sent me, I know or can quickly learn about 7 or 8 of them.  I was like, "Give me a week or two, and I’ll be ready".  Well, I didn’t get my week.  I got 4 days!  Ok, so now I’m sweating a bit.  It takes me a bit to learn songs, as I’ve been WAY out of practice, and am somewhat of a perfectionist.  In the end, I have 4 songs ready, and 3 that I can try and ‘wing it’.
The day of the audition rolls around, and everything is good.  I’ve worked on all the songs that I have ready, I’d been working with my equipment to get the right sound, and I felt fairly comfortable with the ‘total package’.  So, I get there on time and have Surprise #1… as I walk in, there’s another guitar player there!  Ack!  I’m not a competative person!  I like to compete, but having someone right in front of me does NOT help my nervousness… So, I watch the band kick into a couple of songs with this other guitarist.  And what really didn’t help was that he is an incredible player!  But, my attitude changed while listening to the band.  It went from ‘Great, they’re gonna choose him’ to ‘Hey, this band sounds really cool, and even if I don’t make it, I’ll get their name and go out and see them when they play’.  I think that put me in a much better frame of mind.  Instead of being nervous and uptight, I was feeling a bit relaxed.  I still was nervous, but what the heck?
After listening to these guys play two songs REALLY well, it was my turn…  Time for Surprise #2… I wasn’t paying attention to my amp setup.  Which meant that when I plugged in a control for my amp, I plugged it in the wrong way!  I at least get the right ‘basic sound’, then hope like crazy that nothing else goes wrong with the amp.  After what seems like forever to me, I finally get all my gear hooked up.  My nerves were already wired…  And then I notice that the other guitar player is gonna hang around.  Whoa boy… I’m feeling like ‘ugh, this is NOT gonna go well’.  The songs I have ready are a couple of ‘guitar hero’ type songs… play’em right, they sound great, miss ANYTHING, and it’s bad and noticable.
We start off with a couple of easy, ‘couldn’t forget if I tried’ kinda songs.  They went reasonably well.  I played my tricky parts good enough to make me happy, even though I felt VERY stiff.  I did the 4 songs that I had totally prepared.  They asked if I had anything else ready, and I said, I’ve got 1 more, but it probably won’t be right.  We played it anyway… and the energy level went UP a couple of notches!  I missed 1 little part, but the band didn’t stop, and I caught back up immediately.  Was there anything more that I could play?  "Well, I know the main lick to one song, and can fake the rest"… we kick into that song, and I’m relaxed, and having fun.  Who cares if I screw it up?  I gave them lower expectations for it… And it went really well!  It was a fun jam… Last song…the singer wasn’t wanted to do it, so someone offered to speak the words… well, we kicked off into the song, and the singer was like, to heck with it, it sounds good, I’ll sing it!  And it went VERY well!
So, after all the worries, nevrousness, and everything what was the outcome?  The band asked BOTH of the guitar players to join!  So, I’ve got a band now!

How to send out .eml files written by System.Net.Mail

In a previous post, I wrote up how to send emails to a directory instead of an email server when using the SmtpClient class.  But, one thing I DIDN’T write about was how to send those files out AFTER sending them to the directory.
The first thing that has to be done is add the SMTP Virtual Server to IIS.  In the Add/Remove Windows Components dialog box, highlight ‘Application Servers’ and then press the ‘Details’ button.  In the dialog that pops up, highlight ‘Internet Information Services (IIS)’, and then click ‘Details’.  In the dialog box that pops up, scroll down a bit and find ‘SMTP Service’.  Make sure that is check, then click OK through all of the dialogs. 
Once the SMTP Service is installed, go to the IIS Control Panel, and find ‘Default SMTP Virtual Server’ under the IIS Machine’s name.  Right click on the ‘Default SMTP Virtual Server’ item and select ‘Properties’ from the pop up menu.  Go to the ‘Delivery’ tab and click on the ‘Advanced’ button.  Put the host name in the Smart Host, and click OK until the properties dialogs are gone.
Once this is configured, to send out the email files, just put them in the Pickup directory, which by default is C:inetpubmailrootPickup.  As long as the SMTP server is running, the emails will be sent out automatically.
That’s it!
UPDATE:  See what happens when you write something before testing?  The directory should be the Pickup directory not the Drop directory.  Thanks to Mario for helping me figure that out!

I’m not dead (although many people *wish* I was)

No, this has nothing to do with Steve Jobs and the latest publication of his premature obituary.

This blog entry has to do with the fact that *I*’m still alive. In fact, I missed my usually ‘monthly update’. How could I possibly not write something, ESPECIALLY when my birthday fell in the middle of the month!?! Well, I plan to detail the whole story. At this point, no one’s going to be upset with me for talking about the last three/four months, and it will be good to get it out on blog.

Also, I plan to do some more technical writing. I have been getting a lot of hits for people searching for the solutions that I’ve posted on my blog. More of those to come!