Permalink

Will I Ever Use This In The Real World?

This month saw the publication of Don Knuth’s Art of Computer Programming Volume 4A. In eager anticipation of receiving my copy in the mail, I was reading some of Knuth’s writings on number theory. This ostensibly had nothing to do with anything I was working on in the real world, but I was enjoying it.

Today I was trying to solve an odd programming problem for a project I’ve been consulting on. The program was supposed to receive a series of (X, Y) coordinate pairs and process them, but for some reason the processing of the Y coordinate was consistently off, while the processing of the X coordinate was perfect. Moreover, the larger the Y value, the worse the processed result became. I presume that something was going wrong in the processing, but exactly what was eluding me.

While I did not have this matter in mind at all during my reading of Knuth, I was inspired by some of the number theory concepts to find an approximate pattern in the faulty processing and then find an acceptable value to multiply our Y-coordinate by, such that the modified Y input would offset the problem. I still didn’t understand the underlying cause of the problem, but the software was supposed to ship today, and this made it work acceptably well.

My fix was not particularly an application of number theory; at most, it was basic algebra. But even though number theory itself wasn’t involved in my solution, studying number theory prepared my mind to think in the direction of seeking patterns in numbers, something that I probably wouldn’t have thought of otherwise.

So to the question, “will I ever use this in the real world?”, the answer may well be no… but even if not, the study of the material forms new connections in your thinking, which may help you in real world situations.

Posted by: tjr | Conversation: comments off | Category: Education

Permalink

A Compiler Bug

I was converting an avionics subsystem from Ada to C. It was a client application that had to talk to an Ada server, sending and receiving rather huge chunks of data, large, deeply nested, intricate structure types. The C structure type had to match the Ada type exactly, or else it wouldn’t work.

I got it working fine on our desktop simulation, but running on the actual hardware it was consistently off. After extensive testing, I realized that it was a bug in the compiler for the target hardware, such that a very particular type of structure (something like, {int, char, float}) was being packed incorrectly, resulting in a 2-byte pad that shouldn’t be there. If I reordered the structure elements, it was fine, but that particular grouping and order refused to work correctly.

It was GCC, so we could fix the compiler ourselves, right? Not very practically, as, for avionics systems the compiler has to be thoroughly qualified for avionics use, and changes equal requalification. I “fixed” it by storing the float as an array of characters, converting it to and from a real float type as we needed to use the data value.

Trivial, perhaps, but I was very excited to resolve the problem, after spending days barking up wrong trees. One usually expects that the problem is not in the compiler…

Permalink

A Check from Oracle

Today I received in the mail a check for $190 from Oracle Corporation.

I graduated from high school in the summer of 1998. As a graduation gift, my grandfather gave me $500 to invest in the stock market, in hopes that I would learn something about business and stocks. I had spent the past year becoming very seriously interested in computer programming, and the hip new programming system at the time was Java, produced by Sun Microsystems. So, without knowing much about the stock market, or even about the financials of Sun Microsystems, I decided to put the whole $500 into Sun stock, on the basis of liking their products. I was able to buy ten shares.

I asked for the stock certificate to be mailed to me personally, and, like Balki Bartokomous on Perfect Strangers, I framed the stock certificate and hung it on the wall. I was not particularly interested in making money through the stock, but rather, was delighted to be a part-owner of my favorite company.

About six months later, in December of 1998, my grandfather very unexpectedly passed away. I knew he had not been feeling well, but he was generally a very healthy person. There is much I could write about how my life changed after this (in short, I became much more aware of spending time on things that are long-term important), but the relevancy to the present story is that I suddenly no longer saw my stock as just a symbol of company ownership; it was now the last gift that my grandfather gave to me.

A few weeks later, I happened to be browsing a newspaper, and looked up in the financial section the current value of Sun stock. To my surprise, it had doubled since I bought it, and my ten shares were now worth $1000. Months went by, and Sun Microsystems, a major provider of networking hardware during the dotCom boom, continued doing very well. They went through several stock splits: my ten shares turned into twenty, then forty, then eighty. Eventually, my $500 investment was worth around $6000.

I imagine that if my grandfather had still be around, he would have advised me to sell the stock. But I continued to view it more as a cherished gift than as a way to make money, and held onto the stock.

Years passed, and the dotCom boom morphed into the dotCom bust. The value of the stock sank and sank and sank, eventually getting down to around the same price that I originally paid for it.

In 2008, I received a letter from Sun, stating that they were initiating a reverse stock split, and I was advised to send my shares back to them, in exchange for a smaller number of shares at the same value. I complied, but rather than getting another certificate, I received a notice that I would not be getting a paper certificate, but electronic-only shares. It was disappointing to lose my physical stock document, but I still owned the stock itself.

In 2009, I learned that Sun was being bought by Oracle Corporation. Another disappointment. Oracle may be a great company, but there would surely be changes; some product lines may continue on, but the company that I thought was so neat in 1998 was coming to an end.

Not reading much of the details of the transaction, I assumed that I would get stock in Oracle now, but this wasn’t the case. Instead, I received a check from Oracle, with a note explaining that Sun stockholders were being given $9.50 per share of Sun.

So now I have $190, which, in some sense, is what remains of my grandfather’s gift. He wanted me to learn about business, and about investing, and about the stock market. I like to think I’ve learned a lot about these topics over the past twelve years, though you couldn’t tell it by looking at my $190 check. I held on to that stock despite common sense, because I valued it more sentimentally. I suppose there is nothing wrong with doing that, if that’s what you want to do, though I now realize that it wasn’t the stock itself that I cherished, but rather memories of my grandfather.