Archives For jquery

A few months ago I began using jQuery Mobile for a couple of Web projects. If you’re not familiar with it, jQuery Mobile uses CSS and JavaScript to make an HTML5-based site look and act much like an iOS app. No native programming required; nothing for the user to download and install. It’s a pretty amazing little package, which is not unexpected given how great jQuery is. If you’re curious to learn jQuery Mobile, check out this excellent tutorial written by C. Enrique Ortiz and posted at IBM’s developerWorks.

The only thing I’ll add, which is not mentioned in the article, is that jQuery Mobile is a logical choice in situations where you’re making a mobile version of your Web site that’s separate from the main version (and, presumably, redirecting mobile clients to it). Whether or not that’s a good policy is of much debate these days.

UPDATE: Amazon currently has the book for sale at $30.47, as I write this.

I am very happy to say that my latest book, Modern JavaScript: Develop and Design, is official done. Well, not done, but close enough to blog about it. I just submitted the last chapter to be written, Chapter 13, Frameworks. In it, I quickly discuss how to choose a framework, when you should use a framework, and some common libraries (as a framework alternative). The bulk of the chapter introduces and uses jQuery and the Yahoo! User Interface (YUI) Library. For both I explain how to perform common tasks—selecting DOM elements, DOM manipulation, event handling, and Ajax, and then walk through more advanced examples. For both, the chapter explains an autocomplete example, using a PHP script as the data source. For jQuery, I also discuss the DataTables plug-in. For YUI, I also discuss and demonstrate the Yahoo! Query Language (YQL). For it, I go through a couple of examples, including fetching a weather report and a stock quote. (For the record, I specifically target YUI3, which is an improvement over YUI1 and 2, even if some of the framework is currently in beta.)

Chapter 13 is the first chapter in Part 3 of the book, Next Steps. I already wrote Chapter 14, Advanced JavaScript, which has a heavy focus on closures. Chapter 15, A PHP and JavaScript Example, creates a pseudo-complete auction system. Auctions are set to expire on a certain date and time. Logged-in users can bid on items. All dates and times are shown using Coordinated Universal Time (UTC) or the user’s timezone, if the user is logged-in. Then, JavaScript used to enhance the experience. This includes using Ajax for the login and bid forms, retrieving the latest bids via Ajax (and updating the table of bids with them), and creating countdown timers that show them amount of time left in an auction, when that’s less than an hour. I think the chapter turned out well, and it emphasizes the various ways to pass data back and forth between PHP and JavaScript, a common point of confusion.

All of the initial writing is now complete. I’ve also done the rewrites on the first nine chapters. I still have to do the rewrites on the last six chapters, but that won’t take long. I will also be doing supporting videos and articles related to the book.

I believe the book will still ship, as originally planned, at the end of February. I am now going to go celebrate!

The CodeLobster PHP IDE

June 23, 2011

I’ve been contacted a couple of times now by the people behind CodeLobster, a PHP-centric IDE, in the hopes that I’d review/mention CodeLobster on this site. Now, CodeLobster only runs on Windows, which means I haven’t, and probably won’t, use it myself (I primarily use a Mac, only using Windows for testing purposes), but I have no problems mentioning products and sites here that I don’t personally use, because such things may still be of use to you (you, whoever you are, presumably are a separate entity with your own interests, needs, etc., and are statistically more likely to be running Windows). Anyway…

So, CodeLobster is an IDE for PHP that runs on Windows. It’s available in both a free and “professional” version, the professional version costing $100 (US). The free version comes with an HTML editor and inspector, a CSS editor, a JavaScript editor, a PHP editor, and a PHP debugger. This all includes the standard features such as code completion, code collapsing, browser preview, project management, FTP, and so forth. The professional version includes all of those features, plus plug-ins for specific tools and frameworks: CakePHP, CodeIgniter, Drupal, jQuery, Joomla, Smarty, Symfony, WordPress, and Yii. In other words, the professional version gives you code completion, contextual help, and so forth for these additional tools that you may also be programming in.

As I said, I haven’t personally used it, but if you’re looking for a PHP/Web Development IDE, it may be worth checking out.

I’m just about finished with Chapter 7 of the fourth edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide”. I thought I’d take this time to finally share the rough version of the Table of Contents (this is actually version 2, as the first version was changed while working on the SQL and MySQL chapters).

In my newsletter, I had presented some of my thoughts as to changes for the fourth edition, and I received a ton of very useful replies. Before showing the TOC, I want to discuss the feedback and how that impacted my plan. Continue Reading…

In a previous post, I previewed my forthcoming, self-published JavaScript book: why I’m writing it, when, and how. Here, then, is the current Table of Contents, with some explanatory text. To be fair, this is the first draft of the table of contents, and it’s probably more inclusive than the final book will be. As I write the text, the order and specifics will no doubt change, and I may need to cut some of the most advanced and esoteric content if the book gets to be too long or complex.

