I have touched this subject already twice: first I I blogged about forcing site rendering to be done with Internet Explorer’s latest engine. Then I faced a situation where separate intranet zone (bad idea, Microsoft!) fallbacks to compatibility mode and does not respect the IE=edge meta tag as internet zone web sites do.

Well… the saga isn’t over, as I faced this situation at work today. Again. I was going to put the IE=11 meta tag in place to force normal mode, but then I started to doubt how older IE’s (9, 10) would interpret the “11” tag. Short answer is: they don’t. Luckily you can specify many different modes, and the browser will pick the first one it supports. To apply this use either a meta tag in your page:

<meta http-equiv="X-UA-Compatible" content="IE=11; IE=10; IE=9; IE=8; IE=7; IE=edge" />

Or apply this IIS configuration to add the correct headers:

<system.webserver>
  <httpProtocol>
    <customHeaders>
      <!-- No need to expose the platform -->
      <remove 
        name="X-Powered-By" />
      <!-- Do not show IE compatibility view -->
      <remove 
        name="X-UA-Compatible"/>
      <add 
        name="X-UA-Compatible" 
        value="IE=11; IE=10; IE=9; IE=8; IE=7; IE=edge"/>
    </customHeaders>
  </httpProtocol>
</system.webserver>

Not nice, but works.

I’ve always been a music fan. Not a die-hard-fan, but one with lots of music and decent equipment. During the era of CD’s, I routinely bought new discs, and they accumulated in hundreds. And then hard disk prices fell and network speeds grew, and I wanted to digitize all I had. This was years ago, maybe around year 2004. I wanted everything in lossless format, as digitizing was slow and I was not going to do it again. “Alternative” media format (.flac, .ogg) support was poor in Windows world, and I chose lossless windows media audio (WMA). I spent many evenings changing the disc on my laptop, and typing album and track names when they were not automatically found from media info databases.

Fast forward almost ten years, and I have to admit I made a wrong decision: lossless WMA support is not on all devices and music servers I need. Plex Media Server is the one I would need the support most, as I use it to serve all our family media to all connected devices. It became evident, that I need a copy of my lossless audio library in some other format. I decided, that this copy can be in lossy format so that it would be easier to copy to offline devices, like my car’s radio system. And as the format needed to be something that was ubiquitously supported, I went for MP3. Luckily I found a blog post by GeoffBa that automated this task in PowerShell. I made some changes so that I can re-run the script to keep lossless and lossy folders synchronized. The script I used is attached below; I have used it about a year already without a glitch. I hope it helps someone else in my situation.

# Convert WMA files to MP3
# Creates new mirrored folder structure
# 
# Adapted from: 
# http://geoffba.blogspot.fi/2011/04/converting-from-wma-to-mp3.html
 
$tool = '"C:\Program Files (x86)\WinFF\ffmpeg.exe"'
$succescounter = $failurecounter = 0
$sourceFolder = 'M:\Media\Music'
$targetFolder = 'M:\Media\MusicMP3'
$failedConversions = New-Object "System.Collections.Generic.List``1[System.String]"

# Start by copying all source files that are already mp3 or flac
echo "Copying all files that are already in correct format"
Invoke-Expression "& robocopy $sourceFolder $targetFolder *.mp3 *.flac *.jpg *.jpeg /e"

