Checklists
They are totally useless. Unless you have to perform a certain task. If you don't list every little thing you have to do to achive your goal, you may miss a teeny-tiny part, like updating fstab after moving directories. And end up screwing with the server all night long instead of 10 minute job.
BTW, if you use pygrub with Xen, extra won't work and you won't be able to boot domU in single mode, for example. You'll have to specify kernel and ramdisk and comment out bootloader instead.
Back to RentACoder
I've stopped freelancing for a while again, and now I'm back to it one more time.
I missed it. I left RAC over 2 years ago becase of several reasons. Most important are:
No challenge
When I stated there, it was all new and exciting for me. Finding clients, persuading them to hire me, working on real things I only tried on localhost before... But them I gained enough experience and improved my skills. Most projects looked boring for me. Others were too cheap (I know, a gig's a gig, but working for $20 overnight isn't so pleasing anymore).
Stability
I was working for two guys I met on RentACoder, Leif and Matt. They paid me enough so I didn't have to search for more projects. Also I found a full-time job which also paid off pretty well. I had enough money and enough work and also some free time: why would I need too work more.
Concurrency
Well, my skills are good. My rates are acceptable. But by the end of 2007 RAC was invaded by thousands of cheap Indian coders. I just couldn't compete with their rates. No offence to good coders from India: they had even harder time fighting both their cheap inexperienced colleagues and a stereotype about cheap coders...
But recently I moved from my parents house and could really use a couple extra bucks. And also I suddenly had much more free time (I still have no explaination for that!), so I though: Why not? And RAC was much better this time: more interesting projects, less scriptkiddies (I made 8 bids in first two days and won one) and decent prices. I'm glad and excited.
It's good to be back.
rsyslog
It's unique. What's it's uniqueness, you ask me? I'll tell you what is it. rsyslog's man page is more clear and easy to understand and to start with than documentation at it's website.
Heartbeat
We've grown enough to need high availability solution, so the first thing I've tried is Heartbeat. It turned out enough for now (although, I'll have to update a few init scripts), and I'll write a mini-howto on running Heartbeat inside OpenVZ container as soon as I have enough time for that.
For now, just one hint. If your node doesn't come up when it should, and /var/log/ha-log contains the following:
Setup problem: Couldn't find utility /bin/gawk
then it's most probably not really about gawk (it's very hard to find Linux system without gawk). It may also mean that you don't have which installed, while Heartbeat's scripts use it to find a real path to gawk. It's not that common, too, actually, but, for example, some OpenVZ templates do not include which package.
So, yum install which (or vzyum $VEID install which) brings you happiness.
Ubuntu is so Ubuntu
Note to self: stop using alphas!
This shit costed me a lot of neurons and hell of a time. I though I went crazy ot supid at some point.
I even googled for 'netmask calculator' after I calculated it in head and then on a piece of paper.
Both ip addr and ifconfig output wrong broadcast address.
% uname -a
Linux amiheev 2.6.31–11-generic #36-Ubuntu SMP Fri Sep 25 06:37:23 UTC 2009 x86_64 GNU/Linux
inet 192.168.200.21/26 brd 192.168.200.31 scope global eth0
inet addr:192.168.200.21 Bcast:192.168.200.31 Mask:255.255.255.192
One Month In Office
As I have already mentioned, I got a normal nearly full-time job recently. I work in a web hosting company (Russian) now. And I promised to write an artcile about how is it after a month of been employed. So, here st it.
I'm few days late, though.
It is hard to distinguish pros and cons right now as I'm all into this new job. It's new, it's interesting, it's (somewhat) challenging, it fits me perfectly. Hm.. Okay, let's state that was a pro.
On the other hand, it's in office. It means I have to be clothed (and I mean clothed, so robe and slippers ain't an option) to work, I have to move myself from home to office in the morning... That turned out pretty hard, I've never been and early-riser, so I didn't have enought sleep first two weeks and still I feel that if I could sleep more, I'd feel better.
I can't make coffee or tea in the office as I used to make them. Actually, there's no way to make fine coffee there (can't stand instant coffee), the tea I make there is acceptable, though.
It's harder to take a break in office, and you have to go through from morning to lunch and from lunch to evening. It's okay now, though, as I even forget about lunch sometimes (that will surely pass later). Opposed to this, it's easier to concentrate: home freedom gives you too many chanes that you'll reading blogs or playing Chromium rather than working. I was sick a couple days ago and had to stay home and tried to work from here as I used to do all those years. And what? Routine tasks took two times more than they usually take when I'm in the office. And I missed our issue traking system and lots of things I just got used to already. And most of all I missed the ability to turn my head and ask co-worker a question instead of emailing it.
BUT. I have weekends now. I can do anything (or nothing, which I prefer) after 6 AM. And I know what will I be doing next day. After three years of freelance it feels marvelous! I guess I'm getting fat-old-stability-loving-guy.
Also, I can learn now. First, new work means new challenges, and I have to improve some of my skills, which were pretty weak before. I never had time and need to get beyond just general understanding of perl, bash, sed and awk. I barely understood how MySQL replication actually works. I knew nothing about PAM, NSS and postfix.
And I can actually learn: read books and manuals on things I do not use in my work. Just because I've got free time now. Finally I'm reading Dive Into Python and I like this language and will try to build my next own project with Python.
I don't have to pay attention to my time management anymore. No need to explain anyone, why do I have to work when they want to see me. Less interference between work and my (yet inexistent, though) private life.
And the last thing for now, I guess, is pro office work again. I can get enough resources when I need. I cat ask for a test server, so I don't have to manage virtual machines and virtual network. I can ask for software, though I never needed it yet and I doubt that I'll be need of something non-free in future.
Uhm. The very last: I know now what is TGIF really about, and I don't like it very much actually.
You see, there are much more pros for me now. Actually, this job is a good balance between freelance and what is usually ment by office work.
Encoding Mail Subjects Properly When Sending Mail With PHP
It is one of the most common bugs in Russian web applications. Nowadays coders do not forget to add Content-type header to mail messages, but many of them forget (or don't know) that this header affects he messag body only. They think, if they specified proper encoding for body, mail client will use it for Subject, too.
Which is totally wrong, of course.
I am speaking about Russian developers, because I only receive mail in Russian and English, and English messages for obvious reasons do not suffer from this problem. I'm sure that other languages suffer as much as Russian do.
So, enough dull talk. What should proper mail Subject be? If encoded if consists of the parts separated by special characters:
=?{original text encoding}?{encoding method}?{encoded subject}?=
So, if you want, for example, to send mail in UTF-8, your message subject should be converted like that:
$subject='=?utf-8?B?'.base64_encode($subject).'?=';
Do not do other people's mistakes.
(Use their experience to make your own ones.)