## Author Archive for David Corne

18
Oct
12

### FizzBuzz

FizzBuzz is variously; a drinking game, a maths game, a way of learning numbers in a foreign language and more importantly (for this blog) a programming kata. The principle of FizzBuzz is a counting and substitution game you count to a limit and replace some numbers with words. In the classic example you replace any number which is divisible by 3 with Fizz and any number divisible by 5 with Buzz, and any number which is divisible by both with FizzBuzz. Continue reading ‘FizzBuzz’

17
Sep
12

### I’m Back, and This Time There’s Versioning!

It has been a while! Sorry about that but I’ve been on holiday and moving etc, but now I’m back and a lot has changed since I last posted. I have started using distributed version control with git and mercurial via GitHub and BitBucket. This means that you don’t have to just look at my code on Box with it’s limited syntax editing and no versioning. Now you can see exactly what I’ve been up to! Continue reading ‘I’m Back, and This Time There’s Versioning!’

16
Jul
12

### Finding Primes: Part II – A Python Implementation

As it is easy to get started I first wrote a prime finding algorithm in Python. I used a very basic algorithm for this. I store a list of prime numbers, and I check the numbers less than the square root of the possible prime, if any are a factor of the number I’m checking then it’s a composite otherwise I append it to the list of prime numbers.

The code for this is on my Box account here. Continue reading ‘Finding Primes: Part II – A Python Implementation’

16
Jul
12

### Finding Primes: Part I

Over the last week or so I’ve been working on some old code of mine. As the title of this post suggests it is to do with that odd pastime of mathematicians: finding prime numbers. I have made a few attempts to make lists of prime numbers over the years in numerous different ways. This is a small introduction to what will no doubt be a small series of many posts. This is an on going work in C++ although I’ll also be writing about an implementation I wrote in Python and a discussion of why I no longer use it for large calculations. During this process I have also taught myself to use git and in particular GitHub. So if you are interested in being ahead of my posts here is my GitHub and in particular this project.

06
Jul
12

### GNU Make and LaTex

This is a post about a recent use I’ve found for make. I generally use make for my C++ projects and think that it’s timestamp based dependencies make life much easier. It also means you only have to think about how you want to build the project once, after that you just type `make`. Continue reading ‘GNU Make and LaTex’

03
Jul
12

### Tkinter

I feel this is going to be a very short one this time. I’ve been testing out various graphical toolkits and I wanted to write about Tkinter. As a windows/linux user I wanted something that was truly cross platform. At work I use WPF and although I am actually more of a fan of it than most, but it does have the huge drawback of only being available on windows. Continue reading ‘Tkinter’

17
Jun
12

### Hangman

A short post this time. A few months ago I was looking for a little light distraction and I thought I’d learn Python. After doing all the usual stuff (Hello World, and a few problems from Project Euler) I decided to make a short game. As I’m sure you can tell from the title of this post it was a game of hangman. I made this decision because I found out about the string translate feature in Python and thought that it would be perfect to gradually reveal the word. Continue reading ‘Hangman’

11
Jun
12

### My Coding Style

I think that coding style is important, although not at the expense of good code. This is going to be a rare post where it is mostly opinion. I feel that different languages need different approaches to coding style so I have included a few specifics here too. Continue reading ‘My Coding Style’

09
Jun
12

### Auto-generate C++ Classes Using Perl, Part II

This is the second part of my article about auto generating a C++ class using Perl. Download the full script. Continue reading ‘Auto-generate C++ Classes Using Perl, Part II’

08
Jun
12

### Auto-generate C++ Classes Using Perl, Part I

This is the first part of a post about a short utility I have written in Perl. I use it to generate C++ header and source files with method stubs depending on the arguments given. In this post I will be explaining some more general Perl techniques I use that aren’t specific to this file. Continue reading ‘Auto-generate C++ Classes Using Perl, Part I’