UK National Lottery Automatic Page Generator
If you've made it here, then you've just come from a page that was
automatically generated using the following hardware and software:
Honourable mentions also go to:
- An HP PA-RISC rp3410 dual-CPU server
running HP-UX 11.11 with 4GB RAM.
- I also have a faster Dell Optiplex GX280 machine that runs
Fedora Core 2 Linux to generate the Best Performing Tickets
site code "mostly" works on Linux, but there's still some porting issues
surrounding a couple of tools.
- A Nildram ADSL Max 6Mbit/s (typically) connection hooked up to
a Safecom ADSL wireless modem router.
- HP's ANSI C compiler
with the -z +O2 +ESlit +w1 compiler options.
Yes, it's the latest compiler version and, no, I'm not compiling in
ANSI mode any more because of the use of macros that don't expand correctly
with ANSI cpp. However, I can compile OK with gcc now (using -traditional-cpp).
- A custom C program, called "bhs", which passes macroised HTML through
a hacked XView 3.2 C pre-processor (see below) to generate an expanded HTML
file. I maintain a single header file
containing the macros to be expanded and then edit .bhs files
(using vi of course) containing a mixture of HTML and macro calls, which are
then processed by bhs and previewed with Netscape 4.79. The ability to use
macros, particularly for headers and footers, allows rapid changes to whole
sets of pages to be achieved by a single edit of the macro header file and
then a re-run of bhs, which can recurse down the whole tree and
regenerate HTML from changed (or all) .bhs files if I wish to do so.
- An extensively hacked version of the C pre-processor (cpp) software that
was supplied with XView 3.2 (an OpenLook look-and-feel clone released by
Sun into the public domain for other UNIX systems). The original was written
by Martin Minow for a VAX/VMS machine and ported to UNIX shortly after. My
hacks just make it a bit more "HTML-friendly", rather than aiming it
exclusively at C. The latest change is that the standalone cpp program has
been converted into a shared library instead (is this unique ?) and the
"bhs" command is now directly linked against that library.
- A custom C program to take my data file of lottery results and convert it
into a header file of C data that can be #included into the source code of
the C programs mentioned below. It also does formulaic verification of lottery
results and issues warnings if any don't tally. The other task of the program
is to calculate
(both with and without the bonus number) and
generate them as C arrays for including into the source code in a similar
manner to the raw results mentioned above. Note that the C programs mentioned
below can #include the bhs macro header file and hence generate the appropriate
headers and footers to match the "manual" equivalent.
The whole reason for generating C header files containing arrays is that
by embedding the data in the C program, it makes it independent of data files.
This means that no file opening/reading/closing is needed when running the
program and this results in a huge performance boost, particularly for CGI
- Two custom multi-purpose lottery C programs, which do all of the following:
- Creates the
top-level page, which can optionally include
automatic provisional results.
- Creates all of the Numerical Analysis
and Sales Figures pages.
- Acts as a CGI program to the:
- Verifies the prize amounts and number of winners for each draw's lottery
by using the same formula as Camelot does.
- Manages the Live Updates system.
- Duplicates much of the above for the
Thunderball and Extra sections of the site.
- A custom X11R6 C program which can dump a graphic containing the
balls for any particular lottery without now needing to open a window at all.
It now calls the montage command mentioned below itself for efficiency
and can also regenerate the entire set of lottery GIFs with a single command.
The same program now also generates the mini-lottery ball navigation
graphics at the footers of most pages and also all the graphical frequency
- A custom speech CGI C program that uses 24 sound samples of my
voice to construct any floating-point number between -1 billion and 1 billion.
At the moment, I've set up a couple of links on the home page to say the
winning numbers and the jackpot amount, plus you can hear any of the previous set
of winning numbers by going to a particular individual lottery page.
- A custom C program to generate the entire
Lottery Links section (even the index page) from a plain
text data file. The lottery sites data file is now over 2,000 lines long !
suite of utilities - I use the import command to dump an X11 window in
GIF format (7 balls) or miff format (single balls) and montage to
concatenate miff bitmaps together for the CGI program. The transparency and
interlacing of ball GIFs are handled entirely by those two programs as well.
- A ksh script to tie all the software above together which
generates all the pages (and the latest GIF) with a single command. It can
also offer levels of update (e.g. just the newsflash and home page, just
the pages with an expiry boundary on them etc. etc.).
- Many other cron jobs to automatically "housekeep" the pages, including
GIF cache purging, lottery logo colour changes, virtual lottery entry
total updates, lottery link checking and Live Updates entry resetting.
Basically, once I've entered the latest results into a data file, I can
automatically generate everything in about 2 minutes,
which includes re-compiling all the programs,
plus creating more than 100 Web pages and 8 GIFs.
Saturday/Wednesday (draw days) and Monday/Thursday (expiry days)
cron job updates now only take 4 seconds.
package, which whilst being primitive, was handy for a quick and dirty
temporary GIF at the top of each page.
- The Apple Macintosh, scanner and Adobe Photoshop used to scan in the
official logo [and my winning cheques], not that I'm allowed to use that
This page wasn't automatically generated - ha ha !