Author Archives: Daniel - Page 2

Typing or fretting

It just occurred to me that if you play the guitar and touch-type, you have slightly conflicting demands of your fingertips.  For guitar, you want your left (fretting) hand fingertips to have thickly calloused skin so that you can play longer without worrying about bruising from the strings.  If you play classical or fingerstyle, you probably want to have longer fingernails on your right (plucking) hand so you can get a sharper, clearer tone.

Yet for touch typing, it helps me to feel the keyboard, so I can find the positioning bumps on the home row and feel when I’m hitting keys at their edges so I can reposition.  Good tactile feedback and sense helps me adjust to differently-sized keyboards faster too.  Calloused fingertips don’t feel the keyboard well, and fingernails might even prevent your fingertips from touching keys.

hmpf. 🙂

An article about the costs of US healthcare

It’s easy to bash the American healthcare system and point out instances where it’s lacking.  To me, it seems to be more about billing systems than medicine.  A friend told me about his experience in France, where he, as a foreigner, was seen and treated by a doctor at his hotel, and upon trying to pay was dismissed: “You Americans, always wanting to pay for things.”  Yeah, they pay high taxes and don’t typically have single family homes, cars or enormous flatscreen TVs.  They also seem to generally believe in their government.  Whereas Americans like to euphemise imperfection as “good enough for government purposes.”

Anyway, if you care about the balance of costs versus quality of care, you should check out this article in the New Yorker about how a small town in Texas has one of the highest healthcare costs per person.  I found it a well-written article that’s chock-full of helpful tidbits for your next healthcare debate at a bar, cocktail party, cafe, or late-night dorm room philosophizing session.
Here’s one tidbit from the article:  “In 2006, Medicare spent fifteen thousand dollars per enrollee here, almost twice the national average. The income per capita is twelve thousand dollars.”

Another: ” Two economists working at Dartmouth, Katherine Baicker and Amitabh Chandra, found that the more money Medicare spent per person in a given state the lower that state’s quality ranking tended to be.”

Fast searching on Dovecot with Fedora

Although dovecot comes with its own full-text indexed search, it doesn’t seem to be enabled by default, at least in Fedora 10.  This is a shame.  For me, it makes a search for body text take a few seconds rather than a couple minutes.

To fix, modify your /etc/dovecot.conf and restart dovecot.

  • Add fts and fts_squat to the mail_plugins line in your protocol section (protocol imap for me).
  • Specifically, look for:

    protocol imap {
    ...
    #mail_plugins =
    ...
    }

    and change it to look more like:

    protocol imap {
    ...
    mail_plugins = fts fts_squat
    ...
    }
  • Add fts = squat to the plugins section.
  • plugins {
    ...
    fts = squat
    ...
    }

Sadly, there was no Ubuntu help forum thread that made all this blindingly obvious, so I hope this post fills that need. This all worked on Fedora 10 with dovecot 1.1.10.

Have a nice day.

Configuring VMWare Server 2 authentication

Recently I’ve needed to install a virtual machine on my spiffy RHEL 5.3 system, so I turned to VMWare, since its free Server software (1.0 series) worked fine on Ubuntu Dapper.  So I tried installing Server 2, because newer is better, right (you know where I’m going…)?

Server 2 does user-level authentication, so you need to specify the admin user at setup time.  That will be the only user (initially) that can touch the vmware instance.  This means that if you disable the root password, then you should not choose ‘root’ as that user.

So this is fine, except that I couldn’t login initially.  The trick is that VMWare does its own user authentication off of the normal /etc/{passwd,shadow} files, and I was authenticating with Kerberos as an AFS user.

Here’s how to fix things.  You need to modify /etc/vmware/pam.d/vmware-authd .  Upon installation, it contains:

#%PAM-1.0
auth   required   pam_unix.so   shadow nullok
account  required  pam_unix.so
You need to add a line so it looks like:

#%PAM-1.0
auth sufficient  pam_krb5.so use_first_pass  refresh_creds debug 
auth   required   pam_unix.so   shadow nullok
account   required  pam_unix.so
I used /etc/pam.d/system-auth as a reference. (I’m not sure the ‘debug’ part is needed.)

