Archive: May, 2008

Best Fake ID Ever

fakeID.jpg

★ Hmm.. Something seems off on this one, Jose. Would you and your girlfriend please step out of the vehicle?

Motivational Poster of The Week

ATT1395147.jpg

★ The Mullet, always good for a self-esteem boost.

‘There can only be one’


★ Nice take on the ‘There can only be one’ NBA ads.

Ajax Server-side Validation

★ Validating user input data is an essential requirement for building robust and secure web applications. Validation generally isn’t a developer’s favorite part of coding, but it is very necessary. A web application that doesn’t validate user data properly can result in a poor user experience, a large overhead of useless data in your database, and vulnerability to malicious SQL injection attacks.

There are basically two approaches to validation, client-side and server-side. There are drawbacks to both methods.
◦ Server-side validation is limited by the stateless nature of the http protocol. When an invalid data error is caught the page is reloaded again, forcing you to send all submitted data back to populate the form or make the user re-input the entire form.
◦ When submitting the page, the user needs to wait for a full page reload. This roundtrip is repeated for every mistake that the user makes. This is a very inefficient model.
◦ Javascript validation can help remedy this by checking user data before the form even gets submitted. While this would help to improve the user experience it cannot be relied on because javascript is not necessarily standard across all browsers. Also javascript can easily be disabled in the browser’s settings.

Traditionally developers would leverage both client and server-side to offset the failures of each. This is fine except it means that you need to double code everything making you work harder than you need to. Using Ajax you can get the best of both worlds, keeping your stable/reliable php validation class as your backbone without sacrificing a responsive user-friendly UI. Most importantly it will degrade gracefully.

$(function() { // onload…do
$(‘#contestForm’).submit(function() {
var inputs = [];
$(‘:input’, this).each(function() {
inputs.push(this.name + ‘=’ + escape(this.value));
})
jQuery.ajax({
data: inputs.join(‘&’),
url: this.action + ‘?type=ajax’,
timeout: 2000,
error: function() {
console.log(“Failed to submit”);
},
success: function(r) {
//document.getElementById(‘results’).innerHTML = r;
//document.getElementById(‘results’).style.display = block;
jQuery.facebox(r);
}
})
return false;
})
})

Here we hijack the form submit in an onload function and submit the data asynchronously via ajax then set a callback. In this particular example I used the jQuery.js library, but the same thing could be done with prototype.js or your own ajax engine. I prefer prototype.js but I chose to use jquery.js because the facebook style lightbox modal feedback that I use requires jQuery.js already.

Once the data is passed to your php controller you can validate and sanitize it however you please. On the server side nothing really has to change too much, with the exception of how you handle the feedback/results. The beauty of this method is the way it gracefully degrades. If the user has javascript disabled, the form will still get submitted and the validation will be handle exactly the same either way.

Motivational Poster of The Week

ATT1395131.jpg
★ Everybody has their own reasons…Don’t judge.

Butt-load

★ I wish that ‘Butt-Load’ was a real metric. Right now the term ‘butt-load’ is very relative and could possibly cause some confusion in certain situations. For example, if I were to bring a 5 lbs bag of oysters to a BBQ with 6 people, that’s a butt-load of oysters. But a 5 lbs bag of oysters at a 20 person BBQ is kinda half-ass’d. If someone asks me to buy oysters, I want to be able to ask ‘one, or two butt-loads?’.

I’ve found references to the term ‘butt-load’ as meaning ‘about six seams’ which amounts to roughly 450 gallons; I also found a reference to ‘butt-load’ as a sailing term meaning ‘a little bit larger than a 50 gallon barrel.’

The Urbandictionary.com defines a ‘butt load’ as a term used to define a finite sum of something. Generally accepted as an amount somewhere between a lot and a shit-ton. Often noted when speaking in hyperboly and used for extreme emphasis or exaggeration.

I think this is all much to convoluted for a term as commonly used as ‘butt-load’ is. All it would take is for a consortium or a group with a decent amount of authority to set a final, measurable, value for ‘butt-load’. In todays ‘web 2.0’ world, this may be a problem best suited for wikipedia. Wikipedia could easily crowd source a standard metric that could be generally accepted.

