Postfix Regex Fail

in Admin and Humour
#

So I was diagnosing a problem at work. Automated emails were failing to send, but only in some cases. My investigation quickly revealed that the mail server was refusing to deliver them, instead giving back an error code and the following curious message:

Chinese encoding not accepted by this server

Chinese encoding? I checked the data being sent - there shouldn't have ever been any kind of non-latin character data going into the emails. Maybe the application was using the wrong encoding for some reason? But I couldn't find any evidence for this either.

Read more...

re.split Separator Quirk

in Programming
#

I came across an odd quirk with Python's split-by-regular-expression function, recently.

The re module has a function split which takes a regex and a string and splits the string by occurrences of the regex, returning a list of substrings. Ordinarily it works how you might expect:

>>> import re
>>> re.split( "[A-Z]", "HowNowBrownCow" )
['', 'ow', 'ow', 'rown', 'ow']

Here I'm splitting the string "HowNowBrownCow" by capital letters. The substrings between the regex occurrences are returned including, in this case, an empty string before the 'H'.

But then we come to this example:

Read more...

Correct Code Examples Every Time with Doctest

in Programming
#

Doctest is a neat little Python module created specifically for testing documentation code. "Testing documentation?!" I hear you cry. Why yes, you did hear me correctly.

Doctest will examine your source code, looking for what appear to be code examples. Any examples it finds, it will test using the Python interpreter and compare its result with the one documented. If they differ, Doctest will let you know.

Read more...

Python Generators in Games

in Games and Programming
#

Python has this really neat feature called generators. I've found them to be incredibly useful in my code, especially for games. You see, it turns out they're great for handling animations, scripted sequences, and a whole bunch of stuff.

I'm going to talk primarily about generators in Python here, but generators exist in many other languages such as C# and Javascript, and I believe Unity3D also makes use of them for animations and such.

Coroutines

If you're not familiar with the concept of a coroutine, excuse me while I blow your mind somewhat...

Read more...

How to Explain a Boardgame to a Newbie

in Games
#

I adore board games. As a young child I played a lot of board games with my family, but as a teen, I got more into video games and board games took a back seat. More recently, however, Fiona and I have been discovering a whole world of really cool board games that we never even knew existed, thanks to sites like board game geek, and local board game groups that we go to. I love the mental challenge, the pleasant, relaxed socialising and most of all the game design inspiration I get from studying how these games work.

Being a total newbie to most of the games I've played recently, I've had to go through the process of leaning a new game quite a few times. Now, I'm not much of a quick learner, and I think that learning new games is probably a skill that one can get better at with practice. I imagine the more new board games you play, the better you get at learning the new sets of rules and adopting the appropriate strategies. But from my experience of trying to learn new games, I've noted a few things that I've found can help make things easier for newcomers.

Read more...

Cat Names

in Humour
#

What our cat's name is:

  • Chips

What we actually call her:

  • Chippies
  • Chickpeas
  • Pips
  • Chipples
  • Chipsticks
  • Chipplies
  • Chipolata
  • Chiptastic
  • Chippy-cat
  • Pipples
  • Chaps
  • Chippa-Chips
  • Chippity Doo-Dah
  • Daddy or Chips
  • Chippaaay
  • Mr Chips
  • Chip-Chippity Chip-Chippity Chip-Chip Cheroo
  • The Fog Horn
  • Blimp-cat
Newer >>>