Archive for the ‘programming’ Category
PCRE and newlines (in PHP)
I just wasted far too much time trying to work out why a regex would work for my example test cases but not with real data. Turns out “.”, DOT_ALL, and newlines are more complicated than I realised. My problem essentially came down to not knowing that the imap messages I was working with used [...]
Roman Numerals
From reddit.com/r/programingchallenges: I googled this and I haven’t found a similar challenge, so I’d like to pose this question to you all! Let’s say I give you a range from 1 to 2000. Within this range, find the number that yields the most characters. I asked a friend of mine and he worked out that [...]
IP Address Range PHP Class
I’m not sure how useful this piece of code really is, but it gave me the chance to write some funky PHP code (have a look at the next() method). Example usage <?php // Single host: foreach(new IpRange(’10.10.10.10′) as $ip) { echo $ip . "\n" } // >>> 10.10.10.10 // All hosts on [...]
Code Smell
“In computer programming, code smell is any symptom in the source code of a program that possibly indicates a deeper problem.” — Wikipedia I found this piece of code this morning, I think it counts as something gone terribly, terribly wrong: return displayItemDetails(this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode, 14059111); (The code was in-line JavaScript, inserted into a onclick handler, generated [...]
Sources of Holy Power Generation
Note: The information present in this post is a couple of months out of date. I’ve not had the time to re-update WoL data and create new graphs, but thought it might be interesting share the data/code anyway When choosing a Holy Paladin spec for 10 mans I was never completely sure about benefits of [...]
Text Twist Bot
Yesterday I watched someone play a bit of the browser based game Text Twist. Upon trying myself I found that I was awful, so I did what any programmer would do; cheated. Results of a few hours hacking: Features: Scan for game area and crash and burn if it’s not detected (Crudely) detect what letters [...]
