Mar 2014 21

Let’s say you want to match all href values in <a> tags in an HTML document. You might do something like



But that doesn’t work because the * is greedy and gets everything up until that last closing bracket on the first line. To fix this, make the * lazy but adding a question mark (?) after it.



Notice now that we correctly get 3 matches instead of 2.


Mar 2014 16

Recently I had to do my taxes and having an online store, I had to go through 9000 transactions in Paypal that I needed categorize. Paypal lets you download your transaction history as a csv (comma-delimited text) file with double quotes (“) as a text qualifier which is a standard format. Unfortunately, you can still run into problems if you have double quotes and commas in a field’s value as follows:

“Confirmed”,”8″”, 10″”, 12″” AR550 Gong Round Steel Shooting Target Set 1/2″” Thick ( AR500)”,”300977807743″,”0.00″,”0.00″,”0.00″,””,””,””,””,”Ebay”, ….

Notice that the 2nd field contains double quotes and commas as follows:

8″”, 10″”, 12″” AR550 Gong Round Steel Shooting Target Set 1/2″” Thick ( AR500)

The original text for this field is

8″, 10″, 12″ AR550 Gong Round Steel Shooting Target Set 1/2″ Thick ( AR500)

where the double quotes represent inches as a unit of measure and the comma indicates that there are multiple sizes (8 inch, 10 inch, and 12 inch). The double quotes were escaped with double quotes to indicated that the double quotes are part of the field’s value. However, a double quote followed by a comma messes everything up because there’s no way to know whether that comma is part of the field value or a field delimiter.

The fact that this field contains double quotes and commas breaks the csv format because it appears now that this row has more columns that those in other rows. This is one of many things that can break a csv file. To fix this and other issues, I have found that it is most easy to use a tool called CSV Easy. It’s fast and shows you clearly which rows need to be fixed. Here’s an example of the problem I faced earlier.



Mar 2014 16

If you need a calculator that shows many calculations so that you don’t have to write down and remember what previous calculations were, you can use CalcTape. I have found it to be most useful.


Mar 2014 12

When it comes to losing weight, the formula is quite simple. The amount of calories your body burns each day must be greater than the amount of calories you consume each day.

Calories Burned – Calories Consumed > 0

Calories are burned as you  go about your day to day and if you exercise (primarily cardiovascular).

Calories are consumed when you eat.

You have three options for satisfying the above formula:

  1. Eat as you normally do but exercise A LOT so as to burn more calories than you consume
  2. Don’t exercise at all but eat very little or very low fat / low calorie foods
  3. Do a combination of the above


Mar 2014 12

$(document).on(‘ready’, handler)

// executes when HTML-Document is loaded and DOM is ready. Assets like images maybe still are missing. The DOMContentLoaded event is fired.


// executes when complete page is fully loaded, including all frames, objects and images;

You can see what assets are loaded before and after a document is ready by viewing the Network panel in Chrome’s inspector. The Load event is fired.


The blue line indicates when the document is ready and the red line when the window (page / document) has loaded.

At the bottom, you can see how long it took for the document to be ready (614 ms) and how long for the window to load (3.81 s).


Page 3 of 6712345102030...Last »