Controls Without Borders

November 1st, 2009 gharls No comments
One Mile Record Holders Gunder Haag (SWE, 4:04.6) and Arne Andersson (SWE, 4:02.6, 4:01.6) in September 1942, July 1943, and July 1944

One Mile Record Holders Gunder Haag (SWE, 4:04.6) and Arne Andersson (SWE, 4:02.6, 4:01.6) in September 1942, July 1943, and July 1944

We’re sure many self starters have grumbled often over the odd way in which Internet Explorer treats radio buttons and checkboxes … and many of us have pulled our hair out trying to rid ourselves of those unsightly borders and background colors which surround such controls in IE.

What to do?  We use a simple trick … we simply assign a class to to the control that in turn sets the background to the matching container, and then set the borders to 0. We also set off the class in our CSS as an IE specific class, either with a leading asterisk or other correspondinng command, depending on which versions of IE we need to solve for.  Our ugly rendering disappears in IE while correctly working in the other browsers.

Try it out. You’ll see the difference.

Cross Browser Blues

October 26th, 2009 gharls No comments
1932 24 Heures du Mans Overall Constructor Champion Alfa Romeo 8C 2300 (ITA (2), Sommer-Chinetti)

1932 24 Heures du Mans Overall Constructor Champion Alfa Romeo 8C 2300 (ITA (2), Sommer-Chinetti)

Every web designer has experienced that horrific moment after developing a site in one browser, and then later sagging to his or her knees after opening up the same in a different browser.  The garbled greeting one encounters in such situations seems quite daunting, yet do not panic … it’s just those cross browser demons out taking a stroll.  A full primer on solving cross-browser compatibility issues would fill a tome, so let’s just stick to the basics:

1. As a matter of prudence, one should develop a new site in a protected development directory that prevents public viewing until proper release. Under such controlled conditions, a developer can work out all the niggles before presenting your work to the world for both admiration and scorn.

2. Always run your new site markup through a validator.  A handy one can be found here.

3. If possible, one should develop the site with Internet Explorer as the web viewer. We know, we know, IE does not seem to play fair with our HTML markup, yet its restrictive nature will swiftly reveal your errors versus its more lenient cousins such as Firefox and Safari. Although one must check your markup in all browsers, one general maxim seems to hold fast … if your page renders in IE, it will render anywhere.

4. In our experience, the proper intermixing of <div> tags, <table> tags, and <form> tags generally create the most trouble in a cross browser context. Please be sure to test all of your table and form markup, and always leave yourself enough room, both figuratively and literally, for a page redesign, since each browser has its own rules about default margin and padding behavior.

5. Although most web experts scream at those who utilize browser-specific CSS rules, it’s an unfortunate reality of weblife. No one resource or primer includes all of the instances where one will require a browser-specific CSS rule, so prepare yourselves for some rigorous research with a search engine.  Believe us … someone else has encountered your cross-browser solution in the past and posted a solution on the web.

Lock and Load

October 18th, 2009 gharls No comments
One Mile Run World Record Holder Arne Andersson (SWE, second from left, 4:06.2) in July 1942.

One Mile Run World Record Holder Arne Andersson (SWE, second from left, 4:06.2) in July 1942.

Still encountering some problems preparing your cool page effects (we call them ‘blinkies’) for those users who have Javascript disabled in their browsers?  In most cases, a static image that rests behind your page object will do, while in more complex cases, you may have to resort to a page redirect (yak).

But what about those cases when your Javascript effect truly leaves an undesirable residue for non-script uses (slideshows, for instance), and a page redirect remains utterly inappropriate?

If you’re a user of jQuery, do not forget about the library’s load() function.  With load(), you can place the ugly html into a separate file that will only load into your view page on command.  By using load(), now you can again revert to some form of static image or html to display on the view page if your web visitor elects to disable Javascript in the browser.

Does ‘Stargate Universe’ Have The Legs?

October 13th, 2009 gharls No comments
Will SGU Survive the Ratings Gauntlet Despite its Detractors?

Will SGU Survive the Ratings Gauntlet Despite its Detractors?