# Find .wma files and iterate through the folders recursively
foreach ($child in $(Get-ChildItem $sourceFolder -include *.wma -recurse))
{
    $wmaname = $child.fullname
     
    # Create name for target file.
    # Note that the function is case-sensitive so we handle that first.
    $wmaname = $wmaname.Replace("WMA","wma")
    $mp3name = $wmaname.Replace("wma","mp3")

	# Change target folder
	$mp3name = $mp3name.Replace($sourceFolder,$targetFolder)
	$newFileDirectory = $child.Directory.FullName.Replace($sourceFolder,$targetFolder)
	
	# Do nothing if target file already exists
	if (!(Test-Path -literalpath $mp3name)) 
	{	
		# Create target directory if it does not exist
		if (!(Test-Path -literalpath $newFileDirectory))
		{
			New-Item -ItemType directory -Path $newFileDirectory
		}
	 
		# The argument string that tells ffmpeg what to do...
		$arguments = '-i "' + $wmaname + '" -y -acodec libmp3lame -threads 0 -ab 160k -ac 2 -ar 44100 -map_metadata:g 0:g "' + $mp3name + '"'
		echo ">>>>> Processing: $mp3name"
		Invoke-Expression "& $tool $arguments"
	 
		# Lets see what we just converted, did everything go OK?
		$mp3file = get-item -literalpath $mp3name
	 
		# if conversion went well the mp3 file is larger than 0 bytes
		if ($mp3file.Length -gt 0)
		{
			echo "<<<<< Converted $wmaname"
			$succescounter++
		}
		else
		{
			echo "<<<<<< Failed converting $wmaname"
			Remove-Item $mp3name       
			$failedConversions.Add($wmaName)
			$failurecounter++
		}
	}
}
 
# We are done, so lets inform the user what the succesrate was.
Echo "Processing completed, $succescounter conversions were succesfull and $failurecounter were not."

if ($failureCount -gt 0) 
{
	echo "List of failed files:"
	echo $failedConversions
}

I already blogged about the original platform Orchard I used to host this blog. I needed a new blogging platform, and after all the complexity I wanted something simpler and easier to upgrade.

Lately Github pages and Jekyll have drawn a lot of attention. Tipping point for me was reading what it took for Phil Haack to move his blog over. I tend to test new technology all the time, and decided to take a shot on Jekyll as a blogging platform.

Some people have gotten Jekyll to work ok on Windows. I didn’t. I spent four hours on it, but failed. Ruby was ok, Ruby gems was ok, but installing some gems failed in compilation errors, and the resolutions that worked for some people did not help me. So I installed a new Linux VM just for this purpose. I would not call that experience painless either, but at least now I have a working Github-like local environment.

First up I created a new dummy Jekyll site, and started experimenting. Everything worked like a charm: features are limited if you plan to host on Github pages, but they is enough for my blogging needs. I did not want to go the route of building locally and pushing to gh-pages, I wanted everything to be done at the server side, and only run Jekyll locally if I need to debug.

Reading the convert blogs I thought there would be a very vivid community around Jekyll themes. In the end there wasn’t too many to choose from, as most of the themes needed plugin support, and I had just ruled that out. Themes by Made mistakes drew my attention as they were minimalistic the way I like, and I ended up forking his latest creation HPSTR theme into my own repo. And it’s not just the layout: this theme has Google analytics, social share buttons, Bing and Google site tools, and lots of other stuff included.

After forking the theme it was simply changing settings and creating first posts; I was up and running very fast. I did not get the Jekyll import plugin to work, and decided to convert my post HTML’s mostly manually to Markdown. Took some time, but the only problem I had was with character sets: Github allows only UTF-8 without byte order mark, and Visual Studio wants to save the BOM if you forget to override the default.

The outcome I have right now is a good looking, typographically easily readable and responsive blog layout.

Desktop and mobile views compared.
Layout reacts to different screen sizes. Desktop and mobile views compared.

There are some layout issues that I might tweak when I have time:

  • H1 styles with a desktop browser are massive, which sometimes looks bad with my too very long blog post titles.
  • Background pattern to something else, now I use the default
  • Having the menu only on the hamburger icon dropdown might need a change: I would like to have the top level menu always visible.
  • Favicons: I moved my old, small favicon, but I also need to change the big Apple-specific favicons.

Comments to Disqus

As the site is static, I needed a new home for comments. I would have liked to support Discource, but the theme had already support for Disqus and I opted the easy way. Importing the comments was the hard part: I had to create a Disqusting, Wordpress-compatible import XML to be able to import my comments to Disqus. Created the XML and imported, and now old comments are there and commenting works as expected.

RSS as before

