Category Archives: microsoft

feed your brain with some interesting podcasts

Eggs and Brains

Podcasts are a great way to pass the time while doing semi-automated and/or boring tasks like gardening, driving your car to work and back, or chores related to keeping your house nice and tidy. As long as the tasks don’t take up too much of your active grey-cell CPU you can devote those free cycles to processing some interesting auditory data making that boring chore less boring while learning something in the meanwhile. Sounds good doesn’t it?

Below I listed some of my main brain-food sources I keep going back to, which are mainly technology and science related. I listen to a lot of Microsoft .NET programming related items (guess what we use at work) and some more general programming related topics. There’s also some science stuff or generally geeky & fun things.

  • Hanselminutes: Microsoftie Scott Hanselman talks about interesting topics with a wide range of guests. Well worth the listen and not quite as Microsoftish as you’d expect. If you’ve seen one of his presentations before you know these are fun to listen to as well.
  • .NET Rocks, which is as stated mainly about .NET and related technologies. Still, Carl and Richard occasionally geek out on completely unrelated topics as well, like renewable power or flying to Mars. One of my favorites, because these shows are not only filled with knowledge but they are also great fun to listen to.
  • Herding Code: programming related podcasts about anything new & hip in the coding world. Low frequency updates.
  • Software Engineering Radio: again varied programming topics, not tied to any specific technology hosting some of the big names in the industry. Cherry pick away from their huge archive!
  • ITConversations: ICT/IT/science related. Great to pick & choose from for some brain-food variation.
  • Microsoft TechEd videos: more good Microsoft stuff. These are videos, but if you convert those to an mp3 file, you can just add them to your podcast list anyway.
  • TED videos: lots and lots of really nifty thought-provoking stuff there. Again something to convert to mp3’s or if you have an Android phone simply download the video’s using the free TEDAir app for off-line access.
  • In Our Time podcasts from BBC Radio. If you’re tired of the IT related stuff try this one to learn something new on philosophy, history, science, culture or religion.
  • Radiolab.org. Another really good podcast show about all sorts of topics. Excellent brainfood to trigger some new neural paths to form and extremely well produced. Pick up a few of these for a taste, and I’m sure you’ll be back for more.

To easily convert online videos to mp3s you can use snipmp3, video2mp3 or listentoyoutube, or install a tool from this Filehippo list. Plenty of other options out there that do the same though. I use VLC to do this myself, but it’s a bit tricky at times (read: too much to explain right here and now).

So what kind of awesome podcast do you listen to?
I’d be happy to find out and extend my brain-food diet.

Photo by Alesa Dam, cc-licensed.

square brackets not working in visual studio 2010 and how to fix that

Have that thing where your square brackets (aka the [] thingies) don’t work any more when you want to access an indexer in Visual Studio 2010?
It’s your shortcut keys that are messing with your keyboard I tell ya!

So to fix this very annoying little side effect, you go to Tools > Options > Environment > Keyboard from the menu.
Now in the text field to create a new shortcut, press the combo to get your square bracket, which is Alt Gr + ^ in my case (Belgian keyboard). That should show you which command is using up your key combination as a shortcut. In my case that’s Edit.AlignAssignments.

The VS2010 keyboard options.

Then it’s just a matter of looking that command up in the list and smacking the Remove button. That’ll teach it to mess with your shortcuts dammit!

I get the impression that these changes are only saved when you close your Visual Studio instance. So if you have more than 1 open, you have to close the one where you changed the setting in last. Otherwise, you’ll have to do this again. And again. And again….

WAS crashes IIS 7 while searching for unexisting services for msmq endpoints

And now: a no thrills .NET WCF technology post in the hope of saving some developer’s time while trying to figure out wtf is going wrong.

The problem looks like this:

Your w3wp process crashes, or your IIS application pool gets stopped for no clear reason. Restarting it only causes it to stop again after a few seconds.
Deactivating the Net.Msmq Listener Adapter in the service control panel makes the problem stop.

Your Windows event log shows errors like this:

An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/1/ROOT
Exception: System.ServiceModel.EndpointNotFoundException

Message: The service ‘~/foobarQueue’ does not exist.

