I don't even know where to begin with this post.
Part of the problem is, I tend to think in metaphors and observe similarities and interconnections that other people don't seem to be able to perceive. When I try to demonstrate these connections to other people, they just find it confusing. You'd think I'd learn it's a bad strategy, and yet this is how my mind operates when trying to comprehend something.
Imagine there's this doctor, and he's been practicing medicine for three decades. He's reasonably competent, works hard, but for some reason never kept up with the latest trends and changes in his field. The days roll by, and one day he's suddenly operating in a paradigm that's completely obsolete. And the scary part is, he is so out of touch, he doesn't even realize how out of touch he's become!
With me so far?
Now, imagine the same scenario, but with a web developer-- and let's be honest, a web developer most likely isn't operating with life and death stakes, so he has even less true motivation to keep up with the latest trends and changes in the field. And we all know how quickly things in web development can move and change, right?
Then, on top of all that, what if the web developer works for an organization that is large, where change is glacially slow at best? Where the majority of IT folks are clinging to best practices that have been rendered obsolete years ago-- or even outright ignored because someone decided they just aren't going to do things that way as a matter of personal preference.
I did an inventory of my situation the other day. Basically, because of politics at my workplace, I'm a ColdFusion developer who doesn't really have access to a ColdFusion server. This is sort of like being a magician without a rabbit. Sure, I can get by with static HTML, CSS, a bit of Javascript here and there-- but to really harness the power of dynamic web pages, the best I can do is a Filemaker Pro server on our Intranet.
It got me to thinking-- what's the point of learning Python or Ruby or PHP, when I'm never going to have access to a server that supports these languages? (Yes, I know, I can install Python on my local computer and leverage it without having a server-- but you know what I mean.) I need to flesh out and expand the depth of knowledge I have about tools I can realistically expect to have access to first, before I start spending time and energy learning "the fun stuff" I will never get to see.
So, I'm sorting through my mental inventory and the first thing that pops into my head is Javascript. All major, modern web browsers have support for Javascript, so if I put time and energy into learning that-- really learning it, mind you, not just learning enough to solve the current task I've been assigned-- then that ought to have the highest payoff in terms of being able to assist people at my work place. (Microsoft Access is second on my list, by the way, even though I'd be using it strictly on a network share, not a true web server.)
I made a trip to Borders this weekend and picked up a copy of Shelley Powers' "Learning Javascript" book. It has a copyright date of 2007, so I expect the information in it will be still fresh and current. I was even able to use a gift card I'd received at Christmas to pay for most of it.
(long pause) Um, did I happen to mention I hate Javascript?
See, I tried to learn Javascript a very long time ago (I think it was still in version 1.2, as I recall). I ran into a lot of problems with cross-browser support being . . . lame. (It's a highly technical term-- couldn't possibly explain it further.) I'd write a javascript that worked on one version of one browser, but then bombed horribly everywhere else. You'd have to write four different versions of your code, and then have some horribly kludgey way to "sniff" out which version of javascript you'd encountered and then play traffic cop to get the broswer to the specific version of code designed for it. Then a new version of one browser would come out, and things would break, and you'd need to revisit the whole damn program again.
Who can learn under those conditions? Where's the success? Where's the reward feedback loop?
A few years go by, and the ECMA ratifies a version of javascript, along with an API that should bridge most of the browser differences. I start dabbling with it again out of necessity (adding a "characters remaining" counter notice under a text box, as I recall) and still find it difficult going, although it's better than it was. Then, suddenly everyone and their brother wants their sites to have AJAX-- including the people who'd still be creating their relational databases as one gigantic flat file if it wasn't for me.
Which brings us to current day. I read Chapter 1 in Ms. Powers' book yesterday. It's well written, and it was an eye-opening experience. I found out that the things I had learned back in the day as "best practices" (e.g. using HTML comments to "cloak" your Javascript from browsers that don't support Javascript) are not only currently irrelevant, but can actually cause problems if you plan to use XHTML in your web pages!
(Damn, and to think that less than a year ago, I was taking Google to task for putting out Javascript code in their Google Analytics products that broke valid web pages-- and the solution I suggested was that Javascript cloaking trick. I'd like to thank the patient folks at Google for not sending me flaming emails, calling me a fossilized hacker wannabe.)
Today, I sat down and reread Chapter 1, while taking detailed notes in one of those black and white composition books. I'm hoping that rereading and writing down my observations will somehow ingrain the knowledge in my brain a little deeper-- maybe make it easier to break off my bad habits, as well as pick up new habits that are current best practices. It takes longer than just reading the chapter once would, of course, but if I want to be better than just an average web developer, I need to get to the point where I'm dreaming about this stuff in my sleep.
On the plus side, I'm at least savvy enough to have discovered an error in Chapter 1 on my own. (I'm sure it was a simple oversight and has already been detailed in some errata file on O'Reilly's web site somewhere.)
Man, wouldn't that be a dream job? Being one of the "technical proofreaders" who goes through the texts prior to publication, and get hands on with all the exercises and lessons-- making sure they work properly. Hmm, on second thought, you'd probably be stuck with the responsibility of fixing them somehow when they didn't work properly. Maybe not so cool after all.
I also need to figure out where the changes in trends related to Javascript would originate from (perhaps the ECMA?) and sign up for an RSS feed or email bulletin or something that will keep me from falling back out of date again if/when I do finally internalize this latest material.
A liberal arts grad on the Information Superhighway, stuck in a traffic jam at the intersections of Technology, Psychology and Security.
Showing posts with label web dev. Show all posts
Showing posts with label web dev. Show all posts
Sunday, October 26, 2008
Wednesday, August 27, 2008
"Hacking" Blogger's Profile Search, Part II
Last week I wrote about how Blogger's Profile Search feature allows users to locate Bloggers in other countries, and how you can tweak the URL parameters to find people without even knowing a single blog in your country of interest as a starting point. The process is simple and workable-- just view source on your "Edit Profile" screen to learn the two letter country code of the country you are interested in (example: VA for Vatican), and then append that code to the search URL, like so:
http://www.blogger.com/profile-find.g?t=l&loc0=VA
Not bad, but who wants to "View Source" every time they want to look up a new country? Besides, some of our friends and family members (who aren't necessarily web developers) might want to also play along-- and this solution isn't user friendly for non-geeks. They're bound to mess up the URL somehow.
How about a web form that lets users select a country from a drop-down list of all the countries? And, instead of manually modifying a URL, all they have to do is hit the "Submit" button?
This turns out to be surprisingly easy-- it just requires a little HTML.
Let's take it apart and see how it works. We start with a basic form tag:
<form action="http://www.blogger.com/profile-find.g" method="get">
. . . we'll flesh out this bit later on . . .
<form>
The action attribute above, which tells the form where it should send its information when the submit button is pressed, is pointing at the same URL we used last time for Blogger's profile search-- except there don't seem to be any parameters tacked on to the end of the URL. Don't worry, we'll be teaching our form how to add that extra stuff to the end of the URL "behind the scenes." We will do that by using the form's "get" method.
Before we go any further with our form, let's take a second look at that example URL from before:
http://www.blogger.com/profile-find.g?t=l&loc0=VA
See that "t=l" bit in the middle there that I've bolded for emphasis? Blogger's Profile Search feature can actually find Bloggers in many different ways: by location, by occupation, by interest, favorite book titles, etc. That "t=l" business lets Blogger's Profile Search program know that you are interested in carrying out a search by location. For you mnemonic learners out there, that's t (as in type) equals l (as in location).
We need to make sure our form passes that "t=l" parameter to the Blogger URL before passing the country code. We also want to make sure it can't be changed/messed up by our non-web geek friends. The best way to accomplish both goals is to put a hidden field in the form, like so:
<form action="http://www.blogger.com/profile-find.g" method="get">
<input name="t" value="l" type="hidden">
. . . the drop down list of countries will eventually go here . . .
<form>
Now that we know our form will always specify the "search by location" type of query, we can focus on the "heavy lifting" part-- namely listing all the countries in a drop down list. The important bit to remember is to name the select tag with the same parameter label (i.e. loc0) the Blogger search URL is expecting. If I were to name it something like "countryList" it won't work.
<form action="http://www.blogger.com/profile-find.g" method="get">
<input name="t" value="l" type="hidden">
<select name="loc0" id="loc0" style="font-family:Verdana, sans-serif;">
<option value="_nil_">Select a country</option>
<option value="AF">Afghanistan</option>
. . . I'm not going to type in the entire country list, just enough to convey the idea . . .
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>
</select>
. . .
<form>
I'll leave the specific text content and styling of the form (e.g. background color, font, border, etc.) to your personal tastes. That leaves us with the actual submit button:
<form action="http://www.blogger.com/profile-find.g" method="get">
<input name="t" value="l" type="hidden">
<select name="loc0" id="loc0" style="font-family:Verdana, sans-serif;">
<option value="_nil_">Select a country</option>
<option value="AF">Afghanistan</option>
. . . I'm not going to type in the entire country list, just enough to convey the idea . . .
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>
</select>
<input type="Submit" value="Submit" / >
<form>
http://www.blogger.com/profile-find.g?t=l&loc0=VA
Not bad, but who wants to "View Source" every time they want to look up a new country? Besides, some of our friends and family members (who aren't necessarily web developers) might want to also play along-- and this solution isn't user friendly for non-geeks. They're bound to mess up the URL somehow.
How about a web form that lets users select a country from a drop-down list of all the countries? And, instead of manually modifying a URL, all they have to do is hit the "Submit" button?
This turns out to be surprisingly easy-- it just requires a little HTML.
Let's take it apart and see how it works. We start with a basic form tag:
<form action="http://www.blogger.com/profile-find.g" method="get">
. . . we'll flesh out this bit later on . . .
<form>
The action attribute above, which tells the form where it should send its information when the submit button is pressed, is pointing at the same URL we used last time for Blogger's profile search-- except there don't seem to be any parameters tacked on to the end of the URL. Don't worry, we'll be teaching our form how to add that extra stuff to the end of the URL "behind the scenes." We will do that by using the form's "get" method.
Before we go any further with our form, let's take a second look at that example URL from before:
http://www.blogger.com/profile-find.g?t=l&loc0=VA
See that "t=l" bit in the middle there that I've bolded for emphasis? Blogger's Profile Search feature can actually find Bloggers in many different ways: by location, by occupation, by interest, favorite book titles, etc. That "t=l" business lets Blogger's Profile Search program know that you are interested in carrying out a search by location. For you mnemonic learners out there, that's t (as in type) equals l (as in location).
We need to make sure our form passes that "t=l" parameter to the Blogger URL before passing the country code. We also want to make sure it can't be changed/messed up by our non-web geek friends. The best way to accomplish both goals is to put a hidden field in the form, like so:
<form action="http://www.blogger.com/profile-find.g" method="get">
<input name="t" value="l" type="hidden">
. . . the drop down list of countries will eventually go here . . .
<form>
Now that we know our form will always specify the "search by location" type of query, we can focus on the "heavy lifting" part-- namely listing all the countries in a drop down list. The important bit to remember is to name the select tag with the same parameter label (i.e. loc0) the Blogger search URL is expecting. If I were to name it something like "countryList" it won't work.
<form action="http://www.blogger.com/profile-find.g" method="get">
<input name="t" value="l" type="hidden">
<select name="loc0" id="loc0" style="font-family:Verdana, sans-serif;">
<option value="_nil_">Select a country</option>
<option value="AF">Afghanistan</option>
. . . I'm not going to type in the entire country list, just enough to convey the idea . . .
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>
</select>
. . .
<form>
I'll leave the specific text content and styling of the form (e.g. background color, font, border, etc.) to your personal tastes. That leaves us with the actual submit button:
<form action="http://www.blogger.com/profile-find.g" method="get">
<input name="t" value="l" type="hidden">
<select name="loc0" id="loc0" style="font-family:Verdana, sans-serif;">
<option value="_nil_">Select a country</option>
<option value="AF">Afghanistan</option>
. . . I'm not going to type in the entire country list, just enough to convey the idea . . .
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>
</select>
<input type="Submit" value="Submit" / >
<form>
Tagged as
Blogger,
hacking,
profile search,
web dev
Sunday, May 25, 2008
Google Maps and Gasoline
Can Google Maps help you conserve gasoline?
Let's say you are planning to drive on an extended trip-- perhaps from Washington, DC to Montreal, Canada, for example. You might go to Google Maps to get your travel directions.
In addition to the various roads and turns to make, Google Maps provides you with the approximate distance (610 miles) and estimated duration (10 hours) of the trip.
Although Google doesn't show you multiple routes to your destination, per se-- you can "grab" the path and adjust it to avoid certain roads. If you kept an eye on the time (first and foremost) and the distance (secondary, I should think), that'd give you enough raw data to determine which route should use less gas.
If someone wanted to get really sharp about it, they'd create some Google Maps mashup with one of those Gas Buddy type web sites-- and then integrate the method above so as to take you through destinations with the cheapest gasoline prices.
And, if I thought of it-- odds are someone else thought of it before I did. Someone smarter and with bigger web programming chops. This might already exist out there somewhere-- it's just a matter of finding it.
Let's say you are planning to drive on an extended trip-- perhaps from Washington, DC to Montreal, Canada, for example. You might go to Google Maps to get your travel directions.
In addition to the various roads and turns to make, Google Maps provides you with the approximate distance (610 miles) and estimated duration (10 hours) of the trip.
Although Google doesn't show you multiple routes to your destination, per se-- you can "grab" the path and adjust it to avoid certain roads. If you kept an eye on the time (first and foremost) and the distance (secondary, I should think), that'd give you enough raw data to determine which route should use less gas.
If someone wanted to get really sharp about it, they'd create some Google Maps mashup with one of those Gas Buddy type web sites-- and then integrate the method above so as to take you through destinations with the cheapest gasoline prices.
And, if I thought of it-- odds are someone else thought of it before I did. Someone smarter and with bigger web programming chops. This might already exist out there somewhere-- it's just a matter of finding it.
Tagged as
Google Maps,
web dev
Sunday, November 4, 2007
Javascripts work better when you remember to include them
I have no delusions of grandeur when it comes to my website traffic. When the number of automated webcrawler bots outnumbers visitors who actually require oxygen in order to survive, you get a pretty clear picture of how unimportant you are in the grand scheme of things. ;)
But I knew something was wrong when I pulled up my Google Analytics and I have zero visitors for the entire month of October. Heck, I visit my blog at least once a week, and I didn't set up any filter to ignore my visits!
It turns out, with all the template revising-- trying to get the page into valid HTML shape and all-- I wound up removing the piece of Javascript that Google Analytics uses to gather site visitor data! LMAO!
I'm such a numbnutz sometimes, honestly. Needless to say, I've restored the code now.
But I knew something was wrong when I pulled up my Google Analytics and I have zero visitors for the entire month of October. Heck, I visit my blog at least once a week, and I didn't set up any filter to ignore my visits!
It turns out, with all the template revising-- trying to get the page into valid HTML shape and all-- I wound up removing the piece of Javascript that Google Analytics uses to gather site visitor data! LMAO!
I'm such a numbnutz sometimes, honestly. Needless to say, I've restored the code now.
Tagged as
Google Analytics,
web dev
Saturday, April 14, 2007
Wine411, revisited
I gave my Wine411 web reference a "dry" run today at lunch. Although it did work, it had some issues that kept it from being a smashing success in my mind. First, the navigation is far from intuitive-- so I need to find a better way to manage that. Second, the pages take too long to download on a GPRS phone-- so I've reverted the template for that blog back to a Classic Template and pared it down as thin as I can manage.
Wednesday, April 11, 2007
World Wine (sic) Web ;)
Sorry I haven't made a blog entry for the past several days, but I've been immersed in my latest web dev project. It's far from ready for prime time, but I think it's far enough along that I can at least debut it with a huge asterisk that says "BETA" on it.
(Hey, Microsoft and Google do it all the time-- so why not? LOL)
Several weeks ago, I was listening to the GQ Magazine podcast, and the topic of discussion was "All you need to know about wine." This rekindled in me the interest to try learning more about wine again. After some trial and error, I discovered that I seem to like red wines better than white wines, and my favorite red at this moment is the Cabernet Sauvignon.
Of course, you aren't supposed to have wine all by itself-- if you want to really enjoy it, you need to pair it with a complimentary food. I have some acquaintances who are fantastic at this, but I have no sense for this sort of pairing. Fortunately, there are reference guides and books for people like me, but who wants to walk into their favorite restaurant with a copy of "Wine for Total Friggin' Morons" tucked under their arm? Nothing says "NOOB!" like a black and yellow book.
Having a condensed version of a food pairing guide on your cell phone, on the other hand . . . .
So, I created a relational database, worked out all the various tables, the foreign keys, the relationships, etc. only to realize that I'd need to host this somewhere that had mySQL and PHP or Perl! Well, don't get me wrong-- this is an entertaining diversion, but spending $8 or $10 a month just so I can have my own personal wine/food pairing reference seemed pennywise and pound foolish.
So, there I sat with my glass of Cabernet Sauvignon, stymied. Perhaps it was a flash of genius, or perhaps I was just a little drunk (???), but that's when it occurred to me that you could use Blogspot's search capability, its tags, etc. as a form of application platform. You'd need to cut the template down tremendously to get it to display on older cell phones properly. At this point, it had become more of a novelty and challenge than a practical solution-- so I started entering each wine as an individual post, and labeled them with matching food pairs.
I still need to cut the template code down quite a bit, but it seems to function on my old Nokia 3100 with a few glitches here and there.
And that is how Wine411 came to be. Enjoy!
(Hey, Microsoft and Google do it all the time-- so why not? LOL)
Several weeks ago, I was listening to the GQ Magazine podcast, and the topic of discussion was "All you need to know about wine." This rekindled in me the interest to try learning more about wine again. After some trial and error, I discovered that I seem to like red wines better than white wines, and my favorite red at this moment is the Cabernet Sauvignon.
Of course, you aren't supposed to have wine all by itself-- if you want to really enjoy it, you need to pair it with a complimentary food. I have some acquaintances who are fantastic at this, but I have no sense for this sort of pairing. Fortunately, there are reference guides and books for people like me, but who wants to walk into their favorite restaurant with a copy of "Wine for Total Friggin' Morons" tucked under their arm? Nothing says "NOOB!" like a black and yellow book.
Having a condensed version of a food pairing guide on your cell phone, on the other hand . . . .
So, I created a relational database, worked out all the various tables, the foreign keys, the relationships, etc. only to realize that I'd need to host this somewhere that had mySQL and PHP or Perl! Well, don't get me wrong-- this is an entertaining diversion, but spending $8 or $10 a month just so I can have my own personal wine/food pairing reference seemed pennywise and pound foolish.
So, there I sat with my glass of Cabernet Sauvignon, stymied. Perhaps it was a flash of genius, or perhaps I was just a little drunk (???), but that's when it occurred to me that you could use Blogspot's search capability, its tags, etc. as a form of application platform. You'd need to cut the template down tremendously to get it to display on older cell phones properly. At this point, it had become more of a novelty and challenge than a practical solution-- so I started entering each wine as an individual post, and labeled them with matching food pairs.
I still need to cut the template code down quite a bit, but it seems to function on my old Nokia 3100 with a few glitches here and there.
And that is how Wine411 came to be. Enjoy!
Subscribe to:
Posts (Atom)