Archive for July, 2008
‘Safeguard’ Is Up Again
I linked to my short story, Safeguard, before, but since then I’ve closed the wiki it was originally on.
Today, I finally transferred it to my new wiki, and updated the links in the older post. So, in case anyone wanted to find it, it’s here now, where I expect it’ll continue to exist forever. Or, at least, until I no longer have either a domain, a web server, or I die. Whichever comes first.
I should probably write more short stories soon…
Moving On To Ubuntu
Since my hands are no longer tied by having to keep the mail server up on Hermes, I can now reboot, reformat, and re-all-that-other-nice-stuff on that computer — and so I’m setting up to finally do something I really like the thought of: putting Ubuntu on it. To do that, though, I need to first back up everything on it — and the first part of that is getting the backup down to a more manageable size, which I’m doing by deleting everything I don’t like. This is expected to be a lengthy process (and, so far, it has been), but it’s well worth it.
I’m cleaning up my junk! And that’s a good thing.
Mail Server (And Assorted Naughtiness)
In keeping with the previously mentioned tip about getting stuff done, I’m now starting to work on a problem I’ve been avoiding for several months — moving the mail server.
First part, setting up Postfix on bast to be authoritative for narc.ro, and do all the things my current mail server does. Will it end well? Watch this space, updates forthcoming as progress inevitably ensues (possibly with hilarity; most likely not). Current time: 2:34 am.
Update: 5:15 am and I have Postfix doing most of the important stuff. Counting them:
- receiving mail on the catch-all
- receiving forwarded mail from gmail
- not being an open relay — from default config, so not taking credit for it
- receiving mail on various blackhole accounts — and sending them straight to /dev/null
What isn’t there anymore:
- SpamAssassin. No great loss for me, as the only thing it was doing was marking emails as spam. My main filter has always been the blackhole.
- DNS Blacklists. Also no great loss, for the same reason as above. Further, I’ve heard it’s pretty easy to get on one of them, but very hard to get off them. So, no problem.
- SSL/TLS — wasn’t in use, since SMTP is secured by the anti-relay setup, and POP3 isn’t even open to the Internets. If someone (like me) wants to get their mail remotely, they can tunnel through SSH. And I can, have done, and will continue to do so.
- SPF/DomainKeys/etc. Same argument as above: not in use.
- Antivirus. Never received a virus in email. Don’t have any clueless users. So, no need.
- POP3 “forwards”. This might be a problem, as I did have a couple of email accounts I was fetching mail from using POP3. OTOH, the single important emails getting delivered to that account can be redirected through GMail, whose forwarding works fine. Come to think of it, I can have GMail fetch the emails remotely, and get those spiffy spam filters in on it, too! Not bad.
So, in conclusion, there’s not much I’m missing, and in exchange, I now have a much freer computer that I can power down at night and install Ubuntu on (when I can find some space for a complete backup). Very very good trade.
#1 Tip About Getting Stuff Done: Get Stuff Done!
Seriously, that’s all it takes.
No more putting things off because they’re “going to take too long”. Or because they’re unfamiliar. If something is going to be a net benefit to you, go for it. Right now.
I’m taking my own advice right now and setting up my mother’s computer, the first step in overhauling all the computers in the house. It’ll be a pain figuring out where to back stuff up temporarily (I’m switching most computers from Windows to Linux, so that will involve some hard-drives getting reformatted from NTFS to Ext3), but I’m going to do it. Starting now.
As a consequence, the mail server will be down starting now. I’ll update the post when everything’s back up and running. Excuse me, I’m about to Get Stuff Done™.
UPDATE: Partly done — I’ve decided to do some computer surgery and swapped cases with one of mine. Mail server is up and running again. More downtime tomorrow, around the same time.
Going insane from work
I haven’t talked much about work on this blog and I’m not going to give too many details now, either. For a bit of background, I’m working on somebody’s many-years-old legacy code, much of it written in a mix of PHP and Perl. The code has been worked on by dozens of programmers over the years, and nobody’s really kept any documentation aside from that absolutely required (mostly inter-departmental stuff).
As a result, the code is… well, let’s just call it The Code From Hell™.
So TCFH is a mixture of really old and not-so-old, and over the years the (very many) changes have resulted in a huge amount of cruft. None of which can be removed because, there being no documentation (and very little structure to the code, thanks to a number of people’s preferred coding style of “let’s just make this fucking thing work so I can go home”), nobody knows what’s still in use and what isn’t. On top of all this, “code reuse” was, at some point, taken to mean “let’s make a copy of this thing and make a couple of small changes, making it work for this new situation”.
In conclusion, we’ve got:
- lots of versions of basically the same file with a few small changes
- many old pieces of code nobody’s ever looked at in years
- unused code
- code that’s in use, but is so convoluted (the term Spaghetti Code comes to mind) that everybody hopes it won’t break
- and very few, very confusing and mostly outdated pieces of documentation describing how some parts work (there is no complete documentation of the whole thing. If there ever was, it’s way out of date now)
And, to top it all off, I’m one of only two people remaining who still understand most of how it all fits together, and I’m the junior with only one and a half years’ experience.
On the bright side, most of the code is readable, once you understand a few basic structuring ideas that were, for the most part, adhered to.
It’s the rest of it (about 20%) that gives people nightmares of being stuck in a maze of twisty passages, all alike. I worked on that 20% today.
Let me pause now to describe a bit of the process flow: first, a user clicks a “join” link on one of our websites. The link takes them to the credit card processor, where they enter their CC details and their card is either accepted (and billed) or declined. After a successful billing, the user is sent to a handler on our servers that takes care of setting things up on our end; namely, creating the user in the database, and remembering some associated information so they can be rebilled for as long as they keep up their subscription.
Except that, on three websites, the user is not being created in the database.
The success/fail handler is one of those old pieces of code that’s been around since the dawn of time. There are multiple copies of it, as well as a number of included files which are about as old as the rest of the whole thing. I went through one of the copies today. Or I tried to.
You see, the code is part of that Code From Hell I was talking about. And even the includes are convoluted. So I thought I’d make things easier on myself by writing a script that recursively follows includes and prints them in a tree-like format (this script will be made available to others in the future; watch this space, or ask me for it, I might give it to you if you’re not a jerk).
The result? 177 included files, of which some 20 are false positives (not really includes; or commented out), about 30 are includes of the exact same file, which is used in a lot of places to provide unified logging, some 20 more includes of another file which provides some translation between an id number and the website the action originated on (lots of sites all go through the same handler; don’t ask for details unless you want to make me cry (meanie)), and some 20 or more includes of files defined by variables like $FNAME.
What none of these files seems to do is add a fucking user to the fucking database!
So I’ve basically wasted about five hours hunting for something in age-old code, still haven’t found it, my brain feels like it’s been through a grinder (multiple times), my wrist started hurting a while ago (carpal tunnel scare, though it’s since stopped), and the only success I’ve had so far today is this quick script that follows includes.
I’ve joked about taking this whole mess and rewriting it in PHP, but to be perfectly honest, I think one of these days I’m gonna go rogue and do it. Over a few weekends. And then present the result to the folks on the other end and say “Hey, guys, you know, it can be done better”. And it’ll be structured this time, dammit!
