A notch above a monkey

Hide email address from spammers with Javascript

Update: I published a new, more safe but less friendly version of this script.

Wouldn’t it be nice, if you could post your email address on your web site without worrying spammers will pick it up?

Now you can, by applying a little bit of javascript to your web page. Just import this javascript file in head of your document and call mangle() inside your onload handler. What it does, is replace elements of form

<span class="change">billg at microsoft dot com</span>

with

<a href="mailto:billg@microsoft.com">billg@microsoft.com</a>

There are few caveats to its use. You’re not allowed to use any HTML tag inside of span blocks, which have class set to change. The script also expects such blocks to have only one class definition. If change is only part of class attribute value, this script won’t work.

You are free to use script as you please and to make any changes necessary. But if you choose to replace “at” and “dot” as delimiters, pick replacements that make address easily recognizable for those who don’t use javascript.

Note: The reason why this script works is that spammers use programs which search for email like pattern in page. They don’t interpret pages using javascript interpreter, since it would make collecting addresses significantly slower and more expensive.

Update: Jay Samec let me know there’s a bug in my code, since it didn’t handle emails with multiple dots (e.g. those with subdomains). Script has been fixed now.

Update 2: Holger Rindermann pointed out another bug and provided a patch to fix it that is now a part of the script.

Why I passionately dislike Twisted and Zope

I’ve been a Python programmer for more than 6 years now and during most of this time it’s been the language I used professionally. It’s safe to say, I know it fairly well and I’m quite attached to it. I also have to admit that I can’t stand Twisted and Zope.

It’s a continuous wonder for me, why Python community chooses to promote projects that feel most unpythonic to me. I became addicted to Python, because it was a very simple, yet expressive language which lived up to its mantra of making easy things easy and hard things possible.

So what is actually easy with Twisted and Zope? Practically nothing. At least not as long as you don’t dedicate yourself to their use.

You see, Twisted and Zope are not products. They are religions.

They were not built in a way that would make it easy to integrate them with wonderful things others built. It’s not easy to just pick the parts you like and use them elsewhere.

No, like a good disciple you were supposed to study the way they work, use their new vocabulary and dedicate yourself to live within confines of chosen religion. If you do this, then you’ll get some payoff and you might after a while even think you enjoy it.

But you’ll be missing on a hell of a lot of stuff others made and you’ll have to live with limitations of not your choosing. Well, at least not completely.

I guess I wouldn’t find it so distressing, if I didn’t feel Python developers are getting too eager to add new features to please Zope and Twisted developers. Or features that were inspired by these two.

So this language I loved is with each new release becoming ever less clean and beautiful and it’s getting easier and easier to imagine a day, when I’ll switch to some other language as my main development tool.

Disclaimer: When I talked about Zope, I actually meant version 2.x, because it was the one I actually used on a project and left me scared badly enough that I can’t make myself to even check X3. I heard it’s better in many regards, but I really don’t care anymore.

I also think developers who created Zope and Twisted are amazing. I just think that their product is, well, unpleasant.

I'm a human, dammit!

I’ve changed a lot and a lot has changed for me, since I started my company. Among other I’ve became much more aware of the way businesses deal with me as a customer. Maybe it’s just me, but it usually sucks beyond belief.

Customer relationship management.

I’ve never heard anyone with a successful marriage describing living his relationship as managing it. If you give it a name like this, you’re off in a wrong direction already. No wonder dealing with most companies for me has an appeal of a full-body wax depilation.

There are rare exceptions. One of them is Tomaž, a computer hardware dealer who can get you practically anything you need. All it takes is an email with a short description of what I’m looking for and in shortest time possible I get it delivered personally to my doorstep. There’s no unnecessary bureaucracy, no trying to sell me something I didn’t ask for and I get a good price. In short, it’s a great service that leaves me to focus on really important stuff. And Tomaž gets more business from me than he would probably otherwise.

Why is this so hard for others to learn?

By the way, if you need to buy computer hardware and you want to get a good price with as little fuss as possible, please let me know and I’ll send you his email address.