Storing hierarchical (tree) data in SQL using Ruby on Rails

I have a Ruby On Rails project with a fair amount of hierarchical data.  I have already tried a few different techniques of managing this data.  Nested sets and materialized paths sound good in theory but in practice they didn’t work out so well.  Here are some thoughts thus far.

Continue reading ‘Storing hierarchical (tree) data in SQL using Ruby on Rails’ »

storing money in decimal fields in MySQL

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

Xen 4.0 and 4.1 packages for Ubuntu and Debian

Packages can be found here:

https://launchpad.net/~agent-8131/+archive/ppa/+packages

Design goals:

  • packages created for xen 4.0.1 and xen 4.1.0
  • packages mirror install of xen as closely as possible
  • currently only hypervisor and utils are included (make xen and make tools)
  • no rc.d scripts setup, that’s left to user
  • should be installable and functional on Debian and Ubuntu and on several versions
    • Debian lenny (hopefully), squeeze
    • Ubuntu hardy (hopefully), lucid, maverick, natty

Things to work on:

  • getting stubdom to compile so pvgrub is present
  • testing on various systems and fixing dependencies and conflicts as needed

Fixing netbeans in ubuntu

Netbeans has some issues in Ubuntu 10.10 and 11.04.  One of the most serious is that javascript syntax highlighting does not work.  Another is that Rails 3 applications do not run or debug correctly.  I found the solution to be going to “Tools – Plugins -Settings” and enabling the “Netbeans” update center.  Then by going to “Updates” and clicking “Reload Catalog” I got an update for the update system.  After that was installed an netbeans was restarted I got a lot more updates for plugins (15 or so).  Once updated everything seemed to work as it should.

More information:

Attempting to package Xen

I’m not an expert at Debian packaging but I’ve been gotten tired of building Xen on every systems and losing the advantages that packaging brings like tracking file conflicts.  So I decided to try and package Xen though I have had no luck so far.  I am making slow but steady progress.  I wanted to package both 4.0.1 and 4.1.0 so I could compare them.  I’m finding that 4.1.0 has stability issues and switching between the two without packages is incredibly time consuming.

Continue reading ‘Attempting to package Xen’ »

Working with Xen 4.1

I took a development box running Xen 3.3 on Ubuntu 8.04 and upgraded in to Ubuntu 10.04 and installed Xen 4.1.0 from source.  I still believe Xen is the best open source virtualization solution.  At some point I’ll have to write up my experiments testing KVM + libvirt but suffice if to say the performance and stability were unacceptable.  However, while the performance of Xen is great, I have noticed some issues with Xen 4.1.0.

Continue reading ‘Working with Xen 4.1’ »

shaping p2p traffic

I’ve been doing more work with linux traffic control.  I’m finding my earlier efforts are too complicated and end up introducing latency.  My latest shaper is very simple.  I decided I wanted to check in on the status of a couple of projects that can be used to classify p2p traffic.

Though I’ve played with both of these in the past I’m not using either in production currently.  Most p2p programs are well behaved enough to mark data transfers as bulk which makes shaping easy.