Today I was looking over the letter that came with our garbage bill, and saw that the City of Fairbanks was attempting to lower the cost of collecting garbage. They are doing three things. First, they are going to start working four 10-hour days instead of five 8-hour days. They say this will save them time doing their mobilizing and demobilizing at the beginning and end of the day. Makes sense. Second, they will only drive through a neighborhood one time on the collection day. Good idea. I didn't even know they did multiple passes as it was.
But the third way was the one that caught my attention:
We are installing GPS systems on our City packer trucks and have redesigned routes to maximize efficiency and reduce trips to the landfill.
I always love to see technology put to good use.
Now, if we can only get them to implement something like this system we could save them even more labor costs. And we'd be able to put yard waste in the bins without bagging it first!
It's always fun to see companies reference other companies with which they work. VirtualBox is a software package that allows you run several different operating systems in their own virtual machines (like VMWare, Xen, etc). Their about box is great. They have the Suse Iguana (wearing a Red Hat), the Linux Penguin playing a tambourine emblazoned with the Ubuntu logo, the Microsoft "Butterfly," stars (alluding to Mandrake/Mandriva) rising from the fire, and the BSD Daemon eating a multi-colored Apple. No, VirtualBox can't boot OS X, but the apple is probably an allusion to Darwin, which I assume VirtualBox could boot, and upon which OS X is built. Did I miss any logos?
Anyone who has programmed for any length of time has an opinion about comments in code. They're essential. They're not essential. Commenting is actually worse than not commenting. It runs the gamut. I'm beginning to understand more and more that comments are actually a disctraction to clean, clear, concise code. Especially when writing in Python, it is possible to write code that requires no comments, but is still 100% understandable and discoverable. Sometimes a line or two is required to explain something not clear from context, but it's rare.
Yes. Instead of writing comments, write code that doesn't need
comments.
Clear, and concise, just like his code. After musing on it a while, his ironic streak kicked in, and he composed the following "epic tome," as he describes it, that so clearly illustrates the many useless blocks of comments I have seen in my time as a programmer. He gave me permission to post it, so here you go! Enjoy.
(BTW, visit Troy's blog. He's written a Java to Python translator, and has a really cool stock-trading and analysis application.)
#
## Summary: Explain why excessive comments suck.
##
##
## Author: Troy Melhase
## Email: troy@gci.net
## Date: 05/01/2008
##
##
## Detail:
##
## Comments like this serve no purpose because you have to read all of the code in this file anyway.
## So here you are, reading useless information that I put here to satisfy a thoughtless policy
## or an academic belief. I could explain what the code does, but it's easier to blat out mindless
## drivel that is easily mistaken for insight or actual work.
##
## Even if I do add useful information to the code below (doubtful), someone will have to edit this
## information as the code changes. That's like writing the code twice, and of course that doubles
## the chances of introducing a bug.
##
## Plus, I've distracted you from your purpose -- reading! Reading code can be difficult without the
## additional burden of constantly shifting gears between executable code and non-executable code (these
## comments).
##
## If you've made it this far without giving up, you should realize that I've still added zero information
## to the subject and wasted your time in the process. The original reply is still better, and you should
## aim to adopt it as professional and personal coding policy.
##
## In case you missed the original reply, and in hopes of finding it here, buried at the bottom of this
## epic tome (aka epic fail): Instead of writing comments, write code that doesn't need comments.
##
##
## Plus: extra file encoding type cruft.
## Plus: extra editor hint cruft.
## Plus: extra version control meta data cruft.
## Plus: version control history that should be left in the version control system.
##
Now, this doesn't preclude documentation--we use doc strings at the beginning of files, functions, and classes quite heavily--but in-line comments in code are rare.
In the world of system Unix/Linux system administration, one of the statistics often quoted by system admins is their systems' "uptime." That is, how long has the system been up and operational since its last reboot. This is a conversation in which Windows system admins never join due to the fact that even the smallest system or software update often requires a reboot. My personal best? 500-plus days. Of course, I probably should have rebooted it in that time for some security updates, but for some reason it didn't get done.
It seems Linux admins will soon have even more bragging rights when it comes to uptime. A new project from MIT (where else?) has developed a way to apply security patches directly to a running kernel, without having to reboot. Unless an update makes large changes to the kernel (in this case, modifies data structures), a kernel update will not require taking the system down. Considering that a kernel update is the only reason to ever have to reboot a Linux system -- even hardware drivers can be updated without a reboot -- it might be possible to never reboot a Linux system, and still keep it up-to-date with all security patches.
More information at the Ksplice site. Very interesting stuff, indeed.
I sometimes wonder how marketing types live with themselves. Their whole purpose in life is to convince us to buy things for which we have no need, and often lack the money. As George Foshee said, "We spend money we don't have, to buy things we don't need, to impress people we don't like." But I digress. I was talking about marketers. In addition to trying to convince us to buy things, sometimes they even take techniques, rename them, and then claim they invented them, as is the case in a press release I found today.
First, a little background. HDR (or High Dynamic Range) Photography is a method whereby you take several shots of scene at several different exposures, and then combine those shots into one. This generates a final image that captures much more of the range visible to the human eye. As usual, see Wikipedia for more.
So, today I came across a press release from a real estate web site. Under the pretentious headline "Arizona Firm Revolutionizes Real Estate Photography With New ELC Technology," they claim to have invented a technique called "Enhanced Lighting Compression" which promises to "[bring] new level[s] of detail & appeal to property photos." Hmm...sounds interesting. Let's read more.
This is how they describe the process:
ELC photography involves taking multiple simultaneous exposures with a specially configured digital camera. These images are processed at VMLH's studio, where they are integrated and enhanced with custom software that merges a series of images into one ELC photograph that can be printed, emailed or used on web pages as a standard JPEG photo file.
Sounds exactly like HDR, except for the "multiple simultaneous exposures" part, which is either complete hyperbole, or they have a special multi-CCD camera. Considering it is a marketing piece, I would assume the former, but if it is the latter, then it's still HDR photography, they just had someone make them a VERY expensive digital camera. And on their web site, they simply claim that "custom software" is "custom Photoshop settings."
And I could stop there, since it's pretty clear they they have simply renamed an existing technique and are trying to market it under a new name. But, there is other marketing-speak in the article that is just begging to be called out.
The new Enhanced Lighting Compression (ELC) system produces pictures that bring out far more of the details seen by the human eye, creating stunning images that have a hyper-real level of presence, clarity and immediacy.
"Stunning images?" Well, maybe, in that it's more range than you are used to seeing in a photograph. But no more stunning than a well-taken and well-lit shot of a house.
Brings out more detail? Yes, HDR photography does that. But "Hyper-real!?" Oh, sigh. The only references to hyper-reality I could find on Wikipedia (I know, not always authoritative) were Hyperreality, a term used in semiotics and postmodern philosophy; Hyperrealism, a school of painting; Hyperreal numbers, an extension of the real numbers in mathematics that are used in non-standard analysis; and a song. So unless they are talking about philosophy, math, or a realistic painting technique, their choice of words was completely meaningless. The images aren't hyper-real, they simply, as I stated, look like a well lit shot should.
"I tell people that ELC photos adds $100,000 to the value of their home," said Arizona realtor Kim Stoegbauer.
Right, about that "how do marketers live with themselves" question? Enough said.
If you take a look at the images at http://www.vmlh.com/elc/ (no I'm not linking to them, I have no desire to raise their Google rank), you'll see the sample photos don't look all that amazing. They simply look like a picture taken by a photographer who knew what they were doing.
For some examples of real HDR photography, and what it can do, take a look at HDR photos on Flickr. For an excellent example that shows how HDR can generate a picture showing detail in the bright areas, all the way down to the dark areas, see this image.
HDR photography is neat, and if they want to use it real estate, great! Actually, really great; have you seen some of the photos attached to houses for sale? Some of them are horrible. So, if they want to use HDR, that's fine, but at least call it what it is, instead of creating a new name, and claiming you invented it.
Oh, if you're interested in the press release, copy and paste this link: http://www.prnewswire.com/cgi-bin/stories.pl?ACCT=104&STORY=/www/story/03-25-2008/0004779580&EDATE=
Objects have "failed" in that they've tried to be the be-all, end-all solution to all problems, while not being powerful enough to be the be-all, end-all. On the other hand, they've succeeded in that they are a good (often great) tool in many cases. I often find that objects are nice just for state-encapsulation: keeps me from worrying about certain details at that moment; I might not even be abstracting anything of note.
And I think it comes down to this: procedural, functional, and OO programming tools are just that. You use one or the other where they might be the most appropriate and most practical. Take these few lines from a script in a project I'm working on: (disclaimer: yes, I wrote them).
That is an interesting combination of functional (only two state variables: 'f' from a surrounding loop, and full_name) and object oriented (file and string.Template methods) programming. And the combination works, works well, and is only one logical line of code, to boot.
I don't think it's a matter of object, functional, or procedural styles failing, it's about having a good knowledge of all three, and their capabilities, and being able to make realistic and practical decisions about what will be the best in a given situation. It's also about using a language that lets you combine the three in a mix that works best for you and the given requirements.
(In this case, that language is Python, but that's peripheral.)
In my job at EE Internet, we do a lot of remote data collection, including collection from cameras. Now, the makers of these cameras have figured out how to put the date and time as a graphic in the image itself (Umiat Airfield) but for some reason they haven't figured out how to embed that same information in the EXIF Data for that image. Very aggravating.
So, Python to the rescue. I came up with a script that extracts the area given, converts it to black and white, inverts it (because these cameras have light text on dark background, and OCR doesn't seem to like that), and then feeds that file to a command-line OCR program. It then takes that text, parses it for the date, and then prints it out in any date/time format desired. Works quite well.
Here it is in all its glory.
Comments, improvements, critiques, etc., are always welcome. And yes, you can post comments pointing to another program/project/whatever that does what I did and does it way better.
It requires Python's PIL image library
It defaults to using the gocr command. This is available in the 'gocr' package in Ubuntu. It also seems to work well with ocrad, which is also available in Ubuntu.
There should not be any symlink vulnerabilities in this as the exclusive lock is kept on the file while there is data being written to it. Once the data is written, and the file is closed, then it is passed to the OCR program as an input file. Then, it is removed.
UPDATE: Modularized it so you can call it from the command line, or import it into your own Python script and call it that way.
A search for a cure for cancer leads to a new, seemingly very efficient way, to do electrolysis: literally burning salt water for fuel. I want to convert my car over now.
Update with some more thoughts: I wonder how much salt you need per gallon. It'd be interesting to do the math on the cost. Of course, you don't need table salt. "Low grade" salt such as water softener or simply rock salt would work. The one thing the article didn't mention is how much radio energy it takes to cause release the hydrogen, and how much energy can be recaptured from the flame. You know, it's interesting: several months ago, the Elijah List had a prophecy about a new source of energy that was going to be found in the US. Could this be it? Can you imagine millions of cars running on salt water in a few years?
Update 2: Some more ideas. Can you imagine: A big feeder of rock salt, a grinder for precision deliver, and a tank hooked up to your water supply. Plus a boiler run on hydrogen. (Nearly) free heat for your house and then some. I'm giddy with the thought. I really hope the idea is bought by someone who will use it, not by someone who will bury it (think oil company).
As of right now, I've enabled a system called "reCAPTCHA" to prevent spam comments, not that I've gotten any spam comments yet. OK, a couple. But instead of being just an annoying roadblock to posting comments, reCAPTCHA is actually useful. The words with which you are presented when you make a comment are words that have been scanned from old books, but cannot be clearly read by the computer digitizing the books. So, to post a comment, you enter two words, one which is already known by the system, and one which is unknown. If your answer to the "known" word is correct, and your answer for the unknown word matches other people's answers, then that word is successfully digitized. You can get all the details on the reCATPCHA Learn More page.
It's nice to see Dell promoting Linux now that they are selling machines with Linux pre-installed. For a quick overview on what this Linux and Open Source thing is all about, take a look at this short video.
For those of you who have been wondering what this "RSS" thing is, and who don't really know what I mean when I say "subscribe to updates from my blog," Common Craft has a cute little video entitled "RSS in Plain English." Check it out below, and if you have any further questions, drop me a line via the contact page.
Melissa Draper points out that every has their reasons for not adopting Linux. Whether it be the software they have to use, the hardware, or other reasons.
But she raises an interesting point: if your Linux-adoption hurdle is hardware compatibility, it is very likely you could buy Linux-compatible replacements for less than the cost of a Windows Vista upgrade. So if your hardware is keeping you from giving Linux a try, check out alternatives...it might be cheaper in the long-run.
Paul Grahamsays so. I'll not belabor the point, other than to agree, but when "up and comers" have no sense of "fearing Microsoft," and when those in the tech know-how are all using Mac and Linux, Microsoft is dead. The leading edge eventually becomes standard operating procedure, and Mac and Linux will continue to be adopted on a wider scale.
I'm giving this a trial run. Right now, I'm only promoting Tech, Business, Venture Capital, and Auto categories, so hopefully the content will be pretty clean. If you see something that would not be in line with my standards of "family friendly," please contact me at once, and send along the URL of the offending article.