Eric Roller's Development Blog

This blocking effort appears to have started in the Windows world but it is applicable to all UNIX-based systems where a hosts file is used.

Basically, copy the contents of this example hosts file to the end of your /etc/hosts file (requires root access).


In /etc/hosts, make sure not to remove the pre-defined settings, but you may comment out the duplicate " localhost" line. It should look similar to this:

# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##       localhost broadcasthost
::1             localhost
fe80::1%lo0     localhost

# Custom entries (not shown)

# This MVPS HOSTS file is a free download from:            #
# http://www.mvps.org/winhelp2002/                         #
#                                                          #
# Notes: the browser does not read this "#" symbol         #
# You can create your own notes, after the # symbol        #
# This *must* be the first line:     localhost   #
# *********************************************************#
# ---------------- Updated: Sept-02-2009 ------------------#
# *********************************************************#
#                                                          #
# Entries with comments are all searchable via Google.     #
#                                                          #
# Disclaimer: this file is free to use for personal use    #
# only. Furthermore it is NOT permitted to copy any of the #
# contents or host on any other site without permission or #
# meeting the full criteria of the below license terms.    #
#                                                          #
# This work is licensed under the Creative Commons         #
# Attribution-NonCommercial-ShareAlike License.            #
# http://creativecommons.org/licenses/by-nc-sa/3.0/        #

##  localhost

#start of lines added by WinHelp2002
# [Misc A - Z]  fr.a2dfp.net  m.fr.a2dfp.net  ad.a8.net

Finally, remember to check the example hosts file for updates; it is updated quite frequently.

To automate this process, I have created this script. You would need to execute it with "sudo" (or it could be placed into /etc/periodic/monthly ?).

# File: host_db_update

echo "Started /etc/hosts update"

# Download the current version without progress info:
curl -so /tmp/hosts.zip http://www.mvps.org/winhelp2002/hosts.zip

if (-s /tmp/hosts.zip) then
    # Unzip quietly and convert CRLF -> LF
    unzip -aoqq -d /tmp /tmp/hosts.zip HOSTS
    rm /tmp/hosts.zip

if (! -fs /tmp/HOSTS) then
    echo "Error: Download of hosts file failed."
    rm -f /tmp/HOSTS
    exit 1

set tmpdate = `grep -m 1 Updated: /tmp/HOSTS|awk '{print $4}'`
set etcdate = `grep -m 1 Updated: /etc/hosts|awk '{print $4}'`

if (X"${tmpdate}" == X"${etcdate}") then
    echo "Info: Hosts file is already up-to-date (${etcdate})"
    rm -f /tmp/HOSTS
    exit 0

# Remove the previous MVPS additions from /etc/hosts
sed '/^# This MVPS HOSTS/,$ d' /etc/hosts > /tmp/hosts.new

# Append the new settings
sed '/localhost$/ s/^/##/' /tmp/HOSTS >> /tmp/hosts.new
rm /tmp/HOSTS

# Make a backup and move the new file:
cp /etc/hosts{,~}
mv /tmp/hosts.new /etc/hosts

# Print a message:
echo "Updated /etc/hosts with settings from ${tmpdate}"
exit 0

Essential Mac Applications

- Posted in General by

When installing Snow Leopard, it occurred to me that there are a number of applications that I like and that I (almost) always use. They are, in alphabetical order:

Calico ($59 keskus.com)

An easy to use tool to stitch together multiple photos into panoramas.

Camino (open source, caminobrowser.org)

While I use Safari almost throughout, my bank is the only one that is deliberately refusing to support it. Firefox is good a good browser, but for my purposes it is too big. Camino, being specifically for the Mac, is just what I need for my bank.

Chicken of the VNC (open source, sourceforge.net)

A simple VNC client.

Cyberduck (donateware, cyberduck.ch)

An FTP client will all the bells and whistles to keep you happy (for those cases where "Conntect To Server" in the Finder is not sufficient to your needs).

DrawBerry (donateware, raphaelbost.free.fr)

A simple graphics app.

Fission ($32 rogueamoeba.com)

An easy to use audio editor with a nice waveform viewer (where Garageband is just overkill).

GraphicConverter ($35, lemkesoft.com)

I still use version 5.9.2 since it works fine for my needs.

HexEdit (open source, sourceforge.net)

For those rare cases where you like to dig in and see the guts of a file. Unless you are Japanese, you should stay away from the Japanese "J" version (look under Files for the one without the "J").

iLife ($79 or free with every new Mac, apple.com)

I mainly use iPhoto and iWeb. Most recently, I opted out of installing iMovie and GarageBand since I simply never use them.

iVolume ($30, mani.de)

Analyses and adjusts the loudness of your songs in iTunes.

iWork ($79, apple.com)

I mostly use Pages, but have also discovered that Keynote can be used as a vector-based drawing tool. The only problem is that every new major version cost again $79, which is why I feel inclined to skip one or two versions before upgrading.

Pixelmator ($59, pixelmator.com)

A photo editor. Not quite yet on the same level as Photoshop, but much more affordable and it keeps getting better and better.

TextWrangler (freeware, barebones.com)

Not quite willing to pay for the infamous BBEdit, I find that TextWrangler is an excellent alternative. I particularly like the graphical "diff" tool and that you can launch it from the Terminal (via custom edit and twdiff commands)

Tunnelblick (open source, code.google.com/p/tunnelblick/)

An OpenVPN client for the Mac. Only useful if you use OpenVPN.