❯~/pixelastic

DNS caching and flushing

Yesterday I moved this domain from one server to another on my Dreamhost account (actually, I moved the whole domain from one Dreamhost account to another, but that's the same).

The DNS saved at the registrar where the same (ns1.dreamhost.com, ns2.dreamhost.com and ns3.dreamhost.com). The transfer went seamlessly and I was able to access my website on the new server in an invisible way.

But, strangely, some hours laters I started to experience slow down when accessing the website and finaly all my requests timed out, be it either from Firefox or a direct ping.

I tried with my windows xp and my Ubuntu 8.04. I even change the DNS on xp to use opendns, run an ipconfig /flushdns, rebooted. On Ubuntu I've done a /etc/init.d/dns-clean start. I even rebooted my adsl box, thinking there was something wrong with the DNS cache on my side.

I even contacted both Dreamhost and Gandi with a complete traceroute to know if they could help me, as I thought having done everything that I could think of to resolve the issue. They assure me that their configuration was fine and the problem wasn't on their side.

When asking friends, or testing with http://downforeveryoneorjustme.com/ it occured that the problem really was on my side.

Everyone were true. The problem lied somewhere in between, in the DNS cache hold by my ISP that wasn't correctly up to date. I don't really understand how that could happen, I thought rebooting my Freebox would clear its cache, and specifying dns addresses of opendns would bypass the dns resolve of my ISP but it seems not to be the case.

Anyway, after waiting for some more hours, my website was again reachable through ssh and ftp.

So, if you're sure your dns configuration is correct both on your register and on your hosting service, make sure to clear every DNS cache you can have on your own side. That include windows inner dns cache, those of your browser, those of your router, and those of your specified preferred DNS resolving server.

If all that failed, it should be caching issue with your ISP, and there is nothing you can do about that, except waiting.

What would we be studying if our world was a software?

Physics is just reverse-engineering the world

I once heard or read that somewhere and that make me smile.

Today I wondered if the same analogy could be applied to the other subjects we are teached in school.

If Physics is reverse-engineering, then Mathematics is using the World framework and developping new applications and unit testing with it.

Biology would be micro-debugging and desassambling it, maybe even re-compiling it.

History would be nothing more than writing and parsing the logs.

Geography would be mapping the whole network.

French (or English, or whatever your first language is) would be reading and learning the doc and man pages. And of course, foreign languages would mean learning new programming languages.

Sports would be the fun part, where you are playing you video games.

Did I forgot something?

Debugging a Squirrel webmail

This is a quick blogpost, essentially as a reminder for myself:

A client of mine is using the Squirrel mail webmail. Once in a while, I have a call from him telling me that he can't access its account. The cause is always the same: there is way too much mails saved in his account and Squirrel mail choke on this, refusing to display the page.

The solution is simple, I just have to remove all the mails (except maybe the 100 or so last ones) and save them in a another directory, for archiving. The directory to save is /home/mailusers/c/contact/cur

But, thinking I was clever, instead of copying all the files to a new cur- save-2009 directory I thought it would be faster to rename the current directory to cur-save-2009 and create a new empty cur dir. Except that I forgot that I was loggued in as root and the directory must have a user/group set as postfix...

That's it, I just had to not forgot to set the owner/group of the cur/ directory as postfix once cleared.

Database in UTF8 with Coldfusion

When setting up a Coldfusion application, do not forget to add to your datasource the following connection string:

characterEncoding=UTF8&characterSetResults=UTF8

It will ensure that your data is correctly saved and fetched using UTF8. This is the coldfusion equivalent of the more commonly known SET NAMES 'utf8';

Never use alert() for debugging

One thing I learned today is to never use alert() for debugging pruposes. When the javascript alert() function is called it blocks every other action until the OK button is pressed. It means that your javascript code that is immediatly after the alert() call is delayed until you press OK.

It also means that the thread your browser gave to the javascript engine is halted during all this time.

Imagine you are binding keyboard shortcuts on your website to specific actions. Like pressing Ctrl+S will submit the current form. Of course, Ctrl+S is already defined as a shortcut in the browser, so you will take care of preventing the default behavior in your custom function (using return false, e.preventDefault(), e.stopPropagation() or any method defined in your framework to do that)

The problem is that is you call alert() in your function, the Javascript thread will be halted before you can make the call to stop the propagation and thus, the browser will take control again and firing its default shortcut.

So my advice is that you should never use alert for debugging. Use the console.debug() method shipped in firebur or directly write to the DOM but do not use alert().