Random musings

    Starting out with Swift

    2014-06-04 20:00:00 +0000

    Apple had the unusual WWDC announcement this week, and definitely came out with something I wasn’t expecting. A new programming language called swift.

    Chris Lattner (@clattner_llvm) creator of the language a head of development tools at apple seems to have come up with the philosophy behind the language. On his personal site he gives a nod to Bret Victor (@worrydream) one of the best thinkers on the internet who I have ever had the pleasure of reading is amazing interactive essays on rich IDEs.
    read more

    Becoming a polyglot programmer

    2014-05-08 22:00:00 +0000

    Recently i’ve been sprinting preparing a very exciting new venture that has force me to write code in languages I had little experience in before. The amazing thing I have learnt is that it’s fairly striaghtforward to transfer skills from other languages fairly seemlessly once you’ve invested time in. The fundamental thing I have realised is good code architecture is universal.

    What I like to bring to code is simplification, atomicity and structured design. Consider the following java code…
    read more

    ASP Repeater helper to output class names on every Nth item

    2014-02-06 20:00:00 +0000

    I came across a need to output a “clear” class to every 5th item in an asp:repeater. Here’s an over-simplified example of the code that was written.

    <ul>
    <asp:Repeater runat='server'>
        <ItemTemplate>
            <li class='<%# If((Container.DataItemIndex + 1 Mod 5).Equals(0), "clear", "") %>'>
                <%# Container.DataItem.Title %>
            </li>
        </ItemTemplate>
    </asp:Repeater>
    </ul>

    I say we could to better.
    read more

    Introduction to generators - ECMA script 6 Harmony

    2014-02-04 23:27:34 +0000

    I was just trying out the new formatting styles available in javascript, I was pretty stunned by the way the new Yeild iterator works.

    A very simple yeild in javascript

    var yeildingFunction = function*() {
        yield "fred";
        yield "bob";
        return "sue";
    },
        i = yeildingFunction();
    console.log(i.next());
    console.log(i.next());
    console.log(i.next());

    read more

    How I like to format SQL

    2013-09-30 23:27:34 +0000

    I’ve seem lots of SQL coding styles over my time. Here are three most common formatting options.

    ANSI 89 Equals Syntax

        Select *
        From customers,
            invoice,
            invoice_item,
        Where customers.id = invoice.customerid
        And invoice.id = invoice_item.invoiceid
        And invoice.isPaid = false

    I hate seeing this written.
    read more