Archive for the ‘Strange Problems’ Category

Migrating from DasBlog to WordPress

Due to many circumstances, I have a need to upgrade my shared hosting from .Net 3.5 to .Net 4.0. Normally this is no big deal, but I was running my blog on DasBlog, which hasn’t been officially updated since 2009, and it won’t just recompile and run under .Net 4. While there are some branches of their code re-compiled for .Net 4.0, I decided that un-tested code was not for me. I then decided on WordPress for a platform, mostly to continue expanding my horizons outside of Microsoft technology, and also because my hosting provider supports it, and I have more MySQL instances available for database use than SQL Server. I found an excellent post on migrating from DasBlog to WordPress, and used it mostly for a template on what I did, but since I did do some things differently, I decided to document my process. So below are the steps and technologies I utilized to migrate my blog.

Create a Test Environment

For my purposes, the first thing I did was create a Windows 7 virtual machine to do the migration testing. My production site is using shared hosting, so I can’t run a .exe on the server to get the content, which one of the tools I wanted to use required. I installed IIS, PHP, MySQL, and WordPress. I also made a new instance of WordPress in a virtual directory that matched the name of the virtual directory on my production WordPress install.

Set Up DasBlog Locally

I downloaded both the app files and the content from my hosting provider, then placed them in a virtual directory under IIS in my test environment, inside a virtual directory named to match the directory from production. I changed the site name in the DasBlog site.config file to reference the new location so the app would work.

Extract the DasBlog Content

I used DasBlogML to extract the data from DasBlog on the local instance of DasBlog, which outputs a blogML XML file. Some articles imply you need to remove any non-breaking spaces (   ) from the resulting XML, but I didn’t and had no issues.

Import the Data

I added the BlogML Importer plug-in to both my local install of WordPress and my production instance. I used that plug-in from the test instance to import the data and examine the results. For me it worked without issues, bringing over all the posts, comments, and categories. I had about 160 posts to migrate.

Create A WordPress theme

I am still enamored with the current look and feel of my blog which I built for myself as a DasBlog theme. I decided to migrate that HTML layout into a new WordPress theme, instead of using one of the myriad of available themes. I started with the HTLM5 Reset WordPress theme as a base and added the HTML structure and CSS from my DasBlog theme. I ended up modifying quite a few files in the theme in order to get it to work, and getting accustomed to PHP along the way.

Migrate Data and new theme to Production

I zipped up the WordPress theme directory on my test machine, and uploaded it as a theme in my production WordPress instance. Then I migrated the data using the BlogML Importer plug-in. I also had to configure the widgets in the navigation area and manually migrate some data into them.


This is where the real work for the migration begins. Since my blog has existed since 2003, I wanted to maintain my links in search engines as much as possible. I already lost this once when DotNetJunkies (where I began to blog originally) got closed down by Dr. Dobbs, and it killed my comment traffic going forward. The post by Andreas that I was following advocated writing your own Http Module in .Net to handle all the redirects. I initially thought that was the way to go, but I found out that my hosting provider has the URL Rewriting feature installed for IIS7, so I could use the config file route. I figured that would perform better than any code I would write and is likely less buggy, even though over time the code should be used less and less. It also let me handle some of the one-off pages I added on the site that looked like part of DasBlog but really were just static HTML files, as well as some other media content.

There are a number of type of pages that DasBlog uses that need redirect templates:

  • Permalink
  • Permalink by Guid
  • Categories
  • Dates
  • CommentView

