• Migrating from Blogger to Jekyll and GitHub Pages

    I’ve been in a bit of a blogging slump the last few months. Partly because I’ve been particularly busy, but also I’ve been a bit frustrated with Blogger. I used Windows Live Writer (later Open Live Writer), but sadly after all the effort to make it open-source, the project has kind of floundered with no one apparently leading the project now.

    So what to do? Well maybe it’s time to move to a different platform. I’d see a few people with their blogs on GitHub, and after a bit of research I settled on using Jekyll with GitHub pages.

    How I migrated from Blogger

    I followed this useful checklist - https://thefriendlytester.co.uk/2017/07/blogger-to-jekyll-migration-timeline. Note that the jekyll-importer does not convert Blogger content to Markdown (that had me confused for a few hours).

    I stuck with the same URL format for posts, so that should mean no broken links.

    I made use of Windows Subsystem for Linux to run Jekyll locally (as I’d read it wasn’t so easy to get running natively on Windows). See below for more details of getting that all running.

    Update Cloudflare to point to flcdrg.github.io - https://blog.cloudflare.com/secure-and-fast-github-pages-with-cloudflare/

    Update FeedBurner settings to point to new source RSS feed.

    What I forgot

    I use dlvr.it to post to Twitter about new blog posts. I should have disabled that as it got confused by the change and thought I’d posted some new articles.

    Still to do

    The Blogger migration only copied text. Images are still living in their original locations. It would be good to migrate them over too.

    My old blog had a nice Archive/history listing. I’ve started looking at Jekyll equivalents, but not found one that’s similar yet.

    Getting Jekyll running on WSL

    sudo apt update
    sudo apt upgrade
    sudo apt install ruby
    sudo apt install ruby-dev
    sudo apt install make gcc
    sudo apt install g++
    sudo apt install zlibc
    sudo gem install pkg-config -v "~> 1.1"
    sudo apt install libxml2-dev
    sudo apt install libxslt-dev
    sudo gem install nokogiri -- --use-system-libraries
    sudo gem install jekyll-import
    sudo gem install jekyll

    With my locally cloned Git repo at C:\dev\git\flcdrg.github.io in Windows, in WSL I could change to the equivalent path at /mnt/c/dev/git/flcdrg.github.io, and then run jekyll server.

    Anything else?

    Let me know in the comments if something is broken that used to work!

  • Find where an object is unintentionally being converted to a string

    I’ve been applying the Replace Primitive with Object pattern to a code base - changing what used to be strings into a custom type (which not only makes the code more readable, but now ensures through type safety that you can’t accidentally pass in any old random values to methods that used to just take strings.

    The code has tests, and after applying the refactoring, I have a failing test - which hints that somewhere there’s an implicit conversion from the new strongly typed object back to a string. The test’s failing assertion says it received “MyNamespace.TypedThing” (which is what the default implementation of ToString() returns), rather than the wrapped string value that TypedThing encapsulates.

    My initial suspicion is that there’s probably code similar to this that’s causing the problem:

    TypedThing thing = new TypedThing("thingy");
    string s = $"{thing}";

    ReSharper has a cool utility - “Structural Search and Replace”. Unfortunately it doesn’t work for single expressions like "{thing}".

    If I was cluey, I might be able to write a Roslyn tool to search the code and find instances like that, but that’s going to take a bit more effort than I want.

    What about this: temporarily override the ToString() method on my custom type, and make it throw an exception!

    It’s a bit of a sledgehammer, but it worked!

    As it turns out my suspicion was not quite correct. The offending code was actually assigning the custom type to an Object type (which explains the lack of compiler type warnings), which later on must be converted to a string.

    Now that I could see an example, I could use ReSharper’s SSR to confirm that was the only instance of that kind of assignment (SSR can be used as I’m searching for an assignment statement, not just a single expression). Just for good measure, I’ll also re-run the entire test suite to make sure there aren’t any other similar problems still hiding.

  • Choco list -localonly (Feb 2019 Edition)

    What software / applications am I using on my laptop (February 2019 Edition) according to Chocolatey? Here’s an edited list of the output from choco list -localonly:

    Package Version   Comments
    7zip 18.6    
    audacity 2.3.0 Audio editor  
    becyicongrabber Icon extractor (for creating Chocolatey packages)  
    beyondcompare My favourite file comparison tool  
    beyondcompare-integration 1.0.1 Configure Beyond Compare for TortoiseGit/Svn  
    dellcommandupdate-uwp 3.0.0 Dell’s driver update app  
    dns-benchmark 1.3.6668.0 Useful DNS checker  
    dotnetdeveloperbundle RedGate’s .NET tools  
    dropbox 41.4.80    
    fiddler 5.0.20182.28034    
    FiraCode 1.206 Nice developer font  
    Firefox 57.0.4    
    git 2.20.1    
    GoogleChrome 63.0.3239.132    
    keepass 2.41 Password manager  
    mousewithoutborders Share mouse across laptop and desktop PCs  
    msbuild-structured-log-viewer 2.0.61    
    nodejs 11.9.0    
    notepadplusplus 7.6.3 Using this less now compared to VS Code  
    nuget.commandline 4.9.2    
    obs-studio 22.0.2 Video / screen recording  
    OctopusTools 5.2.0    
    Office365ProPlus 2016.20170321    
    paint.net 4.1.5    
    PDFXchangeEditor 7.0.328.2 My favourite  
    Pester 4.4.1 PowerShell unit tests  
    pingplotter 5.8.10 Useful visual ping network status  
    powershell-core 6.1.2    
    procmon 3.50 SysInternals Process Monitor  
    resharper-clt.portable 2018.3.2 ReSharper’s free command-line tools  
    resharper-ultimate-all 2018.3.2    
    screentogif 2.16 Handy screen recorder  
    snagit 2019.1.0 Screen grabber  
    sql-server-2017 14.0.1000    
    sql-server-management-studio 14.0.17289.1    
    tailblazer Text/log file viewer  
    ubiquiti-unifi-controller 5.9.29 Software for managing UniFi wireless access points  
    vagrant 2.2.3 Manage virtual machines  
    visualstudio2017enterprise 15.2.26430.20170605    
    visualstudiocode 1.19.3    
    vsts-cli Command line tool for managing Azure DevOps  
    vswhere 2.6.7    
    wifiinfoview 2.42    
    windirstat Where’s all that disk space being used?  
    wireshark 2.6.5    
    x-lite VoIP client  
    yarn 1.13.0    
    zoomit Great for presentations  

    This is also a good basis for refreshing my Boxstarter scripts.