When is a Plant not a Plant?

You’re probably aware that the US government is spending huge amounts of money to support production of biofuel. What they tell you is that this fuel will reduce our dependence on foreign oil and that it is better for the environment. It turns out, at least the way that biofuel is produced now, that neither claim is true. It takes more energy to produce the biofuel than it produces, and our topsoil is taking a beating. Add on top of that the finite amount of water that we’re pulling from wells across the midwest and ask yourself the question: would you rather run out of oil or run out of farmland?

Granted there are many plants that are much better candidates for creating biofuel than corn, the main crop used now, and even corn production could be made more efficient and less destructive to the soil. Still, perhaps it’s time to step back and look at the actual problem we are trying to solve. A better solution just might present itself.

What we are trying to do is make solar energy portable. Plants do that using photosynthesis — they put some carbon dioxide and some water next to each other and wait for a photon to whack the system just right, and out comes an energetic molecule, and some nice free oxygen to boot. It’s a pretty slick system. What we are doing now is using plants as solar collectors. We set them out in the sun, give them access to (lots of) water and carbon dioxide, and later we chop them down and collect the energy. Of course, the form of the energy isn’t quite right (sugars aren’t good fuel), so we have to process the result, using up some of the energy we collected.

The goal, then, is to turn sunshine into gasoline, alcohol, or some other handy hydrocarbon.

Flash back to when you were in grade school science class, watching a movie about how plants work. We zoom down into the animated land beneath the surface of the leaf where the magic is happening. A little wizard is hard at work, gathering the ingredients, then… at the critical moment he gawps at the camera, eyes round, and pulls a screen in front of his workbench. “We don’t know what happens back there,” the narrator says in his happy-narrator voice, “but what comes out is…” (I don’t remember exactly what comes out. ATP? You can look it up.)

Bumblebees. Photosynthesis. Great mysteries when we were kids, but not anymore. (Did no one mention to you that bumblebees can fly now? They have tiny horizontal tornadoes raging just above their wings. Sometimes the explanation is even cooler than the mystery.) Anyway, photosynthesis. Somehow, films made before DNA had been discovered still have us convinced that some things are unknown. I’m no photosyntholigist, but I only have to glance at wikipedia to know that the process is pretty well-understood today.

So I ask you: Do we really need the plant? We know how that stuff works, and we can reproduce it. Can we not create a solid-state device that captures solar energy and puts out an energetic molecule – the exact molecule we want as an end product? We could use such a device to create fuels with absolutely no impurities (no sulfur, for instance), and no net carbon footprint. The system does not have to be very efficient to easily outdistance existing plant-based methods, and it would use land that has much less value in terms of ongoing human prosperity. Farms could go back to growing food.

Picture a gas station on the highway between Los Angeles and Las Vegas. Behind it there is an array of dark panes stretched over the desert floor. From the array a pipe leads to a holding tank which holds the highest-quality gasoline money can buy. And the cost to the dealer is fixed – he just has to pay to maintain the system.

There would be environmental impact, of course. Vast tracts of desert would be shaded, and somewhat cooler as a result of energy being removed from the system. Although our machine would use a lot less water than a living plant, (or perhaps another source of hydrogen?), there would still be some demand. Overall, though, I think environmentalists would see it as a lesser evil.

I’ve been kicking this idea around for years, now, but apparently I haven’t ever written about it here. The plan is filed under get-poor-quick, but man, if anybody got something like this working, they could become some kind of ridiculously wealthy. As well they should.

3

The Magic Mouse

I got a new computer as part of my effort to rejoin the workforce. The computer is a Mac, and came complete with a keyboard (small) and a Magic Mouse. The Magic Mouse is almost the coolest input device ever. There’s just one flaw.

Let’s start with the good. Since the dawn of time Apple mice have had only one button. It’s a religious thing with the boys in Cupertino, I guess; even while their operating system supports (and even embraces) functionality that requires right-clicking and scroll-wheeling, the mouse has remained mired in one-button land. The Magic mouse technically keeps the one-button faith, while providing support for a huge range of input. There’s one button, but where your finger pushes the button can change the action. The entire top surface of the mouse is a trackpad. You can configure the mouse to have as many virtual buttons as you want.

There’s no scroll wheel, but if you slide your finger down the surface of the mouse it acts like one. Slide your finger side to side, and you’re scrolling horizontally. I really like that feature, but it took some getting used to.

With a little extra software, things get even better. You see, the mouse can track all five of your fingers at once, and can respond to a huge variety of gestures. Pinch to zoom in. Reverse the gesture to zoom out. Twist with three fingers to rotate something. It’s all configurable and it’s sweet.

