Category Archives: Uncategorized

Listing installed applications on Server Core

If you have SCCM installed, a WMI object is created that provides an inventory of applications installed on a particular machine (and can be retrieved using PowerShell):

get-wmiobject -class Win32Reg_AddRemovePrograms

If you don’t have SCCM installed, the most reliable way to get this information is directly from the registry at:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

and

HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

Though I don’t personally bother with using them, there are some places around the Interweb where others have rolled the registry walk into a ps script.

I would NOT recommend using Win32_Product as it forces re-registration of installed applications, which is slow and may lead to undesirable second-order effects.

It is unfortunate that M$ has yet to develop a simple command line (or PowerShell) option for retrieving information as basic as this…

What the hell happened to StackExchange?

Earlier this morning, I was doing some work with XSLT and had a question on version support in .NET. I found the answer I needed on StackOverflow. What bothered me was the fact that the question was closed as being off-topic.

 So I went onto meta, and asked why this was. The short answer was that just because a question is popular, doesn’t necessarily mean that it is on topic. I can’t fault that logic.  But this is where I have an issue: I think that the StackExchange moderators have become so rigid in their rule enforcement, that we have lost sight of the forest for the trees. 

 In the response to my meta post, I was told: “The reason StackExchange sites are as useful to their users as they are is the rigidity with which we enforce these rules. If we simply allow the community to decide, we would end up with a site full of lol-cats and other popular content. The line has to be drawn somewhere.”  Why are we drawing the line where we do now?  I’m totally for weeding out lol-cats, but do you really think that this question is just as bad?

 It just feels that at this point, its dogma. It just seems that moderators have now become site police and any slightest deviation will be dealt with harshly. Having used StackExchange since very early in its life, I guess I’m just used to it by now. But how do new users feel, when there is a critic standing by for every question you write? It used to be a place where people could openly ask questions and things were more relaxed. Now I’m not so sure.

I don’t know what the answer is. As a guy with only a couple thousand rep on Server Fault, I guess my opinion doesn’t really matter anyway.

ASP.NET 4.5 MVC Bundling and Minification troubleshooting

ASP.NET 4.5 includes the System.Web.Optimization namespace (it can also be added via NuGet).  This library provides functionality to bundle and minify (B/M) your scripts and stylesheets.

Running some tests today, I noticed that my css image links were breaking whenever I enabled the B/M optimizations. Researching this, I realized I was using relative paths for the images in my CSS files. When B/M occurs, the pseudo path is used to resolve to the B/M’d files, which is usually different from the physical path of the files. In my case, the physical path was at ~/public/css and the B/M pseudo path was ~/bundle/css. Since my images are located in ~/public/images, the relative paths were no longer resolving.

Thinking this would be an easy fix, I changed the B/M pseudo path to mirror the physical path ~/public/css. Unfortunately, this broke my css entirely. Checking the server response, I saw that I was getting a 403.14 error.

Turns out the MVC router blocks calls for B/M files that resolve to actual paths in the project. This is expected behavior, since the router is always called first and is simply doing it’s job (duh)!

The easiest fix for this is to simply change the pseudo path to one level lower than the actual path (in my case, changing it to ~/public/css/bundle). The CSS file will then properly resolve all the relative image paths, regardless of whether or not B/M is on.

Breakpoints not hitting Visual Studio Unit Test projects

I’ve switched over to working some software development for the past few months and haven’t been too active on this blog.  Seems that there are plenty of people WAY smarter than me when it comes to coding, so I don’t usually have too much to say about the stuff (other than that I’m a good faker coder).  Anyway, was working on some unit tests for a particular class in my current project and for some reason, breakpoints were never hitting in my tests.  The solution would build without error, but the breakpoints always said ‘symbols not loaded’.

This was really driving me crazy, and since I thought I screwed up the build configuration, I ended up tearing out the test project and putting it back in, with no success.  Then looking at Test Explorer, I noticed that the unit tests were failing.  Looking at the error message, it turned out that the signature the test method with the [ClassInitialize] attribute had an incorrect signature (specifically, it needed to be public static void and have one parameter of the TestContext type).

So, long story short, a bad setup in your unit tests won’t necessarily prevent it from building, but will almost certainly prevent your tests from running.  And the Text Explorer will be more than happily tell you that you are stupid.

Internet Explorer Sucks

I know that this post deviates from my normal techno-babble, but I was so annoyed/amused by this I couldn’t resist.  I normally use Internet Explorer, mostly because I’m too lazy to bother with anything else.  But today, when browsing Microsoft Support, IE served me this:

Just to make sure that the site itself wasn’t honked, I took a look in Chrome:

I don’t know about you.  But if I was a company that had its own web browser, I would at least make sure that my own websites could be properly rendered on them!

Black login box on Windows Server 2003

If you run out of space on your Windows 2003 Server, you might end up with a login box that is black. This is addressed here:

http://support.microsoft.com/kb/906510