Entries tagged "troubleshooting"

Check Array and Object Values in JavaScript with console.dir()

The alert() method in JavaScript is useful for quickly seeing what a variable contains as the program executes, but it has some limitations. It won't display the values stored in an array without creating a loop, for example. If you do create a loop, alert boxes can be aggravating since they each need to be confirmed separately. Luckily, there is another JavaScript method. [Continue reading]

Make Sure Things Are Working Correctly in JavaScript with the alert() Method

My usage of JavaScript can be a bit sporadic. There are times when I go months without writing a line of JavaScript code. So I find myself forgetting how to do certain things. It also doesn't help that most of my time is spent with PHP which adds to the confusion since the languages have different aspects to them. To help get my bearings, I've used JavaScript's alert() method to quickly see things like what value a variable contains. Let's look at a simplified example showing how I use alert(). [Continue reading]

Remove Test Code Quickly with a Simple Dreamweaver Search

Adding test code throughout your scripts may be necessary for troubleshooting or adding new features, but how do you go about removing the code? In a previous post, a few techniques for locating the blocks of test code were discussed, but the code still needs to manually removed. Instead, let's tap into Dreamweaver's search for HTML tag feature. [Continue reading]

Making It Easy to Locate and Remove Test Code

When troubleshooting, sometimes it's necessary to add code to test various features. The problem is that the code may accidentally be left in when going live. Removing the extra code as you go may work in most situations. Or maybe you just know where the test code is located and removing it doesn't seem like a problem. However, what happens if you're pulled away from the task by some other emergency or deadline? Over time, the test code you were so familiar with may not be as obvious. Instead of depending on memory, here are some options for making test code stand out. [Continue reading]

Troubleshooting with var_dump()

When code doesn't perform properly, checking that the variables contain what you expect is an important step in solving the problem. Was the value ever assigned to the variable? Does the variable still contain the value? Is the value formatted for the given the scenario? Let's look at some options for finding out. [Continue reading]

Setting up a Makeshift Test Environment for Experimenting with PHP Code

There are times I need to experiment with new code or re-familiarizing myself with code already in use. But there are times when other project code (sending out emails, updating databases, etc.) gets in the way of the tests. The code could be commented out to prevent it from executing, but that may be more work than it's worth. Plus I may forget to uncomment something when the tests are over. Instead, it can be easier to create a new file and focus on the code at hand. [Continue reading]