• Custom MSBuild Tasks (Or, How To Update Your Content On Build)

    If you've ever wanted to dynamically replace some kind of content in your Visual Studio projects on compilation / build, a powerful (and not too difficult) way of doing it is creating your own MSBuild Task. In the past, this meant writing a custom Task with all its associated code, but with .NET 4.0 or later, you can actually make your own Tasks inline, right in your .csproj file. Straight into … more

  • Debugging the Angular JS Routing Lifecycle

    On the first day at my new job at Tailster, I threw myself at diagnosing an Angular JS bug, despite my general lack of knowledge and experience in Angular. Long story short, if you ever need to trace what route and what controllers are being called, you can add the following code to your your rootscope function: $rootScope.$on('$stateChangeStart',function(event, toState, toParams, fromState, … more

  • Things I Miss About Taipei Now That I Live In London

    So I live in Camden, North London now - and as you'd expect, things get a little different when you travel 10,000 kilometers. My first impressions of London are that it's a vibrant, global city with a deep heritage...but there's some things I wish it would take from Taipei. I really miss 7-11. I miss being able to print random documents on the cheap; our local option is £1 a page, which is 25 … more

  • I Don't Like The Ice Bucket Challenge

    There, I said it. But to clarify; I'm not against research and working towards a cure for Motor Neurone Disease, or funding such programs. Putting aside the fact that apparently the original challenge has the Ice Bucket option to avoid donating to the cause, and the Zizekian objections I have against charity in general, the main reason why I don't like the Ice Bucket Challenge is in the way it' … more

  • Pro-Tip: MVC Bundling Gotchas - Minimized Files and Stylesheet Order

    A few quick tips for anyone who's attempting to add scripts or stylesheets via bundling in ASP.NET MVC and wondering why things aren't working. Minified Items Say you have the following in your App_Start\BundleConfig.cs: bundles.Add(new ScriptBundle("~/mybundle/sample").Include( "~/Content/Scripts/modernizr.custom.min.js", "~/Content/Scripts/site.src.js" )); … more

  • Skritter: Day #913

    That's more than two years of which I spent on average 16.03 minutes a day practicing Chinese, with 1629 characters and 2369 words under my belt; so that puts me roughly around Level 5 in HSK terms. According to the HSK, Level 5 is: Designed for learners who can read Chinese newspapers and magazines, watch Chinese films and are capable of writing and delivering a lengthy speech in … more

  • Upgrading Orchard 1.7 to 1.8 - Add That User!

    My blog has been revived, on Orchard instead of Wordpress (mainly because, well, I like having the option of jumping into the CMS code and ripping it to pieces if I so desire). It'd been sitting around on 1.7 for a while, but I finally moved all the old posts and upgraded to 1.8. It's all very painless; but if you don't want to be poking around updating entries in the .sdf, then make sure you … more

  • Orchard CMS: HQL, Or How To Query Based On Content Fields

    I know, I know; you're thinking - "Why do I even need to write my own queries, when there's a perfectly awesome Query and Projection module in Orchard I can leverage? Well, if you're building an event calendar, for example, you might want to generate your queries on the fly based on query string parameters; in which case, I don't know if creating a bunch of Query items is the nicest way to go. ( … more

  • Orchard CMS: Using A Static ViewModel For Your Driver Display Method

    If you look at all the documentation about rendering shapes in Orchard, you'll see that while the Model for the partial view gets specified for the Editor methods (via shapeHelper.EditorTemplate()), all the examples I came across for Display relied on a dynamic method and generated model. For example: protected override DriverResult Display( MapPart part, string displayType, dynamic … more

  • Orchard CMS: How To Create Content In Your Module Migrations.cs

    While I'm on an Orchard streak, here's something else that I felt sounded easy on paper, but wasn't well documented. In the form of a question - "How can I create content (pages, widgets, whatever) when my module is activated?" To create all content (which again makes judicious use of dynamic objects, since Orchard has no idea what sort of content is being created at compile time / the … more

  • Orchard CMS: Conditional Field Rendering

    Following the theme of "wow, that should be easy, but it's not as fast or easy as you'd think", here's my post / answer to the question "How can I show / hide a field on a content type based on the value of another field"? If you've read about shapes in Orchard, and how they combine with the placement.info file to generate the output of your page, you'll quickly realise that what you really want … more

  • Orchard CMS: Adding a field to a custom content type in your module / migrations.cs

    While it sounds simple, I didn't quite find all the documentation I needed in once place, and there were a few gotchas, so I thought I'd make a post (if only for my own future reference). A few notes on fields, content types and content parts before we continue: When we add a field to a content type via the Admin Interface in Orchard, it looks nice and independent, but in the background all … more

  • Orchard CMS: Planting My First Orchard

    Tried to set up Orchard CMS today, and went a little bit crazy trying to get it to run; even though in the end, none of the problems turned out to be very difficult. First of all, it just kept throwing back 500 Server codes; so to see what's actually going wrong, head into Orchard.Web, edit the Web.config and make sure: in system.WebServer you have <httpErrors errorMode="Detailed"/> (and … more

  • Thank You Internet (For Stopping Logitech Double/Single Click Randomness)

    So today I turned on my laptop, and used my mouse, and noticed something weird going on with my trusty Logitech mouse; for some weird reason, it kept registering a fair number of single clicks as double clicks. Needless to say, this makes things like highlighting text crazy frustrating; but thank you internet for your long memory. Came across this post from an apparently now-retired Logitech … more

  • Some Things You Can't Buy

    To mark the end of the Lunar New Year, the Lantern Festival, held on the first full moon of the year, is generally a pretty exciting occasion in most of Taiwan. This year, I was lucky (or crazy enough) to join the 40,000 people descending on the sleepy mountain town of Shifen in the Pingxi district, where for the Lantern Festival an endless stream of locals and tourists set off sky lanterns en … more

  • Natalie Imbruglia - Torn (Chinese cover)

    Next in the series of Chinese to English and English to Chinese covers, the one-hit wonder of the 90s (One Direction doesn't factor into this song's progeny). http://www.youtube.com/watch?v=AH5F55BxV0w more

  • Happy Lunar New Year - 新年快樂

    Hello everyone! It's been a while since I posted anything - Chinese New Year is the big holiday break here in Taipei (much like Christmas / New Years in Western countries), and to celebrate I'm down in Kaoshiung with family and friends, escaping the Taipei winter and rain. Nothing quite like Mahjong until the small hours of the morning (hanging out for that 自摸 / winning hand), lots and lots of … more

  • Selected Item States For LongListSelector In Windows Phone 8

    Adding to the pile of "something that should be really easy but is not", it seems like there isn't a simple way of adding selected item states (ie, highlight an item with a border when it's selected) when you're using the native LongListSelector in Windows Phone 8. Unlike the ListBox control, there aren't any default "selected item" Visual States in the DataTemplate for you to override, and … more

  • It's a white (Nokia Lumia 920) Christmas!

    Hope the festive season is treating everyone well! After being on preorder and waiting not-so-patiently from the 12th of December, Santa came through and my brand spanking new Lumia 920 arrived! I've been messing around with it pretty much nonstop since I got it, getting to learn and love all the new intricacies of the 920 compared to my previous 800: 1) It is nowhere near as heavy or bulky as … more