It’s Nothing Personal (Software Updates Changing Preferences)

Standard

I’m departing from the usual purpose of this blog to take a moment to rant about software updates changing settings, especially when previously selected options still exist in the updated software.

My annoyance of the week goes to Apple for changing the security setting that permits the installation of any third-party software. I changed this setting in Mountain Lion a long time ago so I wouldn’t be restricted to using only software developed by Apple partners.

Sure enough, on every computer we installed Mavericks on, this setting had been changed. Previously, we had it set to allow apps downloaded from “Anywhere” but after the update it was set to the second option of “Mac App Store and identified developers”.

I suppose this might be an effort to curb future malware problems though, even if that is the case, it shouldn’t be reset after any update. I realize this is a minor annoyance but it’s not uncommon to experience similar problems with iOS updates and these particular options seem, in my opinion, to be modified in order to “encourage” a specific end-user behavior.

A long-time offender includes Mozilla with Firefox updates, which is why I created a post with specific settings that I could refer back to after installing browser updates.

Advertisements

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: