New Mission Website

June 24th, 2010

My sister has been pestering me for ages to design a new website for the Whosoever Gospel Mission.  Sadly, my creativity in design ebbs and flows, and it just wasn’t flowing.  Until I upgraded all my WordPress installations to the new 3.0 version. I took one look at the new default template (“Twenty Ten”), and thought, “now that’s something I can work with.” 48 hours later… I love WordPress.

Add your own logo to a Google Maps mashup

December 10th, 2009

The Google Maps API is really great for building mashups, mixing your own data and maps with Google’s. We’ve been using this on the PhilaGeoHistory.org site, as well as on Philadelphia Architects and Buildings, and it works really well.

One of the things that wasn’t particularly obvious was how to add our own logo next to Google’s logo at the bottom left of the map window. Especially if other sites will be using the maps (like PhilaPlace, for instance), there should be some credit and a link back to the source of the maps. This wasn’t obvious, but it wasn’t hard. Here’s how to do it:

1. Make a nice little logo, probably about 30 pixels high, and not too wide. It should be a PNG file with transparency, so it overlays nicely in the Google Maps interface.

2. Create a new Javascript file that contains the class for your “custom control,” which is Google’s term for any element that sits on top of the map window but doesn’t move around with the map. In this file (here’s the geohistory.js file), you should have the following:

// SETUP CUSTOM GOOGLE MAPS CONTROL TO DISPLAY GEOHISTORY LOGO

// instantiate the new "class"
function GeoHistoryLogoControl() {}

// inherit the functions from Google's Control class
GeoHistoryLogoControl.prototype = new GControl();

// setup the content of the control
GeoHistoryLogoControl.prototype.initialize = function(map)
{
     var container = document.createElement("div");

     var lnk = document.createElement("a");
     lnk.href = 'http://www.philageohistory.org';
     lnk.title = 'Historic map images provided by the ↵
          Greater Philadelphia GeoHistory Network';
     lnk.target = '_blank';

     var img = document.createElement("img");
     img.src = 'http://www.philageohistory.org/tiles/viewer/ ↵
          images/mapsfromgeohistory.png';

     lnk.appendChild(img);
     container.appendChild(lnk);
     map.getContainer().appendChild(container);

     return container;
}

// set the default location for the control
GeoHistoryLogoControl.prototype.getDefaultPosition = function()
{
     return new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(75,4));
}

3. In your page that contains the map, load the Javascript file you created above, then add the control to your map.

<script src="js/geohistory.js" type="text/javascript"></script>

<script type="text/javascript">
var map = new GMap2(document.getElementById("map"));
map.enableDoubleClickZoom();
map.enableScrollWheelZoom();

map.addControl(new GLargeMapControl());  // navigation
map.addControl(new GeoHistoryLogoControl());  // logo

map.setCenter(new GLatLng(39.95,-75.2), 13);
</script>

That’s it. Works like a charm.

The Real Threat of ACORN

October 3rd, 2009

acornKaren Heller, a columnist for the Inquirer, wrote about the evil, awful ACORN people conservatives keep attacking. (Inquirer, Saturday, October 3, 2009.) Of course, that line was only a setup, as she went on to describe the young, idealistic college graduates and the African American grandmothers and great-grandmothers who are making sure Latinos have a voice and that greedy banks don’t foreclose on good people who need homes. Wonderful stuff, indeed, but she comes to the conclusion that this work is being shutdown by vengeful conservatives afraid of minorities getting a voice. And she blames the subtly unnamed “right-wing conspiracy” for all of ACORN’s woes.

Never mind that ACORN affiliates all over the country are implicated in sketchy activities. Never mind that anybody in their right mind would have called the cops when that ridiculous pimp-n-ho duo walked in the door (thankfully, the Philly people did). Never mind that ACORN’s very corporate structuring is intended to obfuscate and hide funding and oversight, politicizing non-partisan activities (like voter registration) and using federal funds for illegitimate purposes. Think I’m exaggerating? Read their own lawyer’s internal investigation and strong-worded suggestions.

