IKD 30

authorKeithius November 17, 2008

Today is what I like to call International Keith Day or just IKD. It’s also commonly known around these parts as “my birthday.” I mean, after all, who wouldn’t want their birthday to be celebrated as an International holiday (so you would never have to work on your birthday)? ;-)

Anyway, this makes it IKD #30 for me… scary, I know!

So, as per my usual IKD advice - I urge everyone to take the day off from work, stay home, play some video games, read a book, watch a movie, go for a walk, take some pictures, and just have fun!!

Happy IKD, everyone!

Desktop Madness, Vol. 62

authorKeithius November 12, 2008

Osaka and Chiyo-chan from Azumanga Daioh

Osaka and Chiyo-chan from Azumanga Daioh

What can I say? This series just makes me laugh!

Depth of Field Experiments

authorKeithius November 10, 2008

I’m a sucker for certain “classic” photography effects. You’ve probably already seen the results of my obsession with the silky-waterfall effect and my experiments with macro mode, but there was another effect I have been trying to master - getting the “out-of-focus background” effect by controlling the depth of field.

For those that aren’t familiar with the term, “depth of field” refers to the amount of a picture that’s in focus. As usual, Wikipedia has an excellent article on the topic if you’re after more detail. The trick with cameras is that depth of field is controlled largely by the aperture you’re using when you take a picture. A larger aperture (smaller f-number) gives a shallower depth of field, and a smaller aperture (larger f-number) gives a greater depth of field. (Confusing, I know.) The theoretical “perfect” pinhole camera has an infinite depth of field, meaning everything is in focus no matter how far away, but in reality there is no such thing as a “perfect” camera, so every picture-taking device - including your own eyes - has some sort of depth of field, even if it’s very large.

Anyway, although you’d think that with photos you always want everything to be in focus, the fact is that you can use blurring to sort of “focus” on one thing - blurring out the background, for example, is often used with portraits to keep the focus on the person.

Now, knowing the relationship between aperture and f-numbers should let me create this effect whenever I want - in theory. In practice, I’ve had some trouble getting it “right.” Oh, I got some nice blurring when I used macro mode - which basically gives my camera a very, very, very small (shallow) depth of field, but it also meant that I could only focus on things very, very, very close to the camera. Useful for closeups of flowers - not so useful for anything else.

So the other day I sat down and decided to try some experiments. To gauge the results, I needed something that stretched away from the camera for some distance, so I could gauge what was in focus and what was out of focus.

Taking a tip from some photography sites which used a similar example, I set up my dining room table with a bunch of bottles of wine from my wine rack. This is what it looked like to start with:

wine line up

This was taken in manual mode on my camera, but I got the settings by using “Program” mode and just depressing the shutter button half-way so the camera gave me it’s “recommended” exposure settings. They are (for the curious): Exposure of 1/8 second, and aperture of f/2.7 (the largest aperture my camera has).

At first, I was a little disappointed - after all, the background is out of focus, but not by very much. The effect I wanted wasn’t very pronounced, and I knew it had to be possible - but what was I doing wrong?

Somewhere along the way (probably in The Digital Photography Book by Scott Kelby) I had read about portrait photographers using a “short zoom lens” (85-100mm focal range) because it produced such nice results for portraits - which, as I said earlier, often utilize a shallow depth of field to produce a blurred background that helps draw attention to the person in the picture.

“Well hey,” (I said to myself), “I’ve got a zoom lens on my camera that I think can do at least some of that focal range.”  So I tried zooming in a little. The results? Have a look:

wine in focus

Well now - that’s much more like it! The bottles at the back are very much out of focus - more so than in the first picture. I might be onto something here!

Now, although the above picture turned out quite nice, I did make the mistake of letting the camera auto-focus for me - that’s why the “Fools Bay” botle is in focus instead of the first (closest) bottle. (My camera at the time was set to auto-focus on whatever was bracketed in the middle of the picture.) So, time to switch to manual focus!

depth of field experiment (wine)

Ahhh, much better.

