Moving from dasBlog to WordPress

I've written earlier why I decided to move my site to WordPress instead choosing Jekyll or keep updating my custom code. In this post I'll go in to some details on how I moved to WordPress with the hope that others might have easier time.

Previously I'd decided to use dasBlog because it was fairly minimal and hackable. In the end I modified dasBlog in such a way that it would be hard to tell for normal users where my own code ended and dasBlog started. As it happens with so many open source projects, people moved on and now this project isn't even updated since 2012. So please move on!

Installing WordPress

As I still have some legacy ASP.Net code so I decided to host WordPress on IIS. Fortunately famous 5-minute installation claims does holds on Windows as well. You just install it through Microsoft Web Platform Installer (WebPI) and off you go, well, except few things.

  1. It's best to install and test everything on your local machine first and then move it to web host. By default WebPI uses WebMatrix server but you might want to use full IIS with all its goodies for experimentation. There are plenty of instructions on installing IIS on Windows.
  2. Search for WordPress in WebPI and choose WordPress product that has WordPress logo, avoid variants such as Brandoo. In WebPI, make sure you click on options:

    WebPIOptionsButton

    On the options screen you should select these options:

    WebPIOptionsScreen

  3. When WordPress installation dialog comes up select New Web Site instead of using default (its a good practice!) and specify some local folder for all WordPress files. WebPIWordPressOptions
  4. Start IIS, stop Default site and start wordpress site. Navigate to localhost, fill in username, password and you should be able to log on to brand new WordPress website!
  5. I would highly recommend that you move WordPress installation to a subfolder instead of keeping it in the root. This has several advantages. First, you keep WordPress files separate so during updates there are no worries for overwriting your own stuff in root. Second, in root folder your can host your own code or override WordPress behavior using URL redirects. Finally, this arrangement allows you to host other Web applications and sub-sites in to its own folders sitting next to WordPress. The instructions are very easy and your external WordPress URLs don't change by doing this.
  6. There are few essential settings you want to no set: Timezone in Settings > General and url formats in Settings > Permalinks. For permalinks I used the Custom Structure with value
    /p/%postname%/

    .

Exporting from dasBlog

The easiest way to migrate posts and comments from dasBlog is using DasBlogML tool. Unfortunately it seem to have gotten lost from Web altogether after MSDN folks decided to reorganize few things. I've put the copy I used on GitHub and for me the process went smoothly without errors. If you do encounter some issues there - are - few - posts out there for help.

Importing to WordPress

While WordPress doesn't have any built-in way to import BlogML content, there is a plugin BlogML Importer. Again, this plugin hasn't been maintained and is broken with current version of WordPress. So I forked it on GitHub and updated it with the fix. You just need to install original plugin and overwrite files I've on repository. Also look at this article for tips.

Cleaning Up the Markup

Over the period I'd use quite a few tools to post to my blogs and some of these produced a really messed up HTML. So one thing I needed was to clean up the markup in my posts. The Tidy2 plugin that can be downloaded from within Notepad++ is a godsend for this purpose. However you might need to invest significant time in configuring it. I've put the Tidy2 config that I tweaked for hours at Github. This config is fairly robust and does good job at cleaning bad markup in HTML fragments, even those awful MS Word extensions.

Managing Redirects for the Old Links