The only problem with this hot little number: It’s wireless. I don’t need wireless; in fact, the vast majority of people who use computers don’t need wireless. It’s a convenience for those who use a mouse with their laptops, but I’ve always been just fine plugging the mouse in (and in fact some people have had problems when their wireless mice have awakened their laptops and drained their batteries).

Yet somehow wireless is better (rhymes with ‘power windows on cars’). The Magic Mouse just seems “magicer” when it doesn’t need a wire to talk to the computer. There is no doubt that the marketplace has decided “wireless is better” and Apple (and the rest of the mouse-producing industry) is not going to fight that.

So what’s my beef with wireless? Simple. It’s the batteries. Batteries cost money, and using this mouse produces a steady stream of toxic waste. If the purchase cost of a battery included the cost of disposing of the hazardous chemicals inside it, maybe people wouldn’t be so fast to use battery-powered devices where wired power is available. How many AA batteries go into landfills each year, creating a toxic mess someone will have to clean up someday, because people buy battery-powered devices that don’t need to be? Let’s reserve the battery power for things that need to be battery-powered.

I know that technically people aren’t supposed to throw away batteries anymore, but people still do. The chemicals in batteries are just as harmful in the soil as plutonium for the same amount of energy (he says with no backing evidence), but people treat them with cavalier indifference. And sure, rechargeable batteries reduce the rate that toxic waste is created, but they don’t eliminate it. Rechargeables will be my compromise so I can continue to use my wonderful mouse with a cleaner conscience. Wired power has environmental consequences as well, but I’d be right stunned if they approached the harm that battery power causes.

So here I am, using the coolest damn mouse ever, happy with it, and feeling slightly guilty. My old Logitech USB mouse is right here, with lots of buttons and a scrollwheel and whatnot, but it’s just not as good. It’s ok to pollute if you feel guilty about it, right?

A Job I’m Glad I Don’t Have

As you might be able to tell from the paucity of episodes here at MR&HBI, I’ve rejoined the ranks of the employed. My writing has taken a real beating, so today I’m going to spend some time writing about work. You don’t have to thank me, it’s what I do.

I don’t mind writing software; I’m pretty good at it and I can make pretty decent money doing it. I would much rather write code than dig ditches, for instance, and luckily for me the world has decided that making Web sites is worth more than roadside drainage. (Before you go and say, “that’s because it takes skill and training to make a Web site, but anyone could dig a ditch’, ask yourself – could you dig ditches for a living? If the economy were turned upside-down, that ditch-digger living in his nice house would say, ‘anyone can make a living sitting on their ass in front of a computer, but I dig ditches. I’m glad things are the way they are, is all I’m saying.)

My current job sends me dangerously into territory I don’t much like, however, and that’s the area known as Information Technology. It’s not really a good name for the job, which is about setting up computers and keeping them running. It’s less about making things and more about making things work.

Last night, for instance, I moved the Web product I’m working on to a different server and it didn’t work. Naturally I assumed the problem was in my code (it had worked on that server in the past), so it was several hours later that I discovered that for reasons I still don’t know, the server failed when it tried to compress very large messages. Just *poof* no response beyond the number 500 (something went wrong). To make things more fun the server was specifically set up to not write out a lot of error messages to its log. I turned off the compression feature (with a hammer) and things worked again. Five hours or so spent to add seven characters to a PHP file, to make things work the same way they already did on other servers. Welcome to the world of IT.

I think the original intention of the phrase information technology referred to the the information that would be stored, manipulated, and distributed by machines. What the I really stands for is the vast store of arcane crap you have to know to do that job well. What line of the php.ini file to modify if you want zlib output buffering and utf-8 character encoding. How to set up all the computers in an office to use a local domain name server first. That’s the information in IT.

The worst thing about having an IT job is this, however: When you’re doing a good job, no one notices. When a company is running smoothly, that’s a sign that the IT department can be downsized. There are no problems! What are those guys doing all day? Having things not happen as part of your job description makes for tricky times when you do your job well. Of course, when something does go wrong people know just where to find you.

So if you work in a company that has people on payroll working to keep your technology humming along, cut them a little slack. Someone’s got to do that stuff; be glad it’s not you. I do enough IT now to know that I’d rather let someone else have the pleasure.

MacPorts and GIMP

Preamble for those here by the grace of Google: Yes, I do eventually get around to talking about Gimp in this episode. Short version: it works but takes hours. Anyway, on with the show!

Setting up a new computer can be a tedious task; there are all kinds of settings and programs and files and whatnot that need to be passed from old to new. When you work with Web development things can get even more cumbersome, as one finds oneself descending deep into the world of IT. There are programs to install that all have to talk to each other, and configuration files to be tweaked. Many of the applications that are required have no user interface of their own, they simply run in the background and answer requests from other applications.

I found myself facing (for the third time in three months) the need to install the latest Apache (and set up virtual hosts), PHP, Pear, MySQL server, PHP email addons, Propel, and on and on. For many of these items, the instructions for installations go something like:

1) Download the source code
2) Configure the build
3) Compile the application

And the instructions go on from there. For most of the above there are shortcuts, and probably-recent-enough versions of some things come built-in with the Mac OS, but when you install it yourself you can get everything where you want it and avoid conflicts. Still, this can be a long, tedious, pain in the butt to get going. And when you install something and it doesn’t play well with the others, finding that one line in the secret config file that’s causing the problem can be a real pain.

Enter MacPorts. MacPorts is a project that has developed a system that does all the steps of the installation for you, and puts everything in standard places so everything else installed with MacPorts can find it and talk to it. There’s still some configuration to do (tell PHP where the database server’s socket is, and set passwords for instance), but overall things are much simpler, and there are very good instructions out there for tweaking and troubleshooting MacPort installs. Since the person writing the instructions knows where all the files are in the standard install, instructions can be much more specific.

With MacPorts installing php 5.3.1 was a simple matter of typing “sudo port install php5” and letting the MacPort system do the rest. Hooray! Setting up a server is suddenly much simpler.

As an aside, MySQL didn’t work when I used MacPorts to install it on a previous machine. Don’t know why. Ran the install, followed the instructions, nothing. After a few hours banging my head against it, I went and got the excellent binary installer. It worked without a hitch. This time around I didn’t bother with the MacPorts version at all.

Anyway, thanks to MacPorts, I was able to get a complete development system up with nary a hitch, in a fraction of the time. Knowing where all the config files were this time around helped as well. I found several useful links on the Web, particularly from HiveLogic and my new buddy Danilo Stern-Sapad who took a little grammar rant from me with grace.

On that note, I read the phrase “How to setup…” so many times in so many places it’s amazing I still have teeth.

Edited to add: I have now written my own tutorial which does into greater detail than the above, and includes a works-every-time MySQL install.

Last night I realized I hadn’t installed GIMP on this computer yet. GIMP is an open-source graphics program that wishes it rivaled Photoshop but it doesn’t really. It’s free, however, and when you consider the incredible amount of work that went into it, you have to be impressed. I don’t do a whole lot with graphics, so GIMP is usually adequate for my needs.

When I went to the Web site for GIMP I found a couple of options for installation, including MacPorts. Just type “sudo port install gimp” into the terminal and that’s that. Pretty sweet.

One thing about a program like GIMP: it’s really a collection of a bazillion smaller parts. Many of those parts require other bits to work. When you run a traditional installer, all the parts are already there and they’re already tied together in a neat bundle. MacPorts does things a little differently; each part knows what parts it depends on to work, so when you say “install gimp” it first looks at the parts gimp needs, then at the parts those parts depend on, and so forth. You get to watch (if you choose to pay attention) the parade of all the little pieces as they’re installed, each the product of an individual or small group of people who have allowed their work to be exploited for free.

For GIMP, the list of dependencies goes very deep. I watched as X11 was installed. X11 is already on my computer, but ok, this is MacPorts and they keep their own realm and that way they can update parts without worrying about how that will affect non-MacPort installations. It’s redundant, but that’s why God made big hard drives.

Then I saw Python 2.6 install. Later, Python 2.5 went by. One of the little pieces seems to depend on an earlier version of Python. This probably means the person in charge of that bit just hasn’t updated it recently. On the installation went. After a while the Gnu Compiler Collection came down the pipe. gcc is a collection of compilers for building programs, and I watched as gcc was built… using the gcc already installed on my machine. Hm. And what’s this? Fortran! Yep, somewhere in the great tree of dependencies (maybe ‘root system’ would be a better term), someone decided that a Fortran compiler was necessary to run GIMP.

Actually, that’s not quite fair; the piece that loaded the Fortran compiler might need it for other tasks not related to GIMP. Just because GIMP uses a library doesn’t mean that’s the only use for it. Still, I ended up with a lot of stuff I don’t need. It’s all invisible and I’d never know it was there if I hadn’t watched the install (which took hours), so it’s not a disaster or anything. And next time I need Fortran I’m ahead of the curve!