Now, it’s worth noting a few things about these last 2 photos:

  • They were shot at f/3.5 - a smaller aperture than the original picture. Yet, there is (or appears to be, at least) more blur - this is counter-intuitive to what I thought I knew about aperture and depth of field.
  • According to the EXIF data in the photos, the focal length was 23.8mm - nowhere near the 85-100mm I mentioned reading about for portraits (although this may simply be because the bottles were closer to me - and my camera -  than a person would normally be when having their portrait taken).

Still, despite the somewhat counter-intuitive results, at least I know now what to do to produce this effect on-demand. (And now you do, too!)

So with all that, I lined up one last shot - the one I’m most proud of:

depth of field experiment 2 (wine)

That was just what I had in mind when I set up the bottles on my table - and being able to actually produce it on my own was very satisfying. It’s little successes like this that make photography such an interesting and fun hobby!

So, now I know the tips to getting that nice blurred background effect:

  • Set up your camera a bit further away from your subject
  • Zoom in a little bit
  • Use the largest aperture (smallest f-number) that you can at that level of zoom
  • Don’t forget to make sure you’ve got the focus where you want it (i.e., watch out for auto-focus)

Yay! Another successful photography experiment.

I expect to be adding some filters (ND-grad and circular polarizing) to my collection soon - so we may have some experiments using those tools soon as well. Stay tuned!

Desktop Madness Vol. 61

authorKeithius November 5, 2008

Azumanga Daioh - The Animation

Azumanga Daioh - The Animation

I’ve really been getting into this lately. I somehow found Episode 6 on Blockbuster’s DVD rental system (to which I subscribe), and then found the first 3 books at my local Barnes & Noble… and I have to say, I’m loving it!

Maybe it’s the quirky story or animation style… or maybe it’s just the crazy characters, but it is just great fun.

A Programmer’s Perspective on Politics

authorKeithius November 3, 2008

Election time always finds me musing on the nature of politics. Of course I must admit that being a computer programmer colors my view of the whole process more than just a little bit.

I mean, I know that the political process in this country is one that has evolved over (literally) hundreds of years - and the common law tradition that we use is even older than that. And while part of me thinks that something so old ought to be inherently trustworthy, the programmer part of me can’t help but think that it’s a little… obsolete?

I mean, it makes sense… if you think about it. Let me explain:

Laws are the “operating system code” of a Society

This is not as far fetched a metaphor as it might seem. After all, what is computer code but the instructions for how a computer should operate - and laws do the same thing for the society (or government). You could say that the Constitution in the United States is our “OS kernel”, and the US Code (which is absolutely enormous, by the way) is the Operating System. Various federal regulations and agencies’ rules make up the applications.

Image courtesty Flikr user umjanedoan

(Image courtesy Flikr user umjanedoan)

When you think of it that way, you can see that our system has more than a little bit of “cruft” in it. In fact, there’s a whole lot of cruft in there - after all, our legal system has evolved over more than 200 years, growing rather organically. If we were looking at a similarly aged computer program that had been expanded, built upon, patched, and repaired in the same way, every sane programmer who looked at it would recoil in horror and demand that the whole thing be thrown away and re-written with maintainability in mind.

Of course whether doing that to our laws and Constitution would be a good thing is somewhat up for debate. Of course, the ones doing the debating are usually legal scholars - one has to wonder what sort of decision would be reached if we put some programmers on the job!

It is Important to Eliminate Ambiguity

There’s a commonly understood legal principle that if a law is so complex that an average person has no hope of understanding it, then the law is a bad law and might even be declared null and void. After all, people can’t obey the law if they can’t understand it!

The same thing goes for (good) code. If you can’t understand it, then it’s not good - no matter how well it might work in practice. With programmers (good ones, anyway) the importance of eliminating ambiguity permeates every aspect of their being - it comes out in the way they communicate, and you can see it quite clearly in their code. If something isn’t inherently understandable, there’s comments nearby to help you. It seems to me to make sense that we hold laws to the same principle.

Ambiguity takes another form as well - computers are very simple-minded, when all’s said and done, and they need their instructions very clear without any wiggle room for misunderstanding - or else you’ll get bugs.

