Diamonds aren't Forever

For all you people looking to wed eventually, a great article on the future of man-made diamonds, which makes some interesting points worth repeating:
  1. Diamonds are not actually that rare, except that most diamond production is owned by a single cartel (De Beers) which constrains the output to prop up prices and create the appearance of scarcity:

    Natural diamonds aren't particularly rare. In 2006, more than 75,000 pounds were produced worldwide. A diamond is a precious commodity because everyone thinks it's a precious commodity, the geological equivalent of a bouquet of red roses, elegant and alluring, a symbol of romance, but ultimately pretty ordinary.

    Credit for the modern cult of the diamond goes primarily to South Africa-based De Beers, the world's largest diamond producer. Before the 1940s, diamond rings were rarely given as engagement gifts. But De Beers' marketing campaigns established the idea that the gems are the supreme token of love and affection. Their "A Diamond Is Forever" slogan, first deployed in 1948, is considered one of the most successful advertising campaigns of all time. Through a near total control of supply, De Beers held almost complete power over the diamond market for decades, carefully hoarding the gemstones to keep prices—”and profits—”high. While the company has lost some of its power to competitors in Canada and Australia over the past few years, it still controls almost two-thirds of the world's rough diamonds.

  2. Diamonds will soon be easily producible in a lab, which will be excellent for industry

    With a cheap, ready supply of diamonds, engineers hope to make everything from higher-powered lasers to more durable power grids. They foresee razor-thin computers, wristwatch-size cellphones and digital recording devices that would let you hold thousands of movies in the palm of your hand. "People associate the word diamond with something singular, a stone or a gem," says Jim Davidson, an electrical engineering professor at Vanderbilt University in Tennessee. "But the real utility is going to be the fact that you can deposit diamond as a layer, making possible mass production and having implications for every technology in electronics.
  3. Unlike diamonds that come from the dirt, man-made diamonds aren't socially nor environmentally destructive

    Like most open-pit mines, diamond mines cause erosion, water pollution and habitat loss for wildlife. Even more troubling, African warlords have used diamond caches to buy arms and fund rebel movements, as dramatized in the 2006 movie Blood Diamond. Actor Terrence Howard wears a diamond lapel pin with Apollo stones. He told reporters, "Nobody was harmed in the process of making it."
The ultimate point is, when real diamonds are cheaply producible in a lab, they won't likely have the luster which comes with scarcity. So ladies, please don't expect your man to spend thousands on a ring because it has a shiny rock on it. Or at least, don't expect that rock to be quite as shiny for much longer.

ROXML 2.0: An open-source takeover (now with defaults, blocks, hash mapping & better syntax)

I've remarked privately from time to time how I couldn't possibly achieve the things I've been working on without a million bits of work put forth by others. The list is massive, everything from the OS I live in to the web framework I build on and the language it's written in, to my source-control management program & IDE, my browser, and a million smaller pieces. Not to mention the many web services, both commercial and not-for-profit, and various tools disguised as websites. Most important of these, lately, seems to have been the git & github team. I'd never done much open-source development in my days, before picking up git. Even if I made changes to an existing project, it was too much a fuss to publish changes, and I was busy with other things. Busy enough that what changes I made, I kept for myself. But now it seems that git(hub) has changed that. Over the past few months I've made a number of contributions, of minor significance, but am graduating into more interesting territory, which is this, ROXML 2.0. ROXML is short for "Ruby Object to XML Mapping Library." XML goes in, Ruby objects come out. In these days, with web-services flying so freely across the web, and XML being one of the common languages thereof, it seems useful that one might be able to declare a mapping in the form of a collection of objects, then extend those objects with functionality, and interact with them cleanly, as objects, not as structured text. I had just this need, and came across ROXML and a number of other similar options. I picked ROXML because it was relatively clean, simple and to the point. I've been hacking away at in in the spare parts of my nights and weekends and by now there's very little recognizable from the original library, so I figure it's time to release :-). For an initial look at ROXML, you can see John Nunnemaker's recent post, or the old site & the docs therein. I'll be using those as a baseline.

