Bash Booleans

I keep getting these slightly wrong, and finally got annoyed enough to write a program which produces a cheatsheat.

In [] conditional expressions, presence counts rather than value.
if [ 0 ]: true
if [ 1 ]: true
if [ ]: false
if [ "" ]: false
if [ 'abc' ]: true

In [[]] conditional expressions, the same
if [[ 0 ]]: true
if [[ 1 ]]: true
if [[ ]]: illegal
if [[ "" ]]: false
if [[ 'abc' ]]: true

In (()) arithmetic expressions, numeric value counts
if (( )): false
if (( 0 )): false
if (( 1 )): true
if (( 3 == 3 )): true
if (( 1 && 1 )): true
if (( 1 && 0 )): false
if (( 1 || 1 )): true
if (( 0 || 1 )): true
if (( 0 || 0 )): false
if (( aaa )): false
if (( '' )): false

In straight if statements, program return values are used, NOT other things
But remember that 0 is true and 1 is false.
if true : true
if false: false
if 0: illegal (no program 0)
if 1: illegal (no program 1)
if true && true: true
if true && false: false
if false || true: true
if false || false: false

Art vs. Reality (XKCD on University web sites)

Today’s XKCD cartoon seems to have hit pretty accurately. (If you’re not familiar with XKCD, it’s brilliant surprisingly often and very good most of the rest of the time.)

XKCD #773

Mark Gritter had the idea of analyzing his school’s homepage.

So I’m going to analyze Carleton’s.

Carleton College front page 30-Jul-2010

Present:

  1. Campus photo slideshow — right there on homepage, with popup labels; also “campus photos” link
  2. Alumni in the news — not linked from front page (they’re in “Carleton in the Media” which is linked from “Carleton News”)
  3. Promotions for campus events — Calendar on the front page
  4. Press releases — “News and Stories from Carleton” on the front page
  5. Statement of the school’s philosophy — no direct link
  6. Letter from the president — no direct link
  7. Virtual tour — no direct link
  8. Full name of school — yep

