I’ve been in debugging hell for a few days. I’ve had a few nightmare bugs, and learned a few things, as well as having my indie ass saved by some lucky stuff. here is the summary:
I had a bug that was a critical, game-ruining crash thing. When I debugged it, I found the exact line of code that was causing it. I had removed a certain if() statement. I remember doing it about two weeks ago. Can I remember why? Can I hell. IF I had proper comments in the code where I changed stuff, I would have worked out what was going on. IF I had forced myself to check in more regularly and ALWAYS type detailed comments into the check-in softwares submission dialog, I would have worked out what was going on.
Luckily, it wasn’t a disaster, because a long time ago, I clearly made a decision to include my ‘design log’ in the checked-in source-controlled files. This is a long rambling document where I always type everything I’m doing, and have my list of motivating ‘**DONE**’ statements for each day. Naturally, when I made that code change roughly two weks ago, I had written about the problem that needed me to do so. Normally, finding this comment would be a pain, because there are no date stamps on the log, and I wasn’t sure what I was looking for. Hurrah! the design log also has a changelist, and I found the bit I wanted just by seeing the changes made to it in the same check-in as the code change itself.
Lesson: Keep a log of your work, and source-control it. Adding better comments to code doesn’t hurt either.
I had a virus attack on my PC. I think it was some sneaky sleeper-thing that only triggered on a reboot, and I don’t reboot often, so I’m not sure where I got it. It could well be a warez site, which I still check now and then to get some pirated links removed. This virus was pretty nasty. Not only did it breeze past malwarebytes and spybot without triggering either of them (let alone windows defender and the firewall, and the browser settings), but it didn’t announce itself at all. What it did, was trawl through every file on every drive, and with html files, it appended some javascript to the bottom of each file which dropped an exe on peoples machines who ran it. Scary as hell.
I only noticed it because I was editing my website local copies, and spotted in windows explorer that the filesizes of some basic html files were too big. Thank kahless I spotted this before uploading them. The difficult part was then removing them. I noticed that even after running multiple virus scans, and my PC looking clean, if I created a new html file and left it for five minutes, the javascript would be added. There was no dodgy process running, it must have been a rootkit or service.
Anyway… Microsoft Security Essentials is apparently ‘teh awesome’ because it not only killed the virus, it restored every one of my files to their original state without problems. And it’s free. How awesome is that?
One thing I did do, as a precaution after all this (apart from keep MSE installed and running several deep scans overnight with 3 different scanners) is to create a truecrypt container and stick a copy of my website inside it. There is no chance of some virus cracking that open and ruining those files (although in theory it could delete the container). I also keep backups of vital stuff on a thumb drive, just in case. Scary stuff though. Especially because I’m not exactly some dork who accepts .exe files on IRC or opens random email attachments. This stuff is getting harder and harder to avoid.