Archive for June, 2011
storing money in decimal fields in MySQL
by specialj on Jun.15, 2011, under Uncategorized
I haven’t found a lot of advice about what precision values to use for storing money in decimal fields. Here’s what I calculated. The scale is going to be 2 for US currency which requires 1 byte of storage.
- precision 4, scale 2 = 2 bytes of storage, 99.99 to -99.99
- precision 6, scale 2 = 3 bytes of storage, 9999.99 to -9999.99
- precision 8, scale 2 = 4 bytes of storage, 999999.99 to -999999.99 (I’ve tended to suggest this as a starting point)
- precision 11, scale 2 = 5 bytes
- precision 13, scale 2 = 6 bytes
- precision 15, scale 2 = 7 bytes
- precision 17, scale 2 = 8 bytes
Ubuntu 11.04 bugs I’ve experienced thus far
by specialj on Jun.01, 2011, under Linux
- Bug #785681 in xserver-xorg-video-intel (Ubuntu): “Unable to unblank screen, cursor still present”
- Bug #616131 in netbeans (Ubuntu): “JavaScript support in NetBeans”
- Bug #632984 in wxwidgets2.8 (Debian): “libwx_gtk2u_media-2.8.so.0 missing from libwxgtk2.8-0”
- Bug #790538 in pam (Ubuntu): “pam update causes cron to stop working with “Module is unknown” error”
- Bug #659738 in sysvinit (Ubuntu): “Duplicate welcome message in motd”
- Bug #509180 in eCryptfs: “ecryptfs sometimes seems to add trailing garbage to encrypted files”
- rails + git source in Gemfile = webserver (webrick or mongrel) cannot be shutdown by Ctrl+C or kill