Time slipped past, the install continued. I went to bed. When I got up this morning to check if the build was finished, I discovered there had been an error. Yep, the MacPort version of gimp-app doesn’t currently compile on 64-bit operating systems. All that other stuff that was installed? Python 2.6 and Python 2.5, the Gnu Compiler Collection (including Fortran), libgnome and libbonoboui and tkl and tk and gd2 and dozens of other things I don’t know what are, they’re still there, waiting to be useful in some way.

Edited to add: The compile bug has been fixed; I recently used MacPorts to install Gimp on my 64-bit laptop. It took a long, long, time, but now it works just fine.

1

Need More Computing Power

I’m working with several products from Adobe corporation right now. That means several things: first, getting used to various ‘quirks’ in the user interface that no other company does the same way. I occasionally say, “There’s the Mac way, the Windows way, and the Adobe way.” The Adobe way doesn’t necessarily mean the same thing in different Adobe products, alas.

Second, running multiple products from Adobe, along with their infamous memory leaks, means that my little Mac Mini is severely challenged. Adobe makes big products, and seems much more worried about features than performance. I have an income (made in part from using Adobe products), and can justify upgrading hardware at some point, but then what happens to the old machine? There’s still plenty of computing left in the little guy. It’s actually pretty fast.

Then it occurred to me that the perfect answer would be a second mini just like the first, that I could connect in such a way that they could share the workload. Suddenly my upgrade gets a lot cheaper and I’m not getting rid of a perfectly good computer.

I know that there is a supercomputer built from a bazillion macs all hooked together and sharing the load, so why can’t I get some of that action? What would it take to get two macs hooked together to become a single computer? It seems just too damn obviously a good thing to not exist.

I’m filing this under Get-Poor-Quick Schemes, since it’s probably one of those ideas that looks good on paper but is in fact a major PITA. Still, what a great OS feature that would be.

One Last Microsoft-Related Thought

While watching television a couple of nights ago, I saw an ad for the new Windows 7, code-named “all the stuff we wanted to put in Vista but ran out of time.” After the ad was over I turned to my sweetie and said, “I know there’s a joke about the significance of them using the theme for The A-Team in the ad, but I can’t think of it.”

After perhaps a second of reflection she said, “How about, ‘We get the job done but there might be a lot of explosions first.'”

I laughed, thought for a few seconds, and ventured, ‘There will be a lot of shooting, but no one will be hit.’

Obviously my sweetie is funnier than I am.

2

Speaking of Google and Microsoft…

Now there’s Google Chrome Frame, or at least the glimmer of it in the future. Google’s spin: since Internet Explorer is holding back the Web; we’ll make a plugin so people can use our more standards-compliant browser technology from within Internet Explorer.

It seems nice on the surface and I’m happy that someone would go and fix Internet Explorer despite Microsoft, but I have to wonder how many people will actually install the plugin. The people who are using IE now are ones who either like IE as it is or who must use IE because their IT department says so. Will the first group see value in adding a plugin to make their browser work like another browser (which they just as easily could be using already), or will IT departments allow their ‘clients’ to install such a large unknown quantity on their machines?

The thing is designed so that the WebKit code (what Chrome is based on) will only be invoked on Web pages that specifically enable it. (This might help the IT guys relax a bit.) I will enable it for this site, although the differences Chrome Frame users will see are only cosmetic. It costs me nothing. Somewhere the Google minions will make note of my Chrome enabilization and use that as part of a marketing pitch.

My hope for the plugin is not that it converts a lot of Internet Explorer users, but that it spurs Microsoft to accelerate their own adoption of the next wave of standards. That would be the biggest win from where I’m sitting. It doesn’t seem likely, though, until HTML 5 becomes a valuable tool for its business customers.

Whether it’s Bing making Google Search better or Chrome making Internet Explorer better, in the end I’m glad these two companies don’t get along.

Screenplay Taxonomy

When writing a screenplay, the word ‘scene’ has a very specific definition. More or less, whenever the scenery on screen changes, it’s a new scene. Walk from the kitchen to the living room, new scene. Walk back, new scene. Simple enough. At first blush it seems similar to the scenes of a stage drama, but it really isn’t. In a screenplay, scenes can change quite frequently, and may only last a few seconds. You can have many scenes that fill the dramatic role that a single scene does on stage. For instance, in a screenplay, the scene can change several times during the course of a running battle.

