Debugging Javascript Errors in jQuery or 3rd Party Javascript Libraries

When you’re righting some Javascript / jQuery and run your code, you normally would see your errors in your browser inspector’s console tab so you can easily fix them. But, sometimes the error you see appears in 3rd party code that you haven’t even touched, e.g. jQuery. One way to find where the “real” error has occurred is by looking at the call stack. In Chrome Inspector, do the following:

  1. Click the Sources tab
  2. Click the Stop sign until it is purple (Pause at all uncaught exceptions)
  3. Reload the page
  4. Examine the call stack

Filtering Text By Line / Remove All Lines Except Ones That Contain A String

Usually I need to find and replace strings with other strings, which is easy to do using your standard “Find and Replace” function in your text editor. But, oftentimes I also need to find certain lines of text and remove everything EXCEPT them.  Trying to write a regex to search and replace everything BUT a particular string is complicated. An easier way is to just use the unix command “grep”. For example, if you want to extract all lines in a file called report.txt that contain the word “time” in them, you can do

$ grep ‘time’ report.txt

If you want to output the result of this filtering to a file, you can run

$ grep ‘time’ report.txt > filtered-report.txt

If you want to extract certain pieces of text in each line of a file called report.txt where those pieces of text are offset from the beginning of each line based on certain delimiters, e.g. commas, tabs, spaces, then you can use the awk command.

Useful Photoshop Shortcuts & Tips

Switch between foreground and background colors
Click “x” key

Increase/decrease size of paintbrush
Click “[” and “]” keys to adjust size
Clcik “{” and “}” to adjust hardness
On Windows, Control + Alt +  Right Mouse -drag left right to decrease/ increase brush size and up/down decrease/ increase brush hardness.

Make a copy of a layer
Hold down “alt” key and click and drag on object

Good tutorial on using the pen tool.
http://www.melissaevans.com/tutorials/how-to-use-photoshops-pen-tool

Print Poster Size Images Using a Home Printer

Recently I needed to print a poster size image using my home printer. I didn’t feel like slicing up the images into a bunch of tiles and figuring out which goes where. Here are a couple programs that will do this with ease:

Poster Printer by RonyaSoft
http://www.ronyasoft.com/products/proposter/index.html

Easy Poster Printer by GD Soft
http://www.gdsoftware.dk/More.aspx?id=3

Using VMs for Website Testing on Multiple Browsers / Versions

When developing a website, you unfortunately have to constantly test it in various browsers and OSs and their many versions because they all seem to behave somewhat differently. One way to easily do this is by installing a VM (virtual machine) on your computer and within one or more VMs, installing various browsers.  Oracle / Sun VirtualBox is a fast and easy VM tool that can do this.

https://www.virtualbox.org/

When deciding which browsers to test against, you can check your analytics to see the percentage of your site’s visitors by OS and platform and decide whether to support browsers that are used by at least X %.