Contour Line

December 16, 2008

possibly inconsistent data

Filed under: couchdb, transportation — jmarca @ 5:12 pm

One of the things I am trying to figure out with couchdb is how to structure data so that it can’t be internally inconsistent, what is that, normalized, I guess.

So suppose I have Caltrans District, County, and City.  All of which are cleanly delimited, etc etc.  In a relational database, I’d enforce consistency by using foreign key constraints, so District 12 links to Orange County, and there can only be one link from a county to a district, etc.  But in couchdb you don’t get foreign keys.  So if I want to include data on the district, etc, I have to shove it into the document.  But that means I can make mistakes, and no one will stop me.

So I can have one document that says:

{
  'City' : 'Costa Mesa',
  'County': 'Orange',
  'District': 12
}

and another that says

{
  'City' : 'Newport Beach',
  'County': 'Orange',
  'District': 7
}

Even though the county of Orange should never be understood to be in District 7. Putting just the one-level-up doesn’t help either, because then I can’t sort on

[District,County,City]

And while I am  on the subject of sorting, I can’t yet figure out how to get a numerical sort of districts.  They are called 1, 2, 3, … , 12, but sorting them on District_id in the view and I get “1″, “10″, “11″, etc  alpha sorting, not numeric ordering.  I figure I’ll get that one sorted eventually.  I saw something that said to sort on dates, so I suppose it is a similar hack, or writing javascript to convert text to numbers in the view function before emitting the key.

Knitting diamonds in the round, hm?

Filed under: lace knitting — jmarca @ 11:09 am

Blog stats are funny.  My incomplete and possibly incorrect posting for my original diamond lace hat is by far the most popular thing I’ve written (popular being a relative term, with only like 300 views).  Looking at the stats, it is mostly one off google searches for diamond lace knitted in the round, etc. etc.  So I really will make an effort to post the actual chart that I used for my second hat, which came off without any glitches and flew off my needles in two evenings.

I’m actually working right now on a cabled hat (v2) and am taking notes on the decreases.  The cables themselves are pretty easy (using Barbara Walker’s second knitting treasury as source, and her advice that fisherman’s sweaters are vertical cable samplers—so this hat is just a cable sampler).

But first I’ve got another monster project  (scarf) to finish.  My goal is 60 rows a night, but I’ve only done 18 and then 24.  At 24 rows a night, I will finish by Christmas, but with no time to spare.

Blog at WordPress.com.