Monday, December 31, 2007

Reverse Geocoding - The Resource You'll Need

The time comes in every geo hackers life when he or she will need to do reverse geocoding - that is, convert latitude and longitude to a street address. And when this time comes, the only resource you'll need is freereversegeo.com. They offer a trivial API to slurp in a latitude and longitude and give you back surprisingly accurate data.

Say you want to know the real address of 38.898563° latitude, -77.037223° longitude? Plug those coordinates into their API and you'll get:

The XML based API couldn't be easier to use. And if that weren't enough to convince you that this is a site worth holding on to, check out the commercial licensing policy:

Commercial licenses cost only around $5 per year, per company for all you can eat.

What a deal. Hold onto this site. You'll need it one day.

Sunday, December 30, 2007

Scenes From The Inner Harbor

A few photos from hanging out with Liam, and Friends. Even though the weather was cruddy, it was still fun cruising around the Baltimore Inner Harbor.


Whatever you do, don't ask me to pick the cutest one of the bunch

Liam was a perfect angel today - the poster child for a well behaved and happy kid.

Don't try this at home - Look guys, no hands!

Yes, we kicked little kids out of this game so that we big kids could play. And yes, we had fun. And no, we don't regret it.


What fun we had today!

Apache Config: Dealing with mod_dav and .htaccess files

I've been using WebDAV rather than FTP to push files to my dev server. So far, I've been happy with Apache's mod_dav and I've especially liked not having to setup and secure an FTP server.

The other day, though, I ran into a snag. I was publishing a series of files, and the server kept rejected my attempts to publish a .htaccess file. It was the oddest thing. The permissions looked fine, yet I kept getting the message:

  client denied by server configuration

in my Apache error_log.

I Googled around, and to my shock and dismay, couldn't find anyone else who had quite the problem I had. People had issues with permissions and were getting the above error, but nobody was having a mod_dav + .htaccess problem.

I was going to have to figure this out using some other technique than Googling. Ouch.

I opened up my Apache config file and saw the lines:

 # The following lines prevent .htaccess and .htpasswd files from being
 # viewed by Web clients.
 <Files ~ "^\.ht">
     Order allow,deny
     Deny from all
 </Files>

Aha! I was rejecting all requests to .htaccess files for security reasons, including publishing them. If I commented out the above settings, my WebDAV publishing worked fine. But I didn't feel comfortable with doing that, as allowing folks to get access to a .htaccess file would be a Bad Thing.

But how to control who can and can't access .htaccess files? I Googled around, and again, turned up empty handed. I knew I was going to have to do something I hadn't done in years: read the (Apache) documentation.

After poking around the docs, I learned that Limit and LimitExcept are the directives I needed to use. And more importantly, I finally understood how they work. Here's what I learned: you can take a directive, such as Order or Deny and put it in a Limit tag. Doing so, limits (well, duh), it's effect. What I hadn't realized was that the contents of a Limit tag are always valid directives on their own.

So, using my new found knowledge, I came up with:

  <Files ~ "^\.ht">
      <Limit GET POST HEAD>
          Order allow,deny
          Deny from all
      </Limit>
      <LimitExcept GET POST HEAD>
          Order allow,deny
          Allow from all
      </LimitExcept>
   </Files>

In English this says: for GET, POST and HEAD requests, reject access to .htaccess files. For other types of requests, allow it.

I'm not sure this is the most compact way to configure this (or even the most secure), but for my purposes, it'll work.

And more importantly, I finally understand one more piece of the configuration soup that is Apache.

Saturday, December 29, 2007

Where Not To Hang Out In The Mall

You'd think the intimates department would be the ideal place for a guy to hang out in the Mall. After all, there are posters of underwear models plastered all over the walls.

And yet, you'd be completely wrong.

When you step into the bra and panty section, any woman within a two mile radius is thinking the same thing: sicko.

Here I am minding my own business, and I just know that women think that I'm a sleaze, who has nothing but trashy thoughts on my mind. When of course, the only thing on my mind is: "She better not abandon me" - as the only thing worse than being caught in the intimates department is being caught alone.

At least with Shira next to me, I can give off the "help me, I'm trapped here with my wife" vibe.

We've since moved onto the petite business suit section. While this isn't as ideal a place to hang out as, say, the tool department at Sears, it is way above the skivvies department.

Oh, and apparently Macy's has taken my advice and setup a half way comfortable waiting area for guys, including a 14" television with a basketball game on it. If they tossed in a Play Station, and didn't fill up the waiting area with racks of clothes, I'd be really impressed.

--Ben

Friday, December 28, 2007

Country Music - Evolving With The Times

Country music loves break up songs. But what I find impressive is how the songs have evolved as the technology has too. Instead of just singing about hanging out in bars nursing a beer, they've gotten more advanced. Check out the lyrics from Terry Ray Thomas' I'd Email You Honey.

