This post was written in 2008. It's preserved here for historical purposes — the technical details may no longer be accurate.
🔍
2026 retrospective
This advice is now the opposite of what Apple recommends. Modern lithium-ion batteries degrade faster from deep discharge cycles. Since macOS Catalina (2019), “Optimized Battery Charging” stops at 80% automatically. Apple recommends keeping your MacBook plugged in when possible and removed the “calibrate by full discharge” guidance around 2012.
3 simple rules:
DO NOT leave your charger connected when the battery is charged, even when
you go to sleep.
DO let it discharge completely, when using it wait till it reaches 0%, when
sleeping it leave it alone, when you’ll wake up and you’ll open it, a resume
from suspend to disk will greet you. OSX FTW.
Monitor it and show off OSX performance counters to your friends (images
courtesy of
CoconutBattery.app and System
Profiler.app)
This post was written in 2008. It's preserved here for historical purposes — the technical details may no longer be accurate.
🔍
2026 retrospective
Sun was acquired by Oracle in 2010 and Solaris is effectively abandoned since Oracle gutted the team in 2017. Python 2.4 and urllib2 are long gone — urllib2 was merged into urllib.request in Python 3.
While happily installing prerequisites to build an app on Solaris
11, i enjoyed having
Mercurial already installed in the base
system.. except for a BIG issue: digest authentication was broken. I
tcpdump’ed the traffic exchanged between the mercurial client and the CGI
server and I saw that no Authorization header was sent, and obviously the
server refused to serve the hg repository.
Before reinstalling python, maybe from source and replacing the default
installation or having side by side two different versions, with consequent
nuisances and dirt around the system, I tried a very very small patch to
urllib2.py that… amusingly enough, fixed my problem:
I’m no fscking python expert (but the language is interesting), so don’t ask me
WHY it works, i simply followed the add_header comment that said “this method
is useful for adding authentication headers” and replaced the
unredirected_header method with the former. I really don’t know why with
Python2.5’s urllib2 “everything works” even with that method, something must be
broken somewhere else. A diff between the two urllibs gave me nothing, I really
should learn Python one day or another.
This post was written in 2008. It's preserved here for historical purposes — the technical details may no longer be accurate.
🔍
2026 retrospective
The Gibberish plugin and this entire approach are long dead. Rails 2.2 (2008) added built-in I18n support, and since Rails 3 the standard way is config/locales/*.yml with the i18n gem. ActiveRecord error messages, field names, and all UI strings are handled natively — no plugins, no monkey-patching.
UPDATE: you don’t need this code, because starting from the 2.2 version of Rails, localization support is built-in.
Today I had to answer one of the questions every non-English Rails developer
stumbles upon sooner or later.. how to localize AR error messages for pleasant
appearance to a non-english customer ;).
First off, thanks to defunkt’s excellent gibberish
plugin and to the way AR validation errors are exposed, the task was
accomplished in an easy and clean manner, without messing too much with AR’s
internals.
I started by translating every default AR error message, with this translation
file located in lang/it.yml:
# Active Record errors#ar_accepted:"deve essere accettato"ar_not_a_number:"non è un numero"ar_blank:"è un campo obbligatorio"ar_empty:"è un campo obbligatorio"ar_inclusion:"non è nella lista dei valori validi"ar_too_long:"è troppo lungo (massimo %d caratteri)"ar_exclusion:"è riservato"ar_too_short:"è troppo corto (minimo %d caratteri)"ar_invalid:"non è valido"ar_wrong_length:"è errato, dovrebbe essere di %d caratteri"ar_confirmation:"non corrisponde"ar_taken:"esiste già"# This one is not a default key, but I use it in my validationsar_greater_zero:"deve essere maggiore di zero"
The first one simply sets Italian (:it) as the default language, the inject
builds a new error_messages hash using Gibberish to translate the default ones.
I named every AR error key in my translation file with an “ar_” prefix, in
order to avoid possible future key clashes. Finally, AR array is overwritten
with the new one freshly built.
This post was written in 2008. It's preserved here for historical purposes — the technical details may no longer be accurate.
🔍
2026 retrospective
Safari abandoned this SQLite cache format years ago. Since roughly Safari 10 / macOS Sierra (2016), the cache moved to com.apple.WebKit.Networking in a binary blob format — the old Cache.db no longer exists.
Five minutes ago, I overwrote the super-shining-new CSS stylesheet that
implements the current color scheme, because i wanted to restore the original
one and put it in a new theme for this site, so that people who enjoyed the old
theme could continue to use it. But, as the most kiddie system administrator,
i uncompressed the original files from the backup archive OVER the current
ones..
Safari to the rescue! Every cached item by safari is stored into a SQlite3
database located in ~/Library/Caches/com.apple.Safari, let’s inspect how it
is structured:
Wow. Impressive. That’s why i love Apple products, because they are so well
structured that you can freely inspect them and use them and their resources
for every unplanned task you could have to complete.. even to fix your own
mistakes ;). And it’s also intriguing, because you have to scratch your own
itch and find the solution while exploring a beautifully constructed software
product.
This post was written in 2008. It's preserved here for historical purposes — the technical details may no longer be accurate.
🔍
2026 retrospective
Both Python 2.5 (EOL 2011) and SCO OpenServer are extinct. SCO/Xinuos went bankrupt, and Python 2 itself reached end-of-life in January 2020. This is a digital fossil.
You must have PTH installed, and maybe other libs.
Add /usr/local/include to BASECFLAGS in Makefile (autocrap sucks).
Patch Modules/ctypes/_ctypes_test.c by putting an #ifdef HAVE_LONG_LONG around functions that use PY_LONG_LONG (hints: lines 384 and 318).
Patch Objects/longobject.c and on line 817 put the IS_LITTLE_ENDIAN macro before the #ifdef HAVE_LONG_LONG block, and put _PyLong_FromSsize_t and _PyLong_FromSize_t after the HAVE_LONG_LONG block.
This post was written in 2007. It's preserved here for historical purposes — the technical details may no longer be accurate.
🔍
2026 retrospective
Ruby 1.9 reached end-of-life in 2015. Ruby is now at 3.x, and Symbol.all_symbols no longer includes this easter egg — it was removed long ago. The answer to life, the universe, and everything remains 42.
A really, really, really NERD novel by Cory Doctorow
that tells about a bunch of sysadmins that strive to keep the good ol’ Net
online after a catastrophic event that brought the entire world to its knees.
They fight with scarce power and food supplies and communicate over the Usenet…
using the good old alt. hierarchy.
Vote: 10+ for the geekiest thing I’ve ever read. It’s really worth the hour
needed to read it completely.
This post was written in 2007. It's preserved here for historical purposes — the technical details may no longer be accurate.
🔍
2026 retrospective
Apple added native SMB-based Time Machine support in macOS High Sierra (2017) and deprecated AFP in Big Sur (2020). Today any NAS with a plain Samba share works out of the box — no Netatalk, Avahi or marker files needed. Time Capsule was discontinued in 2018.
Ingredients: Debian, Netatalk, Avahi, some trickery.
You can safely ignore the “.passwd” stuff, because afpd uses PAM for user authentication.
Hint: Disable the atalk protocol handlers in /etc/default/netatalk for a faster startup:
# Set which daemons to run (papd is dependent upon atalkd):
ATALKD_RUN=no # appletalk protocol
PAPD_RUN=no # printer sharing daemon (printers are soooo '90s)
CNID_METAD_RUN=yes # don't remember but is needed, rtfm!
AFPD_RUN=yes # you will always need this
TIMELORD_RUN=no # my time lord's name is <a href="http://openntpd.org">openntpd</a>
A2BOOT_RUN=no # boot? nah! :P
Step 2: Create a share for time machine backup data, by adding e.g.¶
# path name perms charset
/some/where/tm "Time Machine" allow:vjt volcharset:"UTF8"
Download the avahi service file, put it into /etc/avahi/services and reload avahi with /etc/init.d/avahi-daemon reload (sorry, original links are broken).
You need two files on your afp network share: .com.apple.timemachine.supported and a dot-file named with your en0 MAC address. To create it, the easier way is to attach an USB/Firewire disk, rename it with the name of the intended network share (specified in the AppleVolumes file) and enable time machine on it.