Quality assurance fail

PowerSupplySome fun for Friday. I just opened up a box containing a brand-new bit of telecommunications equipment, and the power supply arrived looking like this, fresh out of the box. (Click for a larger version.)

How bad does your quality assurance have to be to ship to customers a power supply that cannot possibly fit into a power socket?

 

I have a mysterious fifth sense (rerun)

Today, another of my ongoing series of reruns of my fun-for-Friday non-computer posts. Here’s one from the dot-com recovery of 2004.


The economy must be picking up — I’m getting cold calls from recruiters again for the first time in about four years.  Today was the second – and third – this month.

However, apparently some of them are just a wee bit disorganized. I just had the following conversations:

[Ring ring]

Me: Hi, this is Eric.

Her: Hi, this is Barbara[1. I learned later from some of my fellow Microsoftie bloggers that it appeared that Barbara was calling everyone at Microsoft with an MSDN blog. She must have been repeatedly calling the switchboard and asking to speak with each.] at XYZ Recruiters. How are you today?

Continue reading

That’s a big transistor

As promised last time, a fun-for-Friday rerun from the early days of FAIC. But before we get started, a quick physics refresher.

Force is the ability to change the velocity of an object by a certain amount in a given amount of time. One newton (N) of force is the ability to change the velocity of a one kilogram object by one meter per second, in one second. The earth applies a force of gravity of 9.8N on every 1kg mass near it.

Work is the application of a force to an object as it moves a certain distance. Energy is the ability to do work. One joule (J) of energy is the ability to apply a force of one newton to an object as it moves one meter. [1. Note that the force has to be applied in the direction of the motion for it to count as work; the earth’s gravitational force does no work on a sideways-moving object. This should jibe with your intuitive understanding of work; it is a lot harder to raise an object by 1 meter than it is to slide it 1 meter, where the work is done by the force overcoming friction.]

Power is the rate at which energy is consumed in time. One watt (W) of power is the consumption of one joule of energy per second.

Charge is, like mass, a fundamental property of matter. The easiest way to manipulate charge is by manipulating electrons. Charge is measured in coulombs (C). Current is the movement of charge and is measured in amperes (A); one ampere is one coulomb of charge moving past a given point in one second.

Electric potential, better known as voltage, is to charge as gravity is to mass, and is measured in volts. Applying a potential of one volt to one coulomb of moving charge consumes one joule of energy. A better way to think about it though is to divide both sides of that equation by time and get that one volt times one amp is one watt.[2. volts times amps equals watts is one of the funamental equations you have to know in order to wire a house safely. If your house power is providing a potential of 120V and your light bulb is consuming 120W of power then the current on the wire supplying the bulb is 1A. Since lighting circuits typically use wires that are safe for up to 15A, this puts a limitation on how many bulbs you can have on one circuit.]

Resistance is the tendancy of an electric conductor to resist the movement of charge, and is measured in ohms (Ω). If there is a conductor where the difference in voltage between the two ends is one volt, and the resistance is one ohm, then there will be a one amp current in the conductor.


A few years back a bunch of my coworkers and I got to discussing the space program over lunch. Someone asked why it is that we continue to launch devices into orbit by strapping a big old tank full of liquid oxygen to the device and then set it on fire. Why haven’t we developed better technology using magnets or something?

Continue reading

Building a tabletop coilgun

coilgunAs you probably know, I’ve been re-running some of my fun non-computer posts from the last decade. This Friday I’m going to rerun my post on the impracticalities of large-scale coilguns, and I thought that as a precursor to that I might talk a bit about tabletop coilguns. So, no programming language design this week.

A couple years ago my friend Morgan expressed an interest in learning about electronics so I thought that a homemade coilgun would of course be a perfect gift for a ten year old. Yes, I am that awesome avuncular figure who gets kids pocket knives and drum sets and coilguns for their birthdays. Parents, you’re welcome!

This is a great project to teach kids about circuits because it has all of the basic parts except transistors, and each part has a clear purpose. I’ve deliberately left the voltages, capacitances, resistances and inductances I chose off the circuit diagram above. Better to work them out for yourselves on the basis of what kinds of voltages sources and what capacitors you’ve got available, and what your appetite for destruction is.

