• Pro Tip: Using Node.js's child_process with Gulp and Visual Studio's Task Runner Explorer

    A quick tip - had a Gulp task set up to call Git from the command line, get the latest commit hash and append it to some html files, and while it worked on someone else's Mac, it didn't on my machine. gulp.task('tag', function(){ shell('git describe --dirty', function(err,stdout) { if(err) { throw new Error(err); } gulp.src(['index.html'], { root: base }) .pipe( … more

  • Using DTOs With Breeze.js

    Currently doing a lot of work with an existing system implemented with Breeze.js in the frontend, talking to ASP.NET MVC endpoints / EntityFramework in the back. Breeze is pretty powerful - it's a mini database sitting on the client side that just magically handles all the boring CRUD stuff for you. It's great when you're starting out and you can get off the ground super fast, but for some … more

  • How To Queue A Build For A Specific Commit With Visual Studio Online / Continuous Integration And Git

    A standard Continuous Integration build definition would usually be building the latest commit for every check-in to the master branch. But if you ever feel the need to to mess around and queue up a specific build for a specific commit, it's quite easy to do: You can simply provide the checkout override parameter either when manually queuing a new build, or in the actual build definition … more

  • Stories From The Git Frontline (or, how to revert / undo a merge that's already pushed)

    So, this happened: was working on a different branch did a merge back into master too early mistook git revert for "take me back to this point" instead of what it actually does (undo one specific commit) The tree then ended up looking like: a revert i don't actually mean to have a merge of a bunch of stuff i dont want a previous good merge before my merge the commit which i mistakenly … more

  • How To Stop Visual Studio From Debugging Javascript Errors For A Website Project

    Have you found that Visual Studio doesn't listen to you when you tell it not to debug your Javascript? You've started an instance of it via the Debug menu, but you don't want to pause every time a script error happens - however, the Internet Explorer Advanced Options / "Disable script debugging" option does nothing, and neither does Just-In-Time / unchecking "Script" from Types of Code from … more

  • 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