DasBlogML also generated a CSV file matching up the DasBlog permalinks with the WordPress permalinks. I used that as a starting point, and also queried the blogML XML file for the guids and dates of each post, and then matched them up with the CSV file in Excel.  I then used simple formulas in Excel to generate the XML needed for a static re-write file. Because the number of rewrites is so numerous, I decided to store the mappings in an external file called “maps.config” and reference that from web.config. The basic structure (one example per type) of maps.config is:

  1. <rewriteMaps>
  2.   <rewriteMap name="StaticRedirect">
  4.     <!– Permalink –>
  5.     <add key="/blog/2011/12/16/AndroidAVDProblem.aspx" value="/2011/12/16/android-avd-problem/"/>
  6.     <!– Category –>
  7.     <add key="/blog/CategoryView,category,Mobile.aspx" value="/category/mobile/"/>
  8.     <!– Permalink by guid –>
  9.     <add key="/blog/PermaLink,guid,d280262b-e81e-496b-abde-453b6381574f.aspx" value="/2011/12/16/android-avd-problem/"/>
  10.     <!– Comment View –>
  11.     <add key="/blog/CommentView,guid,d280262b-e81e-496b-abde-453b6381574f.aspx" value="/2011/12/16/android-avd-problem/"/>
  12.     <!– Track back –>
  13.     <add key="/blog/Trackback.aspx?guid=d280262b-e81e-496b-abde-453b6381574f" value="/2011/12/16/android-avd-problem/trackback/"/>
  14.     <!– Date –>
  15.     <add key= "/blog/default,data,2010-01-04.aspx " value= "/2011/12/"/>
  17.   </rewriteMap>
  18. </rewriteMaps>

And in web.config of the DasBlog virtual directory I added the following section:

  1. <system.webServer>
  2.     <rewrite>
  3.       <rewriteMaps configSource="maps.config"/>
  4.            <rules>
  5.           <rule name="RedirectRule" stopProcessing="True">
  6.               <match url=".*" />
  7.               <conditions>
  8.                     <add input="{StaticRedirect:{URL}}" pattern="(.+)" />
  9.               </conditions>
  10.               <action type="Redirect" url="http://localhost/wp{C:1}" redirectType="Permanent" />
  11.           </rule>
  12.       </rules>
  13.     </rewrite>
  14. </system.webServer>

To get it to take effect I had to recycle the app pool of the DasBlog app. The important part of the rule is the action. By setting the redirectType to Permanent, it causes IIS to issue a 301 response for the redirect, which tells the caller this is a permanent change. So any search engine should re-write the link in their database and not start you all over again in search engine results. And any other links outside of your site will just redirect automatically.

At this point it seems the new blog is running fine and the redirects are all working. I left the DasBlog instance running, at least for a while. I’m keeping my eye on Google Analytics to see if any other hits show up on the old blog. I am not an expert as DasBlog, so if any other page types show up I’ll find out about it and fix it in the redirect file.

Posted on:
Posted in IIS, Strange Problems, Tools | Comments Off on Migrating from DasBlog to WordPress

Android AVD Problem

If you move your user profile off of your c:\ drive (in Windows 7 x64 in my case), Eclipse will no longer be able to start the Android emulator (AVD). It gives the following error message in the console:

PANIC: Could not open:  C:\Users\dave\.android/avd/myAVD.ini

This issue has been documented here, and also a few solutions. The solution that worked for me was to make a symbolic link on the command line to the directory that actually contains the AVD settings:

mklink /J "C:\Users\dave\.android" "D:\users\dave\.android"

Now when Eclipse asks for C:\Users\dave\.android it is redirected to D:\Users\dave\.android where this directory actually exists.

Posted on:
Posted in Mobile, Strange Problems | Comments Off on Android AVD Problem

Lost Standard Toolbar in Outlook 2007

I didn’t realize how much I use the tool bar in Outlook, but once it was gone, I felt crippled. I have no idea why I lost the toolbar. Corrupt file maybe? Even when I went into the Customize Toolbars dialog box, it was gone:

Missing Toolbar

My colleague Brian Cecile found the solution:

  1. Close Outlook
  2. Open your C:\Users\usernamehere\AppData\Roaming\Microsoft\Outlook directory
  3. Rename the file outcmd.dat to outcmd.dat.old
  4. Restart Outlook

Standard toolbar restored. Likely any other toolbar customizations you may have done are now gone/reset.

Posted on:
Posted in Office, Strange Problems | Comments Off on Lost Standard Toolbar in Outlook 2007

Technical Resumes and Interviews

Having done a few horrible technical reviews lately, I figured I should post a little info to help prospective interviewees out. So here are some of my pet peeves that I run across during interviews (or on resumes) that will immediately get you removed from consideration.

Listing Skills or Technologies You Don’t Know