Continue reading

Thumbs up

ebertRoger Ebert was — is — a hero of mine. I’ve often thought that if I could be one tenth as clear, witty, insightful and kind, I’d consider myself a good writer.

I remember getting a copy of Microsoft Cinemania in the early 1990s, casually browsing the archive of Ebert reviews and realizing that here was someone who really, really knew how to write — and from that point on I was hooked. In the decades since then I don’t think I’ve rented a movie or gone to the theater without checking to see what Ebert had to say about it first. On the few occasions when he wrote something that moved me to respond directly he always answered my emails thoughtfully and kindly. That he took the time at all out of his incredibly busy life to answer fan emails is just one small example of his generosity.

Tonight I’m going to take AV Club reviewer Zack Handlen’s advice and watch Citizen Kane again with Roger’s commentary track. It’ll be good to hear his voice.

Whidbey Island and bagel mathematics (rerun)

Today another in my fun-for-a-Friday series of reruns from the classic days of FAIC. This one was originally published in December of 2004. Enjoy!


299px-Bagels-Montreal-REALI was highly amused to read on Raymond Chen’s blog the other day that mathematicians are hard at work solving the problem of how to most evenly distribute poppyseeds over a bagel. The reason I was highly amused was not just the whimsical description of what is actually a quite practical and difficult problem.

And yes, believe it or not, it is a practical problem; if you can figure out how to distribute points evenly around an arbitrary shape then you can use that information to develop more efficient computer algorithms to solve complex calculus problems that come up in physics all the time. There are also applications in computer graphics, I’d imagine; 3-D modeling frequently requires generating well-behaved finite approximations of a surface.

But I digress. The other reason I was highly amused is that Whidbey Island is the longest island in the United States.

Continue reading

Free beer!

OK, that got your attention.

Most of the Coverity C# analysis team is going to be in Seattle celebrating the opening of our new office on Wednesday February 20th. We’ll be at the Tap House Grill on 6th Avenue in Seattle, starting about 6:15. If you’re in Seattle at that time, over 21 years old, and want to hang out with me and the team then please stop by![1. Note that this is the Tap House Grill in Seattle, not the one in Bellevue.]

There are a very small number of free drink tickets available; if you want one, email me (Eric@Lippert.com) and I’ll send you instructions on how to sign up. Supplies are limited, so serious enquiries only please.

Digital pain (rerun)

Today, another fun-for-your-Friday rerun from the past decade of FAIC.


When you bang your finger with a hammer or burn it on the stove, somehow the pain has to get from your finger to your brain via a nerve. That’s an immense distance on the cellular level. What possible mechanisms are there for that?

A nerve carries the pain signal from your finger to your brain like a wire carries electrical current. Perhaps zero “voltage” on that nerve would represent “no pain”, and then the “voltage” would vary smoothly up to some maximum that represented “extreme pain”. That’s a plausible mechanism.

Or, you could have a system where zero “voltage” meant “no pain”, 100% meant “severe pain”, and any lesser amount of pain is measured by the average power delivered over a period of time, say, a millisecond. If the nerve was on 100% for 250 microseconds, then off for 750 microseconds, that indicates a 25% level of pain. If it was then on for 220 microseconds, off for 780, then on for 200, off for 800, that would indicate that pain was decreasing from 25% to 22% to 20%. The granularity of a millisecond might not be quite right, but in principle this would work. [1. Lighting circuit dimmer switches work using these two mechanisms. Old-style dimmer switches work by adding a resistance to the line that decreases the voltage overall, and modern dimmer switches work by cutting out a certain percentage of the power signal.]

Both of those are analog systems: in an analog system the possible signals smoothly vary from 0% to 100%. But neither of them are how nervous systems actually work. If you measure the “signal strength” on pain nerves you see that they actually send groups of extremely short bursts, where the number of bursts per unit time indicates the level of pain. That is, the nervous system communicates pain by sending an integer from the source of the pain to the brain! It’s discrete, not analog.

Why is that?