The day that you left was a turning point for me
I really didn’t know just how lonesome I could be
Then a friend of mine told me to buy a PC
Get a high-speed connection a nineteen-inch LCD
...
I sold all your things on EBAY, for a dollar ninety nine
I found a girl with a video camera, who just about blew my mind
I joined some dating clubs and told them all my story
Now there’s twenty-seven women who are a perfect match for me

Not that I need a break up song, mind you, but it sure makes for some fun listening.

Handy Site Of The Day: Free CSS Templates

A few days back my buddy Christian mentioned the site Free CSS Templates. I didn't think much of it, and basically forgot about it. I was then browsing TinyScheme's website and couldn't help but notice that the design of the site was simple and elegant. Most programming websites are usually as utilitarian as one can get - after all, they were designed by programmers, not designers.

Ihen I noticed that TinyScheme's website was indeed powered by freecsstemplates.org, and it all clicked together.

There are a couple of take aways from this:

  • No matter how technical your topic, presenting it in a well designed site will help it
  • There is a resource for free, clean, high quality designs out there
  • When my buddy Christian mentions something, I shouldn't promptly forget it

With 250 templates to choose from, I feel like a kid in a candy store here.

Thursday, December 27, 2007

Cooking With Shira

  1. Pizza dough - check
  2. Measuring cups - check
  3. Salt & pepper - check & check
  4. Prescription drugs - check

No wonder her pizza tastes so dang good!

Wednesday, December 26, 2007

Google Charting API

Today, I stumbled on Google's Charting API and it's too cool not to mention. It's URL based, so it's trivial to toss a chart in on page. Here's an example:

To use it, just build up an img URL:

  http://chart.apis.google.com/chart?cht=p3&
      chd=t:10.0,30.0,60.0&
      chs=250x100&
      chl=Neat|Useful|Handy

This should make adding graphs to a web app a truly easy process.

Software Tip: Upgrade Cygwin

Between cygwin and emacs, I've managed to turn my Windows box into a Unix box. Though of late, I've noticed that Cygwin commands seemed to be crashing with more frequency. Then it hit me - I haven't updated Cygwin in forever, maybe there's a newer version to install?

I checked out www.cygwin.com and things didn't look good. The site hasn't changed in years. I did a bit of Googling around and came up with this recipe to see the current version of Cygwin I was running:

 Laptop [~] cygcheck -cd | grep ^cygwin
 cygwin                  1.5.22-1
 cygwin-doc              1.4-4
 cygwin-x-doc            1.0.4-1
 Laptop [~] 

OK, so I had 1.5.22-1. And what's the latest? That's 1.5.25-7. OK, that seems like an improvement - but how much could really happen from .22 to .25? Then I checked the dates of the releases: 1.5.22 was released Nov 14th, 2006 and 1.5.25 was just released Dec 17th, 2007. Whoa! In terms of time, that's huge. Definitely time for an upgrade.

Upgrading is really simple. You can read about it here or just: (1) shutdown all cygwin apps and (2) re-run setup.exe. It will do the upgrade for you automagically

Don't forget to re-run the above command when the install is done to see what version of cygwin you have now:

 Laptop [~] cygcheck -cd | grep ^cygwin
 cygwin                  1.5.25-7
 cygwin-doc              1.4-4
 cygwin-x-doc            1.0.4-1
 Laptop [~] 

So far, cygwin seems to be behaving better. Though, it's probably too early to tell. At least the upgrade didn't do more damage than good.

Tuesday, December 25, 2007

The Christmas Tradition Continue

Shira and I are engaging in our second Christmas Tradition - going to
the movies.

We're seeing Dan In Real Life. The Drafthouse made the decision easy on
us - they had $1.00 tickets tonight. That means we'll watch a movie and
eat a pizza for cheaper than two regular price tickets.

Hope this has been a meaningful and enjoyable holiday for you. And that
whatever traditions you celebrate, there were enjoyable.

What did other folks do on Christmas? Please share in the comments.

--Ben

Monday, December 24, 2007

13 Years Of Chinese Dinners

It's been 13 years since Shira and I had our official first date. It was Christmas Eve, and the Chinese restaraurant was named Ho Ho. It was located in some way-out suburb, where we wouldn't be discovered.

Who knew that 13 years later I'd be eating Chinese food with the love of my life. And that love of my life would be Shira? And she'd conveniently be the woman I married?

Amazing.

Not a day goes by that I'm not thankful she said yes to that date.

--Ben

A Walk In The Park

Shira got the day off, and it was nice enough to really take advantage of it. We took a great walk in the Four Mile Run area in Arlington. It has just enough trees to make you feel like your in the wilderness, all while being in town.