Since I couldn’t find anything online (this is one thing that google didn’t really know) that fixed things, I hope this is useful and saves a few hours or so for somebody somewhere.  The closest post I found didn’t seem to have a clear resolution and solution.

Update: If something gets borked and it says your user is unauthorized, you can set the admin user by editing the value in the <ACEDataUser> tag in /etc/vmware/hostd/authorization.xml .

Let me know if I’ve missed anything–all I can say is that this worked for me.

The costs of running

A little more than two years ago, I started running regularly for general fitness.  What I didn’t expect was the enormous feeling of achievement as I got tangibly better, running distances that I never thought I’d be able to (and actually getting to the point where they weren’t a big deal). Speed was never really a goal of mine, but lately I’ve been happy with my weekly distances, so maybe it’s time to build some speed.

But first, here’s something I didn’t expect.  Running actually costs money.  I run in public places, so there’s no real admission fee or stuff like that, but I do need shoes if I want to stay uninjured.  Running shoes are pretty pricey, usually costing between $70-110.  Add the fact that runners need a particular type of running shoe (just being a generic running shoe is not enough!), and that differences between brands and models within brands are as significant as fit (which is more important for running than for casual or dress shoes).  In business, they call this an extremely high cost of switching.  And running shoes almost never go on sale, and their prices seem only a little less fixed than game consoles.

So why does this matter?  Shoes wear out.  I’m running roughly 20 miles a week and shoes should be replaced every 300-400 miles.  Do the math.  This works out to more than a thousand miles a year, and therefore 2-3 pairs of shoes a year, so between $140-330 a year.  I guess that might be cheap compared to some sports, but it’s more than what I expected for a sport where “all you need are shoes.”

I wouldn’t give it up though.  I feel more alert and energetic than I did in my 20s.  It’s a great stress reliever.  I’m a little dependent on it, though.  If I stop for more than a week, my joints are achy and I get stressed out more easily.  I worry more.

Oh, and I should point out that registration for races is not cheap either.  A 5K or 10K might cost $30-40, but the longer ones cost!  The Disneyland Half Marathon was $100.  I couldn’t justify it.

My race results: Rock ‘n’ Roll San Jose Half Marathon

7773 • Daniel • Irvine CA • M-30 • Half Marathon •
Gun: 7:59:36 AM 5k 10K 10Mile Finish
Chip: 8:02:07 AM 28:06 59:22 1:37:55 2:19:09
Race Pace: 9:03 9:34 9:48 10:37

Perhaps I’ll tell more later.

Webs, the kind made by spiders

I’ve just spent the last hour (most of it, anyway), watching a spider weave a web. If you haven’t watched a spider spin a web, I highly recommend it whenever you have the opportunity.

I was walking home this quiet evening, when I happened upon a rather large spider. By ‘large’, I mean a spider with the abdomen about the size of a piece of Skittles or an M&M. Its legs could probably span the width of two quarters side-by-side. Anyway, I was walking by, and it had just put down a few basic support threads spanning a bush and a tree about two feet away. This was the first time, as far as I could remember, that I had seen a spider actually weaving a web. I thought to myself, “Self, you’ve never seen a web woven before, and this big spider is about to weave one right before your eyes. Why don’t you stop and have a look– you’ve got nothing particularly urgent to do tonight.” So I did.

Watching a spider weave a web is one of the more fascinating things you’ll ever see. As you watch this feat of biology, physics, and, well, nature, you will no doubt observe things that are practically hidden from you when you see the finished product. Here’s what I noticed.

Scaffolding: Though I didn’t see the very beginning of the web, I came early enough to see the spider attach most of its main support threads between the tree trunk, its branch, and the nearby shrub. What was interesting was that a lot of structure is put in place before the center of the web was chosen. This support framing consisted solely of long segments, sometimes bolstered by double or triple threading. When it was done, it began the next stage by marking the center.

Centering: The spider marked the center by emitting a few large globs of web-material. I don’t know if it came out of its spinnerets or if it puked them out, but it sure looked like it puked. One instant, it was attaching another support line somewhere in the web, and the next instant, there was a few army-ant-sized globs hanging on the web. I would later discover that this was the new center of the web. Now that the center was chosen, it could now add radial segments.

