01.20.2012   |   1comment

jQuery LogoContinuing the jQuery pain fun of some tips I’ve learned over the years… Read Part I Here

Don’t Abuse $(this)
Without knowing about the various DOM properties and functions, it can be easy to abuse the jQuery object needlessly. For instance:

$('#someAnchor').click(function() {
    alert( $(this).attr('id') );
});

continue reading Helpful jQuery Tricks, Notes, and Best Practices Part II”


10.25.2011   |   0comment

Art and The Web Texture

Mark, Art and The Web Texture
I thought this was a nice article and analysis of Textures by Nick Petite. Though to many people texture may seem like a subtle thing we feel it is an important part of a website for creating the right mood. The thing that Nick points out is how much more dynamic a website can seem once a more interesting texture is added. In web design, I personally really like the layered texture strategies because it helps to neutralize an otherwise potentially overbearing texture, Nick covers the gambit of options and provides some examples, check it out.

JavaScript Powers Linux In A BrowserBrian, JavaScript Powers Linux In A Browser
I get asked all the time ‘Why Linux?’ and ‘How lightweight it is?’. My usual reply references how Ive seen a Linux web server run off a 2GB thumb drive, but this article trumps even that. With all the overhead the operating systems of today require, people usually assume a servers absolute minimum is even higher. Running Linux in a client-side script like this just blows my mind!


Master Sensei,on the topic of  JavaScript
10.20.2010   |   0comment

Mobile applications are all the rage as smart phones are moving from smart to genius. Along with this movement is the movement to location aware applications. Your phone has GPS, your laptop has wifi, and your IP is known (generally) to be tied to a specific location. Given these new technologies being more commonplace the W3C has seen it fit to add an API to web design for Geo Location.

Although not technically a piece of the HTML5 spec, it is commonly used in conjunction with HTML5 and easy to use.

The geolocation API exposes three methods on the navigator object in javascript, two for getting location information about your user getCurrentPosition and watchPosition, and the other is a paired method for watchPosition, it is clearWatch.

The first, getCurrentPosition, returns a one time shot of where the user is. This is good for pinning a map or giving static directions. The second, watchPosition, continues polling at regular intervals to keep tabs on where the user is. This is perfect for giving dynamic directions, or tracking a movement. The two calls are mirrors of one another in that they both accept three arguments (success handler, error handler, geolocation options). The two calls are also both asynchronous, with a caveat that if this is a user’s first visit to your site they may be prompted to allow their position to be shared, this could cause the browser to stop loading.

The odd ball function here is clearWatch, which simply clears any watches you have assigned, in other words it stops tracking your user.

Now that we know the basics let’s dig in!

if(navigator.geolocation){
     navigator.geolocation.getCurrentPosition(function (position){
         var lat = position.coords.latitude;
         var lon = position.coords.longitude;

         alert('Lat: '+ lat +' \nLon: '+ lon);
     }
}

The example above is about as simple as it gets, a simple one shot to get the users coordinates and then output them to the browser.

That is all there is to Geolocation in the browser, pair it up with Google Maps API and you have an award winning geolocation application ready to please the world.