A syntax makeover

Now, I can be a stickler for syntax. As I've said before, syntax matters. It changes the way we interact with the system, it changes what is done, how it is done, and what can be done. Take, for example, the old syntax: [sourcecode language='ruby'] class Posts include ROXML xml_attribute :user xml_attribute :tag xml_object :post, Post, ROXML::TAG_ARRAY end [/sourcecode]

Read-only-ability

There's something important missing in those definitions above. Quick, is :user modifiable, or no? What about :tag and :post? Surely it's one or the other, but which? It turns out that the attributes above are writable, which is the default. To override this you'd have to write the following: [sourcecode language='ruby'] xml_attribute :user, ROXML::TAG_READONLY [/sourcecode] As syntaxes go, this is a pretty obtuse barrier to const-correctness, and will likely lead to most developers simply leaving their attributes writable, even when more restrictive setting would be correct. The Ruby community may have cast aside strict typing, but const-correctness is still a very important part of object-oriented programming, what with factoring being all about minimum exposure and minimum coupling, and it ought to be treated as such. The solution is to treat writability the same way the standard attr methods do, by making it a key part of the declaration name. The type name is relegated to a parameter, which gives us flexibility we'll exploit later. In short, you end up with this: [sourcecode language='ruby'] # read-only: xml_reader :user, :attr # writable: xml_accessor :user, :attr [/sourcecode]

Object-tivity

Now you may notice above that :attr declares the referenced type as the second argument. This is consistent throughout and there are several more types. They are:
  • :attr: an xml attribute on the current node, returned as text
  • :text: the contents of a named sub-node, returned as text
  • :content: the contents of the current node, returned as text
  • Object: Any ROXML object can be provided to declare sub-types, including recursive types (provided recursion terminates)
  • [Object], [:text]: Put the type in an Array to declare that there are multiple instances of this type which should be provided in a collection
  • {}: A hash type can be populated with sub-nodes and attributes, in various ways
:text is the default, if no type is declared,

Named args & TAG_what?

The old ROXML uses only positional arguments and these TAG_ constants to declare aspects of the declaration. But the ROXML::TAG_ stuff is unnecessarily heavyweight, so the new ROXML uses symbols instead, e.g. :cdata rather than ROXML::TAG_CDATA. Likewise, many optional arguments are now named, rather than positional. So rather than have to put in the default values for these parameters, or nil, you can simply omit them. So these: [sourcecode language='ruby'] xml_text :name, 'NAME', ROXML::TAG_CDATA & ROXML::TAG_READONLY, 'USER' xml_text :name, nil, ROXML::TAG_READONLY, 'USER' [/sourcecode] Become: [sourcecode language='ruby'] xml_reader :name, :from => 'NAME', :in => 'USER', :as => :cdata xml_reader :name, :in => 'USER' [/sourcecode] The options map as follows:
  • :in: Previously 'wrapper'
  • :from: Previously 'name'
  • :else: Used to declare a default value in case the entity is missing; previously unavailable
  • :as: Previously 'options'. Can be passed as a singly symbol, or multiple in an array

Hash attack!

One of the more important additions is the Hash base type mapping. Hash declarations have a syntax of their own which enable you to pull from attributes, contents, names and sub-nodes of a series of entries. This can be super-useful for web-services which provide collections of named attributes, which fit naturally in this type. The ROXML documentation covers these cases well. Here's a few example of the syntax: [sourcecode language='ruby'] xml_reader :definitions, {:attrs => ['dt', 'dd']} xml_reader :definitions, {:key => {:attr => 'word'}, :value => :content}, :in => 'definitions' [/sourcecode]

Blocks, yo

As xml is by its very nature textual, it may be necessary to coerce it into a certain type or otherwise modify the data before it makes proper sense in the context of an object. As such you can supply a block which enables you to modify the incoming text, for example: [sourcecode language='ruby'] xml_reader :count, :attr do |val| Integer(val) end [/sourcecode]

Under the hood

Finally, an invisible improvement is that I've moved it over to libxml-ruby rather than REXML, for the sake of performance. So it should be significantly zippier on large sets of data, though to be honest I've done no profiling to confirm this.

Wrapping up...

So there you have it. You can get the gem from my github. You can see the docs here. I'll see if I can get this onto the official rubyforge site as well. The code is fresh, and while I've increased testing on it significantly (up to 131 assertions from the initial 25), there's plenty of possibility for bugs therein. Please just send me a message or pull request on github if you run into anything. Finally, I'd be remiss if I didn't thank Anders Engstrom, Zak Mandhro and Russ Olsen for their prior work on ROXML, which made this all a lot easier to get going. Thanks guys.

What would a sane healthcare system look like?

I received notice earlier today that a photo I'd taken was to be used in an editorial in the St. Louis Post-Dispatch. I'm glad to see my work (loosely speaking) get out there, but I had some issues with the editorial itself, and posted the following response:
As the taker of the photo (seriously), I have other thoughts on the subject. I don't agree that governmental health care reform is the way to go, without knowing more about the specific legislation. I looked up the one you mention, and found not a lot to like. Specifically, this is a big problem:
In exchange for all of this consumer support, the Wyden-Bennett plan would require individuals to have health insurance (an individual mandate), which must be purchased from a state-run purchasing pool that would require health policies to have substantial benefits (rich benefit mandates) and offer a choice of private policies. - source
This is a problem because health insurance itself is largely the culprit in our broken system. To make a Massachusetts-style health insurance mandate would only reward those who screwed things up in the first place, while perpetuating an inefficient system. My point in taking the picture was that insurance itself has got way out of hand, because it complicates the whole process. The key problem here is that health insurance isn't used as "insurance" per se. Proper insurance (fire, flood, car, &c) covers unlikely but potentially devastating expenses. But regular health insurance covers far more, and inserts itself into almost every health transaction, to our detriment:
"Insuring primary care is like insuring lunch. You know you're going to need it. You know you can afford it. Why on earth would you pay a third party to pay the restaurant on your behalf, adding overhead and taking a big chunk out of the money you pay—”and because of the process, have to wait a week to get a table and then have only 10 minutes to eat?" - source
As it is, some 40-50 cents on the dollar goes to wrangling with insurers about payment, this is wasted value which the consumer never sees, and which drives up medical costs. The alternative I favor is the system put forth by Dr. Garrison Bliss, which has 3 parts:
  1. A High-deductible health plan, i.e., insurance which only kicks in for catastrophic problems, such as cancer or a bad car accident. The premiums are much lower because the deductible is much higher (on the order of $1.5k).
  2. A Health Savings Account, which you and your employer contribute to tax-exempt, and from which you pay most of your medical expenses. You can afford to have money here because your premiums are so much lower.
  3. An enrollment with a Direct Primary Care provider, such as Dr. Garrison's Qliance, where you pay a fixed rate (in this case ~$50/month, though it could go lower), and in return get real relationship with, and 24hr access to, a primary care physician, and other services (x-rays, labwork, at-cost pharmacy) which makes your primary care physician much more than just someone who refers you to a specialist after 10 minutes.
