Archive | August, 2008

Using jQuery Selectors

jQuery Selectors are a powerful feature of the framework that is essentially one of the main reasons that you’d want to use it in the first place. Those who are already familiar with how CSS3 selectors work will feel right at home with the concept of selectors. Today’s modern browsers at best support “most” of the CSS3 specification (with Firefox 3 & Safari), while others use only limited features of it. What’s so nice about jQuery is that the browser doesn’t need to support the CSS3 specification for you to use them within the framework itself. Those familiar with XPath will also be happy to know that simple XPath selectors are also supported via a plugin for jQuery if preferred. Here are some examples to demonstrate the power of selectors:

Style alternate table rows

$("table#mytable tbody tr:even").addClass("alt");

Add text based on a link’s file extention

$("a[href$=.pdf]").append(" (pdf download)");

Style links to external sites

$("a[href^=http://]").addClass("external");

Keep in mind that these are one line of code each that would otherwise take somewhere between 5 and 10 lines of javascript. As an added benefit, they also will execute as soon as the document object model is ready since the “$” shortcut function performs this for us behind the scenes. It is essentially waiting for the earliest time that the script is able to run, when all markup has been loaded (but not images or flash videos) so that we’re not having to wait for larger files to load before hand.

jQuery also has custom selectors which act like shortcuts for some common tasks. For example, you can find all buttons with $(:button), find all checkboxes with $(:checkbox), etc. If you would like to learn more, there is a jQuery selector documentation on their website as well.

0 Comments

Think your WiFi is secure? Think again.

Upon digging into a network issue that happened the other day I came across some interesting facts about wireless security. Namely one which criticizes WEP (wired equivalent privacy) security which actually originated with the first generation of wireless networking equipment. The flaw is the result of the static nature of WEP keys which makes them easy to decipher. Its been reported that German researchers were able to compromise a network that used a 104-bit key in under a minute with no more than a 1.7GHz Pentium M computer. Because of these concerns it is recommended to use the newer, more robust WPA (WiFi protected access) encryption as this technology was developed because of the shortcomings of WEP.

0 Comments

jQuery Framework First Impressions

Javascript frameworks come in a variety of flavors, they’ll typically encapsulate common practices that web developers frequently use in their sites. With the three dominant mainstream browsers (FF3, IE7, Safari and potentially even more) to worry about, each with a slightly different technique to program for, it can be a good practice to use a tested framework which works across the board and remove the overhead associated with testing common methods.

The framework which I’ve come to grow quite fond of lately is called jQuery. JQuery is best described as a type of web designers toy box that focuses on separating content from functionality. So what do I mean by this?

Here is an example setup for a jQuery project.

Sample jQuery Page Structure
$(document).ready(function(){
   $("#Button1").click(function(event){
	alert("Say Something");
 });
});

Whats nice about jQuery is that the footprint is relatively small at 54k or less, and if you prefer there is a file hosted from the Google API website which you can link to directly inside of your page. In fact you’ll find that many tasks require a minimal amount of code to achieve some impressive results.

// Resize lightbox on button click

$(document).ready(function(){
   $("#Button1").click(function(){
      $("#lightbox").animate({
          width: "1000px",
          height: "400px",
          fontSize: "3em"
      });
   });
});

Those familiar with object oriented programming will be glad to know that jQuery also supports chainability as in this example.

$("a").addClass("test").show().html("foo");

The jQuery framework is becoming increasingly popular among many high profile sites such as Netflix, NBC and Dell to name a few. Even the Microsoft development community is taking notice as their next update of Visual Studio will be providing jQuery code completion within the software itself.

For more information on jQuery you can visit their website: http://jquery.com/

0 Comments

Blogging explained in plain english

To some extent, I’d like to think that this blog is meant for a wide range of visitors. So I’ve decided that in an effort to widen my audience, I’ll occasionally be posting material that is more suited to those without much technical knowledge and Internet savviness. With that said, here is a short 3 minute video from CommonCraft.com that breaks down the concept of blogging into simple, easy to understand terms.

0 Comments

Did you know… Facts about blogging

In my endeavor to become the ultimate blogging guru I came across some facts about just how popular blogging has become.

  • There are Bloggers Choice Awards awards given out to best blogs in a given category.
  • There are over 175,000 new blogs every day.
  • Bloggers update their blogs regularly at a rate of over 1.6 million posts per day, or over 18 updates a second.
  • People actually get paid to write blog posts usually for a pre-determined rate of pay.
  • It can take Google as long as 4-6 weeks to fully index your blog.
  • Google has their own blog search engine.
  • 83% of corporate bloggers saw a traffic increase to their site.
  • 6 million Americans get their news and information from RSS aggregators.
  • Blog promotion is just as important as its content.

Sources
http://technorati.com/about/
http://www.movabletype.org/documentation/business-blogging/facts-and-figures.html
http://www.web-strategist.com/blog/2008/05/29/the-many-challenges-of-corporate-blogging/
http://thewrongadvices.com/2007/05/03/why-do-blogs-fail/

0 Comments