I already had my RSS feed at FeedBurner. Feed usage is in decline, but it does not hurt to have one. I just changed my source address to the Jekyll-generated feed.xml.

What’s missing

I lost site search in conversion: the new theme does not have proper search, and I’m considering creating an option to the theme myself and creating a pull request to the original theme.

I also lost the time-based archives view I had. That is not too big of a loss, as that revealed too easily that I do not write enough blog posts.

I can’t use Windows Live Writer to write posts anymore. That was a good tool, sadly abandoned by Microsoft.

I do not have any WYSIWYG editor, I must just hope that markdown converts into nice HTML view and all images fall into their proper places. This is not a big con, as I use only a limited set of layout styles on my blog posts.

Speed? Upgrades?

With Orchard site speed and platform upgrades were my pain points. So how did this gh-pages + Jekyll adoption change the situation? Completely, I would say:

The site is compiled after every change, and Github serves pretty aggressive cache headers out. As a result my site is very fast. Hosting is pretty far of from Finland and that can be seen in increased latency times, but the negative effect is acceptable.

Github runs the site build and hosting platform, and I do not have to take care any of that. As I forked this blog from the theme repository, I can get fixes to HTML, CSS and some of the JS by fetching from the original theme repository. My biggest risk right now is, that there migth be errors on Github build that I cannot reproduce with my local Jekyll environment, but I’ll take that risk as I can always revert to previous version with simple git commands.

When I originally started this blog I had two options: use some readymade blogging platform, or host one of the blogging platforms myself. I wanted a complete control of everything, and decided to build the blog to my own hosting. As .NET was (and partly still is) my thing, I wanted the platform to be .NET based. Sadly, none of the available platforms pleased me: dasBlog was aging and was not updated, DNN was too complex and written in Visual Basic. Luckily there was one new emerging platform called Orchard that was exactly what I wanted.

Start was nice and easy. One of Orchard’s creators Bertrand Le Roy created his own blog on top of Orchard, and blogged about the experience. There was a nice overly simplistic theme, that looked just what I was after. After some hours (days?) I had a blog running on Orchard and hosted on DiscountAsp.

Performance

A the beginning performance was a problem: as everything in Orchard was based on dynamic compilation, app restart was extremely slow. Things got better along the releases, but even the latest versions were not as fast as I would have liked. I think speed is one of the key factors in web usability, and therefore any times over one second are too long to have everything rendered on monitor (or mobile phone) glass.

Customization

Orchard is very, very flexible. So flexible, that learning curve is way too steep. I managed to make customizations and my own theme, but I never fully understood the development model. Luckily you could get pretty far with plugins and customization with the management console.

Upgadeability

This is where it all fell apart: I used almost all versions up to 1.7, and every time I upgraded it was pain. I never knew beforehand if the update would take an hour or three. One of my other sites I never got past one version as it failed with so mysterious errors that I was not able to find the reason. Still I needed to upgrade, as there were security fixes and performance fixes that I really needed. Maybe if I had gotten aboard later, the negative association of the upgrade would not have grown so big.

This is not to say, that Orchard is a poor project; it definitely rocks if you take the time to learn it. Still, it is not a simple blogging platform, but a full blown CMS.

I needed a platform change, and I’ll next blog about that.

A while ago I blogged about a recurring problem in my laptop: event log was filling with Software protection service scheduling errors, and the fix was to change one system folder’s permissions. I ended up re-installing my laptop from scratch (to Windows 8.1), and again after I joined the machine to our company domain and installed Symantec Endpoint Protection the problem re-appeared. I still do not know which - domain or SEP or both together - is the root cause, but as the problem emerged over and over again, I gave up and automatized the change. I created one batch file:

ECHO OFF
ECHO Fixing Software protection service scheduling ACL problem.
icacls %systemroot%\System32\Tasks\Microsoft\Windows\SoftwareProtectionPlatform /grant "NETWORK SERVICE":(OI)(CI)F

…and scheduled this file with admin permissions to run semi-frequently (one could also add an event log trigger to this one event). Problem solved (for now).