index of posts
2017-12-28 Advent of Code 2017
This month I wrote code in C++ to answer the Advent of Code questions.
2014-10-25 Introducing Loon
I wanted a simple way to read and write program configuration and some state data. The configuration needed to be human readable and it would simplify problem diagnosis if the state data was also human readable. In the past I've sometimes used XML for these tasks. This time I wanted to do something different, so I made Loon and wrote a Loon reader/writer in C++, which is public domain.
2013-10-13 Minecraft4k in Lisp and C++
Markus Persson wrote his JavaScript Minecraft4k "to test what's possible in JS and HTML5." It gives an impression of travel down a never-ending tunnel of blocks. Here I recode Minecraft4k in C++ and Lisp. There is an 80:1 performance difference between the C++ and Lisp versions. I speculate this is because I'm doing Lisp wrong.
2013-05-13 Binary to decimal conversion: how hard can it be?
How hard can it be? It’s easy if the numbers are just a few hundred bits long. After that it gets a little tricky if you care about how long it takes. Here I calculate the biggest known prime number (trivial), which is 57,885,161 bits long, then render it to decimal (the tricky bit). I use Scheme and Python but mostly C++. My code is pitifully slow compared with the MPIR/GMP libraries.
2012-08-10 I'm free
Today was my last day working for someone else's company.
2012-07-31 Logo, Scheme, C++
I re-implement a tiny Logo function in Scheme and C++; it's of no interest to anyone but me.
2012-06-09 SMBIOS UUID FAIL
Somewhere on the system board of virtually every Wintel computer in existence there is a programatically accessible identifier (a 128-bit number). In theory, this identifier is unique to each system board and may be used to differentiate this particular computer from every other computer. In practise, you cannot rely on this being the case and therefore this identifier is useless.
2012-04-24 Invent Your Own Computer Games with Python
My youngest son asked me if I would show him how to program, so for his twelfth birthday I gave Max a copy of Al Sweigart's book Invent Your Own Computer Games with Python.
2012-02-20 Inventing on Principle
I recently watched a video of a very interesting presentation given by Bret Victor at the Canadian University Software Engineering Conference. It was called Inventing on Principle.
2011-10-18 Steaming pile of poo
I think 50 million lines of anything is likely to be a little whiffy.
2011-10-09 Loop counting: Google's multi-language-bench
Three different benchmarks. Three different winners.
2011-09-18 Programming for children
BoingBoing's Mark Frauenfelder recently asked people to suggest programming languages suitable for introducing children to programming. He got many interesting suggestions, some of which I'd never heard of: there are some wonderful resources out there for people who want to learn to program. I made a list of the suggestions and wondered if it would be of use to others.
2011-06-23 I learned to program...
I've been struggling with a blog post that may never see the light of day. In the mean time, have you seen this?
2011-02-08 The Art of Computer Programming
Polly Jean Harvey is one of my favourite artists. Her work is extraordinary, moving. Not that I'd claim to fully understand any of her songs.
2010-11-29 A funny thing happened...
When I got home tonight I had a really nice surprise waiting for me.
2010-11-27 Lisp interpreter in 90 lines of C++
I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second. Just for fun I wondered if I could write one in C++.
2010-10-17 Advice to a young programmer
Over the years I've learnt a lot from the ACCU General mailing list. The other day someone posted about an interview Bjarne Stroustrup gave to Wired.com.
2010-10-06 SHA-1 in Lisp and other languages
Lisp is a fascinating language and I want to learn it so that I "get it."
2010-08-14 Unit tests
Like many people I've found unit testing to be a useful technique for raising the quality of the code I work on. What I learned when I started using unit tests was that they are not just a means to expose bugs - they have a wider positive influence on the code.
2010-06-22 Why the lucky stiff
I first heard of him in 2007 when I encountered Why's (poignant) Guide to Ruby, which I thought was highly original, funny and even helped me to learn Ruby! (It didn't hurt that Ruby itself is a charming language.)
2010-06-17 Why?
One of the questions I'm never asked is "why did you call your blog How to Write a Program?" The answer I would give is the slightly flippant "they say you teach what you need to learn."
2010-06-14 Reformat or leave it alone?
So anyway, you start trying to figure out how to make the little change and it gets curiouser and curiouser, and some of the code is like "WHY did she do THAT?" and some of the comments are unhelpful, if not mocking. And the thing you thought would be bound to be little turns out to be spread through the code in Windows Resource files, ATL template parameters, hard coded string literals, on-the-fly generated names, ...
2010-02-14 Write a C function taking two strings...
My big question: "Write a C function taking two strings and returning a string containing one copy of the characters that occur in both." Hint: Spend some time looking at one of the strings and use an array of flags.
2010-01-15 Roman Numbers
I converted Knuth's original Pascal more-or-less directly into C++, except that this version returns the Roman numerals as a string rather than printing them, which makes it referentially transparent and easier to test.
2009-07-19 Einstein's Riddle
Here’s a sucky program I wrote to solve Einstein’s Riddle, which has nothing to do with Einstein. It is many, many times slower than other much better solutions.
2009-05-13 Lutz Prechelt's Language Comparison
I’m rather pleased that my 49 line C++ effort is only 4 lines longer than the great Peter Norvig’s Lisp version.
2009-03-25 bytefluo
I was reading Gulliver’s Travels to one of my children tonight and we came across the term Big-endian in a passage about the reason for the war between Lilliputians and Blefuscudians (the latter crack their eggs at the big end, the former at the little end). Although I read Gulliver’s Travels many years ago I had obviously forgotten this because I assumed that big- and little-endian were just computer jargon. But it seems Swift coined the term.
2009-03-13 UUID and Byte Order
When I read the note in the SMBIOS v2.6 specification I interpreted it not as saying the format was changing from big- to little-endian, but as saying that the UUID had always been stored little-endian, but this had hitherto not been explicitly stated.
2009-03-08 Test for a Power of 2
A while ago I wanted to test whether a given number was a power of 2. The code was C++ and the number was a long.
No comments:
Post a Comment