Radials: The spider deposited its first radials rather sparsely, apparently to lay out some structural support. Only after there was roughly even support all around did it begin filling in. After the first set of radials, it would fill in the gaps with about 12 degree spacing– I counted about 30 radial threads from the center at the end. Once these radials were done, it never laid down any more of them. It proceeded to the spiraling.

First spiral thread set: The spider proceeded to add spiral segments around its center, easily referenced by the army-ant-sized globs. Ring spacing began around 2mm, and would grow gradually, until they were about 3cm apart, about 10 inches or so from the center. Once they got too far apart, the spider stopped, and began filling in the outside.
Support arcs: I suppose there’s a technical term for what it built next, but it laid out arcs at the top and bottom of the outer edge of the web, several inches from the boundaries of the spiral it had just made. The top and bottom each got three or four arcs, spaced about 1cm apart, spanning several radials.

Outside spiral fill: After these supports were put in, the spider began filling in the web in a spiral fashion, beginning with the outside arcs. Spacing was about 7-10mm between rings. This is the final stage (before I began typing this) of the web construction.

Resting: Every now and then, the spider seemed to pause for a several seconds, apparently to rest.

Attaching threads: The spider paused for about half a second to make attachments after each segment. The long, framing threads took a lot longer to attach– perhaps three or four seconds. I now understand why spiders have eight legs. When spinning threads, the spider uses two rear legs from one side to guide and push the thread to the attachment point. Why two? It hands thread from one to the other. And with two legs on a side not supporting weight or providing stability, it assuredly needs another two on that side. It’s attaching a really thin thread coming out of its butt and attaching it to a precise point on another really thin thread, so a lot of stability is required. I never once saw it slip or stumble.
Thread spinning observations: Usually the spider added threads by releasing silk while crawling along an existing thread. It was interesting to watch when it didn’t. In those cases, it would let itself drop slowly, releasing its silk, until it landed on the horizontal segment it somehow knew was there.
Gravity: After finishing, the web’s spiral rings looked really quite evenly spaced. The slightly wider spacing at the top hints at a different story during construction. I was surprised to find that after beginning what I called ‘support arcs’, the additional weight ruined the nice inner spiral, which looked increasingly ruined as more spirals were filled in from the outside-in. Not to worry– the spider re-tightened the innermost spiral rings afterwards.

Final dimensions: The spiral web portion was roughly three feet in diameter. Yes, that means that if you walk into it, it will wrap around your head completely with room to spare. This spider should get some mighty fine eatin’ tonight.

Anyway… you should really have a look if you’ve never seen a spider spin a web right in front of you. A book, DVD, wikipedia entry, or youtube video will just not cut it. It’s a different experience when you can walk around it, put your face as close as you dare, squint to see its impossibly thin threads in the light, and watch the web undulate as the occasional breeze (or breath) blows by (you’ll notice that its rigidity increases with support threads and decreases with sticky threads that catch the wind).

Epilogue: Actually, the spider’s completely finished now.  It’s resting in the very center of the spiral, and the globs of stuff that marked the center are now completely gone.  Overall ring spacing is about 1cm near the top, and 3-4mm at the center and sides, and maybe 3mm at the bottom. Verily, I marvel.

Math for pill poppers

I’ve always felt that mathematics is a useful tool in everyone’s daily life. Here is an example.

Recently, I was prescribed some medicine, and it was to be taken twice daily: once in the morning, and once before bed. However, I made a couple mistakes. The first morning, I took twice the dosage in the morning. And, in the evening I dutifully took another dosage, but made the same error and took a double dosage again. I realized my hapless error just as I downed the requisite glass of water. So what was I to do. Clearly, the drug was now above the prescribed concentration in my bloodstream, so should I continue the normal schedule the next morning?

We can use math to figure this out. Most drugs taken in orally can be considered to have a “half-life” in your bloodstream. Yes, this is the same concept of half-life in radioactivity. Basically, your body gets rid of stuff from your bloodstream at a constant rate, given the current concentration of the ‘stuff’ in your blood. This is modeled in math as an exponential decay function. To illustrate, have a look at these equations.

