Thursday, November 03, 2005

Syntax versus semantics

Recently I had someone contribute some coding changes for my project at work. I had made it clear that I wanted to know all of the things he had changed. He didn't seem willing to do that and for mostly political reasons, I didn't feel I could compel him to give a complete report. So I settled on a compromise: he'd give me a list of "interface" changes.

My idea behind that suggestion was that if he fixed a bug or reformatted some code, I really didn't care too much. But if he changed the way a part of the system operates, I'd like to know the general reasons why. A couple of weeks later, he checked in his code and reported the changes in the interface as he saw it and I started to test the code.

Not surprisingly, something broke. He's an outstanding programmer, but with a large system it isn't easy to make a large number of changes that work right out of the gate in every situation. After digging around for a few hours, I finally discovered the offending code. He had replaced an entire source file with a check-in comment something like, "Replaced with working version." His version changed the semantics of a function call in a way that broke a program in a non-obvious way.

Now, that sort of change is exactly the sort of thing I was fishing for when I asked about "interface" changes. His response was that since the function signature hadn't changed, the interface hadn't changed. And he's correct if we had been talking about syntax. But I don't care about the syntax interface. A compiler can tell me if that changed. I needed to know about semantic changes, which are much more difficult to discover.

Thursday, October 06, 2005

The price of foam

On of the more obscure problems Katrina caused is a shortage of foam used in upholstered furniture. Thankfully, Select Comfort's business model allows them to sell beds now and ship them later, so with careful management it should be possible to avoid lower sales if not fewer deliveries. If the average delivery time goes up only a few days, consumers might not even notice or care.

The principle of supply and demand might cause problems in the long term, however. If foam is in short supply over the next few months, companies that need it will bid up the price in order to ensure they have enough to finish their own products. Until the supply problem is fixed, Select Comfort is at risk of lower profit margins.

Company-specific risks like this are hard to predict unless you have a detailed understanding of the micro-economics of an industry. Even then, the unexpected happens more often the we think. But good companies with solid capital structures and competent management will survive.

Tuesday, October 04, 2005

Capital allocation

The central idea of capitalism is that money is the score-keeper of economic activity. Most people would feel that there are numerous other criteria to judge human endeavors than whether or not it makes money. For instance, artists take pride in creating works that are not commercial, environmentalists oppose companies that pollute, and most people would trade salary for doing what they really enjoy. And if money didn't somehow represent all of those things, capitalism wouldn't work.

Consider labor unions. They demand higher pay and better working conditions for workers at the expense of company profit. Auto workers over the years have virtually guaranteed that US manufacturers will produce more cars than they can profitably sell. In essence the unions have won the battle, since it is Ford, GM and Chrysler who are paying the price, and not the workers. But the war isn't over, and if those companies can't stay in business while paying their wages, all sides will lose.

In other words, money gets converted into what we really value. For organized labor, it gets converted into job security at all costs. Consumers don't particularly care about job security (except their own, of course), but they do care about how much money their car costs. If paying for job security lowers the cost (unlikely) or raises the quality of cars sufficiently, it could be a good use of capital and the companies will thrive.

The problem with the communist systems in Eastern Europe and Russia, was that workers where theoretically valued, but poitical influence was valuable. Over time, the disconnect became unsustainable.

Tuesday, August 30, 2005

More on Canon

This Business Week article includes a quote from the S&P 500 analyst who recently downgraded Canon: "'Canon has been one of the few electronics companies able to maintain double-digit margins, but [Canon's second-quarter operating profit] shows that even Canon isn't immune to price pressure,' says John Yang". The other concern seems to be who might replace CEO Fujio Mitarai, who is 69.

According to SmartMoney.com's DCF calculator, Canon's current price assumes about 1.5% earnings growth. The article suggests 6 to 7% growth which works out to about $60 an ADR. Given more productivity gains and a return on the company's R&D investment, I think Canon is a good value.

Thursday, August 18, 2005

Writing good error messages

A good error message should say:

  1. What the program was trying to do.
  2. What it expected to have happen.
  3. What actually happened.