One of the things I care about a lot is making sure that links on my website remains valid during the moves. I've practically obsessed over this even if this website is not popular and there are hardly any old links out there pointing back here. But still, I have 301 redirects from all the way back from year 2000 so even those links remains valid today after 3 major technology stack changes. With IIS Rewrite Maps things have become much more easier. Here's what I did: Create a file that looks like below with list of URLs for individual posts dumped from the DasBlogML tool plus others you add manually. For categories you should have one URL for each category in dasBlog.

 <rewriteMaps>
	<rewriteMap name="ShitalShahV3Redirects">
		<!-- redirects for the pages -->
		<add key="/aboutme.asp" value="/about/author/"/>
		<add key="/aboutme.aspx" value="/about/author/"/>
		<!-- etc -->
		
		<!-- 401s detected from Google Webmaster tools -->
		<add key="/?s=CategoryView.aspx" value="/p/category/" />
		<add key="/blog/CategoryView.aspx" value="/p/category/" />
		<add key="/?s=content/AllComments.xml" value="/comments/feed/" />
		<add key="/?s=CommentView.aspx" value="/comments/feed/" />
		<add key="/blog/content/AllComments.xml" value="/comments/feed/" />
		
		<!-- redirects for the feeds -->
		<add key="/blog/SyndicationService.asmx/GetRss" value="/feed/"/>
		<add key="/blog/SyndicationService.asmx/GetAtom" value="/feed/atom/"/>
		
		<!-- Redirects for categories -->
		<add key="/blog/CategoryView.aspx?category=AI" value="/p/category/machine-learning/" />
		<add key="/blog/CategoryView.aspx?category=Announcement" value="/p/category/personal-news/" />
		<!-- etc -->
	</rewriteMap>
</rewriteMaps>            

Now you can put reference above map in your web.config. Below example also takes care of other URL patterns that dasBlog had. This however does not take care of guid based URLs that dasBlog had as permalinks. Unfortunately its just too much effort to mine theme and map them to new WordPress URLs. I used Google Webmaster Tools to find external guid links that were getting 404s. For me there were only couple so it was a quick fix.

<system.webServer>
	<rewrite>
		<!--Include the map -->
		<rewriteMaps configSource="ShitalShahV3Redirects.config" /> 
		<rules>
			<!-- If we find match in the map then just that -->
			<rule name="dasBlogTitleRedirects" stopProcessing="true">  
				<match url="(.*)" />  
				<conditions>  
					<add input="{ShitalShahV3Redirects:{REQUEST_URI}}" pattern="(.+)" />  
				</conditions>  
				<action type="Redirect" url="{C:1}" appendQueryString="false" redirectType="Permanent" />  
			</rule>                   
	
			<!-- Redirects for various URL patterns that dasBlog provided -->
			<!-- date based URLs -->
			<rule name="dasBlogDateRedirect" stopProcessing="true">  
				<match url="^blog(.*)" />  
				<conditions>
					<add input="{QUERY_STRING}" pattern="(?:^|&amp;)date=(\d+)-(\d+)-(\d+)(?:&amp;|$)" />
				</conditions>                                     
				<action type="Redirect" url="/p/{C:1}/{C:2}/{C:3}/" appendQueryString="false" redirectType="Permanent" />  
			</rule>
			<!-- month based URLs -->
			<rule name="dasBlogMonthRedirect" stopProcessing="true">  
				<match url="^blog(.*)" />  
				<conditions>
					<add input="{QUERY_STRING}" pattern="(?:^|&amp;)month=(\d+)-(\d+)(?:&amp;|$)" />
				</conditions>                                     
				<action type="Redirect" url="/p/{C:1}/{C:2}/" appendQueryString="false" redirectType="Permanent" />  
			</rule>
			<!-- year based URLs -->
			<rule name="dasBlogYearRedirect" stopProcessing="true">  
				<match url="^blog(.*)" />  
				<conditions>
					<add input="{QUERY_STRING}" pattern="(?:^|&amp;)year=(\d+)(?:&amp;|$)" />
				</conditions>                                     
				<action type="Redirect" url="/p/{C:1}/" appendQueryString="false" redirectType="Permanent" />  
			</rule>
			<!-- Any other URLs -->
			<rule name="dasBlogRootOtherRedirect" stopProcessing="true">  
				<match url="^blog\/(.+)" />  
				<action type="Redirect" url="/?s={R:1}" appendQueryString="false" redirectType="Permanent" />  
			</rule>
			<!-- Blog's root -->
			<rule name="dasBlogRootRedirect" stopProcessing="true">  
				<match url="^blog[\/]?" />  
				<action type="Redirect" url="/" appendQueryString="true" redirectType="Permanent" />  
			</rule>
			
			<!-- main website old redirects -->
			<rule name="defaultAspxRedirect" stopProcessing="true">  
				<match url="^(default\.asp[x]?)$" /> 
				<action type="Redirect" url="/" appendQueryString="true" redirectType="Permanent" />  
			</rule>
			
			<rule name="wordpress" patternSyntax="Wildcard">
				<match url="*" />
				<conditions>
					<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
					<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
				</conditions>
				<action type="Rewrite" url="index.php" />
			</rule>
		</rules>
	</rewrite>