Providing Error Handling / Exception Handling is Important

People make mistakes, and it’s also impossible to consider all possible outcomes. That’s why having a good error-handling strategy is key to designing a robust computer program - and the same applies to a legal system, as well.

Image courtesy Flickr user Jims Junk

(Image courtesy Flickr user Jims Junk)

Right now, error/exception handling is handled by the appeals process, and ultimately the Supreme Court. Issues “bubble up” to the Supreme Court in the same way that unhandled exceptions “bubble up,” eventually triggering an OS exception or being trapped by a debugger.

It goes without saying that having such a system is important (because errors happen), but like in programming, exceptions are computationally expensive and slow down the entire system. Throwing an exception should be a last resort - and when you throw a lot of exceptions, you slow everything down. The same goes for our court system - when there are lots of cases and appeals pending, everything just gets bogged down.

As in programming, having the system to handle errors important, but it’s also equally important to limit the number of errors that “bubble up” to higher levels, and to try to handle errors locally, before they get out of hand and bring down the entire system.

Continuous Upgrades

Some people would say “if it ain’t broke, don’t fix it,” but it’s a fact of life that computers change - hardware gets replaced, and upgrades are pretty much a fact of life. Thus, code must be updated to handle these changes. Likewise, the society on which our laws “run” is constantly evolving as well - and laws need to be “upgraded” to handle these changes.

There are lots of lists of old, weird laws that are still on the books in many states - and at the Federal level, I can only imagine the old, outdated laws that are still lurking in the corner of some ancient statute. As with code, it would be best for everyone if we took the time to go through the old laws (old code) and remove the stuff that isn’t relevant anymore - or at least update it so it reflects current society.

Look at laws related to things like copyright and search & seizure, and how they are being bent, twisted, and pried into “fitting” around things like digital archiving, the Internet, and so forth, and you’ll see why keeping your laws up-to-date is important. I’d almost say that the main part of a politician’s job should be reviewing and updating old laws, rather than always trying to write new ones.

Ease of Use (Usability)

This is less of a programming point and more of a UI-design point, but the two are closely related so I’ll let it slide.

No matter how awesome a program is, it’s useless unless people can figure out how to use it. People shouldn’t need to hire an IT professional every time they want to change their desktop wallpaper or install a new program. And by and large, programs today do try to make it as easy as possible for the user - to the extent of doing extensive usability studies and so forth.

If laws and statutes and regulations are the “programs” of our government, then it’s fair to say that their usability is… pretty crappy. Why else would we need to hire specialists (lawyers, tax specialists, accountants, etc.) to understand the law, or require police to read a simplified version of people’s rights to them when they are arrested?

Take the tax codes as an example. Most people have only the vaguest idea of how it works, and they use some default settings (1040-EZ) to get by, even though there might very well be better options for them. If the user can’t find these options, or can’t understand how to use/apply them, then they might as well not exist!

We need the legal equivalent of the Ribbon UI from Microsoft Office 2007 - or maybe the UI from Apple’s OS X or iPhone - to help people actually USE the laws that have (ostensibly) been created for their benefit.

Wrapping it Up

As I said, maybe it’s just because I’m a programmer that I think about these things in this way - but somehow, I can’t help thinking that having a few programmers in politics - or teaching some politicians to program - might not be as bad a thing as it might sound to some. Being a programmer and a geek does tend to come with a particular world-view, which does of course color the way you see things.

However, when you stop thinking about politics and law and government as being “special” or “sacred,” but instead just think of them as another system in our lives that needs to be managed, you can see that applying what I’ve talked about here - what is basically just common sense - is really in our best interests. I can only hope that eventually more people will see it that way.

(Images courtesy Flickr users umjanedoan and Jims Junk, licensed under a Creative Commons Attribution 2.0 Generic license and a Creative commons Attribution-Noncommercial-No Derivative Works 2.0 Generic license.)

Logos | Icons | WordPress Themes

Using Internet Explorer is risky. Click here to upgrade to Firefox, the world's safest web browser for free.