This is the same requirements of a good bug report, except that there is no need to show the code used. And actually, the location of the code (source file and line number) should also be included in an error message unless it's completely obvious. This is such a common requirement, many systems include source location automatically:

$ perl -e 'die' Died at -e line 1.

The more difficult thing, surprisingly, is knowing what errors to report. Most system errors should be reported, but not if the code tries to work around the problem.

Wednesday, August 17, 2005

Bad error messages

Error: can not locate file....

What am I supposed to gain from reading that message? Any information at all would help. What file? I know the program must know what file it tried. Why the ellipsis and the "Error: " string? This error resulted from a failed stat call, which normally means the file doesn't exist. But what if it were a permissions problem or a self-reference symlink or the path argument exceeded PATH_MAX? That's why we have errno and strerror.

Fortunately I had access to the source and changed it to:

Can not stat /path/to/file: No such file or directory

The orignal code made this more difficult by using this custom function:

int error_msg(char *error)

I know varags is a pain, but it really does have a place. There is no reason error messages can't provide more than enough information to debug any problem.

Friday, July 29, 2005

What am I missing?

Canon is currently trading at about $49.50 a share, which is just about what ¥5,560 is worth in dollars. (¥112 buys about $1.) Over the past four quarters Canon has earned $3.73. That works out to a P/E ration of about 13. It holds roughly $8.63 a share in net cash and has raised the interim dividend, which strongly suggests the year-end dividend will be raised too. If you use a discount rate of 11%, the current price implies a growth rate of 1.8%. But earnings have grown 20% a year over the past 10 years. My dicount cash flow model suggests the company is worth $100 or so.

Is Canon cheap because it's a Japanese company that faces greater competition from China? Are investors afraid the Yen will rise (or fall) dramatically? Is there some risk Canon executives are running an Enron-style fraud? I just don't understand.

Update (August 5): A Standard & Poor's stock report has one possible answer.

We recently reduced our opinion on the shares to hold, from strong buy, after the company posted second quarter earnings per ADR of $0.82, lower than our estimate of $0.86. Revenues grew by 7%, but gross margins narrowed by 234 basis points compared to a year earlier. Although CAJ's cost structure has improved relative to competitors, its second half guidance indicates that it is not immune to declining selling prices of printers, copiers, and digital still cameras.

Here's the breakdown of Canon's revenue by segment for Q2, 2005:

Sales by product                Q2, 2005   Q2, 2004  Change (%)

Business machines:
  Office imaging products      ¥ 292,716  ¥ 284,938     +  2.7
  Computer peripherals           285,445    269,890     +  5.8
  Business information products   25,316     28,119     - 10.0
Cameras                          219,241    190,108     + 15.3
Optical and other products        89,755     77,313     + 16.1
-----                          ---------  ---------     ------ 
Total                          ¥ 912,473  ¥ 850,368     +  7.3
=====                          =========  =========     ======

The problem is that the three biggest segments are also becoming lower margin bussinesses according to S&P. For instance, operating profit on Business Machines sunk from 21.3% to 19.7%. Worse, Canon had originally projected an increase to 22.7%. Cameras, meanwhile, earned about 17%. Optical and other products had operating profits in the single digits. So margins are clearly a concern.

The bottom line is that Canon is a premiere company is several tough industries. If they are going to keep up earnings growth, they're going to have to steer costumers to higher margin products (color copiers and printers versus monochrome, and SLR cameras versus point-and-shoot). Also, Canon has to be on the lookout for new products like its flat-screen TV initiative. Canon has benefited from the recent shift from film to digital cameras, but that shift will eventially run out of steam. When it does, I'm confident Canon will be ready for what's next.

Loss-leaders

The three companies I bought for my IRA share a common tactic—selling at low margin in order to win high-margin sales later on. Select Comfort sold a bunch of discounted beds to Radisson this year. In exchange, Radisson is using the Sleep Number bed to promote its hotels on TV and thousands of its guests will have a chance to try it out. Hopefully this will translate into sales at high margin Select Comfort stores or direct sales as people learn more about the product.

Canon (and other printer manufacturers) sell printers at very low margins in order to gain customers. They make much higher profits by selling "consumables" (paper and ink). While it is possible to buy generic brand consumables, they don't tend to produce the same quality as the name brand and don't really save all that much.

