Posts for Computing

Avoid waiting for DNS to propagate when registering a domain

2011 December 27

When you register a new domain name you do not need to wait 48+ hours for the DNS to "propagate". It never takes me longer the 10 minutes to get from choosing a name to an active website. I hope to show you how you can do the same in this blog post.

When registers say you have to wait for DNS to propagate you are actually waiting for a negative DNS cache to expire. When you access your site in a browser it tries to resolve your domain name into an IP. It generally sends a request to your ISP responsible for your internet connection. If the DNS or even name servers have not been set at your register yet then your ISP will cache a negative result typically for 48 hours. You will then need to wait till that cache has cleared before you will be able to get the new DNS records. It comes down to which tools you are using to check the website it functioning. If you are using your browser you are doing it wrong...

Counting lines of code in a python/django project

2009 November 19

Today I had the need to count all the lines of code in a django project. To start with I looked for a python script, then it occurred to me that seeing I'm on a *nix I should be doing this on the command line. So this is what I came up with:

find . -name "*.py" -type f -exec grep . {} \; | wc -l

This counts all the lines in the .py files in the current directory recursively. It does not count blank lines but it does count comments.

Keeping Mercurial history linear

2009 September 30

When ever I work on a project that uses Mercurial for DVCS there always seems to be a lot of "Merging up stream." At first I thought "Great, looks like this project's having new features merged often". On further inspection most of this merging was not necessary. I believe this is due to the fact Mercurial does not have a rebase command enabled by default. Thankfully though there is one shipped with Mercurial that is very easy to enable...

Mac OS X Disk Utility commands

2009 April 27

For my fist post I thought I would keep it simple. The following are two commands related to disk images in OS X.