You know what my favourite scene in the movie version of The Return of the King
is? It’s the one where Gandalf needs to send a message to Rohan in a hurry, so he has Pippin climb up the side of a mountain to light a signal beacon. We then see this great sequence as the beacon wardens set off the seven signal fires on Amon Din, Eilenach, Nardol, Erelas, Min-Rimmon, Calenhad and Halifirien, one after the other.

Listen carefully to the soundtrack at this point. It echoes Gandalf’s “White Rider” theme, which was established earlier in a visually parallel set of shots, as Gandalf and Pippin ride up the seven levels of Minas Tirith. But to give it some additional fire, they add these kick-ass violin arpeggios on top of the basso continuo. The whole thing works perfectly; it’s a triumph of cinematography!

But I digress.

The Gondorian war beacon system sends a single binary bit at extremely high speed over the huge distance from the White Tower in Gondor to Meduseld in Rohan. Suppose the Gondorians wanted to send more information than just “we need help!” — like, say, how big the opposing army was. They could come up with an analog convention. Perhaps a really big signal fire indicates a really big army, a small signal fire indicates a small army, a medium sized signal fire indicates a medium-sized army.

Obviously that doesn’t work. There are seven beacon fires. The beacon keepers would have to figure out how big the previous fire was and then set their fire accordingly. Error would accumulate along each part of the process, and the final result might bear little relation to the original input.

To send information accurately over long distances without error you need some kind of discrete system. You need signals that are clearly either ON or OFF. Once you’ve got ON and OFF, you can use them to transmit integers, letters, morse code, whatever you want.

That is why nerves are digital, not analog. Nerves need to transmit huge amounts of complex data over the vast distance from your toes to your brain without accruing any error along the way as the signal is picked up by new nerves and forwarded on. All the sensory nerves work this way: smell, touch, taste and so on, are digital. We are digital machines, we’re just digital machines made out of meat instead of silicon.


Next time on FAIC: We’ll resume the current series on uses and abuses of the static constructor.

Hummingbird PSA

hummingbirdWe interrupt our adventures in lifted arithmetic optimization for a brief public service announcement on behalf of my little friend to the left there. (Click on the image for a larger version.) I took this photo at my home in Seattle this past Sunday, before I flew down to San Francisco for training at Coverity’s head office. (And it took a number of attempts to freeze the wings, even at 1/640th of a second shutter speed with my Canon DSLR.)  Amazingly enough, male Anna’s Hummingbirds like my friend there will spend winters in Seattle. At the time this photo was taken it was well below freezing. Apparently more and more male hummingbirds are staying in Seattle over the winter, as climate change makes the winters here slightly more survivable; even Rufous and Allen’s hummingbirds are being observed. They migrate out of the hills to the warmer lowlands, but don’t go farther.

Hummingbirds are always within mere moments of starving to death and in the Seattle winter there are far fewer sources of food than other times of the year. (Anna’s Hummingbirds are unusual in that they can eat bugs while in flight, which does help.) If you’ve got hummingbirds coming to a feeder, keep it stocked. Take it in at night; I found my feeder frozen solid and a very vexed hummingbird trying in vain to feed one morning.

A number of people have asked me where they can get my feeder; you can find it here.

You’ll notice that in my feeder the liquid is clear and colourless. It is one part sugar to three or four parts water, and that’s it. Stores will try to sell you hummingbird food at enormously inflated prices, but what they’re selling is sugar mixed with red dye. The red dye does nothing to attract the birds, and it is bad for them. Their little kidneys have to remove the dye from their bloodstream.

I’m in California again next week, but I’ve queued up a couple of articles to go out while I’m away. Have a great weekend, and tune in Monday for the final episode in my excessively long series on lifted arithmetic optimization.

The postmodern gumballs (rerun)

I’ve been writing this blog for almost ten years now and there are plenty of readers who have quite reasonably never gone back through that archive of over 750 posts. Maybe one Friday a month or so, I’m going to rerun one of my favourite “fun” posts from the last decade. Today, a story I posted on the first anniversary of my blog, in September of 2004. Enjoy! Continue reading