Oracle is quite willing to offer deep discounts on new licenses. (Even as low as free if the rumors are true.) But that's fine, because customers tend to use Oracle's software for many years and pay a steady stream of revenue to continue licensing the software and get support. Essentially the continuing revenue more than makes up for discounts at the front-end. Even better, most applications purchasers will also by Oracle applications servers and databases at a standard price.

In each case, it's best to think of the discounts as an investment rather then a cost. Like grocery stores advertising great deals on strawberries and steak in order to draw customers to the store to buy milk and eggs, these companies discount in order to bring in higher margin business. Ultimately the hope is to use discounts to increase earnings over time.

Thursday, July 28, 2005

Busy week for my investments

Select Comfort, Canon and Raytheon all reported earnings this week. I don't have a fundamentally different view of any of the companies, but it seems the market reacted fairly strongly.

Wednesday, July 27, 2005

Fear of uncertainty

Looks like investors of Select Comfort were nervous about the possibility of an earnings disappointment. It would have been a great time to buy. Meanwhile, Canon also reported earnings last night and it's stock price barely budged.

Monday, July 25, 2005

GE mentality

Joel Spolsky just wrote an article about how software companies make money. Basically, since there is no incremental cost to shipping more software, only the top supplier of a certain type of software can survive. If you aren't number one, you can't sell enough to make back the costs of hiring a bunch of developers to create your product.

That's why it's so encouraging to me that Oracle's Larry Ellison has embraced the GE mentality: "the belief that businesses must be, or become, number one or number two in their marketplaces." Oracle already has the number one possition in database, but they needed to buy PeopleSoft in order to remain or become number two in certain applications.

Monday, June 27, 2005

Discovery

Every now and then you discover something surprising in ordinary things. This weekend I started making Rosemary-Olive Oil Bread from Nancy Silverton's Breads from the La Brea Bakery. When I was ready to shape the boules, I decided to reread the description since that step never seemed to work right. In the past, I'd assumed the boule (French for ball) was rolled like a ball of clay. But the directions are clearly refering to a horizontal, twisting motion. I couldn't understand how this was going to work, but this morning I tried it.

Needless to say, the twisting technique worked beautifully. And the bread is delicious.

Friday, June 17, 2005

The one that got away

I just got an email from a co-worker about his son's "matriculation from elementary school". (I'm not 100% that's the right usage. From the definition I read, it sounds like you can't matriculate from something.) It's impossible to describe the image that sprang to my mind. Mostlikely any image you think of would suffice.

Tuesday, June 14, 2005

Is Wal-Mart exporting jobs?

I just watched a Frontline episode about Wal-Mart that suggested the company is forcing companies to manufacture in China. It's a complicated issue but one comparison the show made is clearly faulty. The focused on a town in Ohio that used to be home to a television parts manufacturer that was forced to close because of Chinese price competition. Meanwhile, a Wal-Mart opened up. Obviously the Wal-Mart jobs paid much less and offered none of the benefits of the manufacturing jobs. It would clearly be a huge step down for those people.

But why would anyone make that transition, except to stay in their hometown? In contrast, millions of Chinese workers are leaving their agricultural communities to the new industrial cities on the coast in order to get better jobs. They make nothing compared to what they could make here, but substantially better than what they could do at home. This is the same process America went through nearly two hundred years ago.

I imagine most people who lost jobs to China found equivalent or better jobs, or just went into retirement. They might have moved, or pursued more education, or done something less interesting, but I'd be surprised if too many had to work at Wal-Mart. The contrast is stark, but not really meaningful.

The real irony is that people who buy cheap, Chinese-made TVs from Wal-Mart can spend more money on other things, like contributing to PBS programming. It's a bit of a stretch, I suppose. On the other hand, we bought our TV at Wal-Mart and this summer we started a Netflix subscription so that we'll have something to watch on it. Other people pay for cable and buy TiVos, or but DVDs at Wal-Mart. Surely some of our collective disposable income is creating jobs in the US.