equations
The simplest form is (1), which illustrates the basic shape of the drug concentration. We add a step function (2), which allows us to make just the part after the dose is administered, along with a t0 time offset parameter to give a more accurate shape in (3). (4) adds a half-life parameter, which is scaled away from the irrational e to become (5). This is the concentration resulting from a single dose, over all time, parameterized by dose administration (6). While you are taking the medicine (t=0 to t=t_finish), we can represent your idealized concentration as (7). The summation variable i gets incremented by 0.5 each time, which flies in the face of normal convention. Sorry about that. The code farther down is correct.
All simple, right? Let’s plot things. I used Mathematica to generate these plots. Equation (6) becomes:

dose equation
Note that in this function, x is time (in days), and t is the time offset. I threw the equation together before thinking about how best to represent things for others… Sorry…. The 1.3333 factor is the the half-life constant. The half-life for my medicine was roughly 18 hours, which is 0.75 days, which is roughly 1.3333 (close enough for my (government’s) purposes).
And then we can plot our ideal concentration.

dose, ideal

This is how the concentration would look like if I took the medicine exactly as directed. We can see that the concentration is roughly periodic after about two days of accumulation. But! I messed up, remember? How can I adjust my next doses to return to the ideal case?

dose, adjusted

You can see that at t=0, my medicine concentration is twice the ideal(conc = 2), since I took twice the dosage. Accordingly, the second dose, which was also twice too large, boosted my concentration to about 3.25. In this scenario, I skipped the third dosage (second day, morning), to bring my concentration roughly the same as the ideal case at t=1.5 . So there you go.

The bottom line is that I should skip the third dose if I take two double-doses on the first day. Yay! Isn’t math fun? This amount of math is no more than what a high-school graduate should have, and probably less than what an overachieving middle schooler could do.
I’ll be sure to post other examples math in real life when I get the gumption. Have a nice day!

Regulating broadband and wireless

For the record, I am in favor of unlicensed frequency spectrum and in favor of “net neutrality”. By “unlicensed frequency spectrum,” I’m referring to the sort of free use of sections of the electromagnetic spectrum (e.g. the 2.4Ghz Industrial/Scientific/Medical band) that allow people to transmit without having to purchase the spectrum from the government.
I used to think that the availability of unlicensed spectrum was unassailable as a public good. IEEE 802.11-based networking (i.e WiFi) has completely transformed computing and has allowed people to create/share/consume content and to pervasively communicate with others at levels completely unprecedented and completely wonderful. Wireless networking first got really popular when I was in graduate school, but it now seems inseparable from university campus life. Those not belonging to university communities or (tech) companies with their own deployments may not understand how WiFi has changed the game. Outside of those environments, we have coffee shops with free/semi-free wireless (lovely) and other places with paid wireless (*sigh*), but if your experience is only with those few spots, then you won’t understand. It’s like getting internet at home through dial-up versus ‘broadband’. Broadband (esp. with static, public IP addresses) is just a far more pervasive networking experience, and it changes the way we get information. Wireless networking has that effect.

But wireless networking existed before WiFi and 802.11, so why didn’t we go wireless earlier? The main reason for the creation of 802.11 and its subsequent explosion was the availability of the unlicensed 2.4Ghz band. Now anyone could produce equipment operating on that band and sell that equipment to anyone else. There’s hardly any incentive to do this if that spectrum is licensed, since only the spectrum owner will buy such equipment, and even a humongously rich owner has less money than, uh, the rest of the world. Sometimes the lack of control in unlicensed spectrum is a pain– my wireless connection drops every time my colleague uses the 2.4Ghz cordless phone– but my connection would not exist without unlicensed spectrum that enabled the creation of my wifi hardware.

This being how I feel, I read Wired’s article on an upcoming proposed frequency auction and was struck by the linked articles that decry open-access spectrum. Corporate welfare for dot-com billionaires? Please. Open access spurs innovation. Do you have a wireless router at home? It’s conceivable that (insert traditional telco name) could’ve taken part of their licensed spectrum and sold people wireless hardware (for laptops and home routers), but did they? No. Would they have? Probably not. Look at where they are with wireless data plans and hardware. Is that market flourishing? Every laptop sold has wireless these days, but not connectivity to a 2.5/3G data carrier. I should be happy that 3G data is available at all. It just costs them a lot more to provide the service than it costs for lots of independent places to provide WiFi hotspots.

