Client-side query term highlighting demo using jQuery

Yesterday, the subject of “static vs. dynamic websites” came up and an example of “something that requires dynamic page assembly” was search query term highlighting. In other words, using the HTTP Referer header (yes, it’s misspelled but that’s how it is in the spec) header and parsing it and if it’s a click-through from a search engine results page (SERP), using the search terms to highlight occurrences of them in the page.

I argued that while you could do this server-side, that this wasn’t necessary; it could be done client-side, too. In modern browsers, the “referer” (sic) information is available through JavaScript in the document.referrer (spelled correctly) variable. (NB: If you’re looking for document.referer, you’ll get frustrated. It’s actually spelled correctly in JS.)

As my suggestion to use JS and DHTML on the client-side wasn’t getting across, I decided to implement a quick proof-of-concept demo using jQuery, a fantastic JavaScript library that’s light on bytes but heavy on the features. Here’s a link to the demo:

Client-side query term highlighting demo using jQuery

Here’s the few lines of CSS and JS that makes it work:

</p> <style type="text/css"> .qterm { color: #444; background-color: #ee9; font-weight: bold; } a span.qterm { color: #00f; text-decoration: underline; } a:hover span.qterm { color: #666; } </style> <p><script language="JavaScript"> $(document).ready(function() { if (!document.referrer) return; var matches = document.referrer.match(/[?&]q=([^&]*)/); if (!matches) return; var terms = unescape(matches[1].replace(/\+/g, ' ')); var re = new RegExp().compile('(' + terms + ')', 'i'); $("body *").each(function() { if ($(this).children().size() > 0) return; if ($(this).is("xmp, pre")) return; var html = $(this).html(); var newhtml = html.replace(re, '<span class="qterm">$1</span>'); $(this).html(newhtml); }); }); </script></p> <p>

It is really that simple. Now you see why I love jQuery.

Tags:
,
,
,
,
,

Tcl’2006, or why I don’t travel to conferences much

The annual Tcl conference, Tcl’2006, is going to be held in Naperville, IL, this year, during the week of October 9-11. At a bare minimum, if I only go for the technical sessions, the registration is $395 (with the $100 early-bird discount that ends October 1st) and covers October 11-13. Airfare from Newark (EWR) to O’Hare (ORD) on Continental, according to Travelocity.com, would be $173.60 round-trip, if I fly out the evening of October 10th and return the evening of October 13th (Flights 1193/1174). Hotel rooms at $99/night for those 3 nights will run me $297 plus taxes.

Not including meals and other incidental expenses (transportation to and from the airport, etc.), we’re talking close to $900 to attend. That’s a lot of money to be spending out of my own pocket. Given the attendees and speakers, it’d be worth it, but on top of existing expenses, it’ll be hard to come up with the money.

I guess I have a few weeks to try and scare up some consulting work to pay for it.

Tags:
,

Personals for married couples? Make any sense?

The other day, I got an email from Susan Mernit (an AOL alumnus, now at Yahoo! Personals), that really got me thinking. I’m a firm believer that the best products are created by people who create them for themselves, to scratch an itch they have. Of course, this isn’t the only way to create great products, but I suspect it helps a great deal.

I’m married and have children. Online match-making sites don’t exactly cater to folks who aren’t looking to, well, find a romantic match. There’s a wellspring of social networking sites (MySpace, etc.) that purport to connect people, but there’s such a large population of singles out there that it seems most people you meet online are looking to find dates and/or hook up. Some online dating sites have gone as far as explicitly excluding married folks from even participating. Others imply that married folks are there to cheat on their spouses, or are looking to swing. What ever happened to, well, friendship? You know, the platonic kind? Are we really that sex-driven as a society and culture?

Of course, you have companies like eHarmony that boast extensive self-service tests that can be used to match you up with someone who is statistically compatible with you. For a long time, I’ve wondered: if my wife and I had both completed our profiles at eHarmony, would their system have matched us up? It seems that someone over there had a similar thought and they now have a service for married couples: eHarmony Marriage. This is great and I’m going to try and convince my wife to try it out with me. I’ve just registered and sent her an invite.

But, this still leaves a gap that I’m still looking to fill: finding friends. eHarmony could fill the gap by using their profiles to connect people who are looking to just make new friends. Not having used their service, I don’t know if they already do this, but all the promotional materials seem to heavily imply that successful use of their products results in marriages. There must be a sizable audience of married couples who are still interested in meeting new people who are likely to be compatible, but aren’t looking for a romantic relationship? Am I really that strange? Is the notion of a platonic match-making service so crazy? Personals for married couples, to meet other married couples and/or singles who want to make new friends?

Tags:
,
,
,
,

My celebrity collage by MyHeritage.com

The folks at MyHeritage.com are creating some interesting facial recognition software and one of their applications involves uploading a picture, their software recognizes the face in it, then matches it to other faces in their database. You can now get a collage of faces that matches … you can see mine below.

Interestingly, 4 out of 8 of the matches are female faces … I guess if humans have a hard time guessing my gender right (you’d be surprised), it’s no wonder a computer would have just as hard a time.

Tags:
,
,

Phanfare, a photo/video hosting startup, in New Jersey, too!

Living in New Jersey, I really like to avoid having to go into New York City. But, being a technologist, there’s so many companies there, so often when I’m looking for work, the jobs are all in NYC. Today, I’ve come across a startup right here in Metuchen, NJ, called Phanfare, a photo/video hosting company similar to Flickr and YouTube, combined.

What I like: the CEO, Andrew Erlichson is blogging. What I dislike: they’re in the business of making desktop software. I found this funny:

Instead of a slow and clunky web interface, you interact with a zippy program running on your computer.

Uh, how about a fast and not-clunky web interface, that I interact with a zippy programm running on my computer (you know, that “web browser” thingy)? Hello, 1998 is calling and it wants it’s client-server architecture back.

To be fair, for managing any significant amount of large assets like photos and videos, having a helper application running on the client’s machine outside the browser is probably necessary, due to all of the important security restrictions placed on code that runs within the browser. However, having to support client software across platforms is just such a headache. I’d at least develop it in something portable like Tcl/Tk so the same code could be run without modification across platforms.

Well, I wish the Phanfare team lots of luck: I’d like to see more startups in New Jersey! Perhaps one that I’d really like to be a part of who would like to have me on their team.

Tags:
,
,
,
,

My definition of “software design archeology” and “software anthropology”

I recently used the term software design archeology and realized that it’s not a widely used term from what I can tell, so I felt it might be a good idea to clearly present a definition for it. A complementary term, software anthropology should probably get a definition, as the two are related. I welcome any criticism or feedback about my use and definition of these terms, so we can all share a common vocabulary around the activities they represent.

My working definition starts by taking the existing definitions for archaeology and anthropology and replacing the references to humans with the phrase “software design” along with other relevant changes. I’m not sure if this constitutes plagiarism, but it is certainly not what is intended. The definitions I’m starting with are certainly not my own and my new use of them is simply derivative work for the benefit of the scientific community to broaden our shared vocabulary.

archeology[1], n.: The systematic study of past human life and culture by the recovery and examination of remaining material evidence, such as graves, buildings, tools, and pottery.

software design archeology, n.: The systematic study of past software’s design by the recovery and examination of remaining material evidence, such as design notes, chat logs and transcripts, mailing list archives and interviews.

anthropology[2], n.: The scientific study of the origin, the behavior, and the physical, social, and cultural development of humans.

software anthropology, n.: The scientific study of the origin, the behavior, and the physical, social, and cultural development of software.

[1] “archaeology.” The American Heritage® Dictionary of the English Language, Fourth Edition.
Houghton Mifflin Company, 2004. Answers.com 08 Aug. 2006.
http://www.answers.com/topic/archaeology

[2] “anthropology.” The American Heritage® Dictionary of the English Language, Fourth Edition.
Houghton Mifflin Company, 2004. Answers.com 08 Aug. 2006.
http://www.answers.com/topic/anthropology

Is the time ready for such a study to be undertaken by academics? Is there sufficient interest? Would a university recognize this as a worthwhile endeavour? I’ve been thinking lately about pursuing a Masters or Ph. D. degree, perhaps this could be something I could pursue. Any suggestions where to start?

As always, I welcome everyone to leave a comment below. Thanks!

Tags:
,
,
,

Dilbert: Where’s your artificial sense of urgency?

Dilbert, 2006-07-25

Dilbert, to PHB: Is it more important to follow our documented process or to meet the deadline?
Dilbert: I only ask because our deadline is arbitrary and our documented process was pulled out of someone’s lower torso.
PHB: Where’s your artificial sense of urgency?
Dilbert: Teamwork killed it.

Some days, I swear, Scott Adams must be following me around, watching me work.

Tags:
,
,
,

Our nine senses? Exactly what is a sense, anyway?

Mark Poesch asks on his blog, “Why is it that all children are taught that they have only “five senses”…. Doesn’t a sense of gravity (i.e., acceleration) count as a sixth? …could you live without it?” I responded in the comments that I tend to think that it falls under the sense of “touch” as there’s a physical mechanism in the inner ear–specifically, the macula utriculi and macula sacculi[1]–that is responsible for our sense of gravity or linear acceleration.

No surprise, the Wikipedia entry for “sense” points out that the definition of “sense” isn’t well defined. Given a certain definition of sense, there are nine human senses: vision (sight), audition (hearing), gustation (taste), olfaction (smell), tactition (touch), thermoception (heat, cold), nociception (pain), equilibrioception (balance, gravity), proprioception (body awareness). So, it seems Mark is right, conventional wisdom considers gravity its own separate, dedicated sense.

However, in the comments to his blog entry, I asked: “What about “sense of time”? Is that simply cognition (and not a sense)? Probably.” Of course, Wikipedia has an entry on “sense of time” too, which says: “Although the sense of time is not associated with a specific sensory system, the work of psychologists and neuroscientists indicates that our brains do have a system governing the perception of time.” Why isn’t it associated to a specific sensory system? Is the prerequisite for a sense that it must have a corresponding sense organ? This can’t be, since thermoception, nociception and proprioception fail to meet this criteria. If senses are the perception of stimuli, the passing of time definitely causes a stimulus which we perceive.

It appears that back in 2001, researchers identified that the basal ganglia and the parietal lobe are responsible for perceiving the passage of time. Perhaps this provides for a solid explanation for deja vu and other temporal sensation anomalies?

What do you think? Share your thoughts in the comments below.

Tags:
,
,
,
,

Japanese Pastafarians and Pilates, huh?! Non sequiturs abound!

Taking a quick break while working tonight, I decided to surf some USENET and saw this message in alt.religion.pastafarianism:

coj wrote:

I just saw “The complete book of Pilates”

Shivel me timbels…one flom your lockel Jones San?

To my Japanese Pilates bretheren, I say, “ALLLLLLLLL!” (Of course, the Japanese know that ninjas are cooler …)

(If this makes absolutely no sense to you, perhaps you should brush up on your Engrish.)

Tags:
,
,
,
,
,

jQuery 1.0a (alpha) released June 30, 2006

John Resig announces jQuery 1.0a (alpha). If you do any client-side Javascript, you owe it to yourself to check out jQuery. If you’re a developer of a JS library, you really ought to pay attention to what John’s doing in jQuery, because he’s doing things right.