In this system, your Direct Primary Care provider (DPCp) can work unencumbered by insurance paperwork, and has a strong financial incentive both to keep you happy (and thus enrolled), and healthy (and thus safe at home, rather than in their office). In those cases where you need to go to a specialist (much less often than the status quo), your DPCp would act as an independent, knowledgeable advocate on your behalf, advising you on the necessity of procedures, and the reasonable costs of them. Here again, the DPCp does so because they want your continued business, not because they're hoping to wring out another unnecessary procedure. Meanwhile, different DPC providers can directly compete, on costs and amenities, for the business of available patients. Such a system would dramatically shift the balance of power back to the consumer and their doctor, rather than putting it in the hands of insurer overlords who get to decide your every medical transaction. People would have a real relationship with their primary care provider, who has a strong incentive to support them with ongoing preventative care. While competition and consumer choice work to push inefficiency out of the system, from top to bottom. To me, this sounds a good deal better than the status quo, and other options I've heard.
Just to be clear, in the above system, the cost-savings and added benefits work out as follows:
  • By removing multiple rounds of insurer paperwork from each transaction you save a large portion of the 40-50% currently spent on administrative costs.
  • By maintaining a close relationship with a primary care doctor, on an enrollment basis, you greatly reinforce incentives to engage in preventative care, thus in many cases avoiding major health expenses by nipping them in the bud.
  • Many lower-level emergencies which might otherwise send you to the (expensive) emergency room can instead be handled by your DPCp.
  • As your DPCp is paid on a monthly basis, rather than per-procedure, they have no incentive to cajole you into unnecessary tests or procedures. This cuts down on medical expenses in general, by reducing unnecessary ones.
The net effect is the patient and primary care provider at the center of health care decisions, while potentially providing a significantly higher level of care for the same cost.

Can Money be Speech?

I was reading up online and I came across this statement in an argument about the public finance of campaigns (which I happen to think is a bad idea for many reasons, which I won't cover here):
Money is not free speech.
My response: This is a troubling statement. I'll try to explain why... Speech is not just speech. It is a million little steps which translate one person's thoughts into corresponding thoughts in another person's head. Money is one path through which a person's ideas and intentions travel. For example, if I want to communicate in another language, I must have a translator. If one isn't available for free (i.e., doesn't volunteer), then I must hire one in order to express my message in that language. If the government limits my ability to give a translator money in order to speak for me, then they have limited my right and ability to speak. The same is true of other forms of expression which require a purchase, such as advertising. So ultimately, when I give my money to a group which I support, they are acting for me, and by proxy expressing my speech. I support Ron Paul, and he, quite literally, speaks for me in the Republican debates, and in his ads. If you legislate my right to act through him, you limit my very ability to express myself. IMO, liberals are taking the wrong approach by going for public financing. Other people, such as Lawrence Lessig, are doing a much better job of approaching the problem without potentially destroying our speech rights. The problem here is quid-pro-quo (whether it be votes or access), and as he cites, interesting work is being done to break that (quid-pro-quo) link, without limiting the speech that occurs through dollar-voting on the part of citizens.