And it's not like stopping Wal-Mart would keep the high-paying manufacturing jobs here. Wal-Mart's an easy target, but every retailer is involved with cutting costs by importing from China. The real problem, if there is one, is that Americans have gotten used to the idea that full employment is it's own goal. Franklin Roosevelt said it best: "No Country, however rich, can afford the waste of its human resources. Demoralization caused by vast unemployment is our greatest extravagance. Morally, it is the greatest menace to our social order." If you focus on the last sentence, employment seems to be a birthright, but the first sentence makes clear the productivity cost of unemployment. If the Chinese can make TV parts cheaper and better than we can, we need to find ways to be more productive.

Monday, June 13, 2005

Joy's old Palm m100

During my vacation to the East Coast last month, I had some time to read The Psychology of Everyday Things. The book make lots of really great points about how designers have failed users in a wide variety of everyday things, but I was especially struck by the author's desire for a device that very strongly resembles the PDA. Since the book was written in the late 1980s, the cheap, powerful, simple, connected devices that so many people rely on, didn't exist.

Joy stopped using the Palm m100 she got free when she bought her UCLA class ring. I'm not sure why, but I think it got replaced by her cell phone. At any rate, it's been sitting in our desk drawer. So I bought a few more researchable AAA batteries and started using it to see what all the fuss is about.

Some observations:

  • It's a pain to carry around. I wouldn't have done it at all except that my job forces me to carry a cell phone now, so I carry a messenger bag to work to hold the phone and I throw in the Palm too.
  • It works better than the Yahoo Messenger alarm for keeping track of meetings and appointments if only because I carry it around more.
  • The time doesn't get updated when I do a synch with my desktop. Surely this is an option on newer PDAs. Actually, a built in GPS or cell phone would solve this too.
  • It's great to be able to synch with Yahoo address, calendar and todo lists.
  • I don't bother using Graffiti or the popup keyboard if I can help it. It's easier to enter things on my desktop. Of the two, Graffiti seems to be the winner once you get over the learning curve.
  • Games are a bit slow, but that is a function of the device's age more than anything else.
  • All-in-one devices (phone, GPS, PDA, camera, etc.) will have a definite advantage for the average person.
  • I have to be sure to enter meeting times as soon as I get an email. Otherwise, I'll miss them.

"Not dead yet!"

Ok. I haven't posted anything in forever, but I've got some good excuses:

  1. New job responsibilities
  2. Two and a half week vacation
  3. Two year old son
  4. Writer's block
  5. Perfectionist streak
  6. Bad hair days
  7. Lost an hour to Daylight Savings Time
  8. Too busy trying to find HTML way to reverse order of lists
  9. Embarassed by the complete lack of new posts
  10. Been reading not writing

Tuesday, April 12, 2005

"Nano, nano"

Before it's even sold one TV, Canon and its SED Inc. joint venture with Toshiba has been sued for violating a patent license. Nano-Proprietary, Inc. owns a patent for the process of producing SED screens, but sold a royalty-free license to Canon back in 1999 for $5.5 million. That probably looked like a good deal back then, but given the potential revenues Canon is likely to get from using the license, it doesn't look so good now.

My inexpert and shallow reading of bits of the contract suggests that Nano-Proprietary will lose the suit and Canon will be able to produce SED TVs royalty-free. Canon has spent a lot of money on R&D and invested heavily in its subsidiary, so losing the license could be very costly. Therefore, it is possible that Canon will settle to avoid negative publicity and delays in the product launch. Ironically, Nano-Proprietary's very weak case increased the probability of pursuing legal action. There is very little to lose except legal fees and a remote possibility that some court or settlement could grant the company extra revenues.