Seems obvious, but clearly it is not. If you list a technology on your resume (especially the harder ones or ones not strictly in your specialty), I’m going to ask about it. For instance, if you list all the technologies in a project you were on, but all you did was update ASP.Net pages and someone else did the WCF/SQL Server/whatever it is, you shouldn’t list it. Technology acronyms may get the recruiter’s attention, but I am going to ask you about it, and if you don’t know it, I’m going to assume your resume is a batch of lies. I don’t have the time to figure out what you do know so I’m just going to eliminate you.

And since we’re discussing technologies on resumes, stop applying bold to the technologies and phrases in a seemingly random manner all over your resume (STOP IT!!).  While you may think it’s helping people skim through your resume, it actually harms the people reading it. So my impression of you is that you don’t understand users, and probably make poor choices when trying to build a system that interacts with people, because you can’t format a document intended for people to read.

Listing Clients as Employers

Your clients did not hire you as an employee, but a contractor. Those are very different scenarios. If you work for a contract house and worked on a project at Proctor & Gamble, P&G is not your employer. I have personally seen contractors list Microsoft as an employer because they worked on a project led by Microsoft Consulting Services. You were not an employee of Microsoft, you were a sub-contractor. You did not go through the extensive hiring process at Microsoft and pass. Someone at MS hired your company to provide developers, and not specifically to hire you. That’s not the same thing at all.

Brush up on Basics

If you are a developer whose main skill set is Java or .Net, you should know OOP basics. How about the four pillars of OOP? I am amazed that interviewees with 10+ years of experience can’t answer this question. If you know C#/Java/whatever, you should be able to tell me what the language keywords mean and their effect. I expect you to be able to write code in the interview. I don’t think you should be able to write up a connector for WIF, but some basic coding without the benefit of Uncle Google is a prerequisite.


I am consistently shocked by the number of developers who won’t express an opinion, on even the simplest of questions, like what do you like better about C# compared to language X?. I don’t want team members who won’t tell me what they think or even tell me if I’m wrong. I’m pretty sure if you can’t express your opinion in an interview you can’t work on my team.

Look up your Interviewer

Again, seems pretty basic, but it doesn’t happen. I know the recruiter gave you my name. In almost 10 years of interviews, only two people actually looked me up ahead of time. If you are reading this before I interview you, congratulations, you are on the right track, but I’m pretty sure you are the minority. This is an easy way to demonstrate some initiative.


Again, I can’t believe I have to write about this, but listening to the interviewer is kind of important. I can tell when you aren’t listening to what I say, and if you can’t listen to me in the interview, why would I think you would listen to your team once hired?

Ask Questions

If your only question is what is the project this interview is for, I’ll just assume you are just another contractor looking for a gig and not looking for a career at my company. Again, I don’t want you. If you don’t know anything about my company going in, I’m going to assume you are lazy in your work as well.

Learn About Tech Interviews

Do yourself a favor, learn about tech interviewing:

What Great .NET Developers Ought To Know

On Interviewing Programmers

The Guerrilla Guide to Interviewing

Java Posse Discussion

BlackBerry Simulator Error with SQLite and HTML5

When testing an HTML5 app on multiple BlackBerry simulators, on some of them I was getting the error:

SECURITY_ERR: DOM Exception 18

What this turned out to be was the lack of an SD card in certain simulators. The browser was expecting to use that storage space for the SQLite DB files. Once I set up the SD card for the emulator the error disappeared.

“Keyset does not exist” Error while Installing SharePoint 2010

In my continuing battle with SharePoint, I needed to set up a new development environment. This time I am constrained to using Windows 7. Clearly, this has been done before and good instructions exist. But, as is frequently the case with me and SharePoint, it just doesn’t work as advertised. I was performing an install with a local account instead of a domain account (a constraint I have no control over), which I have had issues with before. This time I got a new error when trying to create the configuration database using the new-SPCofigurationDatabase cmdlet:

Keyset does not exist

Turns out this was happening whether I tried to do a complete install with the SharePoint version of SQL Express or with a full version of SQL Server. I found one post which purported to have the solution, but it wasn’t the case for me. I think Sasha was trying to do a standalone install, which is not what I wanted. I have SQL 2008 R2 installed, and I wanted to use that instead of getting another SQL Express instance installed.