Apparently, I'm not the only one who thinks that Arlington makes a great place to walk:

[A] December 2007 report released by the Brookings Institution ranks the Washington region first among the country's major metropolitan walkable areas per capita, citing Arlington's pedestrian-friendly urban villages and smart growth as key contributing factors. Seven of the 20 most walkable communities highlighted by the report are Arlington County urban villages.
http://www.commuterpage.com/walk/about/

Even if kids are dissapointed, I have to say, I'm quite satisfied with a 50 degree Christmas.

--Ben

Sunday, December 23, 2007

Whew, Still Married

Yesterday, while in Rochester, Shira realized she had misplaced her
wedding ring. Without the ring, I wasn't sure if we were still
married.

She had her engagement ring, so at least we were still engaged.

Tonight, when we got back to DC, she checked her purse - and among other
debris, she found her ring. Whew, we are still married.

Better take down that JDate profile now...

--Ben

Saturday, December 22, 2007

Our Body: The Universe Within Exhibit

I just finished going through the Our Body: The Universe Within Exhibit at the Science Museum in Rochester. Our Body is the exhibit which consists entirely of real bodies dissected and presented in various ways.

I'm still processing the exhibit, but I'll say:

1. I was impressed that they didn't dumb things down at all. They showed skeletons, organs, etc. and a brief description in technical terms. While some explanation was presented, the bodies did most of the talking, if you will.

2. The trend these days seems to have exhibits with lots of activities, flashing lights, movies and other extras. Bodies was just bodies. I think this singular approach was more powerful than lots of extras.

3. The running history of how the study anatomy evolved was a nice bonus. Again, this was simply, and cleanly done.

I think I liked it. But, like I said, I'm still processing.

Here's a fun fact I learned from another exhibit in the museum: The Rochester area* is the snowiest populated region this side of the Rockies. But I guess I knew that already.

* Not sure how this "region" is defined

--Ben

Friday, December 21, 2007

Welcome To Rochester

How fitting is it that we should arrive in Rochester to be met with big
'ol snow drifts.

But we were a bit thrown off - the sun was shining bright. That never
used to happen when we were kids (and were walking up hill both ways to
school).

--Ben

Thursday, December 20, 2007

Offering Your Own Live Support

I just learned about Wimzi, an AOL widget that embeds an anonymous AIM client on a web page

The result is that anyone can come along and easily chat with you, just like those fancy Live Support modules. Only, instead of some guy in a 3rd world country getting paid $0.10 a day to attempt to answer your questions, you get to talk to a real person.

So what the heck, give it a try. Ask me anything, I dare you:

On a more serious note, I've set this up on the i2x website so that people can easily contact us.

Scheme Recommendation From Google

OK, perhaps I'm exaggerating a bit. But check out what the Google Calendar API Dev Guide has to say about programming with their API:

To add a new entry, you create the entry using the client library's classes and methods, then call the feed.insertEntry() method to send the new entry to the service. Again you provide a continuation function, which the service calls when the entry has been successfully added.

If you're new to JavaScript, the control flow may be a little confusing. After calling a method like getEventsFeed() or insertEntry(), in most cases your script ends. Execution resumes in the continuation function when the service returns the requested data. Therefore, anything that your client does to the returned data should be done in the continuation function, or called from that function. You may need to make some variables global in order to use them in multiple functions.

For more information about this style of programming, see "Continuation-passing style" in Wikipedia.

And which language should you use to learn about Continuation Passing Style? Why Scheme of course. Even the Wikipedia article gives its examples in terms of Scheme.

So if you want to be a JavaScript hacker, you should learn Scheme.

Like I said, a recommendation to learn Scheme from our good friends at Google.

I think Scheme should rebrand its marketing effort: Scheme: the JavaScript of the server side.

Wednesday, December 19, 2007

New Experience In Yummyness

Try this experiment next time your at the supermarket: pay a little more and pick up a couple of persimmon fruits. The ones I just tried were yellowish-orange and a bit soft. They had a fairly nasty looking leafy growth on the top, where the stem should be.

Elizabeth bought us some as part of a gift, and they turn out to be incredibly delicious. Why have I waited my whole life to try such a tasty fruit?

Persimmons are even easy to prepare - we sliced them in quarters and ate the innards out, tossing the skin. There was no gigantic pit in the center you need to navigate (yes, I'm looking at you mango). Just pure goodness.

My taste buds really thank you Elizabeth - what a terrific treat.

--Ben

Tuesday, December 18, 2007

Helping spread the word: Freerice.com

I love it when a site goes viral. How else is it possible that Shira and I would receive recommendations from two completely independent and geographically disparate sources to check out the same site? I'll do my part and continue the trend, by mentioning it to you.

Check out: Freerice.com. The idea is clever: you play a word game, and for every answer you get right, 20 grains of rice are donated to the UN. Theory is, you can have fun, get smarter, and do your part to end world hunger all without leaving your desk. Impressive, no?

I mentioned tonight to my buddy Greg about this remarkable occurrence, and he explained to me that he had heard about Freerice.com months ago. Guess I was lagging behind on the technology curve (of course, he's a writer, and trades in words, so I suppose a word game is appropriate for him). Still, it's remarkable how some ideas can spread so effortlessly, while others just die.

Time to re-read The Tipping Point.

Monday, December 17, 2007

Leveraging Your Online Presence

Yesterday, Shira read off some scary statistic from a magazine (which of course, I can't find now) that said something to the effect of:

35% of all students will not be hired for the job they want because a recruiter will find pictures of them sprawled drunk on their dorm room floor from their Facebook profile. Don't use Facebook if you want to get a job or a spouse or become an adult.

OK, I'm exaggerating here. But the message is all over - the Internet is weapon that can screw your future up, so be very carful with it.

And this is mostly true.

What would be a interesting and novel strategy, though, would be if parents and teachers could also see the other side of this. It used to be, a recruiter looked at the same materials for everyone - their resume, application, cover letter, etc. Now, students and job seekers of today have a secret weapon. When a recruiter looks you up on line, you have a chance to shine.

Imagine if a recruiter looked you up and found a hilarious short film you put together? Or a travel journal of your summer vacation? Or a bio on a charity website you participate in. Wouldn't this same dangerous medium work in your favor?

Parents and teachers should be teaching kids how to put their best foot forward online. How cool would it be if high school guidance counselors were also SEO experts? "Johnny, your SAT scores are nice and all, but you don't show up on Google till page 3, and even then, for a lame comment you wrote on a post. Let's fix this."

Online is a double edge sword. Use one of the edges to kick butt.

The PayPal Fake E-mail Test In Action

This PalPay message that ended up in my inbox, and not spam folder is an obvious fake. You can tell this in just a few seconds by using Tip #3.

You don't even need to be a geek to apply the trick.

Tool Of The Day: WinSCP

Tonight I worked on a client's site that required me to use sFTP, instead of the more standard FTP protocol, to interact with it. I was a bit worried, as sitecopy doesn't do sFTP. My client said he used WinSCP to work with the files, so I grabbed it.

Turns out, WinSCP is an impressive little app. It does all the things you'd want an FTP client to do - allowing you to easily drag and drop files and directories. It prompts you when you're overwriting stuff, yet allows you to ignore it. You know, the usual goodies.

What earned it T.O.T.D though, was it's Keep Remote Directory Up To Date. Essentially, you setup WinSCP so that the local directory (left pane of the window) has your source files, and the remote directory (right pane of the window) are showing. You then go to Commands >> Keep Remote Directory Up To Date, answer a bunch of questions, and hit Start. From that point onward, any change you make to your local files are more-or-less instantly copied to the remote system.

It's a really handy feature, and makes remote development a snap.

I should really be looking for this feature in my regular FTP client too. That's not to say that I'm ditching sitecopy anytime soon. Sometimes having explicit control of what gets put to the server is really important. And it's especially useful when you're really developing locally and just want to push the files remotely in a sort of final deployment.

With that said, WinSCP is still quite cool and has opened my eyes to a possibility I hadn't thought of.

Update: Two things I've learned about WinSCP. (1) it does FTP, so I can start using it on a day-to-day basis and not just with sFTP sites. And (2), it's scriptable (Thanks Dave!). Seems like a real find.

Saturday, December 15, 2007

A Trip To the Mall

We just found the very best way to see Washington's monuments is at night ... in the freezing rain. We stumbled across the fabled George Mason monument on our way to a monument dedicated to some Jefferson character. Mason's eyes have seen better days, but you can sit a spell next to him without the park police hassling you. Parking was plentiful, and surprisingly, we didn't get arrested for suspicious behavior. After all, we were traipsing around taking photos of our national monuments - exactly what the terrorists would do.

Great seeing Elizabeth and getting the gang back to together. We vow to run in the morning, though, that may or may not actually happen.

Update: For the record, we did run today! 18 miles. OK, not exactly - it was more like 3 ½ - but hey, that still counts, right?

Friday, December 14, 2007

Two Sidekick Tips

Not sure how useful these tips will be, but here goes:

  • Use IM as a super fast way to exchange information between your laptop and your Sidekick. On my way out to visit a customer this morning, rather than writing down the address to plug it into the GPS, I just IM'ed it to myself. Just add your Sidekick as a buddy on your laptop and you're all set.
  • Surprisingly, the driving directions pages on Google Maps look great on the Sidekick browser. You don't get the maps part, but you do get the directions part quite clearly.

    Again, I discovered this, this morning before heading out to a client. I took the Google Maps link for my directions, ran them through Tinyurl and then IM'ed them to my device. I clicked on the link and was greeted with a nice list of driving directions. Not sure if this is Google's handy work or the Danger's - but either way, I'm impressed.

What PHP Got Right

While I may pick on PHP every once and a while, I do have to say they got at least one thing right: The Docs.

First, the comments in the manual are terrific. There's a remarkable amount of useful code that has been contributed there. Take the docs on the require_once function. In the comments is useful chunk of code that explains how to get a relative version of this function. That certainly saved me a good block of time.

The other aspect of the site that I love is their URL scheme. Essentially, you can visit the URL:

  http://php.net/<keyword>

and you'll be taken to just the right part of the site. It's a simple hook into the site search functionality, but it's beautifully done. I find myself typing URLs like:

http://php.net/explode - figure out the right order of the arguments to explode
http://php.net/gd - Learn about all the functions offered in the gd package.
http://php.net/array_length - There is no function array_length, that was just a guess. The site brings me to search results instead of a 404 page.

The result is that the site almost has a command line feel to it. Rather than scouring Javadoc pages, I just hit they key sequence Alt + d and start typing away.

Thursday, December 13, 2007

Review: The National Geographic Field Guide to Photography: Digital

The last few times I've been to the library, I've considered getting a book on photography. But every time I browse the shelves I'm underwhelmed. The books seem to be too basic or too vague. Finally, I decided I would just pick something and try it. I chose The National Geographic Field Guide to Photography: Digital by Rob Sheppard, and boy was it a good choice.

The book is short enough to qualify as a skinny book, which is gives it points to start off with. While the introduction began with basics that I could have lived without, it fairly quickly makes two suggestions I found useful:

  • Learn to read and understand the histogram that is shown after snap a photo. I've had access to this graph, but always ignored it.
  • Experiment with different color balances. This is an obvious no brainer. But still, I tend to leave the white balance on auto and ignore it. But, cool effects, and sometimes more accurate shots can be attained by playing with it.

If that's all Rob had taught me in this little book I probably would have been satisfied. But things get a whole lot better.

Much of the book is dedicated to the Digital Darkroom. In just a few pages, Rob gives a totally manageable way to attack improving your photos in Photoshop. Rather than trying to educate you about the hundreds of features of Photoshop (and related graphics programs), he explains that you can get by with understanding only 4 functions. This reduces the incredibly complicated world of photo editing to a much more tolerable size.

The book also covers topics like is digital photography as pure as film photography? (yes) and are digital pictures less reliable than film pictures? (no). It's a discussion that I could have lived without, but still one worth learning about.

I give this little gem a 9.2/10 because of the doors it's opened for me in the photo editing world.

Wednesday, December 12, 2007

ATMs Rock!

The latest Bank of America ATMs are amazing. You feed in checks and
cash, and it does the OCR thing to process it all. No envelopes or
filling out forms. Just cram it in the slot (up to a stack of 40 bills,
if you've got that many) and you're good to go.

Between this and self service package machine at the Post Office, I'm in
heaven. Forget robot butlers or flying cars - what I really want is to
avoid lines, and having to fit my life into a 9 - 5 schedule.

Kind of interesting that the banking and postal industries have a
reputation for the slowest service, yet have leveraged technology to
turn that around. If they can take on their biggest complaints, surely
other business (airlines, cell phone carriers, etc.) can too.

--Ben

Jeopardy in a 30 Minutes or Less

For the last couple years, Shira has put together a fun Jeopardy game for her office. And every year I watch her do this in PowerPoint and cringe. It's not so much the basic creation of the game (one slide has a big grid on the it, and uses hyperlinks to slides with questions) - but it's the tweaking that gets me. Whenever any change needs to happen, there are inevitably a ripple of additional changes.

So last night I did something about it. We decided to work in parallel - she'd start in on the PowerPoint version and I'd roll my own app for her. After 30 minutes, she was making good progress with the PowerPoint, but I had a beta version for her to play with. It was good enough that it convinced her to go with a more custom solution.

Check out what I ended up with here. It's an HTML / CSS / JavaScript solution, and you're welcome to grab and use the files however you wish. (Sorry about the lame default questions - I was in a hurry.)

Here's a few lessons learned from this quicky app:

  • JSON rocks! I was quickly able to roll my own file format, just like I might with s-expressions. And best of all, didn't have to spend any time on a parser. Hopefully, JSON will keep replacing XML as a format choice.
  • The HTML / CSS / JavaScript solution turned out to be a good choice. I could make a fairly dynamic app, yet have the files copied to a thumb drive and usable on any computer with a browser. No need for a network connection, either.
  • Surprisingly, laying out the main grid using CSS floats was way easier than if I had used old fashioned tables. I usually try to go tableless because it's the Right Thing Todo. But in this case, it saved a big chunk of programming headache.
  • Thanks to prototype and an HTML library that I've worked up, creating dynamic pages in JavaScript is really painless. And the HTML library allows me to make tags easily using JavaScript syntax, so I don't end up with a mess that's got tons of HTML tags embedded in my JavaScript code.

Shira uses the app in a few hours. I guess that will be the true test of whether or not it was smart to roll my own solution.

Amusement Of The Day

This amusement (not quite useful, but certainly cool!) was sent to me by Christian Cantrell. As this tip suggests you can:

¿ʇɐɥʇ sı looɔ ʍoɥ ˙uʍop ǝpısdn ǝʇıɹʍ

¡ƃolq oʇ ʇou looɔ oʇ ʇnq 'lnɟǝsn ʎɹǝʌ ʇou 'pıɐs ı sɐ

Just visit this site, enter your text normally, and copy the flipped text.

Perhaps this is useful for authoring love notes?

Monday, December 10, 2007

A Super Tiny PHP SQL Shell

I needed to run some adhoc queries against a MySQL database. I didn't have shell access, so running the mysql command was out, and I didn't have access to the standard phpMyAdmin tool. Instead, I rigged something up myself. Here's what I came up with - it's tiny, but takes any SQL I throw at it, and renders it reasonably well. Surprisingly, it even works well for commands like explain account or show tables.

WARNING: this code is really dangerous. If anyone ever found out it was running on your server, they could run any SQL command they wanted to against your database. If you don't know why this is a bad thing, don't use this script. Ever.

mysql_connect(<DB_HOST>, <DB_USER>, <DB_PASSWORD>);
mysql_select_db(<DB_DATABASE>);

$sql = $_REQUEST['<some secret parameter name>'];
$results = mysql_query($sql);
if($results) {
  echo "<pre>";
  while($row = mysql_fetch_assoc($results)) {
    var_dump($row);
    echo "\n";
  }
  echo "</pre>";
} else {
  echo "Failed to execute: [$sql]: " . mysql_error();
}

This script, combined with my URL testing hack made for a remarkably usable solution. Click a button on my browser link bar, enter a query, get the results. Who could ask for more?

Sunday, December 09, 2007

URL Testing Hack - Bookmarklets to the rescue

Tonight I had to write a PHP page that would take the term parameter from a Google AdWords link and do something useful with it. The tricky part about this is that the term parameter is whatever random text the user plugged into the search engine. This was going to require lots of testing, because no doubt people will type all sorts of junk into that search box.

My URL had the shape:

  http://somesite.com/somepage.php?term=<text users searched for>

I could have copied and pasted that URL into the browser, and then just edited it to have various combinations of text to experiment with. There are even keyboard shortcuts to make this relatively painless. But it still felt clumsy. Then it hit me - I could roll my own little bookmarklet to solve this problem.

First, I created a new bookmark for the site. I then edited the properties of the URL to say:


javascript:window.location='http://somesite.com/somepage.php?term='+escape(prompt("Term?"))

The magic, of course, is the prompt function which pops up a little JavaScript input box. The contents of the box are what's returned as the value of the prompt function. As a result, every time I hit this bookmark (which I had prominently on the link toolbar), I was asked to plug in a value for term.

I even took my setup a little further and added a debug mode to my somepage.php file. I set it up so that if it finds the parameter debug it just gives me a bunch of info as to what it would have done. I added the debug flag to the above recipe, and I had an instant interactive testing environment.

This whole bookmarklet approach seems like it could have all sorts of uses, way beyond simple testing like this. Definitely a hack to keep around.

Chanukah Yummyness

Tonight we got to attend a friend's Chanukah party, and boy, was it a treat! The latkes were absolutely perfect - just like Mom used to make. And the rest of the food was delish - from the brisket to the parve desserts (mmmmm...parve desserts). Oh yeah, the company was excellent too :-).

What a fun way to make the holiday special. I'm sure it was more than worth the points of cholesterol I earned tonight.

SNL: Christmas Time For The Jews

David recommended this classic SNL skit to me this morning. Hilarious stuff.

Best. IE. Shorcuts. Ever.

I just learned about these incredibly handy keyboard shortcuts in IE:

Address Bar shortcuts
Select the Address BarALT+D
Add "http://www." to the beginning and ".com" to the end of text in Address BarCTRL+ENTER
Add “http://www.” to the beginning and the website address suffix you have specified to the end of text in the Address Bar*CTRL+SHIFT+ENTER
Open the website address that is typed in the Address Bar in new tab ALT+ENTER

I wouldn't say it's love yet, but I'm certainly tolerating IE better. These shortcuts will actually help quite a bit.

Friday, December 07, 2007

Setting Your Default Browser in XP

To help push me to use IE even more, I thought I'd do the unthinkable: set it to be my default browser.

This was surprisingly difficult to do - I would never had guessed that the steps were:

  1. Open up Control Panels
  2. Click on Add or Remove Programs (yeah, what's that all about?)
  3. Choose Set Program Access And Defaults (again, why is this here?)
  4. Choose the Custom tab
  5. And set the Default Web Browser

How random is that? Years I've been using Windows, and I never knew to look here for any useful settings.

Another Google Maps Icon Tip: Shadowmaker

Let's say Google doesn't offer just the right icon you're looking for for your Google Maps app. What's a geek to do? Well, create your own icon, of course. This is trivial to do.

What's not trivial to do is to get the shadow image right. And attempting to use a Google Maps Icon (GIcon) without setting a shadow image will break your app.

Along comes: shadowmaker that does exactly what you want it to do: it takes your icon and generates the appropriate shadow image.

What a time saver! And the app will even spit out the code you need to use to get the settings on the icon just right. If you do Google Maps, you need this site.

Check out my first Google Maps app in the wild here.

Putting your base to work

I may be way late to the party on this one, but I just had to share. Yesterday, I stumbled on: FlipperTV. The Democratic party has basically offered the following:

  • Lots and lots of raw footage of the Republican candidates
  • The license to remix this footage anyway you want
  • A handy form where you can submit stuff you've found (and by finds I assume they mean Republican oopses)

I think this is a really clever move, regardless of the party offering it. Clearly, getting raw content from the campaign trail isn't particularly difficult. The hard party is finding the gems in it. So, why not offer a trade? You provide the content which people can use for any purpose whatsoever, in exchange for eyeballs looking it over.

It'd be a fun game/project to try to make a short film from the content. And of course, if along the way, you found one candidate bashing another or making an ass of himself, well, so be it.

I think the site would be better if they let you easily edit and create new video from inside of it. But still, it's a start.

Thursday, December 06, 2007

Working at the satellite office

Actually, this a hurried shot of Shira "at work," not me.

If you couldn't guess by my blurred photo, we've taken a micro vacation to AC for today and tomorrow.

Shira's playing downstairs, and I'm hacking away on the laptop upstairs. I love this whole mobile lifestyle. I even managed to put the three hour drive to use, doing local web development on my own apache instance.

Now, if I could get a client here in AC, I'm sure Shira wouldn't mind plenty of site visits.

--Ben

Wednesday, December 05, 2007

A White Chanukah

I think this is the first "snow storm" DC has had this year. There
might be a whole 1/2" of snow on the ground.

Though, I'm pretty impressed, nobody seems to be panicking. School
doesn't appear closed for the week, and the US Government didn't shut
down. To be fair, though, I wasn't on the roads, so I don't know for
sure.

I ran tonight in the snow and it provided a nice ambiance change.

We'll, as they say, better a white Chanukah than a white Sukkot.


--Ben

Learning to Love IE

I can think of at least one serious ooops moments with all my i2x clients, where I realized that something I was showing them worked in Firefox, but not IE. It's totally common sense to check your work in both places, but I find that it's just too easy to make that one last, itty-bitty tweak in Firefox and ship it - only to find out that you've totally broken things.

So, today I decided I would do something about it. The only reasonable solution I could come up with was to actually do development in IE. Sure, I love Firebug, and I know I can get the ability to toggle to IE in a Firefox tab - but nothing is going to get me to fully, 100%, test my stuff in IE, other than actually using it.

Switching to IE, I quickly realized some of the Goodies that I totally take for granted on Firefox.

  • The support for developer tools - I've addressed this by using the DevToolBar and Script Debugger. The tools aren't as slick as the Firefox options, but they work. One thing I have to hand to IE, is that when you have debugging turned on, it bugs the crap out of you. You want to fix the bug just so the stink'in thing will shut up.
  • Spell checking. Holy crap do I need spell checking in my browser! How did I live without this? Between my e-mail, calendar, spreadsheets, wiki and blogging, 95% of my writing (other than code) happens in a web browser. It better give me an easy way to spell check. I found IE Pro 7, a plugin that adds all sorts of features to IE, including spell checking. Seems to work great. No doubt, it's installed enough spyware on my machine to bring it to its knees (actually, so far, it really seems like high quality, well done stuff).
  • Keyboard shortcuts - hate the rodent, love the keyboard. I've studying this cheatsheet with more rigor than I did the SATs. One shortcut not mentioned (and maybe added by IE Prox 7?) is Control + Shift + Z - to re-open a closed tab. A really handy one.

So, I've sworn off the Fox. I wonder how long I can keep this up? What other plugins should I be using to make IE more palatable? Anything out there get it to emulate emacs?

Chanukah Refresher

Like most Jews, I can explain some details about Chanukah - yet when I was asked yesterday when it happened and a few details about the story, I found myself clueless. (Of course, dates aren't exactly my thing, if you asked me when the Civil War happened, I'd need to look that up too*). So, here's a few key facts about Chanukah beyond the fact that we light candles and eat yummy food cooked in oil:

  • Chanukah commemorates a military victory and miraculous event that occurred in 167 BCE. Here's the time line leading up to Chanukah:
    • 200 BCE - Jews are living independently in the Land of Israel
    • 175 BCE - Antichous IV Epiphanes becomes King Of Syria. Things start to go down hill, Jews are looted, massacred, and their religion is outlawed
    • 165 BCE - Things hit an all time low when Antichous orders a temple be created for Zeus
  • Judah Maccabee and his brothers lead a successful revolt to regain control of The Temple. Note, Judah earned the nickname Yehuda HaMakabi which means, I kid you not, Judah the Hammer. Even the WWF would be impressed with a nickname like that.
  • Along with the military victory, there's the miracle of the oil lamp - that is:
    According to the Talmud, olive oil was needed for the menorah in the Temple, which was required to burn throughout the night every night. But there was only enough oil to burn for one day, yet miraculously, it burned for eight days, the time needed to prepare a fresh supply of oil for the menorah.
    Hence the 8 days of Chanukah.
  • So, what's Chanukah all about? Well, it's certainly not about getting 8 nights worth of gifts. I think the standard prayer recited on the holiday sums it up remarkably well:
    ... [G-d] delivered the strong into the hands of the weak, the many into the hands of few, the impure into the hands of the pure, the wicked into the hands of the righteous, and insolent ones into the hands of those occupied with Your Torah.
    In other words, it's the ultimate underdog story. That'll teach the ancient Syrians to mess with us.

* - 1861 - 1865

Tuesday, December 04, 2007

Come On Baby, Light My Fire.

Happy first night of Chanukah Chanukkah Chanukka Channukah Hanukah Hannukah - ah, forget it.

Happy first night of the Festival Of Lights!

And a happy birthday to the smartest, prettiest, most wonderful wife who ever was.

--Ben

Monday, December 03, 2007

Visiting Clients

I got to thoroughly test our GPS today, as I visited two clients in DC. The nüvi did well, re-calculating the route as I took wrong turn after wrong turn.

I also drove out to Tysons, and the nüvi did a less than stellar job of routing by restaurant. It couldn't find Penara the restaurant that I incorrectly spelled as Penera (d'oh!) and finding a near by location wasn't easy either, though some of it is me just getting used to the new UI. We'll see if I continue to have issues with routing by POI.

No, I didn't have to visit a client at the Capitol, but I did get to drive close by. I'm not a huge fan of GW, but i2x is strictly non-partisan - if he has an idea, I'm glad to implement it.

--Ben

Schleping Really Big Rocks

Jenna passed me this cool video about how some dude is building a Stonehenge type structure by schleping the rocks himself.

Perhaps it's because I'm so focused on i2x, but I can't help but think of this as the perfect metaphor for how small businesses can make a huge impact. Don't just push, use leverage, gravity and lots of creativity.

An impressive feat. Though one does have to ask, nu, his wife didn't have enough for him to schlep already?

Sunday, December 02, 2007

PayPal E-mail Tips

Last Friday I was on hold with PayPal for a bit too long, and rather than listening to music, I got to hear them talk up their services. Along with mentioning their latest products, they mentioned some security tips. Specifically, what you should do if you get an e-mail from PayPal.

Tip 1 - PayPal won't ask for you person details in e-mail. This is good to know - if you get a message from PayPal asking for your password or social security number, you know it's automatically a fake. The only problem with this advice is that these nasty, technically known as phishing, e-mails look so dang real. It's hard not to trust something that looks so official. But don't.

Tip 2 - Not sure if an e-mail is valid? Send it to spoof@paypal.com to check on it. Good news, you don't need to bother your 12 your old niece to ask if an e-mail is OK to respond to or not. You can just forward the message to PayPal and ask them directly.

Tip 3 - Does the message start off with Dear <your name or business>? If not, it's almost certainly spam/phishing. This is a clever litmus test for these e-mails. What was once a marketing trick to make e-mails seem friendly is now a useful security check. The fact is, spammers or phishermen (or phisherwomen) don't know any details about the people they are sending messages to, so they can't send customized e-mails. They send them out to Dear PayPal User or some such generic recipient. If your mail message isn't customized for your, then it's probably not kosher. Still, the above tips still hold. Though this is an easy test to use whenever dealing with any questionable e-mail.