A tale of music discovery in the Information Age

  1. Load up boingboing, one of the more interesting blogs on the internet, to see what they've scared up recently.
  2. Notice an article on the holographic projection of sea-life on a recent Diesel fashion show. Sounds interesting...
  3. Follow the link over to youtube, to get a look at the effects
  4. You're a sucker for distorted vocals and dirty beats (see Vitalic, Battles), so you immediately notice the first song on play in the video, and suddenly you must know the answer to the question: who are these people?
  5. Search for some of the lyrics. Nope not good enough. Try again. And again.
  6. Bingo
  7. You ask yourself, who the heck is this "Walter Meego" guy?
  8. Look up "his" wikipedia page.
  9. Oh it's actually a them (who thought up that band name?). And they're from Chicago. Independent until recently, only E.P.s so far. The person who wrote the "style" section is laughably amateur, not at all in wikipedia style. This means the page doesn't get much traffic. Not surprising considering the other facts.
  10. Hop over to their myspace page, looking for more music to sample. They say they are working on a full-length album, good for them. You're much more impressed with "Romantic," the song from the video, than their other stuff, but that's life. Hopefully the eventual album is more in that style. Not touring much at the moment, unfortunately. You've discovered them just a bit too late to reasonably tip-off your NY-habiting friend about their show there that very night.
  11. Check if youtube has any videos of theirs, to get more a feel for their style
  12. First up, a video which appears to have been made in a dorm room, and includes a synchronized dance scene ala the macarena. The whole thing is kind of flippant and uninteresting. Okay okay they're independent, you get it. You just have such high expectations after seeing such great stuff from other bands.
  13. Second up, for the song which tipped you off, is a video involving ninjas playing in a theme park, playground, rollerskating, and getting rejected by the girls they make advances on. This is, put simply, an abomination. It runs totally counter to the song, trivializing the depth and sorrow of it in again, a flippant way. A commenter captures this in more than one language:
    I don't like this video. I love the song. I'm just so frustrated I'm gonna say this in swedish because I'm way too frustrated to think right now. Videon gör inte låten någon som helst rättvisa! What were you thinking? You've made light of the song and yourself with this video! C'mon u guys got some serious potential! Silly video and so's the other one.
  14. Disappointing, yes, but not a deal-breaker, after all, it's just the music you're there for. Still, someone needs to give these guys a talking to. Competition in the music industry is fierce, and videos are one of the best ways to spread the word. If your talent doesn't translate into the visual realm, find someone whose does.
  15. Head over to Amazon to pick up an E.P. Think twice and go to the band's website. They probably keep more of the money that way.
  16. Hmm... Romantic was the song you liked, but the Romantic EP is stuck together with "Wanna be a star" which is a bit more straightforward in just about every way... beats, lyrics. Definitely a B-side. But the sample remix isn't terrible. Ah well. If you were playing the iTunes game you may wait and purchase by the track, but you're not, so platters it is.
  17. Reflect on how awesome it is that you just used a fashion show soundtrack together with a host of internet tools as a music recommendation system to find a promising, yet (deeply?) flawed, relatively unknown band.
  18. Write a blog post about it.

ideas travel through us

A quote, relating to this column by (none other than) Fidel Castro titled "Ideas can not be Killed". Some could claim that ideas can't be killed because they are spread quickly through society. Of course the truth, I suspect, is more beautiful:
One could go further and say that ideas are inherent to reality. That what we do is just pick up the pieces of a story folded all around us. So one can tell you not to think, blow out the brains of the one who does, but they can not destroy the reality which we fight to carry out, to honor, to realize.

Creationist Revisionism

Well, it has been a long while, but after weeks of travel and work and films and art and some business, I've been refocusing my attention on the need for creation, for creative action. In that spirit, I'm reclaiming this blog for what I'd always intended it to be, a place for me to record my thoughts, and perhaps contribute something meaningful to the conversation at work on the web these days. So be warned, the future is now; or very soon at least.

Urban Shenanigans

I've recently moved to Seattle, and while the trip itself is something I should take the time to write about, since then I've had a really excellent time of getting to know a new place, finding and settling in a house, and meeting new people. Aside from all that, I love the city, but have had trouble explaining why. Today I had an experience which I think conveys the beauty of Urban life.

I've rented a place in a neighborhood called Capitol Hill, an interesting area across the freeway from downtown proper. I've all my things, save any furniture, which didn't make it into the car for the roadtrip up here. Anyhow, no furniture means no bed. It didn't take long to learn that the tile floor would be inhospitable, so after a brief stint sleeping on a mat of some of my clothes, and a longer one on a cot borrowed from a co-worker, as of today, I returned home to find the bed I had ordered over the weekend. Seeing as how I'd never owned a bed larger than a twin, I didn't have the sheets for the new one, so I set off, at 8:20, to get some sheets downtown from a certain store, knowing full well they were closing at 9:00.

