Posts Tagged ‘javascript’

Book Review – jQuery in Action

April 9th, 2010

jQuery in ActionI just recently finished reading  jQuery in Action by Bear Bibeaut and Yehuda Katz.  I had used very little jQuery before reading it, and even less AJAX.  I can’t recommend this book highly enough.  Five Stars.  To be fair, I may be biased largely because jQuery is so awesome, anything about jQuery will inherit it’s awesomeness.  But either way, if you want to get into jQuery, this is a good place to start.

I’ve heard it pointed out that all of the information in this book is already online, on the jQuery website.  But that’s missing the point.  The book presents the information at a well-thought out pace and order, minimizing confusion.  For example, early on it spends a good amount of time introducing and explaining the various CSS3 selectors and getting your “Wrapped Set” of elements before it jumps into how to manipulate those elements.

The book process to move through all of the awesomeness that jQuery offers with DOM & Content manipulation, Event Handling, Animations, Plugins, and Finally AJAX.  My First attempt trying to implement AJAX was without a framework, using the WROX “Beginning AJAX” book.  I’ve decided that book isn’t worth it’s weight in lead, and that it should be pulled from the shelves.  jQuery makes it ridiculously easy to make POST and GET requests to the server, and handle the results.  I was using AJAX in production code within a week of reading this.

I don’t know what else to say.  The level of Awesome that jQuery exudes is matched only by other epic wins such as Dropbox and Vim.  If you haven’t tried jQuery, you need to. Now.

Buddypress jQuery is not defined error

December 16th, 2009

While developing a Buddypress plugin, I was running into a problem where none of my Javascript was working. Instead, Firebug was telling me: “jQuery is not defined”.  This was quite frustrating, as I could verify that the jQuery file was indeed, being loaded.  While a few other people received the same error for different reasons (corrupt files, etc.) I did not quickly find the solution for my problem.  Here it is:

Problem: Buddypress calls your plugin’s JS files BEFORE jQuery files.
This applies when you use the function wp_enqueue_script() – as you should.

Solution: Tell wp_enqueue_script your file depends on jQuery.
It turns out, wp_enqueue_script() takes a few optional parameters – the third being an array of other js files yours is dependent on.

Here’s how the call looks after the change:
wp_enqueue_script(‘my-js-file’,’my-file-path.js’,array(‘jquery’));

Viola!  Your js file is now loaded after jQuery and you’re good to go.

The Zen of CSS Design

December 7th, 2008
The Zen of CSS Design

The Zen of CSS Design

I recently finished The Zen of CSS Design. The book has a good display of creative website designs, and it’s good for providing inspiration. It organizes the content in an interesting way, where each chapter focuses on a single aspect of desgn: ie, layout, imagery, typography, etc.  Within each chapter, individual designs are dissected and evaluated as they apply to these design principles.

Unfortunately, I found much of the text to be cheesy and repetitive, not unlike what you would stick in a history paper to reach the word count your teacher asked for.  The author is at times ambiguous, and at other times attempts to wax poetic.

It suffers from an identity crisis that many web books do: It moves too fast for the beginner, and re-hashes the basics too much for the experienced. Myself being in the latter camp, and my eyes start to glaze over when I read how to use a “background-image” or “border” property.

Also, with many CSS books, it fails to acknowledge when compromises are necessary. There are times when it’s just plain better to use JavaScript or tables. As a working web developer with deadlines and budgets, you don’t have the luxury (burden?) of creating 10 lines of CSS and 3 divs just to avoid using a little 2 cell table.

Overall, I’m glad to have the book, but mostly for the eye candy rather than what it has to say.