Monday, March 28, 2011

Top Ten, 19 of 10

We last left our hero some time ago in the top ten list of ways to be Screwed by "C". I happened to be looking at the old posts, and noticed that the author has added a couple. Today's entry is Accidental Integers. The first example is:


int a = 2 && 4 && 8; // what is the value of "a" ?

The issue here is that integers are also Booleans in the C language. So this expression is expected to use the constant "2" as a Boolean, which is clearly not false and therefore true, perform logical and with "4", which is also true, and perform a logical and with "8", which is also true. The answer is true, and the variable a is set to 1. On read, integer values that are zero are false, and anything else is true. But if the language has to pick a non zero value, it uses 1. Since this example has several constants in an expression, the compiler would evaluate these at compile time and simply assign the value of 1 to a. The second example is a little curious. It's supposed to be the same.

int value = a && b && fn(a->x,b->x);

In this example a and b are structure pointers, and fn is a function which returns an integer. The author wants to check to see that the structure pointers aren't NULL before calling the function, which in C is usually zero. NULL is typically a zero cast to (void *). If you check the boolean truth value as in this code example, you are expecting the value to be compared with zero. But also, the && and operator is a shortcut operator. If the left hand side of the operator is false, then the right hand operator is not evaluated. So, the idea in this code fragment is if pointer a isn't NULL then check if pointer b isn't NULL, and if it isn't, call function fx and set value to the truth value of the integer returned by fn. One suspects that the unexpected result is how the return value is assigned. So this is probably what the author wanted:

int value; /* return value from fn() */

if (a && b) {
value = fn(a->x, b->x);
}

Which is to say that the author didn't want the truth value of the function, but rather the integer value. From a stylistic point of view, i would not be tempted to compress this to

int value; if (a && b) value = fn(a->x, b->x);

or even


int value = (a && b) ? fn(a->x, b->x);

This last is particularly odd. It explicitly sets value only if a and b are both non zero. I can't think of any production code that uses the question mark operator without a colon. The question mark operator is not that commonly used as it is, but one could imagine it could be used to conditionally set a variable in this way. Perhaps in some real life example, the variable was initialized. But in this case, it's difficult to imagine how the return that is set to value is used. Since value was uninitialized, how could the code dependably know if it's the return of fn or some random value? Well, perhaps fn has some side effect, such as setting a global variable that the following code could check. It's a poor example, in my opinion.

The idea that NULL is zero is pervasive in C code. However, i've worked on a machine where the NULL pointer was not, in fact, zero. That's because this unusual 16 bit segmented architecture added byte addressability late in its development. So pointers point at 16 bit words. They added an address bit for the even/odd bytes, though for compatibility reasons, it's not the low bit in a pointer. And worse, the bit is set to "1" for the even numbered bytes. So address zero has a "1" set in it somewhere. The C compiler for this machine defined NULL correctly, but it isn't zero. Yes, there are other complications for C on this unique and special architecture. But we did get a Unix kernel to boot on it. So the above code fragment wouldn't work on this machine. You'd need to explicitly compare with NULL, which properly documents intent, and has no performance consequences. It might looks like this:


int value = ((a != NULL) && (b != NULL) ? fn(a->x, b->x);

It should also be noted that this topic is directly related to the second topic in this series. That is Accidental assignment/Accidental booleans. Use of "=" when you meant "==" is a pretty common error. And it's true that it wouldn't happen at all if a strict Boolean type existed in C and people actually used it, and if the C language did not allow integers to be used as Booleans. My own opinion is that in assembler language, which C compiles to, integers are used in exactly this way for Booleans. And, it was up to the programmer to document the meanings of variables. For code size and performance, integers and Booleans are routinely mixed. Therefore it is up to the programmer to document their variables. My own coding style is to do this near the declaration. Most C programmers do not explicitly declare local loop variables with comments where the use is common and obvious. But in my standards, each variable is declared on its own line so that it can be documented. After all, this makes no difference whatsoever to the compiled code.

Friday, March 25, 2011

Filters in Emacs

In the early 80's, i wrote a filter in C called 'onespc' (V7 Unix had 14 char filenames, i tended to omit vowels). 'onespc' by default would read stdin, compress groups of blank lines (with optional white space) to a single blank line, and write to stdout. I'd use it from the command line, sometimes in scripts that changed many files. I'd use it from Emacs on the whole buffer or regions. 'onespc' has a bunch of options to do similar things, like remove all blank lines.

Emacs was sluggish starting up until the 386/33 or 486/25. This may be ancient history, but it was more than a decade for me. I haven't come up with a good way to use Emacs to edit hundreds of files. My current plan is to learn elisp. That should fix everything. Lisp isn't easy to learn. But i've used Lisp and Sheme in the past.

In the late 80's, i wanted something easier in scripts than

for i in *.txt; do
 onespc $i > x
 mv x $i
done


It's not a good solution, since x might exist as a file. So, i wrote a version of 'into'. The syntax is

for i in *.txt; do
 onespc $i | into $i
done

So, 'into' copies stdin to a temp named file, which it determines does not exist in advance. On EOF, it renames it to the argument, deleting the existing file if it can.

I was about to publish all these utilities, but then someone publish the 'getopt' functions for command line. I liked my least ambigous command line parser better. I never liked the '--' standard. I stalled.

Who knows? Maybe Emacs has a simple file mapper. I'd like to be able to do this easily:

for i in `find . $HOME/some/other/place -type f -name \*.txt`; do
 onespc $i | into $i
done

But 'find' and my filter set (including all of the *ix filters, including 'sed' and 'perl') is a pretty powerful set of flexibility to allow.

Despite emacs's internal docs, 'info', 'man', and google, i can't always find docs for what i want to do just at this moment. One learns by putting in effort. One can always learn more.

Monday, March 14, 2011

No Child Left Untested

The news is that President Obama is to push an overhaul of the No Child Left Behind (NCLB) program. As a parent of school age children, i'd like to get rid of it.

From my perspective, what we need is evidence based education. The way that would work is that we would come up with ideas on how to educate better. The first step would be to implement them in small pilot programs. If the new idea works better than the standards, then it would be moved to a larger pilot. Really good programs would be expanded nation wide. Every change implemented at large scale would have costs and benefits understood beforehand. Was there ever a pilot before introduction of No Child Left Behind (NCLB)?

NCLB suggests that we can't test teachers to determine their competence at teaching. I can understand that. Testing is rarely a good test of competence. Managers in industry mostly can't tell competent employees from dead wood. So, the NCLB idea is to test students. But why do we then think that testing students determines their level of compentence? Didn't we just say that testing rarely is a good test of competence?

And, NCLB does not address course approach and content. For example, teaching astronomy with english together allows students to research history, make observations, etc., and write papers about these things - graded for content and form together. It's been shown more efficient. And why wouldn't it be. Students put in a little extra effort to make their papers better, but don't have to do as many. That's more efficient for the students. It's more efficient for the teachers. There's no additional teacher training cost. You use an English teacher and an Astronomy teacher. You just use them at the same time. Teachers alternate classroom time. Both teachers grade papers. This is just one of a zillion examples.

There are lots of cheap programs that have worked well in pilots that have not been fielded at large scales. It's so sad.

Thursday, March 10, 2011

Kepler

If you look at all the colors of the light given off by a star in fine detail, you'll see lines that are characteristic of atoms and molecules that make up the star. These lines can be compared with similar lines when the same atoms or molecules are heated in the lab back here on Earth. So, you can tell what objects are made of anywhere in the Universe. If an object is moving toward you, these lines move to higher frequencies - towards the blue end of the spectrum (at least in visible light). If the object moves away, these lines move to lower frequencies - towards the red end of the spectrum. It's similar to the way a fire truck's siren is higher pitched when it comes towards you, but falls to a lower pitch when it has passed by and moves away from you. Looking at the detail of the colors of light is called spectroscopy.

The first planet discovered around a star other than the Sun was announced in 1995. That's about 16 years ago. Since then, 528 such planets have been discovered (a number that changes almost daily). The method used at the time was the "wobble" method. Most of these discoveries were made using this technique. It's based on spectroscopy. The idea is that as a planet orbits it's star, it tugs on it's star with gravity. So the star wobbles. With spectroscopy, the movement of the star towards or away from us can be detected. It's not just if it's moving away or towards us, but how fast. So, if the planet is closer to us, it tugs the star towards us. If it's on the far side, it tugs it away. The planet has to go around it's star at least once, but more is better.

Now, it's easier to detect movements of a big star if the planet is big. And, it's easier to detect movements of a planet if the planet is closer to it's star. That's because planets closer to the star pull on the star with more force if it's closer. And, shorter, quicker orbits mean that you can get one or more full orbits quicker. So, most of the planets detected this way are large - as big as Jupiter, and close in to their parent star - sometimes closer than Mercury is to the Sun. And, it's easier if the star is smaller than the Sun. A planet can move a small star easier than a big one.

What we'd like find is Earth sized planets in orbit around stars like the Sun. That's because what we'd really like to know is if there are planets like ours. At the moment, the only place we know of for sure with life on it is the Earth. We'd like to know if there are other places with life. Do aliens exist? (If they're on their own worlds, they aren't aliens - they're natives).

There are other ways to discover planets around other stars. One might expect that a picture could be taken of a star at high resolution, and all the planets would show up. Unfortunately, stars shine through their own light, and planets shine mostly through reflected light. So, stars are something like a billion times brighter than planets. It's like looking for a firefly next to a search light, only harder. But it has been done. At least twice. This technique favors planets that are far from their host star, big, and it helps if they're very young, so they can shine in infrared light by virtue of being hot. You have to take at least two images to show that the planet moves with the star. Three images gives you more confidence, and can show the planet arc around in it's orbit.

Another way detect a planet around another star is to watch a star often, and look for a small drop in light as the planet comes in front of the star. You have to look very often to catch it in the act. You have to have pretty good sensitivity, like a part per 50,000. Both of these issues suggest that you need a telescope in space. In space, you can look at the same spot on the sky 24x7. You don't have to worry about poor weather. And, you don't have a boiling Earth atmosphere making changes to your star's brightness every few seconds. But there's another issue. Most planets won't happen to pass in front of their stars from our point of view. It's a geometry thing. If we're looking down on the pole of the star, then we'll never see any planets come in front. And the farther the planet is from it's star, the fewer stars will be aligned close enough to get one cross in front. So, if you want to detect planets this way, you have to look at lots of stars. This method, called the 'transit method', is used by the Kepler space craft. It's looking at the same patch of sky with a keen interest in about 150,000 stars.

And, the Kepler mission has 15 confirmed planet discoveries. In February of 2011, the team announced 1,235 planet candidates. Estimates are than perhaps 80% of these candidates will be confirmed as real planets. That suggests that perhaps 976 new planets will have been found. If confirmed, it more than doubles the current number of known planets. And, this preliminary data is from when the Kepler mission has more or less just gotten started, nothing like sixteen years. Since Kepler hasn't been looking very long, the data favors planets that orbit close to their stars. Bigger planets are easier to spot. But planets as small as the Earth and smaller are among the candidates. And yet, fifty four of the candidates orbit their star at a distance where liquid water might exist on the surface. These kinds of orbits are smaller for smaller stars. Five of these palnets are near the size of the Earth.

The Kepler mission is currently funded for an initial mission of 3 1/2 years. That's because the goal is to find Earth-like planets in orbit around Sun-like stars. We can tell if a star is Sun-like through spectroscopy. We can tell if a planet is Earth-sized by the amount of dimming. The spacecraft needs to detect three transit events to give us confidence that it's really a planet. Three orbits of a planet in an Earth-like orbit around a Sun-like star will take three years. You'll need a little extra to make sure you get three. The mission could easily be extended longer. The spacecraft doesn't run out of fuel at the 3 1/2 year mark. It's is hoped that the data from Kepler will lead to solid statistics on how common habitable planets are in the Universe. Or, at least, in our part of the galaxy.

What can we do with such statistics? We'll, in 1961, Frank Drake proposed a simple formula for estimating how many civilizations there might be in the galaxy. At the time, we didn't know much about what numbers to plug into the formula. The formula has terms like "the fraction of stars with planets". This is a number where Kepler data can help. Better numbers help give us a better estimate.

We also might be able to discover not only if there might be water, but if there actually is water on these planets. The Spitzer infrared space telescope was used to detect a variety of compounds in the atmospheres of a couple extrasolar planets. And while it is no longer capable of this feat, it demonstrates that it can be done. Transit data tells you when to look to pull it off.

The Kepler discovered planets will miss something we would really like. And that is that none of them will be very near to the Earth. If a planet discovered by Kepler has intelligent life on it, communication (by radio) would still take thousands of years, each way. It's tough to hold up much of a conversation with that sort of delay. We'd really like to find habitable planets that happen to be closer to us. But to do that, you have to look in almost every direction at once. And, we'll likely have to use direct imaging. That's going to require very large telescopes in space. In principal, it can be done. In practice, it will be expensive. But the results will definitely be exciting.

Wednesday, March 09, 2011

Truth That Hurts

Edsger W. Dijkstra
You're doing it wrong.
Edsger W. Dijkstra wrote a very short classic paper, How do we tell truths that might hurt? in 1975. In it, he lists a number of things that he imagined computer scientists of the day thought were true "without hesitation". They're great sound bites. That is, they have no context. They have no explanation. But they're delivered by someone (in this case Dijkstra) in authority. For the record, though Dijkstra was amazing, he said a number of things that are no longer true, and/or were overly general.

For example, at the time, languages such as machine language, FORTran or BASIC, one of the primary control structures available was the "GO TO" command. There was no real choice. You had to use it frequently. And it could be very difficult to follow the flow of a program when there were lots of them. You'd try to follow where things were going, but it was like following spaghetti noodles. By the 1980s, block structured languages were abundantly available. That included C, Pascal, and even Fortran, with the 1977 standard. Oddly, one of Dijkstra's favorite languages, Algol 60, was on it's way out. Anyway, in 1968, he wrote an article against the Go To.

In the 80's, i had managers totally go crazy seeing even a single "go to" in my code. Now, while a single "go to" could in principal be difficult to follow, when it is clearly used to exit a doubly nested loop, there's no such issue. The spaghetti argument can't be made. How much of a rat's nest can you make if you are limited to one loop? My argument wasn't that he was wrong. My argument was that by using absolute authoritarian statements, he caused as many problems in the industry as he solved. The C language has the break statement to exit a loop. But one must use "goto" to get out of two nested loops. One of the typically ways to get the same effect is to introduce a state variable. This has two problems. First, state variables can be just as hard to follow, or even worse than spaghetti "go to"'s. Second, checking a run time variable increases code size and slows execution.

The same managers who balked at a single "go to", would scold me for daring to use recursion to solve a problem. Really. Recursion looks strange when you see it for the first time, but it's very powerful. If you're a programmer and don't know it, then it's something you must learn. Get out of your comfortable space and do some growth. Dijkstra would have approved. I haven't yet spotted a reference where Dijkstra was a big Lisp fan, but he was into proving program correctness, and Lisp was and is the language to do that in. You can do lisp without recursion, but Lisp lends itself to recursion so much that many programs use it instead of using loops, and it's quite natural.

Anyway, back to the paper. It's pretty funny. But in his paper, How do we tell truths that might hurt? he never answers the question. It's a rant. If you tell people that they're doing things wrong, you'll ruffle feathers. After all, Galileo was a giant - developing the telescope, discovering all sorts of interesting things with it. But he suffered house arrest by the Vatican for his arrogance. Yet, it doesn't seem to occur to Dijkstra that there's only a little difference between "You're doing it wrong", and "there is a better way to do it". And yet the difference makes all the difference. There is plenty of evidence that the Vatican was already cool with a Sun centered solar system. It wasn't the facts so much as the way they were delivered.

I'm currently learning COBOL - a language i've been avoiding for decades. It's not that it's difficult. It's a little clunky. But it can certainly get the job done. And in the late 70's, everyone claimed that it was on it's way out. But forty years later, it's still going strong. So, what did people know back then? Anyway, the paper starts by calling COBOL a disease to either fight or ignore. Hysterical. But, let's see how the other sound bites hold up.

Programming is one of the most difficult branches of applied mathematics; the poorer mathematicians had better remain pure mathematicians. I agree that programming is difficult. I have an engineering degree. When you design a car, you reuse the same bolt design over and over. In programming, if you're doing the same thing again, you make it a subroutine and call it twice. Ideally, there's no repetition, no repeated parts. And each of those parts works with, reacts, and counter reacts, at least potentially, with every other part in the system. So the complexity goes up faster in programming. Now, only one in four students who start an engineering degree graduate. And, you have to be really sharp to get enrolled. Back in 1975, programmers came from the ranks of mathematicians. Today, it's its own discipline. It's not that mathematicians were poor programmers. Programming requires unique skills. And not everyone gets it. Not all programmers with a Computer Science degree today will meet Dijkra's standards. The standard of competence today is that the programs created work. Dijkstra also required elegance, which leads to mainainability, sometimes performance, in addition to a sort of art appreciation.

The easiest machine applications are the technical/scientific computations. This was likey true at the time. Computers are good at math. If you need to figure out how much the beam will bend under load, it's a pretty easy program to write. But these days, the simulations you need to do for a car crash aren't exactly easy. It's just that computers in 1975 weren't up to the task. I'd say that business applications are the easiest. That's not to say that they're trivial.

The tools we use have a profound (and devious!) influence on our thinking habits, and, therefore, on our thinking abilities. The language you learn, be it English or whatever, has cultural prejudices embedded. And, solving a problem in Lisp will almost always lead to a very different approach than solving it in C. Having done both, my initial guess, that one language would be better than the other at some tasks, has been validated. So with any two languages, each will have it's strengths. I wrote both solutions, using the available language features and styles. So it's not necessarily thinking habits. Habits can be broken. Prejudices can be fought. The process is the same. Think about everything. Don't take anything for granted. Anything less is lazy. So, Dijkstra is right, but not in any absolute sense. In particular, we should not all switch to Lisp, even if that is the language where it's easiest to "prove" the correctness of our programs.

FORTRAN --"the infantile disorder"--, by now nearly 20 years old, is hopelessly inadequate for whatever computer application you have in mind today: it is now too clumsy, too risky, and too expensive to use. FORTran, about 50 years old, has evolved. One of the quotes going around in the 80's was I don't know what language we'll be using in the year 2000, but it will be called FORTran. It's not my favorite language. Last i used it, it was difficult (but not strictly impossible) to write code that manipulated text symbolically. It was great for math computations, but not great at symbolic math. When i got to use C, which is pretty good at math, pretty good with text, and OK with symbols, i pretty much only used FORTran if i had to. But it's still in use today. It's just not as clumsy.

PL/I --"the fatal disease"-- belongs more to the problem set than to the solution set. PL/I was an IBM language. I wrote one of my very first programs in a subset of PL/I, called PL/C. I was maybe 12 or 13. It was block structured. It seemed OK. But i didn't stress the language, so i have no idea what Dijkstra might have been on about. It couldn't have been as bad at the time as BASIC, from Dijkstra's perspective. Last i heard, PL/I was in use at IBM internally only. It may have been abandoned by now.

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. Well, BASIC seemed to encourage GO TOs. All lines were numbered, and these numbers could be used as labels for GO TO. Numbered lines made editing easier. But BASIC had for loops. And these loops added some block structure. Another issue was that all variables had global scope. That limited the size of programs by making the complexity needlessly high. Later versions of BASIC fixed these issues by adding real block structure, local variables for subroutines, and even recursion.

The real problem with BASIC wasn't that it damaged anyone. It was that the tools it provided were good enough. And programmers that learned it, tended to write code in other languages as if those other languages were BASIC. It was comfortable. But Bruce Lee had it right: “There are no limits. There are plateaus, and you must not stay there; you must go beyond them. If it kills you, it kills you.” Bruce studied martial arts. It's hard to imagine that learning Lisp will kill you. And, Lisp might have been what Dijkstra was thinking about as an alternative. It gave you block structure, recursion, complex data structures, and things that are difficult to imagine if all you've seen before is BASIC. The Lisp/Algol course i took in school gave us five weeks for Lisp and two weeks for Algol. Algol is more similar to BASIC. Five weeks was not nearly enough for Lisp. Two weeks was like luxury for Algol.

The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence. I've just started with COBOL in detail. I suppose that Dijkstra would have considered this, like suicide, to have the perpetrator and the victim be the same person. So he'd likely consider it an unpardonable sin. Maybe i'd get special dispensation for learning it as my fiftieth language. But from what i've seen of COBOL, all of the complaints that Dijkstra had for BASIC and FORTran apply to COBOL. There may be more complaints. Perhaps the idea that COBOL is so verbose is one of them.

APL is a mistake, carried through to perfection. It is the language of the future for the programming techniques of the past: it creates a new generation of coding bums. I haven't seen APL (A Programing Language) in decades. Perhaps it's dead now. It had some warts. It required a non-ASCII character set that included the entire Greek alphabet. That made it difficult to use in an era when most computer terminals could only display UPPER CASE. APL used single greek letters for built-in function names. And, one would string together dozens of these letters together without spaces to form a new function. Calling it hard to read is an understatement. I thought of it as a write-only language. However, it was terse. Whole programs were often a single line, and a short one at that. And, terse can be good.

The problems of business administration in general and data base management in particular are much too difficult for people that think in IBMerese, compounded with sloppy English. I believe Dijkstra is talking about COBOL again, though maybe with JCL - the other language i'm learning currently. I don't think he was talking about SQL - the Standard Query Language, used by most databases today, invented at IBM. I have issues with SQL, but i'll save that for some other rant. Obviously, business administration has worked using COBOL. I'll grant that other languages would have been OK too, possibly better. But the computer scientists of the 70's turned out to be wrong on many, many fronts, when predicting the future. Their logic was sound, generally. It was the assumptions that were mostly wrong. Can't fault them too much for that. Things happened in computers in the past 30 years that would have been hard to believe. So they probably wouldn't have given much thought to the ramifications. But memory is more than a million times larger. Disk storage is a million times larger. Everything is 10,000 to a million times faster. Everything is cheaper. The rules and goals have changed.

About the use of language: it is impossible to sharpen a pencil with a blunt axe. It is equally vain to try to do it with ten blunt axes instead. I agree with him here. Well, he was vague enough that he could actually get away with being general.

Besides a mathematical inclination, an exceptionally good mastery of one's native tongue is the most vital asset of a competent programmer. I'd agree if i thought that mathematical inclination was very important for computer programming. Native language skill is paramount, to be sure. But i know people who are very good at math that absolutely do not grasp programming concepts in any practical way. I was pretty good at math, but i don't see that it helped me overly much. Skills are skills. Is there one skill that everyone will find more difficult to master than every other? I doubt it.

Many companies that have made themselves dependent on IBM-equipment (and in doing so have sold their soul to the devil) will collapse under the sheer weight of the unmastered complexity of their data processing systems. This simply hasn't turned out to be the case. Perhaps all the big companies have made themselves dependent on IBM or MicroSoft, and so are on equal footing with each other. Digital Equipment, which was a clear alternative to IBM in the 70's, is gone. IBm is still with us. Of course Digital's demise didn't necessarily have anything to do with the quality of their technology, for good or ill.

Simplicity is prerequisite for reliability. What is a prerequisite for reliability is program correctness and maintainability. Generally, these are achieved through simplicity. But i've written programs that i could maintain, but had much difficulty in explaining. They were as simple as i could make them, but that didn't turn out to be very simple. The requirements demanded a certain minimum level of complexity. Yet, these programs had long lifetimes. They were configurable by anyone, and that was pretty much the only maintenance required.

We can found no scientific discipline, nor a hearty profession on the technical mistakes of the Department of Defense and, mainly, one computer manufacturer. Obviously, it was done. I agree that it was a bad idea. And, the industry has managed to move away from that model to some extent. Unix, and the open source movement have had an incredible effect on the industry.

The use of anthropomorphic terminology when dealing with computing systems is a symptom of professional immaturity. I'm not entirely sure where Dijkstra is coming from with this. It's certainly a mistake to talk about computers as "thinking", at least at the moment. Take the example of the chess player. Humans and computers do use some of the same logic. But they don't get at strategy from the same perspective. Humans do better at recognizing situations as similar to historic situations, and work with classes of problems. Computers tend to work at the tactical level so deeply that strategy emerges. So it's different. And that's just one example. It gets worse with more complicated problems. But maybe he meant this: So, there's a bug, and because the computer saw this datum, it came to this erroneous conclusion. It happens. And Dijkstra may call it immature because that's what parents do with their infants, when no such claim could possibly be scientifically made.

By claiming that they can contribute to software engineering, the soft scientists make themselves even more ridiculous. (Not less dangerous, alas!) In spite of its name, software engineering requires (cruelly) hard science for its support. If by soft sciences, Dijkstra includes philosophy or psychology, then i agree. Otherwise, i've no idea what he's talking about.

In the good old days physicists repeated each other's experiments, just to be sure. Today they stick to FORTRAN, so that they can share each other's programs, bugs included. In the 1980's, when C++ was gaining momentum, the claim was that you'd write a good class (set of methods combined with a data representation), and it would simply be reused. You were done with that problem. And the joke was, "Now we can reuse all of our mistakes". My good friend Karl lamented that he was rewritting his subroutine library (the equivelent of a class) for the third time, so solve some issue. I thought version two was pretty damned good. So i told him that "all software
needs to be rewritten". (And in this sense, Dijkstra was right, you are doing it wrong. It can always be better in some sense.) But in the open source arena, you can use the existing code to stand on, and fix it if it's broken. And, you can contribute your fixes, so that when the next version comes out, it has your fixes, but also everyone else's. And there's open competition to have the best code to steal. Physicists still repeat each other's experiments, when at all practical. Otherwise, they examine each other's data.

Projects promoting programming in "natural language" are intrinsically doomed to fail. I think, with the victory of IBM's Watson in the game Jeopardy, natural language is within the grasp of computers in the near future. But Dijkstra was likely talking about COBOL, which was touted as readable by (non-technical) mangers.

PS. If the conjecture "You would rather that I had not disturbed you by sending you this." is correct, you may add it to the list of uncomfortable truths. The current most disturbing thing i've heard is from Carl Sagan's 1980 Cosmos series. He talks about how carbon dioxide has formed a greenhouse on Venus that keeps the surface temperatures hot enough to melt lead. Then he goes on to say that we are engaged in a similar, but uncontrolled experiment with our own atmosphere. Back in 1980, there wasn't much talk about it. We're talking about it now. Sagan didn't say anything in his series that wasn't already solid science. That's why so much of the series is still so relevant, 30 years later. What's most disturbing is that many are still in denial about climate change.

If Dijkstra wanted computer engineering to be practiced by an elite, then perhaps politics, on which our shared planetary environment depends, should be dictated by the best scientists. Just because industries of all sorts have survived with mediocre computer programming, doesn't mean that the Earth will make it. Consider that moving to Mars isn't a solution. Moving to Antarctica is much easier. You don't need to manufacture your own air.

Tuesday, March 08, 2011

Sounds Fast

My newest Sansa mp3 player has slow, normal, and fast modes for podcast play. The fast mode increases the rate at which sound is played back. And the idea is clearly to get through material faster. A side effect is that the pitch of the sound is increased. It's like playing a tape faster than it was recorded. There are techniques for playing back a digital recording faster, without changing the pitch, but this unit isn't doing that. There are both computational and quality advantages to the way the Sansa does it.

I measured the speed at which fast mode plays. It takes 80% of normal time. So, a track which would normally take an hour will take 48 minutes. That's a 12 minute savings. The speed is therefore 1/0.8 = 1.25 times normal. As an aside, in marketing, people do the sale percent math inconsistently with each other, often making it difficult or impossible to predict what the final price will be. This case might be reported as either 20% faster or 25% faster. I'm trying not to be sloppy.

Some of the podcasts either have music introductions, or the show is actually about music. So, for example, i listen to my friend Craig's Open MetalCast. He interviews artists, but also plays tracks from their albums. I was curious how the pitch changes for music and voices. How would one figure this out? It should be a case of a little math.

A piano keyboard is organized into octaves. Each octave going up in pitch has a frequency that is exactly twice as fast as the previous octave. Now, you might think that there are eight notes in an octave - since the oct prefix means eight. The notes are labeled A through G, which is seven notes. The eight comes from counting the note that you start on. So, in this case, A is counted twice. And, indeed, there are eight. But, there are 5 black keys interspersed. There are a total of 12 notes to an octave. You still have to count the starting note twice. It's a fence post problem. The way to solve fence post problems is to think about each one carefully. Otherwise, you'll be off by one.

In the modern equal tempered scale, each half note - adacent keys on a piano, has the exact same frequency ratio as any other adjacent keys. Since there are 12 steps in an octave, and an octave gives you a factor of 2 frequency change, the ratio for a half step is the 12th root of 2, or 2^(1/12).

Now, remember that the speed change is a factor of 1.25. If we want to find out how many half steps that is, we need to know how many times we must multiply the 12th root of 2 by itself to get 1.25. So, here it is in algebra. We just need to solve for x.

(2^(1/12))^x = 1.25

We can take the logarithm of both sides and preserve the equality. It doesn't matter what base log you use. Your calculator may have a base 10 logarithm funcion labeled "log", and a natural logarithm (base 2.718...) button labeled "ln". The Windows calculator, in scientific mode (use the View menu), has these.

log(2^(1/12)) * x = log(1.25)

we can divide both sides by the constant log(2^(1/12)) and get:

x = log(1.25) / log(2^(1/12))

Plugging this into a calculator:

x = 3.8631371386483481744438331538727

This is the first thirty two digits of the answer. I'd be very surprised if the full answer has fewer than an infinite number of decimal digits. Since i only measured the speedup to about a part per 1000 (to the second over about 17 minutes), the result should be rounded to 3 significant digits, or 3.86. So, the speedup is more than a minor 3rd, and closer to a major third. It's not exact. So, all music played this way will not be in an A 440 based key.

As an aside, the quartz crystal used to regulate how the sound is produced is likely accurate to at least nine significant digits. A part per billion. It's quite possible that the manufacturer designed the speedup to be arbitrarily exactly 25% faster. In that case, nine digits, or a value of 3.86313714 might be justifiable. Or, again, who knows, the manufacturer could have wanted A 440 music to stay A 440 (but transposed), and set the speedup to be about 1.25992105 times faster (to get a major 3rd).

Anyway, more or less a major third. What's interesting is how a major third changes everything. Many voices are nearly unrecognizable. The tonal quality of voices generally change dramatically. There are very few spoken voices that you thought were typical deep male radio voices that you'd consider at all deep when played faster. Many adult voices sound like children. And music vocals, singing or rap, change in character similarly. But instrumental music usually sounds pretty normal right away, or pretty normal after a few seconds.

What amazes me about this is that my musical sense of pitch is quite relative, not so much absolute in nature. I can't tell you if a piano is a half step flat, generally speaking, even if i play it. Sometimes i'll accidently play a left hand part in the wrong octave without noticing. Yet, the character of the voice is quite apparent.

Another aside, when i play violin, i carefully tune each string with an electronic tuner. If a string goes out of tune, it generally goes out of tune with respect with the other strings. Once my brain has an absolute reference, i can get the instrument to play accurately pitched notes. There are no frets on a violin. You have to put your fingers in the right spots to get the right pitches.

In the mean time, there is a little music in my podcasts. This music, when played up a major 3rd, often sounds odd for a bit, then i get used to it. There is the odd piece that doesn't translate. For example, Beethoven wrote the Moonlight Sonata in C# minor. You can get a sheet music version transcribed (transposed down a half step) in C minor, which, having fewer sharps and flats, some people find easier to play. If i hear it played in C# minor, then hear it in C minor, it sounds disturbing to me. But if my piano is consistently tuned a half step down, and there's no absolute reference, i'm totally cool with it.

Anyway, this is a little thing. There's a function on my mp3 player. A curious thing, and i was curious. Was there more to think about for this function? Maybe. This musing was well within my comfort zone. I just sort of rambled around and played with what appeared interesting in my most distracted ADHD sort of way. But Bruce Lee had a different idea. He said, There are no limits. There are plateaus, and you must not stay there; you must go beyond them. If it kills you, it kills you. Bruce was into martial arts. A little curiosity won't kill you, unless you're a cat.

Wednesday, March 02, 2011

Pope: Jews not to be blamed for death of Jesus

Pope: Jewish people must never again be blamed for crucifixion

So, Pope Benedict XVI says that Jews are not responsible for the Death of Jesus. Must be a slow news day. The Vatican has maintained this view for decades. But i'd heard the view as a kid and rejected it out of hand.

There's a passage in the Gospel of Matthew, where the Jews shout to Pilate, Let his blood be on us and on our children. For one thing, if this was said at all, these people didn't have the authority to say such a thing. How could they? But since Christianity didn't exist, all Christians at the time were Jews. Further, despite the rampant ramblings of Paul, the Christian Church is founded on Peter, who taught at the synagogue. Christianity is built upon Judaism. Get over it. So, if the Jews are somehow responsible for the death of Christ, so are Christians. And probably Islam. Everyone else is innocent. BTW, if i'm responsible for the death of Jesus, i'm cool with it.

One expects that Biblical scholars have thought about this before. And, they probably have thought about the next puzzle. After all, Biblical scholars should be thinking about the basest blasphemy possible, if only to strengthen the faith. And that is, this. Given that Jesus partakes in the divinity, he could certainly have avoided his own death. He clearly knew about its coming in advance. Scripture says he was tempted to do something about it, and chose not to. So, was Jesus responsible for his own death? Was it assisted suicide?

Wednesday, February 23, 2011

Task Master

I've been using Windows since 3.0, even if it wasn't my first choice. Sitting in front of Windows XP, i happened to notice something i'd not seen before. I had a long running task - consuming CPU time. The interactive response had become crappy, even though the machine is generally pretty capable and modern. I brought up the task manager, and found my program in the Processes tab. On a whim, i right clicked on my task. A pull down menu came up. One of the entries is Set Priority. There are six entries, Realtime, High, AboveNormal, Normal, BelowNormal, and Low. There was a bullet by Normal. I set it to BelowNormal. My interactive response snapped back to reasonable. And, the task seemed to be getting most of the wall clock time in CPU time, as i'd wanted.

Now, i could rant about how under Linux, or other Unix variants including MacOS, the normal priority for a CPU bound task does not, in general totally mess up interactive response. It's just under Windows. I could also rant about how right clicking on random data is not a particularly discoverable user interface. It's not like my employer gives me a Windows manual to read, or the time to read it. I can't very well right click on every little piece of data in every window. But at the moment, the fact that there's a problem i can actually fix, and easily, is a good thing.

Tuesday, February 22, 2011

Vaccination

The US Supreme Court has ruled that vaccine lawsuits can be preempted. I'm no lawyer. I know neither the law involved, nor the case involved. But here's my take on it.

As a parent, what i want is the highest chance of a good outcome for my child. No vaccines are perfect. None protect every child. Often it's just 80%. But if all children are vaccinated, then the disease has fewer places for transmission, and the all children are protected. So, vaccines protect not only my child, but all children against some dread disease. It may also harm a few, even if everything is done as well as can be done. Chances are still way better for all of the children. Having parents opt out of a vaccination program doesn't just fail to protect their kids, it also fails to protect my child. And, we're starting to see cases of dread diseases for the first time in decades. Kids now face death at much greater numbers than they did with vaccines.

It's not a perfect world. But vaccines have certainly made it better.

I'm no lawyer, and won't comment on any particular litigation. But as a society, we're smarter if we decide to protect ourselves. Is it worthwhile to compensate the one in a million harmed while protecting the million? It's a fair question. Perhaps the vaccination laws could have put in non-confrontational compensation to the few. For all i know, they did. Having been to court, i've come to this conclusion. We'd like justice, but we have the courts instead.

On the subject of protecting ourselves, there are diseases, like polio, where we vaccinate, but haven't had a case in the US for ages. It costs alot to vaccinate. But we could forego it once we've eliminated polio from the Earth, as was done for smallpox. And we could fund such an all out attack on polio, and come out ahead in just a few years. The economics make sense, even if we're all totally selfish bastards.

Monday, February 14, 2011

Valentine's day car

Saw an advertisement from a car company suggesting that having a cool car loaded with features might impress your first date. Yes, it's Valentine's Day. Of course, St. Valentine had nothing to do with sex.

My first date (in a car) was with a Lincoln Continental Mark iv. Quiet, smooth, electric sun roof, and with a 7.5 liter v8. The family Lincolns actually had climate control, not a silly blend door control. We'd set the thermostat to 72 year round, and it'd turn on the a/c or heat as needed. But my date was disappointed. She knew i had access to a real beater: an F-250 with three quarters of a ton of character. No tail gate, an electric bench seat taken from a Buick - not even bolted to the floor, AM radio, starter motor on it's last legs, and zero fear of dirt. Every ride was an adventure, with no cell phone to call for help. What more could one want?

And these days, my car is a stripped down 2000 Saturn. It's a 4 door sedan with a 1.9 liter straight four, front wheel drive and 5 speed manual. It's got 285k miles now, and has averaged over 43 MPG. The 12 gallon tank costs $36 to fill at $3 a gallon. Sure, it only goes 500 miles on a tank. When the wife and i go somewhere, it's not in her much younger, more comfortable vehicle. We keep the excitement going.

A USA Today article says that the Ford Escape hybrid is $7,600 more than the Ford Escape non-hybrid. It gets 9 more miles per gallon (MPG) - 32 MPG vs 23 MPG combined. The obvious question is how many miles before the hybrid breaks even on cost?

$7600 / (($3/g / 23m/g) - ($3 / 32m/g)) = 207,170 miles.

This assumes that maintenance for the hybrid will be zero. That's probably not true. But it also assumes that gas will be $3 a gallon for the life of the car. My guess is that gas will go up. It was $4 a gallon in 2008. Math is a powerful tool, if used to inform. But it's important to know what the math is telling you, and what it doesn't say.

I did this math for the Escape in 2008. The answer was 270k miles. Gas was $4 then. My car at the time had 295k miles, so it seemed at least a possible win. But, given that the break even cost is lower now, at least Ford is making headway towards making hybrids worthwhile economically. That's encouraging. Hybrids make more sense for people with lots of city miles, like taxi drivers. I drive lots of highway. I don't expect a hybrid in my near future. Turbo diesel might be nice.

There's more math. If $7,600 makes such a big difference that it takes 200k miles to make it up, clearly, the purchase costs dominate. Since i didn't get a car that's bigger than i needed, i saved huge amounts up front. And i bought it used, saving most of that. I spent less than 10% of the $23k non-hybrid Escape. And, since it's smaller, it gets better economy too. What have i spent my money on? Well, mostly on family essentials.

The total dollars aren't the only concern. There's also capability. My current favorite new car on the market is the Fiesta. I don't happen to know if my telescope will fit in it. I'd like a vehicle that can tow a boat. I've got a boat. The Fiesta won't do it. One cheap way is to get an old body-on-frame car. I've got the car. It needs an engine. I expect to come out ahead compared with buying a truck. It'll get 30 MPG when not towing.

I remain convinced that cars are not a good investment. It often makes sense to put money in an old car even if the resale value is lower. Invest in your own comfort. Realize that comfort is ephemeral. What's the cheapest way to get what you want for the longest time? Buying another junk can set you up for expensive diagnostic costs. Taxes devalue other vehicles compared to yours. I'm glad that people buy new cars, though. Please buy a new Fiesta so that in a few years when my Saturn dies at 350k miles, i can buy it from you. I'd like the smallest engine, turbo if you can get it, with the manual transmission, please.

Tuesday, February 01, 2011

Trader Joe's Wine

So, i've got a head cold. Concrete in the sinuses. I'm not on my death bed, so i'm going to work. Last night, i got a free music track download from Sharon Bautista, called Trader Joe's Wine. It's a preview of her new album. I put it on my mp3 player in the morning, but waited until i was at my desk to listen to it. After all, it's noisy in the car. By the time i got to work, i was in a kind of sour mood. Damned cold. As i started the tune, i felt like a music critic. Was this another song about song writing? Almost no one can pull that off. But half way through the piece, i'd calmed down and just let it move through me. When it seemed to be getting slow (i really doubt the tempo changed), it switched to some sort of bridge, which really does pick up. Sharon has a beautiful voice with some vocal range and variety.

My music biases are few. I listen to Contemporary American Folk, Classical, Indian, Industrial, Rock, Disco, Movie Soundtracks and so on, and even in shuffle mode. Mozart next to Sister Machine Gun. Rap isn't music. I don't listen to much Country. My rules are these: If there are no lyrics, then the music has to do something. I would say that there must be melody and chord progression, but i've heard good atonal music that really goes somewhere. If there are lyrics, they have to be presented so the listener can hear them, and they have to have something to say. And it can't be some dead horse you're flogging. Country often violates this. It's "he left her", or some such tear jerker, but the same plot as the last ten songs.

This bit about saying something is tricky, since it's really easy to sound like you're on a soap box, preaching your personal Gospel. Worse, my all time favorite pieces really are someone preaching their personal Gospel. The main trick that saves these pieces for me is to show some insight. For example, P!nk's So What? is a "He left her" song, but she's already picked herself up and figured out that he's not her whole life. Sure, it hurts, but life goes on, and there's hope for the future after all, and it could be even better. Without giving away the plot, Trader Joe's Wine has a situation, and presents, well, if not a full solution, then at least something that makes it suck less. If Sharon writes her own stuff (and i think she does), then in addition to a voice, she's got serious writing talent.

If this track is representative of the album, then it's pure gold. In the old days, when albums had mostly top 40 radio (which was really top 5 with a few stray tracks), i was happy if an album had only one track i liked. In this case, i've heard one track. And if that's the only track on the album i'll end up liking, it will still be worth it. Even though i've already got the one track. Perhaps i don't really have a one track mind.

Wednesday, January 26, 2011

Number seven

So, this is an empty bottle of Arizona iced tea (sorry, the home page is Flash. I really wish people wouldn't have their home page in flash.) I bought three of them, and this is the last. This isn't a returnable bottle. Iced tea has no carbonation, so no deposit/return is required. That's the way it is. But it is plastic, and therefore can be recycled. So, i flipped the bottle over to discover a number 7 in the triangle. It's very hard to see. I tried, but could not get a photo of it. The camera refused to focus on it. There's not much contrast. The raised triangle and number are not raised very high and the plastic is translucent, so even lighting it from a slant angle produced no defined shadows to help in reading it. All this to say, it's not very easy to read.


In truth, if i'd known that it was number seven, i would not have bought it. There are two reasons. From a convenience point of view, my curb side recycling only accepts number 1 plastic and number 2 plastic. So, i must go quite a ways out of my way to recycle number 7 plastic. But the other reason is more interesting. Number 7 plastic has a rather perverse history. The material was originally an attempt at making artificial female hormones, like estrogen. It has been said that you should not refill plastic water bottles because it's unsafe. IMO, if it is unsafe to refill, then it's unsafe to use for food in the first place. I'd like to see the material banned, certainly for food, but probably for everything. After all, if the material makes it to landfill, then it's likely to leach stuff we'd rather not have leached into the environment. Short of banning it, it'd be real nice if Arizona, and other companies would simply stop using it. After all, the stuff is potentially nasty, and what company needs to have a public relations issue on their hands. And if a company like Arizona doesn't do their own local bottling, then they should put the ban into their contracts with their bottling partners.


I'm not particularly worried about the effects of estrogen-like compounds in my own body. I'm an adult. But my kid's development could be affected. What, if any, long term research has been done? Leave a comment if you know anything.

Monday, December 27, 2010

Helicopter flight school

Excerpt from a toy helicopter's directions: "In if the flight does not have the impetus to change the operating lever, but the helicopter still in airborne spun, by now might adjust in your hand on remote control's vernier adjustment knob, balanced does not spin until the helicopter."

My translation: "Fly the helicopter to a steady height with the Throttle stick. Then adjust the Vernier adjustment knob so that the helicopter does not spin left or right."

Note that the diagram shows the Throttle stick and the Vernier adjustment knob.

Note to companies: I charge $100 per hour for translations. That's real cheap. This entire manual could be fixed in under an hour. Then your company won't be so embarrassed, and more of your customers will be able to figure out how to use their Holiday Gifts. Lowered childhood frustration might lead to world peace.

Sunday, December 12, 2010

Neil Armstrong sent Robert Krulwich, of Radiolab on National Public Radio fame, a letter. And he talks a bit about what he and Buzz did on the Moon in '69. And, I agree with everything he said. I'd love to hear Neil make an appearance on Radiolab.

And, i haven't changed my opinion about what NASA is currently doing. Going to the Moon was dangerous. And worth it. As far as the space program goes, i'm not risk averse. While one should do everything one can think of to limit risk, it's required to make progress.

The Shuttle accident rate is 2%. That's the worst of any vehicle that carried anyone into space. In my opinion, that's unwarranted risk. Use more reliable rockets. Further, the Shuttle program promised that it would be cheaper, through reuse of systems, than other vehicles. But it hasn't delivered on the cost promise. It's easily twice as expensive. Don't get me wrong - the Shuttle is amazing. While the external booster issue that the Challenger disaster exposed seems to have been solved, the wing problem that the Columbia disaster exposed was not solved. The program should have been terminated. I understand that the long-canceled National AeroSpace Plane did solve the wing problem. But that's not something that could be retrofit into the Shuttle.

So, the recent success that NASA has had with SpaceX is encouraging news. I was hoping that when the Constellation program was canceled, that something like this would emerge.

Friday, December 10, 2010

Unkillable

Over at The Seanachai, Patrick has a new book - Unkillable. I've listened to the first seven chapters. If you loved How To Succeed In Evil, you'll love Unkillable. If you haven't yet succeeded in evil, you should do yourself a favor now. Then, do me a favor. Send him a few bucks. Maybe he'll write some more.

Wednesday, December 01, 2010

Be Unreasonable

The reasonable man adapts himself to his environment.
The unreasonable man adapts his environment to himself.
Therefore, all progress is due to unreasonable men.

In this case, NASA is taking the reasonable approach. If the astronauts experience bone loss, radiation damage, etc., then change their diet, give them drugs, or whatever to get them through it.

The unreasonable approach is to notice that astronauts do not have millions of years of evolution in near zero G conditions. So, provide them with artificial gravity. This can be achieved by spinning. Radiation shielding is expensive, but possible. 10 meters of water all around should do it. Since this weighs as much as a battleship, one should consider electrostatic and magnetic deflection as lighter and therefore cheaper alternatives. And one should test these technologies. Half a trillion dollars has been spent on the International Space Station.

Going to the Moon was unreasonable. Audacious aeronautical research, like the X15, was unreasonable. That's what NASA was created for. NASA is being reasonable when being unreasonable is called for.

Wednesday, November 17, 2010

Podcast file name convention

What's in a name? If you're publishing a podcast, the filename used makes a difference. File names must be unique, otherwise your subscribers will overwrite older shows that they may not have listened to yet. The file name should distinguish the show from other subscriptions the subscriber may have, much for the same issue. So, don't use 'episode'. Someone else may do that. Better, is something from the name itself. All In The Mind becomes aim, for example. And this show-unique bit should come first in the name, so the subscriber, using a sorted list, can see all your shows together.

After the show title part of the name should come a numeric part that makes each episode unique. One way to do that is to number them. The first show could be '1', and the second could be '2'. But, such numbers should have leading zeros so that in a sorted list, the lexicographic sort order also is a sequence sort order. So, use '01', at least, so that the first nine episodes sort properly with the tenth. It may be arrogance or optimism to use '001' or '0001' for your first show, suggesting that the expectation is over a hundred or thousand shows. But there are plenty of shows out there with more than one hundred episodes already. And some monthly shows are getting close.

Another way to do this is to encode the date. Some shows use a 2 digit year, 2 digit month, and 2 digit day. For example, 100823 is 2010, August 23rd. This has the advantage that the lexicographic sorting is also the date order. And the sequence won't break for another 90 years. Of course, a 4 digit year such as 20100823 also sorts properly, and won't break sort order for nearly eight thousand years. Either is fine. But i find that the four digit year is easier for a human to read. That is, while one hopes that it's a date, and one hopes that it's in the form of year, month, day for sorting, one must still guess that 10 is the year and not October. Dates come in all the permutations of order, in different cultures. IMO, the military gets it right with YYYYMMDD. While 2010Aug23 may be easier for a human to read, it fails the sort order requirement, and is therefore unacceptable.

Underscores are optional in filenames. aim100823.mp3 is OK. But they must be consistent. You can't use aim100823.mp3 one week and aim_100830.mp3 the next week. This error breaks the sorting order. Best to name these things with a script. Does it matter if the file name is the recording date or publish date? Probably not. There should be a publishing script that gets all the RSS details right. If there is, it could get the file name right as one of those details.

Speaking of underscores, are there characters that should not go into file names? Yes. No colons (:), no slashes (/), and no backslashes (\), because these characters are directory separators on various operating systems. But really, one should stick to alphanumerics, hyphen (-) and underscore. In command line environments, (parenthesis), dots (.), quotes ("'`), brackets (<{[]}>), pipes (|) and so on (~!@#$%^&*+=;?) can all be interpreted, making it difficult (but almost never impossible) to cope. Simply avoid these.

After the sequence number or date, a very brief description of the show may be included. This information can very easily be included in id3 tags within the file - and they should be there. But one or two words will often help the subscriber. Don't make it too long. Windows may have long filenames but DOS does not. And, like it or not, there are mp3 players out there that have 8.3 filenames. So long file names show up as micros~1.mp3 on these players.

What can be included as text within mp3 files? Some of the shows i listen to have complete transcripts. It's incredible.

What if you got it wrong? Should one rename old shows? Absolutely not. Once you've made an error, changing an old filename risks having thousands of podcasting software suites download these old shows again.

This podcast filename convention should also work for any other RSS published material, such as a blog. However, for blogs, the file name length does not have to observe the 8.3 convention. Short file names have mostly gone the way of the dinosaurs. You do use Rock Ridge extensions on your CDs, right?

Monday, November 08, 2010

Binocular spam

I got some spam by email recently.

The Optic 1050 binoculars, with up to 1000x magnification will allow you to see objects up to 35 miles away! The lightweight, rugged and durable Optic 1050 binoculars are only $19.98 and just $7.95 P&H. These super lightweight binoculars easily adjust to your eyes, are shock resistant with shatterproof lenses and feature wide-angle viewing.


Plus, with each pair of binoculars you order, youll also receive the bonus Pocket Spyscope. Its less than 6 inches long with 24x magnification. Thats a $50 value, yours FREE! You just pay $4.95 to cover shipping and handling. The Pocket Spyscope is lightweight and portable. You can see objects up to 7 miles away and it doubles as a magnifying glass for close up use.


National TV Bargains Power Binoculars...


Ignore the missing single quote in youll. Presumably, when they say 1050 binoculars, they're talking about 10x50 binoculars. Read this as "ten by fifty". But it's 10x - ten times larger than your eyes normally see. The big end of the binoculars are 50 millimeters. That's about two inches.

They say up to 1000x magnification. No. They're 10 times magnification. 1000 times magnification with binoculars that have a 2 inch big end would produce a useless, grainy image. For 1000x magnification, the big end would have to be about 20 inches across. And that would be pushing it. I'd really want the big end to be 40 inches across for 1000x. That's how optics work. Naturally, such an instrument would be more expensive, and less portable.

will allow you to see objects up to 35 miles away! How disappointing. I've seen the Andromeda Galaxy without optical aid. That's about two and a half million light years away. One light year is about 6 trillion miles. So Andromeda is more than 15 quintillion miles away. If i can only see 35 miles with these binoculars, but can see 15 quintillion miles without them, there must be something wrong with them.

shatterproof lenses. They must come from Krypton, like Superman.

feature wide-angle viewing. I suppose anything is relative. They're likely wider angle viewing than my telescope at low power. But they're not very wide compared to naked eye. But notice that they don't say what they're relative to. Nor do they give any measure of how wide an angle you can see with them. Normally, binoculars are sold with such a reference. It might be five degrees or seven degrees.

Pocket Spyscope. Its less than 6 inches long with 24x magnification. The length isn't that important. If this Spyscope has a diameter of less than an inch, then the views through it will be grainy. For 24x magnification, it will likely have to be two inches in diameter to be able to produce any kind of decent image. If it's six inches long, it's unlikely to be even an inch in diameter. This is not a $50 value. It's so mis-designed that $5 is too much.

You can see objects up to 7 miles away. So, it's not even as good as the binoculars? Well, that's the truth.

doubles as a magnifying glass for close up use. I think this says something about the way the optics work. I don't think means anything good for use with distant objects.

I have a pair of 10x50 binoculars. They're really good. However, if i want binoculars for hand held use (no tripod), then I find that 8x, or eight times magnification, is about as much as I can handle. With more magnification, the view isn't as steady. But I have a nice tripod. And my 10x50 binoculars work really well on it. I also have a small scope - much more than 6 inches long, and 2 inches in diameter. And it can magnify to something like 24x. But it is totally useless without a tripod. So, my best guess is that this 24x Spyscope is useless.

$19.98 + $7.95 + $4.95 = $32.88. That's the amount you can save by reading this post.

Everything breaks

An odd series of failures seems to have happened all at once. Seals on the oil pump for one car, the water pump, and now it seems, the thermostat of the other car, a printer, and the CPU fan for a computer. The phone. Having redundant hardware isn't enough. Well, nothing lasts forever. But the CPU fan is only maybe five months old. I had expected better. The worst failure, though, is a long lasting cold. Well, there's no fever. But it's been far too long.

This blog has been idle for quite a bit. Lots going on. There are about a dozen posts in the queue. Just have to get time to upload them. Also, i've pretty much abandoned my livejournal blog. The ads that livejoural have added are invasive. I don't like my own site. So, my astronomy stuff will start getting posted here as well in the near future.

Thursday, August 05, 2010

English as a first language

I admit it. I hated English in school. Well, perhaps hate is too strong a word. It was more that there were other subjects that i preferred. I don't hate chocolate ice cream. I simply prefer vanilla. But i was talking to someone who majored in English in college the other day, and it got me thinking.

So why was English less than my favorite subject? It's probably the way grammar and spelling are taught. The way grammar is often taught is to explain the rules of grammar, with heavy emphasis on this is a noun and all sentences have at least a noun and a verb. It largely ignores the simple fact that English has no rules at all that aren't regularly broken. By the time the average American child is ten years old, they've learned 10,000 words of vocabulary, but also 10,000 rules of grammar. This is as large a vocabulary as adults master for most other languages. And really, come on. A rule for every word is pretty much the same as an exception for every rule. That's like saying that there are no rules at all. And American children don't learn these things by having to remember either the rules or the names of the rules. They do it by usage. And usage is how the language is defined. Really. Dictionaries are written by examining published material. That's why congress critters and others can routinely verb words. (The word verb is, of course, a noun). And, of course, learning just exactly what words are nouns, verbs, adverbs, adjectives, pronouns, prepositions, and so on, and what, exactly, the rules are for these things is roughly irrelevant to the English speaking child.

Here's an example. As a former child, i remember these, and swore i'd never torture my kids with them, should i ever have any. As a parent, i enjoy torturing my kids with them. There are few other perks being a parent, so one must enjoy the opportunities available. Johnny and me went to the park. The correct phrasing is Johnny and I went to the park. Please don't explain what rule this breaks. The correct way to teach this is as follows. One must drop the Johnny and bit and see if it still sounds right. So, Me went to the Park doesn't scan as well as I went to the Park. And yet, when i was a kid, i didn't respond even to the full grammar lesson, with what amounts to technojargon words and rules, using what ever in a sing-song voice, as i routinely get now, even with my methods. So, there are at least two things to note here. The education problem is much harder these days, now that we don't demand so much respect from kids. And, it's likely that we're attempting to teach kids the full grammar rules before they're mentally equipped to deal with them.

I did hear a Johnny and me reference on the radio recently. It was correct. Which is to say, it passed my test. I can't remember when (if ever) i've encountered anyone doing it right. Maybe the simpler rule is to simply always use Johnny and I. It may not always be right, but it may be right so much more often as to not make any difference. You heard it first here.

Spelling is even easier to teach. Tell the kids to write lots of stuff, and demand that they use spelling checkers. Have them turn off the word processor feature that corrects words as you type. This feature doesn't teach anything. Have the word processor mark anything it doesn't understand, and allow it to offer suggestions. This is how i learned to spell. Learning vocabulary words by rote was irritating. It also wasn't nearly as effective at expanding vocabulary as simply reading challenging books.

This correct-as-you-type feature is pretty evil. IMCO (In My Considered Opinion), the feature should be removed from all software. It often "corrects" words that have been typed correctly. That is, it often introduces errors. I often use a specialized vocabulary, for computers, engineering, or some other business. I end up having to type the same word correctly half a dozen times in the course of editing. I often have to come up with unique tricks to get what i need, such as writing some longer word, and deleting bits of it to get the right spelling. I even have to correct broken capitalizations.

I went to an Engineering school. And i work with engineers. With few exceptions, these people are brilliant, well rounded people. But they often have poor English skills. They leave out articles, make references using pronouns without clearly establishing what the references are for, and so on. And many of these people only know one language. It's often far worse when English isn't their first language. From a strictly business point of view, one might say, who cares? The work is getting done, right? And these people are brilliant, right? But poor documentation, especially unclear and ambiguous documentation can lead to needless rework and worse. Worse is documentation that misleads. One could call it anti-documentation. You're actually better off without anything. It has negative value.

Now, when i went to school for engineering, there was considerable opportunity to write. There were lab reports and other assignments. There were requirements to do work outside of your chosen major. Usually, these were not graded on English grammar or spelling, however. There were projects that one needed to do in groups. Since i had advanced computer editing, formatting and typing skills, i generally typed up the group projects. And, it was somewhat of a surprise to me that my ability to compose prose was generally superior to that of other students. After all, these kids were all off-the-wall brilliant. I completely ignore students for which English was not their first language here. I'm talking about native English speakers. And yet, as far as i recall, the school did not offer an English course of any kind. But one really needs a firm understanding of English to achieve technical excellence. And technical excellence was clearly the primary goal of the school. So, while it isn't my opinion that engineering schools need to have an English department offering and capable of granting an English degree, they should offer English courses as an option. Otherwise, all students are stuck with whatever they happened to learn in high school.

How large is your vocabulary? It's worse than impractical to try to list all the words you know and count them. Humans are terrible at listing things, especially when the list is long, such as when there are more than about three items. And yet, it turns out that there is a fairly quick and simple way to find out. Get a dictionary that brags about the number of words it contains. Many college dictionaries boast half a million words. Get a blank piece of paper and a pencil. A pen will do. Make two columns, Right and Wrong. Open the dictionary to a random page. Jam your finger down the left edge without looking. Then slowly move your finger down until a new word is exposed. Examine the word. Do you know what it means? Can you use it in a sentence? Try it. Then read the definition. If you were right, make a mark in the Right column. Otherwise, make a mark in the Wrong column. Do this exactly thirty times. Now the math. Take the total number of words in the dictionary, multiply it by the number of words you got right and divide that by thirty. That is, multiply the total number by the fraction you got right. That's an estimate of the number of words you know. If you don't believe it, you can always use a larger sample than thirty, or repeat the experiment, or change dictionaries.

So, my spelling is now good enough that i frequently argue with my spelling checker. But there is a word that i always spell wrong. Everyone has one. For me, the word is wrong, which i always spell w r o n g.

Sunday, August 01, 2010

Practical hyperthreading

I recently read some inconsistent material concerning Intel's CPUs. It had to do with hyperthreading.

The idea behind hyperthreading is that you have more than one set of CPU registers (including hidden registers) so that it is very quick for the CPU to switch from one process to another. In fact, it can be done between every instruction. That is, if there are two processes currently runable, the CPU can execute instructions from alternating processes.

There are a couple of reasons one might want to do this. One might want to have separate state for operating system kernel instructions and user level instructions. One might have separate state so that interrupt routines would run quickly. No need to save the state, just use registers dedicated to running interrupt service routines. This was done for Digital's PDP-10 computer back in the 1970's.

But there is a problem for modern machines that's a little different. It's the memory wall. Eventually, the bottleneck for Von Neumen architecture CPUs is the communication of data between the CPU and main memory. One can delay this bottleneck for awhile, and this has been done, but it will eventually come up and smack you in the face. And these days, CPUs are much faster than main memory. So, while the CPU may execute instructions at three billion per second, main memory takes at least several nanoseconds to respond to a request. OK, so most memory references only go as far as the on-CPU chip cache. These requests may be satisfied in as little as a single cycle. But to go all the way out to main memory can take what seems like forever. At least, forever if you're a fast CPU. It can be over a hundred cycles.

So the idea is, have more than one process running. When an instruction is executed that fetches data from main memory, the CPU might have to wait for the result before the next instruction is executed. However, if the CPU switches to an entirely different process, then that processes' next instruction can't be waiting for this result. There's a better chance that it can proceed without waiting at all. If the CPU is idle less often, then it is doing more useful work per unit time. It's faster. For Intel, this is usually about 20% faster. That is, you get an extra 20% more cycles per unit time.

However. Let's say you have two processes. Each process will get about half of the available cycles. If the total is 120%, then each process will run at about 60% of the original speed. Yes, that's right, the total throughput is higher, but a single processor will run a single process faster. But consider that a single processor will run two processes at 50% each, rather than 60% each. Still, people worried about speed often want their single process to run as fast as possible. Can one get the best of both worlds?

Yes. Often, there is inherent parallelism available within an application. The operating system supports something called threads. An application can have two threads running at the same time. Both threads have access to all the memory of the application. And in a hyperthreading environment, both threads can contribute to the performance of the single application. Therefore, a single application can get the speed boost offered by hyperthreading. It requires more effort on the part of the programmer. The result is usually more complicated, and can be more difficult to debug (get right). But it can, and often is, done.

When hyperthreading became available, i fired up a benchmark, timed a run of one copy. Then timed a run of two copies at the same time. Then, i went into the BIOS, turned on hyperthreading, and reran both tests. With hyperthreading turned off, the results were 100% speed with one process, and 50% for each with two simultaneous processes. With hyperthreading turned on, the results were 100% speed with one process and 60% for each with two processes. There was no additional gain to be had in total bandwidth for more than two processes with my simple benchmark. The benchmarks perform a fixed amount of work. So by 50%, i mean that this work load takes twice as long (wall clock) to execute. By 60% speed, i mean that this work load takes 1.66 times as long measured by the wall clock (1 / 1.66 = 0.60). Very simple.

But i started this article talking about confusion i've seen. One of the things i've heard stated is that if you turn on hyperthreading, your speed is immediately cut in half. This may be due to the way that the tools report your performance. We pretty much have an idea what 100% means if there is a single CPU with no hyperthreading. 100% use means that the CPU is totally consumed. But with hyperthreading turned on, some tools report 100% if two threads are executing the entire time. And if only one process is running, these tools often report 50%. However, in this later case, the CPU isn't idle. It's getting 83% (100 / 120) as much work done as is possible with this CPU. But this is exactly as much total work as the CPU would have done if hyperthreading were turned off.

And it gets worse. Some tools report 200% instead of 100%, as above. That's on the same running system. With some tools reporting 100% and others reporting 200%, it's a royal pain to compare results. And those reporting up to 100% often end up reporting 102% from time to time.

And it gets worse still. The operating system reports the CPU time that a process uses based on the runable time and the number of processes that were runable at the time. But the performance during that time can vary by 20%. So, CPU time doesn't measure total cycles delivered very accurately or repeatably. Well, with demand paging, this has been true for awhile anyway. Page replacement interrupts, TLB replacement interrupts, and even I/O interrupts all take their toll on accounting. So, IMO, it's not that much of a loss.

My new 4 core AMD Phenom II does not appear to support hyperthreading. I wish it did. But it still suffers a bit from poor accounting. My operating system tools sometimes report up to 400% CPU utilization, and sometimes report up to 100% CPU utilization.

And yet, there is a downside to hyperthreading. It has to do with priority. I often run a very long running background process, with the priority set as poor as possible. And Unix (or Linux) will typically give this process nearly 100% of the CPU when nothing else is running. And if there is a normal priority process running, then the background process will get 5%, with the foreground process getting 95%.

But with hyperthreading turned on, two processes may run at full speed because the operating system treats threads as CPUs. Since there are two CPUs (there aren't, really), the operating system lets them both run at full speed. That means that each process gets 60% of the single CPU speed. That's much less than 95% for the normal priority process, and much more than 5% for the low priority process. And there are times when i'm impatient enough to want that extra 35%. In fact, it's been awhile, but at one time i ran a Unix variant that would give the normal priority process 100% percent, with no cycles at all going to the low priority process. I miss those days. They were nice, or is it not so nice?

Wednesday, April 07, 2010

Of Course

I just completed a three day course at work. That's one point of view. The course used to be four days or five days, but now it's three days. Same material. It takes time for the material to sink in. And the way that this might happen is if i read the 500+ page text book from cover to cover, and do all the exercises in the work book. And soon. But, in principal, i know it all now.

Early in the course, there was an example where there was a pin that was measured to be a certain diameter, and also, there was a hole that was measured to be the same diameter. The question was, will the pin fit into the hole? My response was to ask how big the hammer was allowed to be.

One can, indeed, jam that much information into one's brain in such a short period of time. However, one must be prepared to use a really big hammer. But it's not free. I now feel like i've been hit by a truck, and then run over by a steam roller. We have chosen to describe the result of the incident survival.

Wednesday, February 17, 2010

Ipod Shuffle - Not Dead Yet

My original iPod Shuffle classic isn't dead yet. Fortunately, the ring came off while i was at my desk, and i saw where it landed quickly. I doubt i could get another ring. It appears that the ring was simply glued on in such a way that the bubble buttons underneath can be pressed with it. So, all i should have to do is glue it back on. There are a couple protrusions on the back side of the ring that allow the ring to be aligned properly so the symbols match up.

I fully expect the device to die eventually. After all, there's a non-replaceable rechargeable battery inside. It won't last forever. And, the cover cap for the USB port doesn't have any kind of permanent connection, so one expects to lose this eventually. It came with a second cap that has a cord attached. I never use it. It's around somewhere (i never throw anything out), and could be used as a spare, i suppose.

I have three other mp3 players. They all have more memory than the iPod. From twice as much to four times as much. And they all have more features, for example, a display so you can see what track you're listening to. But i end up using the iPod the most. And that's because i use it while commuting to work. You see, since it has no display, it is designed to be operated without looking at it. The other units are way more complex, and really can't be conveniently operated without looking at them. I've seen an mp3 player without a display since my iPod, but by comparison, it sucks. It's much cheaper, and for example, suffers from having too short of battery life per charge. So my iPod may be irreplaceable.

There are bugs and limitations in the iPod Shuffle. It's not perfect. If you miss the last bit of a track, you can't simply "rewind" into it. And it can be quite painful to "fast forward" from the beginning, if the track is long. And this happens often. I listen to mostly talk shows, and have missed the final punch line of an hour show due to traffic, etc. Another issue is that, from time to time, it fails to turn itself off. So, the battery is dead, even though it was just charged to full. And speaking of charging to full, all you get is a green, yellow, or red light for a battery indication. This isn't really enough to tell if you've charged it enough. And, finally, sometimes when you pause the playback, it will turn itself off, but when it starts back up, it has forgotten where it was. I've run into a couple other bugs, not worth mentioning. Essentially no software is perfect. But simpler devices tend to have fewer issues.

Saturday, October 24, 2009

Coupon

Here's a coupon, good for a 17% discount on all the gas you ever buy. It's good at every gas station on Earth. It's quite convenient. You don't have to show it to the gas station attendant. Since you keep it, you can reuse it forever. And you can use it even if you pay at the pump with a credit card. Did i mention that it's good for 17%? The coupon is free. Here it is:

But, i'm willing to bet that you won't use it. Here's how it works. Here in Michigan, the speed limit is 70 MPH (112 KPH). It's legal to drive at 62 MPH (100 KPH), but what people do is drive 75 or 80 (120 to 130 KPH), risking a speeding ticket. But i drive at 62 MPH. That's because there's a handy 100 KPH marking on my speedometer pointing straight up. And, my measurements show that the difference in fuel economy between driving at 70 MPH and 62 MPH is 17%. I ran these tests on four very different cars.

But you may find that you can't do it. There's a problem of the very worst kind. It's psychological. Despite the fact that in Michigan, trucks are never allowed to exceed 60 MPH, if you drive at 62, everyone passes you. I pass someone on the highway about once a month or less. So what i mean is, everyone passes you. And most people can't stand it. I drive my passengers crazy. You'll think that the other guy is "getting" something that you're not. They are. A higher gas bill.

My commute is 43 miles each way. It's almost all on the highway. If i could go 70 MPH, it would take 36.9 minutes to get to work. And at 62 MPH, it would take 41.6 minutes. So, 62 MPH is 4.7 minutes slower, right? Wrong. My record time is 56 minutes. I think of it as an hour, or an hour and a half if traffic is bad. But what i really mean is that traffic is always bad. But sometimes it's horrendous. So you might think that it takes five minutes longer, but the effect is not measurable. Except at the gas pump. I fill up less often, saving money and time.

I trained myself to drive at 62 MPH with my previous car. My Mazda has a cruise control. I'd set it for 62, and sit back and relax. I'd listen to some tunes, or a prerecorded radio show i'd downloaded from the web. It was really nice. I'm going slower, so i have the right of way. Everyone who wants to go faster must go around me. I don't have to disengage the cruise until i get where i'm going. Well, maybe sometimes. Like in Detroit where i have to take an exit just to stay on i75. Or in Troy, where despite four lanes, there's not enough room for all the cars. But now i'm trained, and that's that.

You can go to the Governator's web site and learn all about Eco Driving. You can buy expensive easy rolling tires and get maybe 2% fuel economy improvement. Or, you can go a bit slower - which costs you nothing - and get 17%. The coupon never expires. But there's no reason not to start today.

Friday, October 23, 2009

Warranty

The other day, the phone rang. It was a sales call. I call it phone spam.

"Our records show that you do not have an extended warranty on your Saturn."

Interesting. I own a Saturn. It is true that there is no extended warranty on it. But I didn't buy it in Michigan. It's never been in the shop. So what records are these? Either the Department of Motor Vehicles sold or gave out this information, or my insurance company did. I have a good insurance company. They didn't do it. I'm liking my government less now.

"How many miles do you have on your car?"

I decided to tell the truth. It turned out to be the right answer, and it would have been even if it was a lie. So i said, "Two hundred and fifty one thousand".

Pause.

"You aren't eligible for our extended warranty."

And that was that. They won't be calling back. I have a car that is in excellent condition and which is rock solid reliable. It gets great gas mileage, nearly 44 MPG, lifetime average. And they won't sell me a warranty that they'd push down anyone else's throat if they could. In the summer of 2008, it's Blue Book value went up by $2000, despite my having driven it an additional 70,000 miles. That's because gas prices went to $4 a gallon. Well, gas prices are going up again. I have a car whose value is increasing with age. It's been to the Moon (238,000), and it's showing every indication that it will make it back to Earth.

Tuesday, September 01, 2009

FPS games

This is a quick start guide for first person shooter games. This isn't about any particular game. These games can be complicated, and may take a long time to master. Go for the easy things first. Easy things first works for learning the piano too.

You can't shoot without a weapon. You can't shoot without ammo.

Aim the weapon, then fire. Unless you have infinite ammo.

You can't shoot if you're dead. Try not to get shot. Jump and dodge. Weave. Move all the time. Standing still is a good way to get killed. There is no hiding. So learn to aim while moving.

Learn your weapons. Fast/slow rate of fire. High/low damage. Long/short distance. Small/large area of effect. Delayed effect. High/low amount of ammo. Some weapons may have more than one mode of use. Use the right weapon in the right mode at the right time. Even if you're left handed.

It's good to know where the enemy is. It's very good to know where an enemy will be. Is the enemy moving to some obvious goal? Conversely, don't let the enemy know where you are. If you and an enemy are moving to the same goal, consider letting them have it. Since you know where they're going, you can let them have it.

The terrain can be your friend. Get to know it. There may be places where it's hard to see the enemy. These may be good for you too.

As you learn the game, identify skills to practice. Aiming. Aiming while moving. Jump to high places. And so on. If there's a feature of the game, see if you can use it. If your game has a novice mode, don't be afraid to use it, and even lose a few games practicing some skill.

Have fun.

Saturday, August 29, 2009

Headache

I don't get headaches often. There's usually some identifiable cause. Dehydration. Nutrasweet (i seem to be allergic, and it causes what i call a migraine for about six hours. I say i seem to be allergic, but i've not gotten any such diagnosis. I say i call it a migraine, but how do i compare? Besides, the point is, with care (and increasing care at that), i can avoid it. I've been about a decade now since i was last poisoned.)

Well, here's an article that gives a reasonable overview of the subject. I doubt it's comprehensive. I don't agree with every word in it. I doubt an article could be written which covers everyone, since everyone is a bit different. But on the whole it's the best i've seen in ages - perhaps ever. And, it's out there for free. Can't beat that with a stick.

Wednesday, August 26, 2009

Jack failure

I thought i'd mentioned it in a previous post here, but can't find it. When jacking up the car to do maintenance, i always put something under the car, so that if the car falls off the jack, it's easier to jack it back up, and, by the way, nothing under the car get crushed. I'm thinking of myself, for example.

Well, i was changing my oil, and while pulling hard on the oil filter wrench (usually i can just twist it off with my fingers), the car rolled back six inches, falling off of the jack (closest to the tire). Fortunately, i had the jack stand set up. And, it held it. In fact, the car didn't even seem to drop any. I say fortunately, but it's the way i work. Always have a backup.

The picture is kind of odd. The right front tire is shown, jacked up completely off the ground.

In case it's not clear, i was indeed, under the car at the time.

Tuesday, August 25, 2009

Firefox and Thunderbird

I've used Thunderbird as my email client under Linux for quite a long time. I recall needing a gui email client because people (probably using Windows) were sending me stuff in styled text, mostly that could easily be sent as plain text. Anyway, it's been years.

But last Saturday morning, my main home machine rebooted. Twice. The logs showed nary a hint why. But afterwards, both Firefox and Thunderbird had an unacceptably small font, used for their menus and other dressings. The size of the content was easily changed. I'd never felt the need to change other font sizes. And there are three font sizes that matter. But only one had changed. I figured at first that i'd lost some font, and that these two applications needed it. But Google didn't seem to know where such files might be.

One of the suggestions was that the file userChrome.css could be modified. I ran "locate" to see where such a file might be. I didn't have one. A Ha! But, no, it's normal not to have one. And creating one didn't solve the problem.

There were other false leads.

What finally did it was to edit my /etc/X11/xorg.conf file, and in the "display" section for my nVidia card, i added the lines:
Option "UseEdidDpi" "FALSE"
Option "DPI" "100 x 100"

In particular, it sets my screen resolution to 100x100 dots per inch, rather than 75 dots per inch. And, i arrived at this result by measuring the screen, computing the resolution (in my head, despite having a computer in front of me that can perform a billion divides or so in a second).

No idea why a random reboot should cause this behavior. It'd been working for a decade at least. No idea why only those two applications should be affected. xorg.conf is supposed to affect everything. No idea why there seems to be a bunch of ways to address this issue. For example, userChrome.css made no difference at all. And, it was system wide, not user wide. I created a new user just to test this out.

I'm a Unix guru. But the complexity and rate of change has gotten so out of hand, that even i had huge problems getting this to work. We've totally lost focus. The documentation is out of date. There are multiple ways to do something, and only one works? This isn't Unix anymore.

But with this post, perhaps Goggle does know how to solve this problem now.