It’s Still Working: As of October 2019

Standard

Every now and then I like to add updates to my various blog posts to indicate whether or not an individual product that I purchased, often several years ago, is still working. I think this may be a little helpful to anyone that has recently purchased, or is thinking about purchasing, the same product.

This is not a list of every single item that I’ve purchased. It doesn’t include things that might be sitting in a closet and haven’t been used in a while. This is a list of things that I’ve recently used, or, I know are still working (in a few cases I’ve listed items that I don’t own anymore, but I know they still work). Some I’ve used only once or twice in the past month, while others are items that I use on a daily basis. Items that failed, or I sold for some reason, aren’t here (it doesn’t mean those items were bad, but, I’m not actually now).

In general, I would normally go back and update each post with this information. I may still do this, but today I decided to take the lazy route and simply list the items that I still use (sometimes frequently and other times, infrequently), starting with the oldest items.

Note that there a number of other products that I’ve never created a post about, which are just as worthy of being listed. Perhaps one day, I’ll cover those (for example, the portable battery I’ve been using for several years, my MacBook Air (mid-2013) that’s still kicking or the various Zwave devices I’ve been using for a long time).

Using TextWrangler to Generate HTML Form Option Values from a Text List

Standard

While working on a project I needed to find a way to take a text-based list of values and convert them to drop-down options for an HTML form.

For example, I a have list in a text file like this:

One
Two
Three
Four

I need to convert them to this:

<option value="One">One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
<option value="Four">Four</option>

The items above would then be enclosed within a SELECT tag.

For a list this short I would just code it by hand but when you start hitting lists of 25 or more options it quickly becomes time-consuming. I attempted to use a Find and Replace operation in Dreamweaver using RegEx but ran into a problem.

Eventually, I moved over to TextWrangler for Mac. I’m not a RegEx guru but after doing some reading I came up with a method that works well.

In TextWrangler I opened the file and then went to the Search menu option and clicked Find.

Here’s what I’m using:

Find: ^(.*)$
Replace: <option value="\1">\1</option>

Also, and this is critical, I checked the option to use “Grep” under Matching. This enables the use of Regular Expressions.

The find pattern captures anything between the beginning and end of the line. In the replace section it takes whatever matches and then inserts it into the surrounding text (\1 instructs the software to insert the contents of the match).

Here’s a screenshot of the dialog: