Error in HTML5 Programming with JavaScript for Dummies

A reader recently wrote to tell me of an error on Page 118 of HTML5 Programming with JavaScript for Dummies. The problem appears in the source code for the SearchString.HTML example. As written, the code will currently work in most cases, except if you type This as the input value. The problem is this bit of code:

if (Result == 0)
{
   document.getElementById("Result").innerHTML =
   "You must provide an input value!";
}

The value of Result can equal 0 in a number of situations, but the problem is that one of those situations, typing This as the search term, is actually a correct input. In order to fix this problem, you must change the comparison condition to look at the text input, rather than the result of the search. The following code works as anticipated.

if (FindValue == "")
{
   document.getElementById("Result").innerHTML =
   "You must provide an input value!";
}

As always, I want to hear about any problems you experience using my books. Please contact me at John@JohnMuellerBooks.com if you encounter any other problems with this example or have questions about the change in comparisons.

 

Understanding the Effects of Net Neutrality on Web Programmers

There has been a lot of hubbub about net neutrality. I even saw not one, but two articles about the topic in my local newspaper the other day. Of course the discussion has been going on for a while now and will continue to go on—eventually ending up in the courts. My initial interest in the topic is different from almost every other account you read. While everyone else seems to be concerned about how fast their app will run, I’m more concerned about getting new applications out and allowing them to run correctly on a wide range of systems.

Both HTML5 Programming with JavaScript for Dummies and CSS3 for Dummies speak to the need of performance testing. Neither book covers the topic in detail or uses exotic techniques, but it’s an issue every good programming book should cover. Of course, I had no idea at the time I wrote these books that something like net neutrality would become fact. The developer now has something new to worry about. Given that no one else is talking much about developer needs, I decided to write Considering Net Neutrality and API Access. The article considers just how developers are affected by net neutrality.

If net neutrality remains the law of the land, developers of all types will eventually have to rethink strategies for accessing data online as a minimum. However, the effects will manifest themselves in even more ways. For example, consider how net neutrality could affect specialty groups such as data scientists. It will also affect people in situations they never expected. For example, what happens when net neutrality assures equal access speeds for the x-ray needed to save your life and that online game the kid is playing next to you? Will people die in order to assure precisely equal access. So far, I haven’t found anyone talking about these issues. There just seems to be this nebulous idea of what net neutrality might mean.

My thought is that we need a clearer definition of precisely what the FCC means by equal access. It’s also important to define exceptions to the rule, such as medical needs or real time applications, such as self-driving cars. The rules need to spell out what fair really means. As things sit right now, I have to wonder whether net neutrality will end up being another potentially good idea gone really bad because of a lack of planning and foresight. What are your ideas about net neutrality? Let me know at John@JohnMuellerBooks.com.

 

Scoring Your JavaScript Library

Choosing a library for your Web application can be difficult. Both HTML5 Programming with JavaScript for Dummies and CSS3 for Dummies emphasize the need to choose libraries with care. There are all sorts of considerations, such as whether the library enjoys popular support and has a good upgrade policy. You also need to know whether the library is secure and performs all the tasks you require of it in the manner you want them performed. These books do a great job of helping you understand the requirements for choosing a library.

At the time I wrote these books, jQuery was the most popular library available. In fact, both books emphasize use of jQuery for programming needs. It turns out that jQuery is still the most popular library around and for good reason, the producers of jQuery have done just about everything right, so developers continue to support them. If you need general interface and low level programming support, jQuery and jQuery UI are good places to start. What it really comes down to is reducing costs and getting work done faster. Money drives everything on the Internet, including your next project.

Two libraries simply can’t meet every need. Developers often use a wide variety of libraries to get the job done. Choosing the right library can be difficult. There are literally hundreds of them, all purporting to do the job faster, better, and for less money (when money is directly involved in the equation). Choosing the wrong library can incur huge penalties. That’s why a site such as Libscore is so important. You can use Libscore to find the top:

  • JavaScript Library
  • Script
  • Site Using JavaScript

The last option is the most important because it tells you what the top sites are and which libraries they use to achieve their goals. By viewing the site and seeing how it uses a library, you can make intelligent decisions for your own site. Exploring Libscore doesn’t take long, but can net you huge gains in productivity that translate into reduced costs and fewer errors.

I receive more than a few e-mails each week about JavaScript, HTML5, and CSS3. Readers really do want to know my opinion about this library or that. Unfortunately, my ability to test every library out there is limited. In fact, let’s be practical—even if I were to attempt to perform the task full time, I still wouldn’t have time as an individual to test all the options. So, using a site such as Libscore is the best option that I can offer you. I’d love to hear your opinions about Libscore or any other site offering the same functionality at John@JohnMuellerBooks.com. If you send me information about another library scoring site, please make sure it actually works with JavaScript or another viable Web technology.

 

Considering Perception in User Interface Design

I read a couple of articles recently that reminded me of a user interface design discussion I once had with a friend of mine. First, let’s discuss the articles. The first, New Record for Human Brain: Fastest Time to See an Image, says that humans can actually see something in as little as 13 ms. That short time frame provides the information the brain needs to target a point of visual focus. This article leads into the second, ‘Sixth Sense’ Can Be Explained by Science. In this case, the author explains how the sixth sense that many people relate as being supernatural in origin is actually explainable through scientific means. The brain detects a change—probably as a result of that 13 ms view—and informs the rest of the mind about it. However, the change hasn’t been targeted for closer inspection, so the viewer can’t articulate the change. In short, you know the change is there, but you can’t say what has actually changed.

So, you might wonder what this has to do with site design. It turns out that you can use these facts to help focus user attention on specific locations on your site. Now, I’m not talking here about the use of subliminal perception, which is clearly illegal in many locations. Rather, it’s possible to do as a friend suggested in designing a site and change a small, but noticeable, element each time a page is reloaded. Of course, you need not reload the entire page. Technologies such as Asynchronous JavaScript And XML (AJAX) make it possible to reload just a single element as needed. (Of course, changing a single element in a desktop application is incredibly easy because nothing special is needed to do it.) The point of making this change is to cause the viewer to look harder at the element you most want them to focus on. It’s just another method for ensuring that the right area of a page or other user interface element gets viewed.

However, the articles also make for interesting thoughts about the whole issue of user interface design. Presentation is an important part of design. Your application must use good design principles to attract attention. However, these articles also present the idea of time as a factor in designing the user interface. For example, the order in which application elements load is important because the brain can perceive the difference. You might not consciously register that element A loaded some number of milliseconds sooner than element B, but subconsciously, element A attracts more attention because it registered first and your brain targeted it first.

As science continues to probe the depths of perception, it helps developers come up with more effective ways in which to present information in a way that enhances the user experience and the benefit of any given application to the user. However, in order to make any user interface change effective, you must apply it consistently across the entire application and ensure that the technique isn’t used to an extreme. Choosing just one element per display (whether a page, window, or dialog box) to change is important. Otherwise, the effectiveness of the technique is diluted and the user might not notice it at all.

What is your take on the use of perception as a means of controlling the user interface? Do you feel that subtle techniques like the ones described in this post are helpful? Let me know your thoughts at John@JohnMuellerBooks.com.

 

JavaScript Updates in the Offing

Readers of both HTML5 Programming with JavaScript for Dummies and CSS3 for Dummies need to know about updates in JavaScript because both books rely on JavaScript to demonstrate programming concepts. The current version of JavaScript works exceptionally well for Web-based applications. You see such applications all the time. In fact, many people now use more Web-based applications than desktop applications to perform their work. For example, I’m using a Web-based application to create this post. I also envision a day when I won’t use Word to write my books any longer and will instead rely on a Web-based application to perform the task. However, the current version of JavaScript could use some improvements to make it easier to use and more bulletproof as well.

There are currently discussions for both JavaScript 6 and 7. (In fact, you can find some early discussions for JavaScript 8 as well.) The discussions are taking place in parallel to ensure that JavaScript 6 coordinates well with JavaScript 7 and to allow one version to naturally flow into the next. JavaScript 6 should appear by the end of next year (2014). Given the complexity of language upgrades, however, it wouldn’t surprise me if there were a delay or two. It’s important to get the changes right and obtaining consensus on the changes is going to be difficult because of the complexity of the changes.

With this in mind, I’ll probably ignore JavaScript 7 for right now and focus my attention on the JavaScript 6 changes. Obviously, if someone wants to talk about JavaScript 7 (or even version 8), I’m all ears. I always want to hear your viewpoint on looming upgrades. However, the focus for me now is on using JavaScript 6 to make the coding examples in my books better.

The big news for JavaScript 6 as far as I’m concerned is the implementation of modules. Using modules will make it a lot easier for developers to share code. The specification contains a good deal more than modules, but the feature most developers are focusing on is the use of modules for sharing code in ways that the current use of APIs and other code sharing techniques won’t address. In fact, the essential goals for modules are:

 


  • Get rid of the need for global variables
  • Make it possible to refactor global code as modular code
  • Reduce the effort required to use JavaScript module systems
  • Speed compilation
  • Simplify JavaScript applications
  • Improve JavaScript usability
  • Define a standard protocol for creating and using libraries
  • Make browser and non-browser environments more compatible
  • Reduce the work required to load external modules asynchronously


Some of these goals are pretty hard to understand right now and a few of them are only in the discussion stage. However, some browser vendors, such as Mozilla, are already discussing how JavaScript will work in their applications. It won’t be long and you’ll want to start thinking about the functionality that JavaScript 6 could add to your applications, even if you don’t implement this functionality immediately.

I’m convinced that the future of development lies with environments that allow you to create one application that runs everywhere. No, desktop applications won’t go away for quite some time (or possibly ever), but if you want to be involved in the technology that will dictate future application requirements, then you need to start considering releases such as JavaScript 6. Let me know your thoughts on this upgrade. I’d also love to hear your questions about it at John@JohnMuellerBooks.com. I’ll use any really good ideas/questions for future blog posts.

 

Adjusting to Web Development

Web applications require a different mindset than the desktop applications of old. Two of my books, HTML5 Programming with JavaScript for Dummies and CSS3 for Dummies, provide techniques for focusing on content, rather than application structure. However, both books contain this information across a number of chapters and some readers might like something a bit more succinct. I recently wrote A Short Guide for Desktop Developers Making the Transition to Web Applications with this need in mind. In a single article you can find the essential information needed to create better sites. The crux of the problem is that a desktop application resides on a device with known capabilities—a Web-based application can run on any device and you won’t necessarily know what that device is at any point during application execution.

The new focus in application design is flexible content. You make the content fit whatever device requires it. The reason that many Web-based applications currently fail is not because they’re poorly coded, but rather that they’re designed for the wrong environment. You see many examples of desktop-like applications on the Internet today. These applications don’t work because the developer has become fixated on creating a neat appearance for the content based on the desktop environment, rather than designing a flexible environment in which to present the content. The environment can’t assume anything because the user device could be anything.

Although my article will provide you with a great overview and provides you with the essentials you need to create a phenomenal Web-based application, you’ll still want to review my books as well. It’s in the books where you see the details of using a particular technology to create your application. The books also provide details that an article simply can’t provide. Of course, this additional information includes specific coding examples so you can see examples of how to implement a good design. So, start with the article. If you find what you need in it, turn to the books for the additional details.

Designing for the Web requires a different mindset. New device types require different design strategies. What are the biggest problems you face when making the transition from the desktop environment to the Web? Let me know at John@JohnMuellerBooks.com.

 

Finding Math Libraries for Your Next JavaScript Project

Finding precisely the JavaScript math library you need can be difficult. In both HTML5 Programming with JavaScript for Dummies and CSS3 for Dummies I define a need to perform math tasks accurately. Both books provide some workarounds for the inaccuracies inherent in performing floating point math. It’s important to remember that some numbers can’t be represented properly in the decimal system used by humans, that there are other numbers the computer can’t represent accurately in decimal, and that there are also error present in converting decimal numbers to binary and vice versa. In short, there are a number of levels at which math errors can occur. Yes, it’s true that the math errors are small, but they become a concern when performing large calculations, some of which can’t suffer any level of error (such as plotting a course to Mars).

The problem is so significant in some cases, that trying to work around the issues becomes an application development task in its own right. It’s for that reason that I started looking for math libraries to perform certain tasks. After all, it’s a lot easier to let someone else do the heavy lifting when it comes to a complex calculation. You can read about the results of some of this research in my article entitled, “Four Serious Math Libraries for JavaScript.” The article not only details the source of many of these errors in great detail, but reviews four libraries you can use to solve them.

The important takeaway I got from the research is that, like many programming tasks, there is no one library that does it all. Each library had something to recommend it. However, each library was sufficiently robust that you shouldn’t need to combine them to create your application. The point is to choose the one library that best meets your needs.

I’m actually looking into a number of library types for use in JavaScript programming. The advantage of JavaScript is that it does provide incredibly strong community support in the form of libraries that you simply use as needed. What sorts of issues do you encounter when writing applications using JavaScript. Let me know what kinds of libraries that you’re having a hard time finding at John@JohnMuellerBooks.com. I’d be more than happy to perform the research for library types that receive enough reader support and report my findings to you.

 

HTML5 and CSS3 Bugs in iOS 7

Several readers have written to ask about an article that appeared in InfoWorld entitled, “Bad news: iOS 7’s HTML5 is full of bugs.” In reading about the bugs, it doesn’t appear that any of them will affect the examples found in either HTML5 Programming with JavaScript for Dummies or CSS3 for Dummies. Unfortunately, I don’t personally own a copy of iOS 7 to perform any testing to verify that there aren’t any problems. A helpful reader did test a few examples for me and didn’t report any errors. If you find that you’re having problems with any of the examples in either book, please let me know at John@JohnMuellerBooks.com.

This issue does serve to point out a problem that I’ve encountered more than a few times in supporting my books. A vendor can release a faulty version of a library, operating system, or other support software required for my books and it will appear that the examples are buggy to the reader. If you read about these sorts of issues, please let me know about them so that I can test the book examples and report back to you here.

 

Obtaining an Editor for Your Web-based Application

One of the things I like most about writing code for Web-based applications is that there are so many libraries out there to make the task simple. You can stitch together libraries to create an application in only a small amount of the time required to create the same application in desktop form and the resulting application is going to be a lot more flexible. (Admittedly, the desktop application is usually prettier and can be faster.) Some time intensive tasks for desktop developers, such as creating an editor, require little or no work when creating a Web-based application. In fact, you can get a number of editors for free as described in my article, “5 Free JavaScript Libraries to Add Text Editing to Your Web Application.”

In this case, I wanted to see what was available in the way of editors. There are quite a large number of editors out there, some paid, some not. After discovering that the scope of my original article idea was too large (just editors in general), I decided to narrow the scope to just those editors that are free. After all, why pay for something you can get free unless you actually need the special features of the paid product?

Unfortunately, I still ended up with too many editors (somewhere in the neighborhood of 20). So, I decided to categorize the editors by complexity and presentation. I ended up with five major categories that span the range from simple to complex. The article contains what I think are the five best editors. Of course, your opinion may vary from mine. The point is, that you have a significant number of editors to choose from, so there is absolutely no reason to ever write code to create your own editor unless you need something truly specialized.

I’m thinking about other sorts of classes of application module for future articles. For example, it might be necessary to create an application where the user can make a simple drawing to show how something is put together or how something has failed. I actually needed such a module when trying to describe the glass panes used in the front of my wood stove not long ago and finally resorted to using paper and faxing it. The graphics module would have been easier, faster, and simpler.

What sorts of modules do you need for your Web-based applications? I’m always looking for good ideas from the people who read my material. Send me your thoughts at John@JohnMuellerBooks.com.

 

Browser-based Applications and APIs

Both HTML5 Programming with JavaScript for Dummies and CSS3 for Dummies place an emphasis on the developer who needs to create a unique site in the shortest time possible, and yet achieve this feat with low support costs. The task might seem impossible. Both books achieve their goals by focusing on free or low cost tools, development aids, and Application Programming Interfaces (APIs). However, the API is the lynchpin that holds everything else together and makes everything work. The idea is to obtain a functional application that does everything it needs to do in an incredibly short time using resources that have been created, tested, and maintained by someone else.

My books discuss a few of the most popular APIs and provide pointers to other APIs that you might want to try. In addition, both books provide some best practices for working with APIs. However, I wanted to explore the concept of what makes a great API further, so I wrote “Avoiding Problematic API Choices.” The goal of this article is to help you weed out the great APIs from those that could actually damage data or leave your organization exposed to unwanted risk. The time saved developing an application is quickly used up when the APIs used to create that application cause support issues, so it’s best to use reliable APIs.

Using tools, development aids (such as free art), and APIs is a no brainer.  Creating browser-based applications makes it possible for your application to run anywhere and on any device. These free (or sometimes low cost) aids add extra incentive to develop browser-based applications because now you also avoid a large amount of the cost and upkeep of an application. Organizations that don’t avail themselves of these technologies will eventually be left behind, especially as the Bring Your Own Device (BYOD) phenomena becomes even more prevalent.

There are many tools, development aids, and APIs out there and I have yet to explore even a modicum of them. I can say that I’ve worked with a considerable number of the most popular offerings online, plus a few private (paid) offerings. Still, I’m looking forward to my continued exploration of this particular area of development. I find it incredibly interesting because I started out at a time when assembler was considered the state of the art (and a time saving approach to development when compared to other methods available at the time). Computers have come a long way since I began and every new day brings something exciting my way. It’s the reason I continue to pursue this technology with such diligence.

Of course, I’m always interested in hearing what you have to say. Do you see APIs as being safe and helpful, or as a source for problems in your organization? Which tools, development aids, and APIs do you use most often? Let me know your thoughts at John@JohnMuellerBooks.com.