As always, any and all feedback you may have on the proposed book is most welcome.

Part 1: Getting Started

The first section of the book introduces JavaScript as it is today, in all its facets. The first chapter talks about what JavaScript specifically is and what it’s used for, what JavaScript isn’t, and what the current landscape looks like. The second chapter has the reader creating some real-world code—client-side and server-side form validation, using both hand-written JavaScript and the jQuery framework (even if he or she doesn’t know JavaScript yet, which is really how we all begin with JavaScript anyway). The third chapter discusses development tools that are useful as one is learning JavaScript. This includes things like JavaScript-aware IDEs and text editors, the JavaScript-specific features of different Web browsers, and debugging tools. The focus in this first part is on a grasp of JavaScript as a whole, also providing a context within which the reader can continue through Part 2 of the book, the most important part.

  • Chapter 1: (Re-)Introducing JavaScript
    • What is JavaScript?
    • How JavaScript Compares to…
    • JavaScript Isn’t…
    • Why JavaScript is a Good Thing
    • JavaScript Versions and Browser Support
  • Chapter 2: JavaScript in Action
    • Embedding JavaScript into HTML
    • Acknowledging No JavaScript Support
    • Cobbling Together Some Code
    • Applying a Framework
    • Steal This JavaScript
  • Chapter 3: Tools of the Trade
    • The Great Debate: Text Editors vs. IDEs
    • A Handful of Text Editors
    • A Couple of IDEs
    • The Browser: Your Friend, Your Enemy
    • Online Resources

Part 2: JavaScript Fundamentals

The second section of the book is the meat of the text, useful for all readers. Here are the fundamentals for programming in JavaScript, i.e., the treatment of JavaScript as a language in its own right. Some of the early material may be too basic for some, but none of the material will be beyond the needs of the standard Web developer. By the end of this section, the reader will be able to understand most JavaScript code just by looking at it, and will be well prepared for the more advanced examples in the third part of the book. Most of the fundamental concepts will be demonstrated using a real-world example. Many examples will also be presented in an alternative syntax (e.g., an ExtJS or jQuery demonstration of the same technique).

  • Chapter 4: Simple Variable Types
    • Basic Variable Syntax
    • Creating Calculators
    • Formating Numbers
    • Constructing Strings
    • Deconstructing Strings
    • Generating Dates and Times
  • Chapter 5: Using Control Structures
    • Comparing Numbers
    • Comparing Strings
    • What is true?
    • More Complex Conditionals
    • Performing Iterations
  • Chapter 6: Complex Data Types
    • Arrays
    • Objects
    • Arrays are Objects!
  • Chapter 7: Creating Functions
    • Defining Your Own Routines
    • Passing Values to Functions
    • Returning Values from Functions
    • Variable Scope
    • Anonymous Functions
  • Chapter 8: Event Handling
    • Browser Events
    • Keyboard Events
    • Input Device Events
  • Chapter 9: JavaScript and the Browser
    • The Window
    • DOM Manipulation
    • Cookies
  • Chapter 10: Working with Forms
    • Handling Form Submissions
    • Form Validation
    • Regular Expressions
    • Handling File Uploads
  • Chapter 11: Ajax
    • Understanding Ajax
    • Providing Dynamic Content
    • Form Validation
    • User Interactions
  • Chapter 12: Working with Other Data
    • XML
    • JSON
  • Chapter 13: Debugging and Error Management
    • Simple Debugging Errors
    • Handling Problems Gracefully
    • Creating Informative Errors
    • Creating Useful Errors

Part 3: Next Steps

The final part of the book extends what has already been covered in two ways. First, it more formally discusses major topics like frameworks, things that have been shown in bits of pieces already. Second, Part 3 goes into some of the secondary uses of JavaScript, like server-side JavaScript, Google Gears HTML5, and Adobe AIR. These extensions demonstrate the breadth and usefulness of today’s JavaScript. Realistically, these chapters will be more of an introductory tutorial to the topic than a full-fledged resource. In each chapter of Part 3, the reader will develop one or more (mostly) complete applications.

  • Chapter 14: Frameworks
    • Choosing a Framework
    • Introducing jQuery
    • Introducing ExtJS
    • Introducing YUI
  • Chapter 15: Server-Side JavaScript
    • What is Server-Side JavaScript?
    • What You’ll Need
    • Validating Form Data
    • Performing Database Queries
  • Chapter 16: Google Gears HTML5
  • Chapter 17: JavaScript for Desktop Applications
    • What is Adobe AIR?
    • What You Need to Know
    • Creating a Knowledgebase Application

Appendix A: Basic JavaScript Reference

The appendix provides a simple reference guide to JavaScript. Tables and other listings cover the kinds of things that are easily forgotten: operators, defined objects, methods, etc.