Many of us hooked-by-the-cheek sci-fi fans are closely watching the rollout of MGM’s new cut on its refried ‘Stargate’ franchise, ‘Stargate Universe’.  Remade with fresh faces and an inspired plot arc, the series shows true promise, yet detractors are already screaming at their television screens over some of the details …

1.  Many believe the show is simply trying to rip off ‘Battlestar Galactica’ with its dark lighting, eerie and cavernous spacecraft setting, and serial-like pacing. The critics do have some points … no matter how much one glazed over while watching ‘SG-1′ and ‘Atlantis’, each of us deep inside knew that each episode was a fully canned story, wire-to-wire.  We could watch the last fifteen minutes, get our closure, and then get back to auto racing on DVR.  The new ’space opera’ format for sci-fi television, designed to build a cult following, simply wears one down after several episodes.  Come on networks, we simply don’t find primetime television all THAT interesting … especially appointment-oriented television.  Yak!

2. Some of us fans think that MGM laid an egg with its casting of David Bruce (’math boy’ Eli Wallace) as one of the show’s prime protagonists … we can appreciate the whole ‘geek-saves-the-cosmos’ hook, yet if you’re going to rip ‘BSG’, you might as well go all the way and cast a strong female ‘Starbuck’-esque character in the part.  The whole ‘assertive-woman-confined-within-the-walls-of-a-spacecraft-and-with-their-pick-among-the-men’ thing works well with your demographic … trust us.  Throw in some smouldering resentment and snug-fit upperwear, and heck, who needs NetFlix?  Appointment television 1, reality television 0.

BTW … this whole ’serial’ thing by the networks will surely finish off both ‘Flash Forward’ and the upcoming ‘V’.  Just wait and see.

Attention producers: Want a winning formula? Try watching the X-Files wall-to-wall.  Each episode was its own canned universe while artfully keeping the audience hooked into the overall ‘ufo conspiracy’ arc with clever references and nuance.

Categories: Weblife Tags:

Oh Baby … You Don’t Have To Go

October 13th, 2009 gharls No comments
1931 24 Heures du Mans Overall Constructor Champion Alfa Romeo 8C 2300 (ITA, Howe-Birkin(2)).

1931 24 Heures du Mans Overall Constructor Champion Alfa Romeo 8C 2300 (ITA, Howe-Birkin(2)).

Just as the great Jimmy Reed once wailed, you truly can keep your website visitors in the corral while allowing them to peek at other web content via your links.

One of the easiest means by which to accomplish the task is simply to use a bit of Javascript and a readily accessible jQuery plug-in to create an overlay window that displays the linked web page.  Your user gets a door to the outside web, yet upon click off, the same person remains at your site.

Examples abound on the web about how to install such functionality with the Greybox plug-in.  An easy starter lesson can be found in David Sawyer McFarland’s Javascript, The Missing Manual.  Also, here’s another example for any racing buffs out there.

Any self starter can have such functionality up and running in mere moments.

Adobe Flash Forward

October 11th, 2009 gharls No comments
One Mile Run World Record Holder Gunder Hägg (SWE, 4:06.1) in July 1942.

One Mile Run World Record Holder Gunder Hägg (SWE, 4:06.1 rounded) in July 1942.

Many self starters placing Adobe Flash with Javascript into their websites for the first time invariably forget the prime rule regarding both tools … some users, for both rational and  irrational reasons, disable Javascript within their browsers.  With Javascript offline, all of your hard Flash work simply vanishes into the ether … and leaves your user with a big empty space on the web page instead of viewing that cool animation you intended to hold eyeballs.

A lot of code examples exist on the Web regarding how to detect enabled Javascript within a user’s browser, yet a simpler approach works just as well as the bithead solution.  First, place your Flash object within an HTML table cell matching the Flash dimensions … be sure to set the table cellpadding attribute to ‘0′.  Second, set the background image for the table cell to a static image (matching Flash dimension size) to your liking.

Voila!  If your user has Javascript disabled in their browser, at least they will get to see your planted image instead of a blank spot on your page.

Reading From A Prepared Statement …

October 7th, 2009 gharls No comments
1930 24 Heures du Mans Overall Constructor Champion Bentley Speed Six (GBR, Barnato (3)-Kidston).