I’m working with script-writing software that allows me to rearrange scenes, but what I really want is a way to manipulate the groups of scenes that comprise the larger dramatic unit. All the scenes that are part of a chase, for instance. I’ve been fooling the software by calling the scenes that make up the sequence “shots”, so they are treated as part of the same dramatic unit. While this leads to correct formatting and lets me manipulate my script the way I want to, it subverts the meaning of ‘shot’ in a screenplay. It’s not a bid deal for me since calling shots is way, way, down the production road, but it’s still a little off to mislabel script elements like that.

From a storytelling standpoint, the larger unit is the important one — the continuous action that can span several scenes but has a clear identity in terms of the story. I think ‘sequence’ is the word I’ve heard used in that context, but it’s imperfect, and the script-writing software I’m using has no concept of the sequence to help me organize my scenes. Jer’s Novel Writer allows the user to define things like that quite easily, and JersNW performs way better than Celtx on my old laptop, but Celtx provides other shortcuts and automatically formats things in an industry-standard way.

I think it would take me two months to make a screenplay version of JersNW. (If I didn’t use the time to also upgrade the way the documents are structured, which I would do.) It wouldn’t have all the features to help production that Celtx and Final Draft have, but it would be writer-friendly. I often joke that Final Draft is a fine piece of software once you have a final draft – it’s not very good for the actual writing. Celtx seems to want to pursue Final Draft, once again at the expense of the writer.

But all that’s a digression. I really just wanted to ask folks if they knew a better term for ‘group of scenes that comprises a dramatic unit in a screenplay’. It really seems like there should be one.

1

Lite Brite

Last night as my sweetie and I were sharing a big salad and watching TV, she turned to me and said, “We should do Lite Brite!” I readily agreed. I had never seen an actual Lite Brite in action.

You remember Lite Brite, don’t you? It is a backlit frame into which you can stick translucent plastic pegs. The colored pegs glow merrily. Lite Brite! You can paint with light! the jingle went (approximately).

I had given the Lite Brite a lot of thought back when I was roughly four years old, and occasionally thereafter. I only remember little bits and pieces of the kids’ program Captain Kangaroo, but I remember the Lite Brite ads that supported the good Captain and his loyal sidekick, Mr. Greenjeans. I remember the ads very well, because it was one of the earliest engineering challenges I ever tackled. How the heck did the dang thing WORK?

Lite Brite Masterpiece: Ducks

Lite Brite Masterpiece: Ducks

In the ads, the pegs are pushed into a black surface and light up. Sweet! obviously there is something backlit and when a peg is pushed in it glows. At first I tried to come up with a system where pegs could be placed anywhere, and stay in place. And then came the real engineering challenge: making the holes close back up when the peg was removed. This last feature was obvious—otherwise the toy would not be reusable, and the smallest mistake meant you ruined everything.

After more careful observation, I saw that the pegs were always in a grid pattern on the board. So, I realized, there was a grid of holes that the pegs could be punched into. With that knowledge, I imagined a system with little spring-loaded doors for each hole. Push the peg in, the flap opens and light comes through. Pull it out, and the flap closes. I watched the ads closely for any sign of the doors. There was none. The black surface seemed completely uniform. Perplexing. Over the years I mentally fiddled with different designs for the Lite Brite doors that would not be prone to light leaks.

Fast-forward forty years, when I came to live with someone who owns an honest-to-God Lite Brite. At last the Engineering mystery would be resolved.

The answer: black paper. No doors, no flaps, no self-repairing gelatinous layers. You mount opaque paper over the grid and punch holes in it with the pegs. There is no undo. The black papers that come with the LIte Brite have little letters printed on them, for color-by-numbers fun. And really, can you imagine how long the delicate little mechanisms I had been imagining since my very first days of TV watching would have lasted? In my gut I knew that there had to be a simpler answer, but I never let go of my assumption that you could take the pegs back out again.

We sat on the floor, my sweetie and I, taking turns punching in the little pegs (I had trouble differentiating the pink and orange ones before punching them in), and had a good ol’ time. When we were done we kept the Lite Brite plugged in to bask in the glory of our masterpiece. And it was good.

1

Quest for the Perfect Moon Widget

You may have noticed that as of this moment there are three different moon phase widgets over on the sidebar. None of them are perfect, alas (although the Japanese one is perfectly inscrutable). I looked around at other WordPress widgets and did not find one that gave out all the information I was interested in (especially for the eclipse) and was aesthetically pleasing. I thought I might spend a few hours and make my own.

The design was very simple. I would write a little Flash thingie that read XML data from a server and draw the moon with great precision and also look nice doing it. In addition I could put numerical readouts for more interesting (to me) numbers. Piece of cake.

I started my quest looking for a server with current moon info. The US Naval Observatory has all sorts of lunar data available, presumably calculated with far greater precision that I will ever need. The only problem is, they didn’t have data for right now. They had almanac generators and whatnot, but nothing that I could ping and get back a message that said, “at this moment, the moon is…” I couldn’t find anything at NASA, either. I broadened my search and found that nobody seems to be providing this service. “fine, then,” I thought. “I’ll make my own moon server. I’m sure there are plenty of places I can find algorithms for calculating this stuff.”

Only, that didn’t turn out to be so simple, either. The motion of the moon is incredibly complex. There exists a thing called ELP 2000-85 which is the latest attempt to make the math match what the moon actually does. What the thing does is loop through a set of calculations a bazillion times, each time with tweaked coefficients that make smaller and smaller corrections to the calculation. Compiling the tables of coefficients must have been a real pain in the butt. Refining the tables is still ongoing. The accuracy of your calculation comes down to how many times you loop through the coefficients before you decide that the computer power is better used for something else.

Nobody in their right mind would actually use all the tweaks in the ELP 2000 for anything as simple as a moon phase widget, or, for that matter, a moon landing. Along came a guy named Jean Meeus, who published a book full of handy formulas for calculating where things are going to be. He includes simplifications of the ELP 2000 (only looping through 64 iterations), and while they’re not as precise, they’re pretty damn good. I don’t have that book, either.

Time wasted so far: 3 hours. Completion of widget: 0%

But now my search began to bear fruit. I didn’t have Meeus’ formulas, but other people did, and had written software. I found some open-source code that implemented some of his stuff. Yay! I implemented the code, moving it from c to PHP so I could run it on my server. After a few routine hitches the code was up and running and telling me just where the moon was, relative to the Earth, accurate to a couple of arcseconds.

Time wasted so far: 6 hours. Completion of widget: 5%

Unfortunately, it didn’t tell me anything else. This particular code did not provide any information that required data about the sun — like, say, the phase of the moon. Harrumph. Back to the Internet I went. Fairly quickly I found some different code, this time in JavaScript, that also cited Meeus. It was much, much, simpler, ignoring many of the more difficult-to-calculate corrections, but I figured that the first code sample had already done most of that. It was simply a matter of adding the new code to what I already had. Naturally, despite having the same source reference, all the variable names were completely different.

After a great deal of forensics (that’s a big word for ‘wasted time’) I established which quantities I had accurate versions of and which I still needed to calculate. I got everything set up and ran some tests. The results were not good.

Time wasted so far: 12 hours. Completion of widget: 3%

I had expected some problems like this – perhaps in one body of code an angle was expressed in degrees and the other expected radians. Things like that. I started working through things. Only after another day of head-scratching did I test the code I’d based the second half of my project on. It was wrong. So there I was with Frankenstein’s monster of code sewn together from different sources, and one of the sources was broken before I even started. Sigh. Back to the drawing board.

Time wasted so far: 20 hours. Completion of widget: 2%

I should mention along in here somewhere that there are people who sell moon software for quite a bit of money. My little server could potentially put a dent in their sales by bringing accurate calculations to anyone who asks, but its not really the calculations they are selling, but the application around it. I’m not too worried for them.

Back to the Web and by now I was getting better searches because I knew the key terms to look for. I found two more code examples, both of which take precision to the most extreme available. One is a complete implementation of the ELP 2000-82b. This honey consists of 36 files with tables with hundreds of rows of numbers, and a sample program in Fortran that shows how to use them. For ridiculously accurate calculations, I couldn’t do much better. But… It only calculates the position of the moon, just like the first code I implemented. I’d still need to work out the phases and whatnot.

The other code I found is based on earlier math, but really concentrates on what an observer would see from a given point on the Earth. It includes corrections for the optical effects of the atmosphere and for the friggin’ speed of light. It’s got a lot of stuff I don’t need (other planets, for instance), but it has everything I’d be looking for. The thing is, the code is horrible. It’s in c, and the writer apparently never heard of parameters or returning values. Or structs, or anything else that might help organize the information. It is impossible to read a function and know what it does or where all the numbers it uses come from. It would be a big task to translate the pieces I need, mainly because it’s very difficult to tell which pieces I need. Still, it’s an option.

Time wasted so far: 24 hours. Completion of widget: 3%

