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.)

Nov. 02, 2007 // 14:01 | Comments (0)


Major Changes, or The Song Remains The Same

I've been saving this for one of those Fool's Days, but it actually came true. Remeber me “complaining” about not getting office job and been stuck to freelance?

Right! I got the job. The very same one that I didn't get in August. The guy they hired instead of me then didn't appear to meet the requirements, so they contacted me again. Oddly enough, I received another proposal at the same time. I even talked to the second company, took their test job, finished it and sent back (they didn't reply, however), but it was something about Windows, AutoCAD, Visual C++ and lots of other things I don't really want to mess around with. I've forgotten my umbrella at their office, by the way :-)

So, now for almost two weeks already I work in a local web hosting company. Our (wow, apparently, it feels pretty cool when you say say “we” talking about your company) website is completely in Russian, because we are targeting Russian customers only, though, with got one client from Greece, as far as I know. In fact, there are only two people busy with hosting here: we are a part of bigger company. I'll tell you more about the company later as there's just not too much to say right now.

I promise to summarize my impressons about working in company and freelancing when it will a month since I started working: at November, 19.

And I'm not going to quit freelance. I'll just freeze it for a while and get back to it later, in smaller amounts, of course.

As new job consumes significantly less time and there are more interesting and challenging work here, I hope I will post articles more frequently hereinafter. I'm still what I am – a web developer and Unix admin, so more work – more experience – more articles.

See you soon.

Oct. 31, 2007 // 21:34 | Comments (0)


RentACoder To Enable Withdrawal With Payoneer Debit Cars, Too

Remeber my posting about GetAFreelancer.com introducing Payoneer cards withdrawals which came synchonously with almost the same article at MDLog:/sysadmin? (BTW, I've already ordered and received the card, but didn't have a chance to use it yet).

RentACoder may follow GAF and introduce the same payment option. There is no official information at www.RentACoder.com yet, but just today I came across an Uncle Edik's interview with Ian Ippolito, the RentACoder CEO, where he states that RAC already partnered with Payoneer.com:

Do you plan to add a new funds escrow option for RentACoder? I took part in the voting about introduction of the iKOBO option. Will it be someday possible to use a pre-paid debit card instead of checks? The reason I ask this question is that I can say for sure that a pre-paid debit card is the best option for Russian-speaking coders.

Yes... we will be adding Payoneer (a debit card like Ikobo) as well as bank deposit and some other options.We have already signed a contract with Payoneer. I hope to rollout a beta in 3-4 months and rollout to the general site in 5-6.

So far so good. I will hold my RAC payments for a few months and hope that's true.

And here's a Russian version of the same interview.

Oct. 30, 2007 // 20:21 | No Comments


The Hell of Non-Self-Documenting Code

There were a lot of buzz about self-documenting code a while ago, and there will probably be much more. I'm not that big fan of it (neither am I a fan of anything but music), but it is really helpful sometimes.

Do you hate lack of documentation as much as I do?

Plenty of languages are more self-documenting than they seem to be. On the other side, the thing that seem self-documenting, aren't always like that.

Take php. Imagine there's a torrent tracker software written in php:


function announce($passkey, $info_hash) {
//plenty of code here
    return bEncode($resp);
}

Pretty obvious, isn't it. Sure. But.

But what?

It is so obvious only if you use some framework to route HTTP requests to your classes and methods. It that case yes, any (awaited) GET parameter has a corresponding function argument, and you can easily see what is passed to /announce.

But what if the application is built like “old-style”: one atomic action – one file? I have to admit, that this style has it's advantages, among some weaknesses.

The worst thing about it is that you have to document it. If you don't – you forget what should be submitted to this particular script. Or, if you remember, a serial killer who reads your code, doesn't know what input does this piece of code wait for.

Use MVC frameworks if you are too lazy to write comments. Please!

Oct. 06, 2007 // 05:17 | Comments (0)


How Many Freelancers Does It Take To Change A Light Bulb?

I am a huge fan of that “how many somebodys does it take to change a light bulb” stuff. I'm sure, everyone knows this one already, but still it's one of the my favoutive:

Q: How many psychiatrists does it take to change a light bulb?
A: Only one, but it takes a long time, and the light bulb has to really want to change.

I am planning to launch a website with lots of such stuff both in Russian and English. Someday. I've even registered a domain name for that. Unfortunatelly, I rarely have enought free time.

What I want to do now is a little contest.

You may have noticed already that there are now Links section in my sidebar. This should be soon changed. And one of those links could be yours forever absoulutely for free.

Just win my little contest.

See the title of this post? Sure, you do. I still do not have any answer to this question in my collection. That's awful, isn't it?

So, the person, who would propose the answer I'd love most, will get a link to his site in my sidebar. Forever and ever and ever.

Sep. 26, 2007 // 23:00 | No Comments


Long Time Away, or Who Is Vanessa Hudgens?

Well, not actually away. Just didn't have much time to post. I had to pass two more exams to continue my education at University, and had pretty much work to do (soon to announce that project here, just waiting for my client to register domain name and rent a server), so I was pretty busy with all that. And there are also great changes in my private life (not too inspiring, but I'm trying to be optimistic), so I should confess, it was a hard time.

Anyway, I'm here now with lots of thing to tell you about. Be prepared for plenty of posts here. Here comes a brief summary of what is coming next.

Gone Ubuntu

I've been a die-hard Gentoo geek for 2 something years, but... Yes, you see it. :)

I'd probably never change my distro, but there were several things that made me think of it first and forced me to try a bunch of them later. I've seen FreeBSD in action and was amazed. I ruined my Gentoo system and had to get working system ASAP, so I've chosen the best available distro. The best available, not the best distro. I'm not too satisfied with Ubuntu.

I got CentOS 5.0 DVD and I'll try it in some near future.

Gone subversion

I didn't need any version control system for ages, but finally I've grown out of just everyday backups. I need to track work done, I need to know what exactly and when did I change in my code, I need to put milestones and track bugs. The latter is too much for SVN on it's own, but trac perfectly fits my current requirements. I even think of running trac in my sandbox and giving my clients access to it, but I don't know how to limit access for different users and afraid that tracking tickets could take too much time.

Gone single

Alas. Love ins't enough to stay together. We tried hard, she even kept trying when I gave up, but still there were too much thing we couldn't take over. Odd feeling, you know. You work so hard to be able to rent an apartment that would be a place for two of you, and suddenly you don't need it all and you don't know what to do with all of it.

Anyway, you're great, Annie, and I those 6 months were just wonderful.

Almost get employed

East is East and West is West, and I'm damned for freelance forever and ever, but I found a forum post about that vacancy and decided to try it out. My experience is more than sufficient for that work. I could become tech support engineer at local web hosting company, but they decided to hire a student (yes, I'm student, too, but I've got my last year in University, while he's second or third year one) with smaller experience, smaller ambitions and smaller salary.

I don't blame them, I'd do the same if I were them. And it's not the right job for me. Although I could do a lot for that company, they don't really need that right now, so they did the right thing.

Bud, God! It was in the middle of August, when it was hot like Hell and they do have an air conditioning in their office!

Got to give my code away

It was the first time when I had to stop working on a project to take a more important one and needed to prepare my code for other developer. Interesting experience and definitely I'm going to share it. Later.

Vanessa Hudgens

Who the heck's Vanessa Hudgens?

Sep. 26, 2007 // 00:14 | Comments (4)