A photo of Brian Douglas

Hi, I'm Brian. Welcome to my blog. Here I write about the things I've learned whilst creating stuff on the web.

I hope that you will find something noteworthy here, that will pique your interest, and that you will visit again soon.

Recent Posts


  • Trimming strings in c

    Strings in C. They are wonderfully intuitive and easy to work with cough.

    No, strings in C are a nightmare. Doing simple things such as trimming the whitespace off the start or end of a string is complicated. Because a string is not a string it's a char *. Which means that if you want to do interesting things you are going to have to get used to managing memory. Which means thinking, and if there is one thing modern programmers hate, it's thinking.

    Anyway, below I have added ltrim_string, rtrim_string, and trim_string methods. I've made the code as readable as I can, and documented it with tests.

  • Making a StringBuffer in C

    I've been writing a lot of C. Whilst doing so I have been questioning my sanity. Am I an awful programmer? You know what, I think I might be.

    Kudos to all those devs that created monumental feats with C. Because it is not an easy tool to use. That said, I do enjoy writing C, just as long as I don't have a deadline or any business critical software to deliver. But when I say enjoy, I mean enjoyment in the sense of using a sycthe to cut a lawn, whilst my lawnmower watches on. It's lovely using the sycthe, but at the end of the day when I am exhausted and cut only a quarter of the grass that I could have cut with a mower in half the time, I do feel a great sense of achievement. I'm exhausted and broken, but happy.

  • Banned from lobste.rs and Hacker News

    For some reason the good people at Hacker News have shadow banned my blog. I can still post, but the post never appears to anyone else. I'm not sure why this is the case, as one of my posts has ~350 upvotes and spent time on the front page.

    What did I do wrong Hacker News?

Older Posts