IYPT IT Part 3

I’ve spent the last days working on our database. A central webbased php/mysql db with a nice frontend so that the teamleaders can input their data. I guess something similar is needed every year – it’s a pity that we have to reinvent the wheel for every IYPT.
Nevertheless I’m pretty confident that what we’ve worked out so far will do the job pretty well. No more Microsoft Office Excel files or crappy Access databases. Nice, clean html and css. phpmyadmin to query just about any information about the participants.
And the coolest feature so far: badges are created on the fly as pdf files.
As mentioned before I’m a fan of CSS based webdesign, so I decided to abuse this quite powerful layout tool to design our badges. Sadly there is no elegant html to pdf converter available. There’s dompdf but it doesn’t work with absolute and relative positioning or floats. I quickly realized that it would actually take a full blown html renderer – like the engine behind Firefox (Gecko).
In good old iypt-style I started to investigate and eventually found a great firefox addon, simply called Command Line Print, that allows firefox to be started in a special printmode. That worked fine on my desktop – but what about our server? Firefox wouldn’t run without a display – but google saved the day again and found me xfvb. Ok, so i would install a webbrowser on a headless server, install a print add-on and eventually start it all with a simple php exec. Guess what? That just didn’t work.
First we had to get a new VPS because on the old server – still running ubuntu dapper – the software we needed just wasn’t available. We now use a VPS running a recent debian, so firefox is actually called iceweasel.
The server would happily create perfect pdf files, but only using my user account. Apache runs as www-data and the extension wasn’t installed. On my account i did that via x-forwarding – getting that to work with another user again took some effort.
Finally i could create my pdf files when logged in as www-data. But still no luck with php executing the script.
Later Georg solved the mystery: apache sets it’s own env variables, so iceweasel quit because it couldn’t access it’s .mozilla dir which was supposed to be in the home dir.
There were some other, minor problems as well as you can imagine. But at least the core functionality is running smoothly now.
I still have to migrate some stuff to the new server. The forum, this blog, our svn reps. By the way I’m thinking about switching to git. It’s much more flexible.

3 Responses to “IYPT IT Part 3”

Comments are currently closed.