</system.webServer>

Themes, Plugins, Pages, Commenting and General Organization

I'll write more detailed post on how to find programmer-friendly themes and essential plugins to make WordPress more hackable in a separate post (the short answer is I'm using Decode for the theme). However eventually question will come and haunt you if you should use page or post for X where X = photo albums or your projects or articles and so on. I eventually settled on the principle to use post for pretty much everything except for few rare cases such as About and Disclaimer. The primary reason is that posts can be categorized which ultimately appears as navbar on my website. Also I've stopped treating posts as immutable pieces of textual stream that they were decade ago in RSS word. Instead I look at them as evolving articles that gets refreshed as new information becomes available. Just that underlying principle has helped me to clear up my mind about using posts as opposed to pages for most scenarios.

I decided not to write my own gallery code or use WordPress's built-in option (which I think is pretty bad). The thing is that photo galleries are finally becoming sophisticated enough that just like blog engines they would take a lot of your time to do them really well. That's the time you could have been working on more interesting problems. So I left hosting of photo galleries to PicasaWeb (with Flickr - they are offering whooping 1TB for free!). The way this would work is I will simply create a post for new albums that will have description and link to PicasaWeb and/or Flickr.

Next thing to get rid of is hosting my projects, binaries and code on my website. Github has evolved to be an obvious choice to browse, view and download so there is now little point in creating my own stuff to do the same thing. So again, the strategy is to create a post for each new project that points to my repos on Github.

Finally I also decided to dump built-in commenting system of WordPress. For an experiment I'd left it turned on for few weeks and I got 150 spam comments. It's huge pain to clean that up and disappointing that even in 2014 WordPress out-of-box comment system is just not usable. There are plugins like Akismet but its not completely free. The next obvious option was Disqus. They have proven that they can scale, they are robust, have great community support and most importantly, they allow exporting all your data so you can switch to something else if you want to. Despite of all these positives, I did encountered few unhappy moments. For example, current markup injected by Disqus actually doesn't validate for HTML5. This is super bad for product that is almost viral. I contacted their support which apparently didn't consider that was an alarming issue and asked me to post it in their community forums where all their devs handout. Huh? Why can't their support just forward it to their own devs instead of me having to find them in their public forums?

Where Do You Host This Thing?