I score that 4/8 (I’m not scoring #2).

Things people look for:

  1. List of faculty phone numbers and emails — “Faculty and Staff” link then “Campus Directory”.
  2. Campus address — “Mailing address” link
  3. Applications forms — “Prospective student” / “Apply”
  4. Academic calendar — “Academics” / “Academic calendar”
  5. Campus police phone number — no (search reveals that the campus security emergency number is 4444)
  6. Department/course lists — “Academics” gives list of departments, clicking through gets a department homepage with “courses” link
  7. Parking information — no
  8. Usable campus map — “Maps and directions” link, then “Interactive campus map”; it’s Google-powered, and names the buildings, and looks accurate
  9. Full name of school — yep

I score 7/9 (I’m counting things that are indirect links but the chain is “obvious”; obviously this is subjective).

So, not nearly as bad as one might expect; Carleton actually has a higher proportion of the things people look for than they do of the things XKCD lists as always present.

The emergency number is something I never would have thought of, and is probably a good idea.  The page does give the main switchboard number. When I was there that was staffed 24 hours a day, but I don’t think it is any more. And it needs to give the external number for emergencies, since people finding that from the web site will mostly be calling from their cell phones. Carleton would never call it the “campus police”, of course.

I’m tempted to snottily say that there’s no parking information because Carleton doesn’t allow parking—but in fact they’ve built a lot of parking lots since I was there, though still not nearly enough for student cars to be common. It’s not in a crowded metro area, and most of the time you can just park on the street fairly close, and the rest of the time you have to park on the street further away; but it should explain that somewhere, and I didn’t find it, even in the “travel by car” section of the campus visits page.

This iteration of the Carleton site is actually pretty decent.

Basic Photographic Exposure

Having started photography before automation was the norm, I had to learn how to use a light meter and set exposure by brute force right up front.

I’ve always wondered what the process of transitioning from automatic to manual exposure was like (hordes of people make the transition, despite the widely-expressed belief in the 1980s that if you started out with an automatic camera you never really could; even at the time that sounded like dinosaur talk to me).

I’m a “how this works and how it developed” kind of learner.  People with drastically different learning styles may very well not find the following information useful; there may be too much of it, and it may not be focused specifically enough on what they need to know right now.  I can answer that kind of question too, but when writing explanations in general I tend towards excessive information.

There are three controls on the camera that affect exposure (ignoring flash).

The “ISO” is the sensitivity of the digital sensor (or film; same units are used).  (One of the great benefits of digital is that I can change ISO from shot to shot, without having to change film (which mostly comes in rolls, so changing in the middle of a roll means either wasting some, or doing a lot of finicky manipulations and marking and risking accidental multiple exposures)).  Bigger numbers mean more sensitivity meaning the picture will be brighter (and noisier), all other things being equal.

The “shutter speed” is the amount of time that the film/sensor is exposed to the light coming through the lens.  It’s measured in ordinary time units — 1/60 second, 1/1000 second, and so forth.  More time lets in more light, and makes the picture brighter, all other things being equal.  (Faster shutter speeds will “freeze” faster motion.  Slower shutter speeds will blur motion, including any camera shake.)

The “aperture” is an adjustable diaphragm buried in the middle of the lens that controls how much light is let through.  It’s measured in a weird unit — “f stops”.  (The f number is the ratio of the focal length of the lens to the diameter of the opening in the diaphragm, so it’s a pure dimensionless number.)  What it’s good for is that “f/8” on a 50mm lens puts exactly the same amount of light on the sensor that f/8 on a 400mm lens does.  This is much more convenient than having to figure exposure differently for each different focal length lens (especially today with zoom lenses being the norm).  Bigger numbers let through less light, making the picture darker (all other things being held constant).  Smaller numbers let through more light, making the picture lighter.

To photographers, the “f/stop” is the basic unit we think of exposure in.  And it doesn’t relate at all directly to the f-numbers used to measure aperture.

“One f/stop” means a doubling or halving of exposure.  We’ll say “I need to give this another two stops exposure”, meaning we have to give it 4 times as much exposure (“two stops” means doubling twice, meaning a factor of 4).  We can do this the obvious way with the shutter speed:  give it 4 times as much time (go from 1/400 sec. to 1/100 sec., for example).

With the ISO, the way it works is that a doubling of the number represents a one-stop increase (doubling) of sensitivity; so we could give the shot two stops more exposure by changing from ISO 100 to ISO 400.

With the aperture, to increase exposure by two stops we cut the number in half — going from f/8 to f/4, for example.  Yes, the numbers go the opposite direction from everything else; large f numbers give less exposure, small f numbers give more exposure.  (To change aperture by one f/stop, you change the number by a factor of the square root of 2, which is about 1.4; this gives rise to the classic series of f numbers that experienced photographers have burned into their medulla: 1.4, 2, 2.8, 4, 5.6, 8, 11, 16, 22, 32.) Changing from f/2.8 to f/4 is giving one stop less exposure, and changing from f/32 to f/11 is giving two stops more exposure.

Photographers talk about the aperture itself, not the number; we will all say that f/11 is a “smaller aperture” than f/8, and that f/2 is a “bigger” or “wider” aperture than f/5.6.  With a manual enough lens, you can see the actual aperture adjusting inside the lens as you turn the aperture ring, and see that what we call “smaller apertures” are indeed smaller; unfortunately for learning, most lenses don’t have aperture rings any more.  We will “stop down two stops” to go from f/8 to f/16, or “open up a stop” to go from f/5.6 to f/4.

I’m not AT ALL surprised that people coming to this for the first time find it somewhat confusing.  It’s one of those highly-evolved systems from the past with strange terminology.  It actually works very neatly in practice, but it’s hard to explain without producing gibbering insanity at least the first few times.

But it could be worse; we could be representing film/sensor sensitivity using the DIN system, which is logarithmic (a difference of 3 in the DIN number represents a one-stop change in sensitivity).  In fact it might be better if we were; the range of ISOs that we have to deal with in modern cameras goes from at least 50 to 25,600.

“Equivalent exposures” is a vital concept.  If you make equal but opposite changes in two of the factors affecting exposure, the net result will be the same (picture will be equally light/dark).  (With digital, in the useful ranges, this is basically true; with film there was something called “reciprocity failure” where at very long or very short shutter speeds this principle, called the reciprocity law, did not hold.)  (All three controls affect exposure AND have other effects; the other affects change as normal.  So we can deliberately adjust the shutter speed to get the degree of blurring/freezing we want, and compensate with the aperture and/or ISO to get the same exposure.)

So, given a starting exposure of ISO 100 1/100 sec. f/8, all of the following are equivalent to it (and to each other):

ISO Shutter Aperture
100 1/100 f/8
100 1/200 f/5.6
100 1/400 f/4
100 1/800 f/2.8
100 1/1600 f/2
100 1/50 f/11
100 1/25 f/16
200 1/400 f/5.6
200 1/800 f/4
200 1/1600 f/2.8
200 1/200 f/8
200 1/100 f/11
200 1/50 f/16
400 1/800 f/5.6
400 1/1600 4/3
400 1/400 f/8
400 1/200 f/11
400 1/100 f/16

(Typed that manually, so I suppose the odds of a grotesque screw-up are pretty good.)

Now, a couple of useful rules of thumb:

The “sunny 16 rule”:  The right exposure for a subject in direct sun is roughly a shutter speed of 1/ISO at an aperture of f/16 (or any equivalent exposure).  So at ISO 400, 1/400 sec. at f/16 is about right.

This one is very rough, but for most people the slowest shutter speed at which they can hold the camera steady enough not to get visibly blurred pictures is 1/(35mm-equivalent lens focal length).  People differ a lot, but the principle that it scales with focal length is reliable; that’s just physics (or geometry) (it’s actually scaling with magnification).  (This doesn’t consider subject motion; the speed that keeps camera shake from being a problem may still not be fast enough to freeze a moving subject.)

So, what’s the right exposure?  That’s an artistic question, and hence totally a matter of opinion; not a technical question.  For many purposes, if it’s possible to get the entire brightness range of the scene recorded, that’s useful (or at least the entire brightness range excluding “specular highlights”, shiny bits that directly reflect the light source). When it isn’t, you need to decide which parts of the scene are necessary to record; and expose to do so.  If you need more than  your sensor can capture (increasingly rare), you can try taking multiple exposures at different exposures and combining them to make an “HDR” (high dynamic range) image.

Lost Ansel Adams Negatives

As some of you have probably heard, some negatives that may be by Ansel Adams, and which pre-date the 1937 darkroom fire that destroyed all his early negatives, have come to light.  Rick Norsigian bought 65 6.5×8.5 inch glass-plate negatives (a size Adams was known to use in the period) at a garage sale, and has gradually come to believe they’re by Adams, and has found experts in relevant fields to agree with him.

The experts place a value of around 200 million dollars on the find, and Norsigian has already started offering 30×40 darkroom prints and smaller digital prints for sale ($7500 for the darkroom prints) from a web site.   This makes me very suspicious, of course.  Rushing to commercialization is not conducive to figuring out the truth.

Adams’ grandson has given interviews saying he doubts they are by Ansel Adams.

An interesting issue is that two handwriting experts say the writing on the envelopes the negatives were stored in matches Virginia Adams’ (based on samples known to be by her), while the grandson says the writing is not hers.  I don’t know what the state of modern handwriting identification is; I don’t know how seriously to take the evidence there.

Extracts from the experts’ reports being used to authenticate the negatives are online. Weirdly, that URL is at a different host than the first link; it appears to go to a Russian design studio.  This may mean that business partners have been brought in, I suppose.

In the report itself, and specifically in the extracts from the experts’ reports, there are a number of points that bother me.

Point 8, “THE SIZE OF THE NEGATIVES ARE UNIQUE TO ANSEL ADAMS”, is interesting.  And blatantly nonsense.  So that doesn’t look good.  (Glass dry-plate negatives of a unique size?  Does that mean he had them custom-manufactured for him, and a plate holder for the camera too?)   (Other references in the document refer to the size and the camera as fairly standard, just not that popular; a 6 ½ x 8 ½ inch Korona view camera.)

Points 2 and 3,

2.
ONE OF THE IMAGES IN THE NORGISIAN NEGATIVES IS VIRTUALLY IDENTICAL TO AN AUTHENTICATED ANSEL ADAMS PHOTOGRAPH
3.
THE LOGICAL CONCLUSION BY THE EXPERTS IS THAT THE TWO VIRTUALLY IDENTICAL PHOTOGRAPHS WERE

also bother me—taking two nearly-identical photos seems very much contrary to how Adams presents himself as working.  But I haven’t browsed the actual negative archives at U of A (I think is where they are?) to see how they speak to the matter; and these negatives are much earlier, so he might have done things differently then.

And with regard to #3, Patrick Alt is quoted as saying “AS TO WHETHER THE SPACING BETWEEN THE POINTS OF COMPARISON MAY NOT MATCH, THAT IS EASILY EXPLAINED BY HIS USING A DIFFERENT LENS, WHICH WOULD CHANGE THE SPACIAL RELATIONSHIPS BASED ON THE FOCAL LENGTH OF EACH LENS.”  Um, no; the focal length of the lens would not change the spacial relationships.  So now I’m questioning Patrick Alt’s overall level of knowledge, and whether I should care what he thinks.

So, one clear conclusion is that this document is amateurish, and has not been carefully reviewed by knowledgeable people.

Now, if in fact these represent not-previously-published works by Ansel Adams—then, for those made after 1922, the copyright is clearly still in force, and I believe would be owned by whoever owns the bulk of his copyrights, probably the foundation or a museum.  So, if the claims of the negative finder are true, his actions in selling prints are clearly illegal.

ETA: Or, maybe they’re by Earl Brooks.

Thin Mint Replacement!

For years, I have been looking for a good equivalent, competitor, or replacement for the Girl Scout’s Thin Mint cookies. (Why? Well, why not? I hate being dependent on one supplier, and I had started to think that perhaps the quality was slipping in recent years.)

This week, I finally stumbled on it. If my memory doesn’t deceive me, these are better than the latest batch of the real thing that I had (last summer).

It’s the Back to Nature Fudge Mint Cookies.  I got them from the “natural” section at Cub Foods (60th and Nicollet).

The box
A cookie