And that’s where I stand. You know, maybe I’ll wait until I’m on a boat full of moon geeks. I bet one of them even knows a Web site that gives current moon data.

1

Upgrading the Search Function

The other day I wondered how many times I’d used the phrase “You don’t have to thank me” in this blog. No problem, I thought, I’d just pop the phrase into the search feature over on the sidebar and let it tell me.

The only problem was, it didn’t give a very good answer. It also included partial matches, which would have been all right if it had either a) ranked the results, or b) shown a little excerpt of the resulting matches with the searched-upon words emphasized. The built-in WordPress search function does neither. Off I went to find alternatives.

One option was to hook up Google to do the search. That’s a pretty good option from a functional standpoint; nobody is as good at ranking results and showing you a bit to help you with your decision. The downside is that it’s pretty ugly. My (very) brief search made it appear that I wouldn’t be able to do much with the results. My search for Google-based solutions was brief because I found another WordPress plugin called “Better Search” which did in fact return ranked answers. Hooray!

Only, not so fast, Sparky. The plugin is still young, and doesn’t provide much in the way of customizing the look of the results, either. The good news was that the source code is right there and I thought it wouldn’t be too tough to rearrange things a bit to make it much easier to customize. The plugin author had already done the mysterious, magical steps to allow a template file to work, all that was left was giving the template the power. So I did that, and sharpened up some PHP skills while I was at it. Now if you do a search, you will see that the results include a relevance ranking. The result page is still pretty ugly, because I haven’t finished tweaking my new template for my site. (I tried to start with a general one that would be useful to others.)

Then, I typed “You don’t have to thank me” into the search box and got… No matches found. What? I know I’ve used that phrase before. I tried removing the word with the apostrophe, in case that had something to do with it. Nope. Eventually I got down to the word “thank”. No matches.

Here’s the thing: MySQL, the database I use, has built this fancy full-text matching thing (which I learned an awful lot about yesterday), but they’ve optimized it for huge sites. There is a list of common words they throw out to reduce the number of matches. Six of those words are “you”, “don’t”, “have”, “to”, “thank”, and “me”. Wow. To make things worse, I can’t change the list. Only the big boys who have their own servers can control the list. Those are the ones least likely to want to change the list, but there you go.

There were some other annoying “features” of the MySQL Full-Text search (exact phrase matching doesn’t work like you’d think, for instance), but some of those I suspect are the result of my provider using an older version of the database.

Now, I can put up with the limits of MySQL (this morning i was coding in my head the algorithm for showing an excerpt with emphasis), or shift focus and let the Goog or it’s new arch-rival bing do the heavy lifting – and the formatting. Why can’t this stuff just be easy?

Edited to Add: Well, that blog episode went obsolete in a hurry. I’m currently using a Google sidebar thingie that is visually acceptable (and adaptable). Play around with it!

There is a feature of the Better Search plugin I was using that I will miss – it kept track of recent searches and produced one-click links in a cloud that showed popularity. I guess it’s not a major loss, since not that many people search here, but I liked it.

1

Table Manners

I am not renowned for my grace. While I’m not infamous for my clumsiness either, when pressed I’d have to admit that on the scale of dexterity I have a definite sinister leaning. Thinking back on my life, I’m pretty sure I’ve always been that way, but it’s only recently that I’ve come to really appreciate my awkward ways. My spazticity is particularly obvious when I’m eating salad.

Take tonight, for instance. I was eating salad, from a plate, using a fork. As I raised a mouthful toward my maw a leaf of spinach leapt from the fork, and flew at my head. I dodged and the leaf hit my shoulder before falling into my lap, leaving red spots of raspberry vinaigrette behind. My sweetie, who caught all the excitement in her peripheral vision, reacted with alarm, perhaps because I had already dropped a steak knife on the floor near my bare foot.

Salad seems to be particularly tricky. Often as we sit sharing a big bowl of salad, I end up dropping significant chunks in my lap, or dripping salad dressing on my clothes, or finding some other way to get food where it was not intended to go. I’m not sure a fork is even the right utensil for eating many of the items we put in a salad, anyway. As I ponder, I wonder if something with more of a grabbing action would be appropriate for items that are difficult to pierce when they’re in the bottom of a bowl. Maybe a miniature version of the tool we use to serve the salad in the first place; a hinged tool with a pair of sporks at the end that could be used to both grab and scoop. I think that would increase the percentage of items that reach my mouth, but the transfer at that point might be tricky.

Still, I think I may be onto something there. In the meantime, I’ll make sure I have towels handy.

Kindle 2 Rocks?

kindle.png