This post pushed me in the right direction. Unfortunately, I did not have the directory pointed out in the post, possibly because I was on Windows 7. For me the path was:

C:\Users\All Users\Microsoft\Crypto\RSA

The service account I was using during the install did not have permission to that directory. So I gave it Read/Write access, and was able to create the configuration databases and using the SharePoint Products Configuration Wizard to complete the setup and configuration of SharePoint.

Install SharePoint 2010 Without a Domain on a Single Server

I was trying to create a virtual machine for development with SharePoint 2010, but I wanted to have a full SQL Server available instead of using the standalone installation with SQL Express. Unfortunately, this situation is not supported unless you are using domain accounts. My VPC is not part of any domain, so the install won’t proceed (which is by design apparently). There is a well-documented workaround using the New-SPConfigurationDatabase PowerShell script, so I tried that.  That seemed to work, it ran for a while, but then I ended up with an error:

User does not exist or is not unique

I found a post on the MSDN Forums that had the right answer. When the script prompted me for credentials, I put in a local username and password, and this was accepted. Until later when the script crashed. It turns out that I needed machinename\username and password. Even though the authentication prompt accepted the credentials without the machinename, somewhere down the line the script needed the machinename and it wasn’t there. Another important item to note was that once the PowerShell script crashed, it would no longer work even if you got all the prompts correct. I needed to exit the script shell and start again.

Posted on:
Posted in SharePoint, Strange Problems | Comments Off on Install SharePoint 2010 Without a Domain on a Single Server

Connecting to TFS 2010 with Visual Studio 2008

I got error TF31002 when trying to connect to TFS 2010 with Visual Studio 2008:

TF31002 The Team Foundation Server name, port number or protocol is incorrect The Team Foundation server is offline Password is expired or incorrect.

The basic problem is that in Team Explorer, before Visual Studio Service Pack 1, you can’t enter a valid URL in the Add Team Foundation Server dialog, only a server name or IP address. Unfortunately TFS 2010 changed the URL of the server to this format: http://<servername>:<port>/tfs/, adding a virtual directory that TFS 2008 does not have. Pre sp1 this syntax is not allowed in the dialog box. Just putting in the server name produces the above error, which, in the irritating way that error messages work, is completely correct since the services can’t be found because they now reside in a virtual directory.

To get Visual Studio 2008 to connect to Team Foundation Server 2010, there are definitely some steps you need to follow. I found a bunch of mostly correct information, but nothing exactly right (beta and RC were widely available) so I figured I’d post it here.

To begin with, you need to install the following, in this order to Visual Studio 2008:

  1. Team Explorer for TFS
  2. Visual Studio 2008 sp1
  3. Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010

If you already installed Service Pack 1 and need install Team Explorer, you will need to re-apply the service pack.

Enter the URL like this:


Add a TFS Server

Now you should be good to connect to the server.

Creating VPC Networks using Windows 7 as Host

I just want to track these two great posts on how to set up a virtual private network for hosting one or more virtual machines where you may not have an actual network connection. This happens to me when I’m giving presentations (like my upcoming one at Day of .Net!) and the host and guest machines need to be able to talk to one another, even if the host machine is not on any network.

Windows Virtual PC: Network Between Host and VM Using Loopback Adapter

Windows 7 & Network Loopback Adapter Settings

Posted on:
Posted in Speaking, Strange Problems, Tools | Comments Off on Creating VPC Networks using Windows 7 as Host

Casting a Null

Found an interesting tidbit today. There is an ASP.NET page that is using session variables. The user has visited the page, and populated the session. But then the user lingers, and the session times out on a page that is not protected. The user then clicks a button, and the following line of C# code executes:

User foo = (User)Session[“bar”];

So what should happen here? An Exception? That’s what I would have thought. But not true. Since the session has expired, the session variable is now null, and you can cast a null into another data type having a value of null. Just as long as that type is nullable. So the line above is the same as:

User foo = (User)null;

which is perfectly valid.

I got the null reference exception down the line when trying to access a property of foo. So once again, defensive programming is the rule. Check your session variables for null!