I'd WebHost4Life as my hosting provider for very long time. However recently they have been going downhill. Their control panel is ancient and a mess of Frankenstein apps. They haven't yet gotten around to supporting latest versions of .Net, IIS and so on. Just doing FTP on their servers gave me nightmares by frequent errors and disconnections. Plus their prices are no longer competitive. So I took this opportunity to check out all the cloud providers. It turns out that none of the popular providers (Amazon, Rackspace, Azure) has a viable option for low traffic website like this one at a price that is comparable to something like WebHost4Life (while Azure has option for free website, they don't allow custom domains). Even after recent price cuts from Google, Azure and Amazon hosting website like this can easily cost $30 per month and that's with severe limitations on bandwidth, storage and compute. So I reverted back to finding regular web hosts and zeroed in to SmarterAsp.net folks. These guys are just great. They really have very modern control panel, nice support, easy to manage emails, multiple websites, databases, FTP and so on. Plus their advertised storage and bandwidth is unlimited which had been my primary criteria even though it really doesn't mean that in practice. I just don't want my users to see errors "This website has exceeded its bandwidth quota" ever.

Deploying to Production

Finally its time to move your localhost WordPress installation to actual web host. How do you do it? It turns out that there is no built-in easy way. Sure, you can export your content as archive and import somewhere else but what about all the themes and plugins and customizations you had been doing all along? Fortunately there is fantastic WordPress plugin called Duplicator that worked like a charm in my case. It moved everything without a hitch to my actual server.

Surviving Windows 8 First Encounter

After installing Windows 8 you might quickly find yourself at unease at doing few things the old way or “cornering” the mouse too much. The answer to your frustration is keyboard shortcuts! There are many but below are the ones that would save the day:

Windows + D Jump to Desktop mode
Windows Switch between Start screen and last app
Windows + Q Search Apps
Windows + W Search Settings
Windows + X A popup menu for power users  (Command Prompt, Control Panel, File Explorer, Computer Management etc)
Alt + F4 Close app (Metro app doesn’t have close button)
Windows + E Open explorer
Windows + R The good old Run dialog
Windows + C Open Charms bar (allows you to quickly go to Settings and Search options for the app)
Page Up/Down Move around tiles on Start screen
Ctrl+Shift+Esc Task Manager
Windows + Tab Recent Metro apps
Right Click on Tile Options for uninstall, pin, unpin, size etc
Windows + Z or Right Click inside Metro App Show App specific bar (for example, open file, play button etc)
Windows + . Snap metro app on left

Groups, Places and Collectives for Makers in Seattle Area

We went to Mini Makers Faire in Seattle today and one of most surprising thing I learned was how abundant are the local
resources for hackers and makers! Reminded me of geek fairy tales of Homebrew Computer Club that you often hear. Here are some of the things
you want to check out if you are interested in making stuff and live in Seattle area:

  • Metrix Create: Space – I think this was the coolest thing I came to know about.
    They have a shop with everything from sewing machine to electronics. They run lots of interesting workshops & classes. It’s your neighborhood fab lab!
  • Make Seattle Meetup Group – Regular meet ups for Arduino/electronics makers and
    learners to exchange ideas and get help on your projects
  • West Seattle Tools Library – I thought this was the coolest concept. They have a
    collection of 1500 tools that you can checkout for your projects. Just look at their tool of the week series. There is also Fixers Collective who meet up at Tools Library and would be happy to fix your broken stuff or just
    tinker around.
  • Xbot Robotics
    Workshop Space
    – They provide you space to work on your projects along with access to almost everything you need such as
    power tools, soldering stations, oscilloscopes, electronics components, drill presses, sand blasters, table saws, sanders,
    grinders!

There were quite a few of cool things we saw there everything from The
Brain Machine
, Zigduino, Lifesuit, Drawbots, to The Most Useless Machine Ever.

I also jotted down the next classes I want to do at Pratt and All Metal Arts.

Tomato Firmware for Router and Comcast Cable Modem

Just a note… if you have Tomato installed as firmware in the router and Comcast cable internet then try followings:

  1. Disconnect cable modem and router and wait until their lights go off. For Comcast modem it takes fair bit of time because of internal battery.
  2. If Internet connection is still lost then connect your computer directly to cable modem. If this doesn’t work then you need to call Comcast at 1-800-COMCAST.
  3. If above works then the problem is that your router isn’t syncing with cable model. To confirm this, log in to router login page usual http://192.168.(0 or 1).1. See the status in overview. If this status is "Renewing…" and never changes then disconnect cable co-axial wire going to model. Turn off cable model. After all LEDs goes off turn it back on. Reconnect cable co-ax to it.

Intel Xeon – the worse branding ever?

This is really frustrating if you didn’t knew. Intel likes to call many of their processors for “business class” systems “Xeon”. When they say Xeon it can mean anything from those dinosaurs based on Pentium II and the latest and greatest ones based on on Core i7. So when you see a system built with Xeon processor you really need to look up its exact subtle number and carefully study its specs to figure out what it really is.

For example, Xeon W3520 is same as latest Core i7-920, including the price. The only difference between two is Xeon supports ECC memory. So what’s the point in branding this processor as Xeon instead of Core 2 i7?

BTW, new Intel Core i7 series is definitely a winner and finally makes 2 year old Intel Core 2 series actually obsolete. This processor can execute 8 threads simultaneously and supports 3 channels for DDR3 access tripling the RAM bandwidth! Best of all, it costs more or less same as older Core 2 processors.

Solving Shared Notebook Sync Issue With OneNote 2010

Since about 3 years we used Groove to share calendar, notes and files within family – until I discovered a feature in OneNote called “Shared Notebooks”. The Shared Notebooks are just like any other OneNote notebooks with a difference that they get synced with other people! If someone added new note or modified a note you get it next time and vice a versa. On conflicts it created new pages and also you can take automated backups. This feature requires either file share or SharePoint. So I’ve now got my personal SharePoint website on Internet (which costs $10 per year) to host our shared OneNotes as well as our shared calendar that gets synced in Outlook.

Unfortunately in OneNote 2010 Technical Preview, the sync stopped working because OneNote for some reason does not popup a dialog to ask for a password to connect to SharePoint website on Internet anymore. Very troublesome. But here’s the work around I’ve found:

  1. Right click on the Notebook, select Properties.
  2. Click on Change Location button.
  3. Type URL of your SharePoint website. This will popup password dialog.
  4. Cancel all dialogs and sync! It should work now.

So, which digital photo frame is the best?

If you are in the market to look for Digital photo frames this note will hopefully save you some time. It's really frustrating to buy one of this when selection is so large. This is very nice Christmas gift to your loved ones. I take lots of photographs but rarely have time to actually see them. So they are excellent gadget even if you want to buy for yourself!

One of the coolest feature in new frames is wireless connectivity to Internet. You can throw RSS feed from flickr or other photo sharing websites and the frame will download the new photos automatically. Some frames would even allow you to specify tags in Flickr for the photos you want to see in frame. So imagine your parents or grandpa suddenly see your trip photos in their photo frame as it is occurring! This the way photo sharing is supposed to be.

There are two major services that most of these digital frames supports: Windows Live FrameIt and FrameChannel. These services helps deliver even more stuff like weather and news in your frame.

There are quite a few vendors offering these types of frame. Some of the current models (11/2008) are:

Lots of choices! To make filtering easier I would suggest to eliminate anything below 15" size. Those sizes (8" and 10") are typically only useful if you want to put frame on the desk just couple of fit away from you. Also frames below 15" will have resolution of 800X600 at best which is not all that good. Even the low end laptops have 15" screen and run at 1028X768 so you can put your laptop where you want to place frame and see how it looks.

In above bunch so far only two frames are 15" or bigger. One from Digital Spectrum and another from PhotoVu. The PhotoVu ones are actually even larger and really expensive ($700+) so for most people only descent choice may be Digital Spectrum MemoryVue MF-8115. There you go, that's the best value frame as of Thanksgiving 2008!

What about the future? Actually if you look at of lot of deals around you will see that LCD displays as big as 22" can now be bought for under $170. So I would predict that bigger frames especially in 15" to 19" range would be under $200 by Thanksgiving 2009. Most of above manufacturers who still don't have 15" models would probably have them pretty soon. Another important note is that life space of LCD frames is not very huge. Most manufacturers aren't releasing this data but depending on brightness levels it can be as low as 20,000 hours. Now that comes out to just above 2 years. So don't consider these frames as your long term investments.

Do you really need 1080i or 1080p or 1440p?

This study basically says that if you have 50" TV and you are watching it at about 9' of distance then 720p has all the resolution human eye with 20/20 vision can ever see!

Currently we use 80X40 screen through our Panasonic projector PT-AX100U. Now that's equal to almost 4 of your tiny 50" screens so certainly 720p won't be enough at our current viewing distance of 10' (our current screen size is limited because of wall size and I think the projector is perfectly capable of going up to 100" diagonal). Actually at that size looks like even 1080p won't be enough. The 1080 runs out its steam at just 76" screen.

For now we will probably stick with our 720p projector though. The 1080p projectors are still super expensive right now($2500+)! Whoever said current HD technology is "enough"...

Run As... is back in Vista!

Yes, this dearly missed shell context menu item is now available again in Windows Vista, thanks to Mark Russinovich. This little new utility is a new addition to Sysinternals toolset and can be downloaded here. Just run ShellRunAs /reg to register context menu for Shell "Run as different user". This menu will then be available in Start menu items as well as Windows Explorer right clicks :).

VistaRunAs