Hmm… super-high resolution screen, and FREE unfettered internet access anywhere? Add to that books that cost a fraction of what they would on paper. Interesting. Very interesting. Is this one of those geat “writers don’t need stinking publishers anymore, they just need a bit of marketing and good word of mouth”, or is it “good writing will get buried in the noise because the traditional filters between the public and the host of really bad writers has been torn down” or is it “the era of the influential critic”?

Or is it all three?

By the way, the comic is xkcd, which will appeal to geeks of all stripes.

Important things you should know: I get a kickback if you use the link to buy a Kindle. I’ve never even seen a Kindle in real life. Make sure when you buy it that you’re getting a Kindle 2.

The Red

In Japan, heroes often come in bunches. Take Power Rangers, for instance. Five heroes (almost always five, it seems, though I don’t watch those shows much) dressed in colorful costumes, working together to fight evil across the world (or at least the part of the world that matters). In these groups, one of them is the leader. You can tell at a glance which one it is, even if you’ve never seen the show before, because the leader wears red. When kids play, they argue over which one is “The Red.”

In the film world, when you say “Red” you conjure a different image, but the same feeling of awe. The Red is a camera. I’d heard people talking about it in the past, but as we head toward shooting I’ve heard that name from all sorts of people. The Red is one of those products that Changes Things. Specifically it means that people with budgets only somewhat larger than ours can shoot digital video at cinema quality.

The reasons this camera is so great are mired in technical details at which I generally nod and rub my chin in feigned understanding. “His is one of the older 4K ones,” one person told me while pimping a buddy’s Red. There’s stuff about dynamic range (one of the things that really differentiates film and video, apparently), and a host of other specs. In the end, it comes down to “there’s never been anything that can match this quality for anywhere near the price.” The fact that the Red still seems to be without peer indicates just what sort of breakthrough it represents.

“I know a guy with a Red,” I’ve heard more than once. “Maybe he can give you a deal on the price.” Unfortunately, although the Red represents a breakthrough in price/performance, renting one through normal channels for three days (along with all the gear and tech that goes with it – this thing produces an enormous amount of data) would equal our entire budget. Even getting a price break, it would still take up a lot of cash I’d rather spend on actors and musicians. We’ll use less expensive technology, and it will still exceed the abilities of HD television monitors.

Still, there’s a little part of me that pauses. Might I be saying, a year from now, “That came out so well. The lighting was awesome, the acting was great, the sound full and rich; it’s a pity we didn’t shoot it on a cinema-quality camera.” I answer myself, “when they pay us to do the next one, we’ll use the Red.”

2

I’m Just Waiting for the Phone

Intrinsic in daily life here is the mobile phone. You’re just not going to get very far without one. I arrived on this continent cheery and bright-eyed, and soon I began shopping for my own gateway to the social world. I bought a chip at one store, a phone at another and (after a brief “whoops we forgot to unlock your phone!” moment I was on my way. It was a Sony phone, and, well, it had problems.

The software for the phone wasn’t great, leading to me missing a lot of messages, but the hardware was worse. Sorry, Sony, that’s three strikes. I’ll never buy another of your products again. Tired of my complaining, my brother ceded me his old phone when he upgraded. Now I own a Nokia N-80 (I think). Holy crap is this thing fancy! It has features and capabilities that I am only beginning to discover. It’s a really nice piece of portable computing power. The problem: it’s suicidal.

The phone has a face plate that slides up and down, which is a pretty good way to hide unnecessary controls until you need them. Unfortunately, the sliding action also unlocks the keypad, and it doesn’t have to slide very far. I would say that when I pull the phone out of my pocket the keys have been unlocked more than half the time. That would be bad enough but when unlocked the phone often goes into a coma which requires rebooting. And today, when I needed to send a message, any attempt to access the messaging features were unresponsive. The software on this phone is simply not stable enough.

Someday there will be a phone, so robust, so straightforward, that I will be able to use it happily. The buttons will work properly. The software will be there when I need it. When I pull it out of my pocket it will be sleeping happily and the battery will still have life. When I throw it in my pocket I won’t worry about my keys scratching it up. This will be the God Among Phones. When this phone walks down the street in phone-ville, all the fancy-ass phones will step out of its way in awe. “What’s that, mommy?” a timid child-phone will ask, only to be shushed by its fearful guardian. “That’s the phone that actually works” mother-phone will reply. The little child-phone’s eyes will grow round. “Ooooohhh…” it will say. “I want to be like that when I grow up.”

I promise you, little phone, that no one wants that more than I.