Mon, 12 Mar 2007
daemon_percentages.rb and Ruby Autovivification
Both Jim Weirich and
Ben Summers were kind enough to
email me about my Daemon
Logging Percentages and Playing with Ruby Idioms post. They sent
me an explanation on how to do the hash assignment in a way I find much
nicer, so with no more delays I present - Option 4:
tally = Hash.new(0)
tally[daemon] += 1
It really is that simple - and I still missed it by a mile. I've updated the script to use this and I wanted to say thank you for the pointer, so thank you both.
Like this post? - Digg Me! | Add to del.icio.us! | reddit this!
Posted: 2007/03/12 21:06 | /ruby | Permanent link to this entry | This entry and same date
books
career
codinghorrors
events
geekstuff
justdont
magazines
meta
misctech
movies
nottech
operatingsystems/linux
operatingsystems/linux/debian
operatingsystems/solaris
perl
presentations
programming
python
ruby
security
security/apache
security/tools
serversmells
services/dns
sites
sysadmin
testing
tools/commandline
tools/firefox
tools/gui
tools/network
tools/online
tools/online/greasemonkey
tools/puppet
unixdaemon