Simply enough, I walk to the bus stop, hoping my timing will be right, but when I check, the schedule says that a bus had just past 5 minutes ago and another wouldn't come by for 30 more, too late to make it. Undeterred, I walked down the street towards another stop, where I know I can catch other routes downtown. Two blocks later, at an intersection, my bus zooms by, late. The light changes before I have time to cross and, flustered, I cross the other way, thinking the bus would be gone before I made it over to the bus stop.

I'm wrong, so when the light changes again, I'm on the wrong side of the street from where the bus still sits. In a moment, I'm running down the street, hoping to cross and catch it at the next intersection. Then, tradgedy strikes; As I'm running, I suddenly realize my phone is no longer in my pocket! How could this be?!? I'm forced to turn around the find it, as it's quite dear to me. I use it to take my pictures.

It turns out that my shorts, which I'd had for a while but were fine, except for having holey pockets, had gone from bad to worse and my phone could now fall out! Luckily it was an inexpensive lesson, as I found my phone, relatively unharmed a few feet away.

Knowing I'm pressed for time, I run to the next bus stop, where I'm glad to see that I have just a few minutes before the next bus arrives. So I sit and wait, and pretty soon four soccer players walk past. Then, there's a guy posting flyers on utility poles and trying to chat up women. The first one doesn't respond and he lurks behind her angrily for a short while, saying "You could at least smile, I'm never gonna see you again," but a few minutes later he's talking to another girl about cell phones and how mothers are sometimes wrong.

Late again, the bus eventually arrives, but now I'm pressed as ever for time. Less than 10 minutes later, I'm at my intersection, so I exit the bus and run through a crowd of sedentry folks waiting for the bus, over to the store which is due to close in 5 minutes. I make it, and after spending a few minutes comparing the merits of egyptian cotton to regular cotton, and 200 thread count to 350, I pick a few things and head to the counter, where the checkers are surprised to see a customer (and not just any customer, mind you ;-)) is in the store. One of them unlocks the door, and after regaining my bearings, I'm off to catch the bus back to Capitol Hill, carrying a rather large bag of bedding.

Pretty soon I see my bus down the street and, once again, this time with loot in hand, run toward it. I'm too late to catch it, and once again something falls out of my pocket. Luckily I've learned my lesson so it's just 2 dimes. While I pause to collect them, I realize that the bus I've just missed has another stop a block away, where a whole crowd of people are waiting for it.

I line up behind one of the people and notice that I'm not the only one carrying a big bag. Most everyone there had a large bag or suitcase or something. So, with nothing better to do in line, I ask one someone with a bag, "What's with all the suitcases and stuff?," to which she replies, "We're homeless, and we're heading down to a Church." Huh. Homeless people in Seattle seem much more "normal" than homeless people in Austin, which mostly are kooky or lazy (Seriously, ask another Austinite). Anyway, I finally get in the bus thinking that I blend in pretty well with these normal-looking, bag-carrying homeless folks, and I'm wondering if anyone thinks I'm homeless. I have time to reflect on that because one of the homeless ladies, who has a cast on her foot, is using the lift to get in, while another homeless lady yells at her (hollers, really), saying "What're you doing?! You don't need that, why I oughta woop your ass! You're holding up the bus!".

After other sights and sounds on the way back, I finally make it back home, and am glad to have sat by some rather polite people, who may or may not have thought me homeless.

So there you have it. It may not sound glorious, but I promise, it was.

PS. I don't want it to be thought that I'm disrespecting the homeless folks. Personally I think it's rather sad that so many people cloak their disdain by "feeling sorry". I give them the respect of treating them just as I treat everyone else.

A most non-trivial problem

I was reading about "Template metaprogramming" on Wikipedia tonight this morning and I noticed this line which got me chuckling.

The syntax and idioms of template metaprogramming are esoteric compared to conventional C++ programming, and advanced, or even most non-trivial, template metaprogramming can be very difficult to understand.

Maybe it's just late early, but lines like that get me thinking of the person who must have written it. I can see him hunched over the keyboard now, his little mustache twitching as he types, his glasses illuminated by the screen.