1930 24 Heures du Mans Overall Constructor Champion Bentley Speed Six (GBR (5), Barnato (3)-Kidston).

Often utilized by the professionals yet rarely deployed by the self starters stands the SQL prepared statement, an effective tool at battling injection attacks.

In short, the database ‘prepares’ and stashes away the SQL statement prior to execution, and then patiently awaits the WHERE parameters when the same fires off to complete its work.  By separating the actual statement language from the WHERE parameters, an injection attack, usually submitted by way of the parameters, simply fails.  Without the full statement at its disposal, a prepared statement ultimately reduces an injection attack to mere gibberish.  As an additional benefit, the database during ‘preparation’ automatically escapes the statement and parameters prior to execution.

Want even more?  A developer can also set up the returning columns in a SELECT statement as bind parameters, thus speeding up statement execution.

Shouldn’t we all be using prepared statements in our web installations?  Perhaps.  The only real resistance remains with the code implementation.  Using prepared statements for the first time seems a bit clumsy and can be a bit tricky in getting to execute properly.  As a result, many developers instead just fold and solve  injection attack through edits.

Don’t let your predecessors get you down … the use of prepared statements will cut down on the number of required edits and make your site safer from attack.

Using Defines Versus Classes In PHP

September 26th, 2009 gharls No comments
One Mile Run World Record Holder Sydney Wooderson (GBR, 4:06.4) in August 1937.

One Mile Run World Record Holder Sydney Wooderson (GBR, 4:06.4) in August 1937.

After reviewing quite a bit of PHP code in our daily lives, we observe a quiet battle brewing over whether to store static application information as a ‘define’, or instead as an instance variable within a class.

Many purists contend that all variable data should be stored within the appropriate class in order to properly support the object oriented approach.  But what about static information intended for future localization, or conversion into another language?

The purists hold on hard, rigorously contending that a class can be constructed to allow for easy modification of variable constants in order to support localization, but do we really want self help developers tinkering around with a class definition?  An improper modification to a variable initialization could break the application, where an improper ‘defines’ entry will only result in an incorrect display on the screen.

Better to play things safe and place all information intended for localization into a ‘defines’ file.

Categories: PHP, Track and Field Tags: ,

Attonitus Maximus

September 15th, 2009 gharls No comments
SuperStorm Raging Away on Saturn.

SuperStorm Raging Away on Saturn.

More outer space fandom …

The Cassini spacecraft is monitoring a ‘gimongous’ storm on gas giant Saturn that has been raging nonstop since January prior.  For context, the storm is ten thousand times larger than our own terrestrial thunderstorms, and measures over 1800 miles across.

Cool stuff.  Note one of Saturn’s moons moving across the planet face in the accompanying image.

Categories: Digressions Tags: ,

I Need You To Validate My E-Mail Address AND My Parking

September 13th, 2009 gharls No comments
1929 24 Heures du Mans Overall Constructor Champion Bentley Speed Six (GBR (4), Barnato (2)-Birkin).

1929 24 Heures du Mans Overall Constructor Champion Bentley Speed Six (GBR (4), Barnato (2)-Birkin).

Many of us web developers raised a loud cheer when PHP announced its support for e-mail address domain checking (Apache only) with a simple call to its new checkdnsrr() function.  Imagine our corresponding horror when many of us discovered that many perfectly valid e-mail addresses fail during validation via the function.  Ugh.

Inexplicable as its seems, one can own an e-mail address that is properly stored in the MX filebase, yet still not pass the purported wonder function.  How can this be?  We haven’t yet heard a clear explanation, but some contend that it’s all related to how MX classifies domains … those such as xxx.gmail.com are readily accessible, while those who have e-mail domains rooted with a given site host do not get the same classification.  Sounds like gobbledy-geek to us …

Whatever the case, simply using checkdnsrr() alone will not provide one with comprehensive validation of e-mail addresses submitted by a user.  Many developers have come up with alternative schemes in PHP to solve the issue (available via a simple search), while others maintain that a simple search for the ‘@’ symbol is good enough (obviously not true).  We will keep our ears close to the ground and let our followers know about any new twists and turns in the validation saga.

Categories: 24 Hours of Le Mans, PHP Tags: ,