It’s time for the good people doing good work at ACORN to step out and say, “enough of the corruption, enough of the greed, we’ve got real work to do,” and start their own organizations, well purposed, well governed, transparent from the start. Moral high ground is only difficult to attain for those unwilling to give up their vices.

Anyway, here’s my letter to Ms. Heller:

Dear Ms. Heller,

I understand you’re an opinion columnist, so I don’t ever expect to agree with you.  I think you’re entirely missing the point with your ACORN article, and the comments from readers at the bottom are closer to the truth.  It’s not the fault of accusers that good people can’t continue their good work — it’s the fault of the bad apples and bad ideas that were tolerated too long by bad leadership.

In any case, if you feel ACORN, locally at least, is doing such good work, and that there is a mass of likeminded people that agree with you, why don’t you all fund ACORN yourselves?  Or is this a case where you think ACORN should get OPM (other people’s money)?  The reliance on “free” tax dollars and the distancing of funding decisions from the people most concerned about important issues causes an explosion of greed and corruption.

Sadly, a handful of good people get tarnished.  But maybe its time for them to leave and do their own thing — because surely ACORN can’t be the only organization doing any of this work, can it?

Blame the bad guys for the problems they cause, even to innocent people.  Don’t blame the messengers.

Sincerely,
Walt Rice

Image Tile Caching, rehashed

October 2nd, 2009

A little more than a year ago, I wrote about my rather simplistic approach to caching image tiles for the interactive map viewer on PhilaGeoHistory.org. Since that time, I’ve made a few updates that are worthy of a reposting, particularly if you want to use the code for anything.

First, one of our partners, the Free Library of Philadelphia, wanted to use the script, but wanted it in ColfFusion. So I migrated it from PHP to ColdFusion. The two versions work very similarly, so you can see the current version in PHP or ColdFusion.

Second, here are the new features:

  • Store the cached images for different layers in different directories. Seems simple enough. I hesitated to do this previously because you could request multiple layers at once through the WMS script, but in practice I’ve never done it.
  • In ColdFusion, open the resulting image to make sure it is a valid image. Sometimes the file that is returned is garbage, or just an error, and you don’t want to cache it. Also, if the PNG file is smaller than 1K, it’s most likely not an image at all.
  • If the first attempt to retrieve an original tile fails, or results in an error, retry the http request again.
  • Use an appropriate file extension denoting the format of the image. Previously, just the hash of the request string was used as the filename. Now it’s the has plus the correct extension. Makes it possible to set the correct MIME type when serving up a cached image, and makes viewing problematic images in the file system a lot easier.
  • Return an HTTP header telling the client to cache the image. The results of dynamic scripts in general are not cached by browsers, but in this case, significant speed benefits arise from holding onto the images, which are very unlikely to change in any short period of time.

Further features that would be useful include recognizing the geographic extent of each layer and not caching tiles outside of that extend; recognizing empty tiles; and more efficiently storing the resulting cached files.

I don’t expect to invest too much in this, especially since there are much larger systems to do things like this (TileCache is one example). Currently, it’s too complicated for me to consider implementing, but if I need more features, or the project scales larger, I’ll have to migrate to something like it.

Georeferencing DPI Quirks

September 20th, 2009

TIFF files have horizontal and vertical DPI numbers set in the header. You can use a program like IrfanView to see and set the values.  Turns out the DPI settings have an impact on how ArcView handles coordinates for geo-referencing.  So here’s a little reference.

  • TFW world files do not seem to use the DPI values, and use straight pixels.
  • AUX.XML files, produced by the newer versions of ArcView, do use the DPI values. The list of X and Y points created during geo-referencing are the pixel location divided by the DPI value.
  • TFWX files, produced in association with AUX.XML, are just plain old world files. So if you happen to correctly resample (change pixel dimensions and DPI, such that the “inches” are still the same) a file that has an AUX.XML and a TFWX, it will display just fine in ArcView. However, a program that can’t read the AUX.XML and relies on the TFWX instead, will not put the image in the right location.

Beware that when you convert images from one format to another, you might lose the DPI setting.  JPEG and ECW files, for instance, may not have any DPI set at all. So when converted to TIFF, ArcView sees no values and uses straight pixels.  If you then open that TIFF file in Corel PhotoPaint (or perhaps Photoshop), the DPI is set to a default, like 72 dpi, and saved with the file. Suddenly the points don’t work any more, and if you reload from the saved text file of points, it still won’t work.

One last hint: you can use Excel to open the points (.txt) file and change the X and Y values in the first two columns.  If you go from a file with no DPI values to 72 dpi, divide each value (only the first two columns) by 72.  Probably can do this in the AUX.XML file too, but you’ll have to write some XSL or do it by hand.

CNN’s anti-Christian Bias?

July 7th, 2009

Codex SinaiticusJust read an article on CNN (“Oldest known Bible goes online“) about the online unveiling of the Codex Sinaiticus. This particular article is misleading as to the particulars of the difference between the ancient codex and modern Bibles, and demonstrates a complete lack of understanding on the subject (or significant anti-Christian bias) by its author.

To have apocryphal books present in an ancient codex is not unusual, nor unexpected; most of the books mentioned indeed are still present in Bibles that you can buy from the bookstore. They aren’t missing, they aren’t seditionary — but it seems the article is trumped up to make excitement that everything you thought you knew about the Bible isn’t true!

The discussion about changes and corrections in the codex does not include any thought as to whether the changes were corrections towards the accepted text or deviations from it; the part about missing passages doesn’t bother to mention whether the omissions are due to missing pages or damage or were never written.

There is also no discussion of the possible theological bent of the monastery where this was copied, which could have led the scribes to change it for their purposes (see the Jefferson Bible, for instance).

I don’t expect a news reporter to spout the standard Christian doctrine, but I do expect a discussion that respects and represents the nuance of the subject in question. And the fact that they would never write an article like this about the Koran reinforces the possibility that this is, plain and simple, anti-Christian bias.

Bad journalism, bad scholarship, and patently offensive besides. CNN, you’ve done it again!

Access 2007 Debugging Disabled?

July 2nd, 2009

So I was trying to debug a rather convoluted report-generating VBA module in Access 2007 (code which I did not write, but which I have inherited for pro-bono support). But no matter what I tried, Access would not stop for debugging breakpoints.

I did my normal Google searches to see if this was an issue, and I was finding nada on the subject, until I came across this lovely little post.

Turns out there’s a little setting in the Current Database options screen called “Use Special Access Keys.” The little help icon seems to indicate that this setting controls whether or not the special key combinations to bring up the database window, etc., will be enabled (you might disable this normally for end-users using an Access app, for instance). But what it fails to mention is that this setting also controls whether or not the debugger is active!

Check the box, close and re-open the database, and voila, breakpoints. Now I have to go back and remove all those message boxes that I was using when I couldn’t get debugging to work…

Gay mole!

May 5th, 2009

So I bought The Unlikely Disciple, a new book by Kevin Roose about his semester at Liberty University. Not usually interesting, except that Roose is a liberal Ivy Leaguer from Brown. The result is intriguing, enlightening, and downright hilarious.

The biggest mix (for me) of sorrow and laughter comes from the rampant gay jokes that permeate the campus. At the end of the semester, Roose is on the verge of being found out by the local rebel (who happens to have a knack for recognizing other rebels). Here’s the exchange:

Joey glances up at the ceiling, then shoots me a suspicious, sideways glare. Oh no. I know that look. I’ve been afraid of that look since the day I got here. That’s the look of a guy who is putting together the pieces of a puzzle. Right now, Joey is thinking: student journalist . . . came to Liberty from secular school . . . scored an interview with Dr. Falwell . . . leaving after one semester . . .

“You know, Rooster,” he says, “I almost feel like you’re a mole, and when this semester’s over, you’re gonna go back and write an article in Rolling Stone about being different at Liberty.”

I laugh — an involuntary, nervous laugh — and stammer, “What do you mean . . . different?”

“You know,” Joey says. “Gay.”

This semester, Joey has called me gay approximately ten thousand times, but this time sounds different. . . 

“So . . . are you?” he asks.

“Gay?”

“Or a mole.”

We stare at each other for fifteen seconds, tension filling the space between us. Head spinning, gut churning, I spurt out the first thing that comes to mind.

“You got me Joey. I’m a gay mole. Actually, I work for Elton John. He sent me here to recruit innocent Christian kids for his army of homosexuals. He told me to become friends with the Liberty students who seemed like closeted gays, and I picked you. Want to join?”

Joey laughs. “Suck my balls.”

He turns back to our video game, chuckling, apparently convinced of my innocence for now. Five minutes later, he looks at me again, shaking his head.

“Man, Rooster, you are one weird bastard.”

Roose is, indeed, a “weird bastard,” but he gives an amazing outsider’s look at evangelical concepts of sin, perspectives on sex and dating, and culture wars (the “God Divide“). While we obviously disagree on core issues, it’s a great book. Buy it, borrow it, read it.

Lies, damned lies, and statistics

April 22nd, 2009

It continues to amaze me how loosely most people deal with statistics, making up or inflating numbers to prove a point or make something seem more significant than it really is.

Exhibit A is an article on CNN today, about a really sad case where a boy shot himself with a gun that his parents had stored in a closet. Why it wasn’t locked up, and why it was loaded, I can’t say. But here’s the statistic in the article:

The CDC says three children per day, on average, died in accidental incidents in the United States from 2000 to 2005, the last year data are available.

The CDC has some really great data resources available, so I went to WISQARS and ran the report. Here’s what I selected, based on how the CNN article described the set:

  • Intent: Unintentional (that is, accidental) deaths
  • Mode: Firearm
  • Years: 2000 to 2005
  • Ages: Custom range from <1 to 17 (this should be what “children” means, yes?)
  • No age adjusting

The result returned was a total of 724 deaths for the six year period. Too many, yes, but three children per day? Hardly. More like one child every three days. The CNN number is inflated 9 times higher than the actual. That’s past lies and damned lies, that’s statistcal malpractice. (I sent a comment to CNN to see if they’ll correct it, but I don’t have high hopes.)

Long live Mark Twain

P.S. Here’s a great article from The Week entitled “When numbers deceive.” It looks at cancer rates and survivability and quizzes of doctors, and it’s some surprising stuff.

P.P.S. They actually corrected it, but the wording is horrendous:

The CDC says one child, on average, every three days died in accidental incidents in the United States from 2000 to 2005, the last year data are available.

And it turns out that I wasn’t the only one to catch it and write about it. The “Stormin Mormon” used this case to ponder again the limits of journalistic stupidity.

Corporate Inbreeding

March 23rd, 2009

Nell Minow has an interesting commentary piece on CNN (“Boards are real culprits in AIG mess“) that looks at the equivalent of inbreeding among the boards of directors of the companies in the middle of the financial mess, and the effects of their serial failures. Turns out we’re really not focusing on the bodies that are supposed to provide effective oversight of corporate overstepping, and in the process to revamp, revise, and review corporate governance at failing companies, we tend to leave them in place.

Favorite quote:

People say that the definition of insanity is doing the same thing over again and expecting a different result. In this case, insanity is allowing the same people to continue to serve on the board after massive failure and expecting them to produce a different result.

Now, tell me, why do we keep re-electing the losers in Congress?