Perhaps I should have expected an opponent of open access to decry net neutrality as well, but I wasn’t expecting him to be so bold as to say that net neutrality is “anti-consumer.” Come on. Net neutrality is equalizing in the way that it levels the costs of bandwidth for everyone. It means that a kid putting his skateboarding videos up on a webserver in his garage has his data treated the same as CNN trying to stream advertisements and breaking video of (insert rich young celebrity name)’s arrest for DUI.

Anyway, this article on broadband by the same misguided soul who decries open-access talks about how there’s no broadband problem in the US. Oh, I don’t know about that. I think we’ve just gotten used to the slow pace at which our telecom companies give us speed. Verizon is trying to roll out their FIOS fiber service with 5down/2up Mbps at $40 and 15down/2up Mbps at $50, while Japan had 100Mbps Ethernet available a few years ago (and is working on mandating Gbps Ethernet in a few years). 20Mbps became prevalent in South Korea years ago, so in 2004, Korean ISPs had to compete on service, since 20Mbps was, well, uninteresting. Besides, 90% of South Korean homes had 3Mbps or greater at home, with overall average of 8Mbps.
I think Japan and South Korea look at our level of broadband the way we look at dialup.

I’ll be the first to say that America has a harder problem in deploying telecommunications– we have a huge area of deployment and we built our cities around cars as transportation (which now seems rather foolish with oil and anthropogenic abrupt climate change)– but surely we can do better. I still think America (particularly Silicon Valley) invents much of the technology in use for all of this, so don’t we have some advantage?
I’ll take a moment here to say that with corruption and other troubles in corporate governance, smaller companies tend to be more efficient at producing value. There’s less people to spread out blame. Higher-ups can more easily see the impact of their decisions on their employees in the trenches and junior employees are less likely to assign any air of nobility or rich-and-famous-glow to their higher-ups. And in any case, the world changes quickly. Smaller companies are more agile, and younger companies have less traditions to reinvent when they adapt.

Anyway, have a nice day. And remember that it will be hard for people older than Bill Gates to understand these new technologies, so go with someone younger, or in the industry. There was something said about technology and our perspective as we age: “Things which existed in our 20s are natural and obvious, while things invented after our 30s are indistinguishable from magic.” Please correct this quote if you know the source.

Internet radio is dying. :(

With the Copyright Royalty Board’s denial of an appeal to its March 2, 2007 ruling, the new royalty rates for online broadcasters will take effect on May 15. And since the new rates apply retroactively to the start of 2006, this means the closure of most small, independent broadcasters who simply do not have the money to pay.

Have a look at details of the original ruling and the appeal denial. The $500 minimum per channel, regardless of the listener count, is pretty horrendous. It’s clear that only for-profit companies can afford to broadcast, and only then with copious commercial time. Thanks, CRB. The sort of personalized streaming channels offered by Pandora seems pretty difficult to sustain with this fee structure, so, thanks again, CRB, for curbing musical exploration and discovery of new artists. Clearly, they have the good of society in mind.
Perhaps it was only wishful thinking that gave us hope that the existing media industry would embrace the freedom and egalitarian content-generation-production-distribution that the internet is capable of. It’s time for a new music industry. It’s just that I don’t know of any music coalitions or consortiums that understand and embrace all that the internet enables. So if you are one, let all of us know so we can support you and your music.

Are there any channels of Creative Commons-licensed music? If so, I’d love to listen to them, and perhaps even serve them.
Anyway, please mark May 15, 2007 as the day that the traditional recording industry made internet radio suck. Of course, it could also mark the day that non-RIAA music began to dominate internet radio, and the day that people discovered the world of non-RIAA music.

How about a French pop music station (stream)? 🙂 It’s commercial-free and 128k.

Have you mailed (yes, postal mail) your congressperson about this yet?