Lawsuits like this one are the bread and butter of IP companies. Since a patent has a limited lifespan (unlike copyrights, which seem to be continually extended for Disney's sake), owners of patents are compelled to either develop them into products (as Canon has done) or license them at the best possible terms (as IP companies do). Sometimes patent holders sell the license too cheaply because they undervalued its potential, over-estimated its appeal, or simply were desperate for the revenue. In this case it seems Nano-Proprietary hoped that other companies would pursue SED technology and Canon would be motivated to sign an exclusive license. Its only recourse now it to attempt legal blackmail à la SCO Unix. This is just one cost of doing business for IP companies.

As a Canon shareholder, I don't think this is a huge problem. The worst case scenario would be a per unit royalty that would add to the overall cost of SED screens. More likely would be an extra lump sum payment to cover Toshiba or maybe to make the license exclusive. Most likely, this will only result in legal costs.

Wednesday, April 06, 2005

Why I bought a raft of index funds

My wife recently opened her first IRA (tax time you know), and I opened a 529 plan for Joshua. Since we didn't have much to invest, we were somewhat limited to a handful of options. Commissions would eat up too much of the investments if we tried to buy individual stocks and most mutual funds require $3000 initial deposit.

For Joy's IRA, we opened an account at USAA, which is where I have my IRA account. The best choice was USAA Extended Market Index Fund which tracks the companies that trade on US stock exchanges that are not part of the S&P 500 index. It's top holding is Berkshire Hathaway, which owns The Pampered Chef (and Dairy Queen and Gieko and Sees Candy and ...)

For Joshua's 529, I opened an account with the New York program. It has the advantage of low fees and a relationship with Upromise. California's plan has higher fees and no extra tax advantage. I've spread the investment evenly between the Vanguard Total Stock Market, Growth, Value, Mid-Cap, and Small-Cap Index funds.

I'm not as happy about the group of index funds as I would have been a few years ago because I think we are in the beginnings of a bear market when holding the market in general won't work as well as it did in the 1990s. (Read Thoughts from the Frontline for some reasons why this might be true.) But there are some very powerful advantages to indexing: low fees of course, but also low turnover. John Bogle, father of indexing, points out that high turnover costs more in taxable accounts and that commissions are a hidden fee paid by the funds shareholders. This is why I use turnover and fees when I pick actively managed funds.

Wednesday, March 30, 2005

Consumer confidence and the long-term investor

Yesterday evening, I noticed that Select Comfort had ended the day down about 5%. It wasn't obvious what had happened—there was no company news that day. But after a little while I remembered that the Consumer Confidence Index had taken a little dip for the second month in a row. This is a poll of consumers that is supposed to indicate how likely they are to spend money over the next six months. Theoretically, if consumers feel good about their current financial situation and their immediate futures, companies that sell directly to them will experience strong sales. This is especially true for makers of "big ticket" products such as Select Comfort.

If consumers are really less likely to buy mattresses over the next six months, we can expect a couple of less than stellar quarters. If this is the beginning of a recession, it could be more like two years of disappointment. So investors have good reason to worry—especially if they are going to need cash sometime soon. Short-term bonds will be considerably less volatile.

But I have a lot longer time period to consider. I bought Select Comfort because I beleive it will outperform the market over the next 10 to 15 years. I wouldn't be too surprised to own both a Select Comfort mattress and Select Comfort stock in 20 years. If I'm correct, I don't think a bad quarter or two will hurt all that much.

Tuesday, March 29, 2005

It pays to vote

When I got Canon's proxy for the 2004 annual meeting, I read that the company wants to add an item to their by-laws:

The objects of the Company shall be to engage in the following business: ... (8) Manufacture and sale of pharmaceutical products

Today I found out that Canon is hoping to sell DNA chips which can be used to diagnose patients. From the press reports, it sounds like Canon will be able to use bubble jet technology to print the chips, which could cost far less then current methods. If successful, these products could help doctors arrive at more accurate diagnoses and researchers understand the genetic code.

While this is exciting news for investors, there's really no way to know how much future earnings this might generate. Most likely this will never account for more than a few percent of sales and may never become profitable. But it's fun to imagine Canon becoming a bioinformatics company at least in part. Certainly it suggests that Canon's R&D department is functioning well.

Actually this news is potentially negative as well. Copy machines, printers and digital cameras are increasingly competitive and low-margin products, in which Canon has remained one step ahead of everyone else. But as airline investors know, being number one isn't always rewarding. So Canon is compelled to find new products (such as flat-panel screens and portable printers), which is a riskier strategy than the cost-cutting that marked the last ten years.

For the next five years, the company is beginning phase three of its "Excellent Global Corporation Plan". Now, it will focus on "Healthy Expansion". Investors can dream that the phrase is quite literal.