ArtOfCode

  1. I need to expand

    Considering the lack of programming I’ve done this year, I need to make this blog into more than just code. Mostly geek related stuff still, but I’m happy to see what it can evolve into.

  2. PowerShell and TortoiseSVN Hooks

    I spent this morning working on a script in PowerShell to update the copyright years on modified files as a Pre-commit hook. I’m actually pretty happy with the resulting PowerShell script:

    updatecopyrightyear.ps1:
    
    $year = get-date -UFormat %Y
    Get-Content $args[0] | ForEach-Object {
        Write-Host "Updating File Copyright for $_"
        (Get-Content $_) | Foreach-Object {
            $_ -replace "(\* Copyright .*)( \d{4})", "`$1 $year"
        } | Set-Content $_
    }
    

    The only thing I’m disappointed about while trying to get the PowerShell script to work was that I couldn’t get it to properly match against a copyright symbol © when the source file was encoded as UTF-8. It seemed to be trying to interpret it as multiple characters as it wouldn’t match to a single . in the regular expression, so I’m guessing it was interpreting it as Windows-1252 or some other 8-bit encoding.

    The biggest issue is that I’m having trouble getting PowerShell scripts to play nice as client side hooks in TortoiseSVN though. The TortoiseSVN documentation on client side scripting wasn’t as explicit as I’d have liked it to be, and so I tried to write some basic scripts to dump the arguments that were being passed to the hooks by TortoiseSVN, however TortoiseSVN was swallowing up the output from my scripts.

    After a bit of searching I ended up finding a method for calling PowerShell scripts as TortoiseSVN hooks that’s mostly suitable, however despite having the “Wait for the script to finish” option selected in the Hook Scripts configuration, it didn’t seem to wait on a

    Start-Sleep -s 10
    

    At least, for now, it’s working in an acceptable manner.

  3. Heading North

    I’m taking a road trip north for the holidays and I’m going to start working on some projects again. After a very long year, I’m looking forward to taking advantage of using an arbitrary point in time which signifies yet another rotation around the sun to put it all behind me and start getting some things done.

    There’s two projects I want to work on. I want to get something significant done with a configuration library I’ve been working on for way too long, and I’d love to have a look at what’s involved in writing a text client UI for the Quassel IRC Client.

    After being burnt out (long story), I’d like to reignite the fervour I’ve had for this stuff again.

  4. The Art of Code

    When I started programming, I saw it as a technical skill. I’d always been decent at maths and science, but after discovering computers and how to wield control over them, I figured I’d really found my niche.

    On the other hand, I always struggled to find a way of expressing myself artistically. When I was 9 I tried some after school drawing classes and was told I would probably never be any good. I played instruments, and enjoyed playing in school bands. Mostly, learning music was more of an analytical process for me though, and I felt I had difficulty playing in a way that expressed the feel of the music, I’d play what I read, be technically correct, but there’d be something missing.

    (There was one band director & music teacher I had when I was 14/15 who helped me to play more expressively than I had before, but I largely credit that to his passion in leading our school band.)

    When I started my degree, I approached programming, and eventually, the software development process in general, from a purely analytical standpoint. I soon found however, that there was one creative skill that I started to use increasingly that I’d had hidden away. It had shown its head from time to time, but had unfortunately not been required nearly enough during my school education.

    When I was in grade 1 or 2, I’d been selected to represent my school at a problem solving competition hosted at a local shopping centre. I can’t remember how well we did, but I remember enjoying myself immensely. Throughout my school years I never struggled much with maths or science, but the times I was challenged I would enjoy those classes much more. I found the same enjoyment again when approaching difficult problems at uni.

    While problem solving certainly isn’t expressly about expressing yourself, there is a creative element to it. It requires you to be able to view a problem from different perspectives, to see details that might otherwise not normally be seen. When it comes to code, not only do you have to analyse the problem you are trying to solve initially, but you’re also required to be able to be critical of your own work, to be able to see what it is, not what you expect it to be. Then there’s also the point about coding style, and almost every hacker/programmer/software engineer develops their own style, their own representations of basically the same thing.

    The world of code is not only about writing instructions to a computer to achieve a result, there’s also the occasionally insightfully elegant solution to a tricky problem, sometimes purely for the act of figuring it out. Some of the best examples of this are quines, pieces of code that when executed produce an exact copy of themselves. One of the more famous and best solutions to a more useful problem is the Fast Inverse Square Root function that was made famous by the Quake III engine source.

    There’s a world of abstract art in the form of esoteric programming languages, the most famous of which would have to be the controversially, and yet appropriately named Brainfuck language. There’s also obfuscated code contests, such as The International Obfuscated C Code Contest.

    Over time I found that I could appease that creative itch by tackling a problem I’d been trying to solve, and I’ve come to see code as a bridge between the analytical and creative worlds. In terms of self expression, I’ve also managed to find other forms of art that I can achieve an acceptable result with, although I’ve found that I’m certainly not gifted with talent in that area, and where I do succeed, it’s due to the effort I put into practising, and ultimately, when it does pay off, it’s usually worth it. I still tend towards a far more analytical approach, however I don’t think this is necessarily a bad thing, and at the end of the day, at least it’s honest.

sidebar

Info