StackTrace:    at System.ServiceModel.ServiceHostingEnvironment.NormalizeVirtualPath(String virtualPath)
at System.ServiceModel.Channels.MsmqHostedTransportManager.HostedBindingFilter.MatchFound(String host, String name, Boolean isPrivate)
at System.ServiceModel.Channels.MsmqBindingMonitor.MatchQueue(MatchState state)
at System.ServiceModel.Channels.MsmqBindingMonitor.ProcessFoundQueues(MessageQueue[] queues, Dictionary`2 knownQueues, Boolean isPrivate)
at System.ServiceModel.Channels.MsmqBindingMonitor.OnTimer(Object state)
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2()
at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke()
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks()
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state)
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

What’s happening:

The problem is in the Net .Msmq Listener for the Windows Process Activation Service (or WAS for short). WAS checks all your MSMQ queues on the system and tries to figure out if there are any WCF services that it should poke to start reading the messages in the queues. Problem is in the case mentioned above there are also queues on the system which do not have WCF services that process them. WAS tries to activate a service for this “foobarQueue” anyway, which results in an exception.

And here is how you fix it:

  1. Make sure all WCF services that should be processing queues are in a virtual directory on IIS. For example http://localhost/foo/foobarservice.svc
  2. The queues to process will also have to resemble this virtual directory in the queue-name, like: .\private$\foo/foobarservice.svc
  3. Set your web site’s MSMQ bindings to localhost/foo instead of just the default localhost.
    You do this in the IIS Management tool by right clicking your web site, then click Edit Bindings in the pop-up, select the MSMQ binding and edit the bindings’ information as mentioned above.
msmq binding screenshot

 

That should do the trick.
Good luck!

 

how to safely run destructive sql statements

christmas afternoon

This tip is one of those “Why didn’t I think of that before” things when I saw it being used first. You see, sometimes you’re on this production database and you need to run some SQL statements in Microsoft SQL Management Studio. Statements that if you mess them up will end up ruining your customer’s day, and most certainly yours too.
Of course you’ve already taken a backup, but that isn’t perfect. It takes time to restore those and the most recent changes might be lost. The database might also be humongous, making backup & restore operations rather annoying.

Enter:

BEGIN TRANSACTION

You know this! Before you run any statement doing anything destructive on your database, first run the BEGIN TRANSACTION statement. It feels like spring doesn’t it? With fluffy little bunnies hopping around merrily in the green grass and yellow flowers.
Whatever you run next, nothing will actually happen until you run:

COMMIT TRANSACTION

If in the meanwhile however that delete statement turns out to act like the Spanish Flue and wipes out half of the precious records stored in your database table, there’s always:

ROLLBACK TRANSACTION

Undo. Restore from last save. You don’t lose a life.
Awesome. More fluffy bunnies.

One thing to keep in mind though. As long as your transaction isn’t committed your statements will be putting locks on rows and perhaps even tables. The longer you keep those, the more chance other people’s queries will have to wait for you to release those locks and might even time out. This is bad. So keep your transaction trickery as short as possible.

For more details on those magical statements, see MSDN.

WCF service throws an msmqBinding error on a http binding

™™™™™™

So you have this WCF service with a typical HTTP binding on it. When you try to use it with a client, or when you simply open up the .svc file link in your browser, it throws an error message telling you your MSMQ binding is incorrect. MSMQ!

Contract requires TwoWay (either request-reply or duplex), but Binding ‘NetMsmqBinding’ doesn’t support it or isn’t configured properly to support it.

But it’s a HTTP binding! Of course it’s two-way!

It took me a while to figure out what was happening, but apparently it was all caused due to a typo in the binding configuration for the service in the web.config.
So when you run into this, check your web.config binding configuration for that service. An incorrect class path or class name in the service’s name attribute can be causing this effect. Also check for mismatches between the used class in the binding and the class used in the service’s .svc file.

I’m guessing the “missing binding” is causing WCF or WAS (which is installed) to try and activate the MSMQ protocol as a default oslt. I don’t get it really. So if someone reads this and understands why this misleading error occurs, feel free to enlighten me.

Photo by greg biché, cc-licensed.

install multiple windows applications at once

patient

Getting a new computer is awesome. Installing all your most frequently used and essential bits of Windows software on it isn’t. So I searched the web for something that could do this boring task for me. Computers are usually good at that. I remember using something called AppSnap in the past, but that hasn’t been updated since 2008 which makes it so 2008 that I didn’t think of using it anymore. A few well placed Google queries later I ended up with something called Ninite.

Ninite gives you a list of well-chosen and good free and open source software (I’m just saying this cause most of my personal favs are in the list), check some boxes and download a lightweight installer. After that, the installer gets the list of your preselected software and goes off to download them one by one and installs them for you. Like a nice little helper robot monkey oslt. Awesome.
Saved me a bunch of time, which I used to write this little review. Ain’t that something!

Photo by Robert S. Donovan, cc-licensed.

visual studio 2010 becomes slow after saving on Windows 7

Rust and oil inside "Niles machine tool" (HDR)

Ran into this annoying bugger of a problem with Visual Studio 2010 on Windows 7 where every time I saved a file (any file, no matter how large or small it was) the GUI started reacting extremely slow on me. Menu’s didn’t react, keystrokes didn’t appear, scrolling didn’t work. It acted like a whole bunch of stuff was going on, but nothing really was. After a few minutes or so responses where back to normal, until I saved a file again…

While it was happening CPU usage of devenv.exe was fine (very low). Cleaning the solution didn’t help either, which in some cases fixes odd VS behaviour. In short, I was at a loss. Googling for a solution didn’t really bring up a solid answer, until I found a post that mentioned something about jumplists in Windows 7 and VS 2010 being slow. In that post the antivirus software is blamed but that was not the issue in my case, since the issue only started occurring recently without any changes to my setup.

Using the Systems Internals (great tools there btw if you want to dig deeper into your Windows system) file monitoring tool I noticed that a file in a specific path was sort of hanging things. When I looked up the file it did point to those so-called jumplist thingies again. After clearing these shortcut files, VS started acting like normal again.

So, if you’re having issues with a slow VS 2010 on Windows 7 on saving, try clearing the jumplists like this:

  1. Right-click the Start button
  2. Choose Properties
  3. Uncheck both checkboxes under the Privacy group
  4. Click the Apply button
  5. Re-check both checkboxes
  6. Press OK

If you’re lucky, VS should be running smooth as butter again.

Photo by Morgennebel, cc-licensed.