Facts of Life

★ Random facts of life. pretty interesting stuff

Interesting use of the twitter

★ @kevinrose twittered about Twistori last week. Twistori.com is the most interesting implementation of the twitter API that I’ve found. The design is very simple and minimalist, yet it’s hauntingly beautiful (I’ve been wanting to use the words ‘hauntingly beautiful’ in a post for a while now). Its almost hypnotic. good way to lose an hour at work.

Hilarious Website

★ This is by far the coolest website I’ve found today. I just can’t seem to stop going back to check it. Hilarity ensues.
IsMikeArringtonADick.com

Obama Vs Clinton

{33EBBF11-B6F2-4EA5-A63F-7A8EB07EBF81}.gif

★ I’m not sure what Hillary Clinton is think right now, but it sounds like she actually believes that she can still win. So that means that she is either delusional, which automatically makes her unfit for the whitehouse, or someone on her staff keeps lying to her in a very convincing fashion. If you ask me (and you DID [because you’re reading this]) Hillary is only hurting her own chances at running next term and damaging the position of her entire party. Nobody wants her to drop out of the race more than Bill Clinton right now. Bill has pretty much been Hillary’s bitch since she got the democratic nomination…I almost feel bad for the guy. For one thing he’s got the alpha dog syndrome and doesn’t want his wife outdoing him. For another, he doesn’t want eight years of scrutiny and having to behave himself. He’s been very happy playing golf and chasing tail with Ron Burkle and shaking down foreign governments for huge speaking fees.

MVP




★ Kobe is the most well deserved MVP in the last 3 years. Lets be honest, Nowitzki turned out to be the biggest MVP bust in NBA history, getting a first-round exit at the hands of an 8th seed. There were better candidates both years that Nash won the award. To finally win this award in a year when the competitive level of the western conference is at its highest just makes it more impressive.

Rodeo clowns

★ A rodeo clown is probably gonna die today…I really don’t know how I feel about that…and THAT makes me a little sad

You may be wondering why a rodeo clown specifically. Well its actually basic logic. A rodeo clowns day probably starts off early with at least an hour of getting ready. He (yes, I’m assuming its a dude) puts on his clown outfit and makeup. He then spends his entire day working in a place that smells like animal crap. As if the smells weren’t bad enough he will inevitably step in a fresh pile of crap at least once through out the course of his day. All of this, the hours of preparation and crap, is for a job where his whole purpose is to be a target for a very large angry animal while looking ridiculous. A long day like this could only end with a full night of binge drinking at a remote roadside bar. This is the type of bar that is poorly lit and has a minimum of two registered (or unregistered) sex offenders, probably hanging out in the back by the jukebox that no longer works or by the door to the restrooms. When its time to head home because the bartender cut him off from the cheap whisky, he’s not going to have a designated driver, because…well because he’s a rodeo-clown…I think you can see where I’m going with this.

This happens, probably more than you know.

50%

★ Why do people always get so offended when I tell them that I only listen to 50% of what they say? I’m willing to bet that LESS than 50% of what they have to say isn’t worth hearing anyway.
Get over yourself already, and stop pretending that anyone cares about more than 30% of what come out of your mouth. You know who you are.

Social Networking Wars


★ It’s funny because it’s true….and sad, so sad.

Motivational Poster of the Week

ATT1395135.jpg

★ Kinda makes you rethink where you stand on the whole lung cancer thing.

Arrogant Bastard

★ This is the most Awesome brand marketing that I’ve ever seen. Legen-dary. I almost feel like I have to order a case of this stuff.

The Mavs/Suns need to start recruiting


NHL Star Called Up To Big Leagues To Play For NFL Team

★ Now I know why SportsCenter is littered with so much NHL highlights during the NBA playoffs. They are actually scouting reports for first-round knock-outs like the Mavs and Suns who desperately need to recruit players. I’m sure it wont be long before they start pulling players up from the NHL in search for someone who has balls.