Extensions that I wrote... (Commercial)

DWfaq Custom Conditional Region DWfaq Date/Time Server Formats (ASP) Template-Lover's Suite Color Assistant DWfaq Date/Time Server Formats (ASP)
Sunday, June 01, 2008

Happy National Regex Day - 5 Tips for working with Regular Expressions

Happy National Regex Day!

To celebrate I'd like to share some tips for working with Regular Expressions that have helped me over the years I've been using them. I've got 5 tips to share today (#1 is already in the post on Ben Nadel's blog that I linked to but thought it worthwhile to repeat here, sorry if it is a dupe for you...)

Tip #1, for Dreamweaver Users: If you're a Dreamweaver user and need to build a regular expression, start learning about the Server Behavior Builder. When you create a server behavior, Dreamweaver generates a regular expression to match the code block(s). If you're in a hurry (or especially if you're just learning regular expressions), the regexes Dreamweaver generates can be a good starting point. You'll find the regexes it generates are in your user's Configuration in .edml files (which are XML files).

Tip #2, for CFEclipse users (assuming this works in other flavors of Eclipse as well): When you use the Search dialog (ctrl+H on the Mac), there's the obvious Regular Expression checkbox. With your focus in the Containing Text field, press Ctrl+Space to get a handy regex cheat sheet.

Tip #3, a Workflow Tip: When trying to come up with that perfect regex, take the time to build a static page or two that has what you want to match in it. Essentially, create a use case document. Then use your favorite regex capable Find and Replace tool to work up to creating the perfect regex. For instance, if you have a huge string to match, start by trying to match only the first 5 characters then add on to your regex and test again. When you've got it matching your use cases, then go ahead and plug it into your ColdFusion or JavaScript code (you don't use other code right? ;-))

Tip #4, Debugging Regular Expressions: You'll most likely find yourself debugging a regex at some point or another, and for me its usually because I missed a use case. (That's when its time to update the use case document.) Any time I've got a regex that isn't quite working right, I trim it back. In other words, I do the opposite of what I described in the first part of my workflow tip above. Stop trying to match what you really want to match in its entirety, take a bit away from the regex at a time until it starts matching your use case file. (If you didn't make a use case file, now is the time to do it!) Then build that regex back up again little by little until you have it matching everything you want.

Tip #5, Application Comments: In the case of using a regex in an application (versus in Find and Replace), always, always make a comment on what that regex means in plain English terms and why you need to use it in the first place. Sooner or later, someone will look at the regex and quite possibly have their eyes glaze over -- it could be you! So do yourself and others a favor and take a couple minutes to comment it. If you're extra geeky you'll have your comment refer to your use case file so they can actually see exactly what the heck that fancy string of characters is supposed to match.

Posted by ~Angela | Comments (0) | Add Comment | Permalink

 
Wednesday, May 21, 2008

UPDATE - CFGRID wrapping text

A few weeks ago I posted about needing to wrap text in a CFGRID's cell. (Read the original posted that I just updated...)

The code I provided didn't work in IE (figures!) but I've since added display:block; to the rule and it works for me...

Here it is, new and improved:

div .x-grid-cell-text{white-space:normal;display:block;}


I'm interested in hearing if anyone has a better fix, or if this doesn't work right for some use case or browser.

Posted by ~Angela | Comments (0) | Add Comment | Permalink

 
Sunday, April 27, 2008

Rock Band

Note to self: I am not a Rock Star. I should never attempt to kick like one (again).

Note to anyone over 30: Learn from the above. Repeat it at least 3 times.

Note to anyone who kicked anyway despite the above: Epsom salt baths help with sore muscles.

Posted by ~Angela | Comments (2) | Add Comment | Permalink

 
Saturday, April 05, 2008

Wrapping text in CFGRID that uses format="html"

I Googled. I googled some more. I found lots of blogs where people asked in the comments how to wrap text in a CFGRID tag, but either no answer was given or the format was Flash.

Well, for the sanity of those on the same mission I was on, I shall blog the solution that satisfied my quest. (It may or may not satisfy yours depending on what you're trying to achieve.)

A simple line of CSS did the trick in my use case:

div .x-grid-cell-text{white-space:normal;}

UPDATE: To fix IE, add display:block; to the rule above.

That's it, one line of CSS. Hope it helps!

Posted by ~Angela | Comments (1) | Add Comment | Permalink

 
Tuesday, April 01, 2008

Adobe Sells ColdFusion

It's true; Adobe sells ColdFusion. In fact, they have for a few years now. Ever since they acquired Macromedia.

Gotcha...Just like last time.

Posted by ~Angela | Comments (1) | Add Comment | Permalink

 
Tuesday, March 04, 2008

IE 8 - To be its default or not... I still have a point

For the last few weeks there's been a lot of buzz about IE8 and how Microsoft intended to make IE7 the default display as not to break existing websites. Recently Microsoft decided to go ahead and render IE8 as itself and many seem to be relieved. I am still skeptical...

I've been meaning to blog on this topic, but I honestly haven't had time to keep up with all the online chatter about it and hence was unsure I should bother. Perhaps what I have to say has been said before? Oh well, I'm going to say it anyway...

What I haven't yet seen talked about is the possibility that a dot release -- or even a full version -- of IE may be incompatible with a website, leaving the web developer wanting to 'skip' it somehow.

The proposed "version targeting" would allow someone to declare the site's compatibility with a specific version of IE so that it would render as that version, despite what the user had installed on their system. For example, the user has IE 15, but the web developer declared IE 7. The IE 15 user is stuck looking at an IE 7 site.

That seems to be the common example that raises all sorts of concerns about the web, user experience, standards and what have you. But what if...

What if IE 9 renders my site perfectly, but IE 9.1 doesn't. IE 9.2 is also perfect. Fixing IE 9.1 would take 40 hours of work and my client doesn't want to do it. Shouldn't I be able to skip IE 9.1 somehow?

Please don't try to tell me that sort of thing doesn't happen. It's happened to me with other software. (Safari being one and QuickTime being another.) So it is fair to say that Microsoft could release a version (be it major or minor) of IE that I don't want to support.

All users shouldn't be forced to the lowest browser supported by the site. In my mind, users should get the highest browser supported. That is, a browser experience that is equal to or the next lower supported version than what they have installed.

Let's pretend I have a list of versions I support on my website that looks like this:

7,8,9,9.2,9.3

Let's say the user has 9.1 installed. I don't support it, they should get the 9 experience.

How does version targeting propose to handle such a situation? Is it something anyone has even though about or discussed? I don't know, and if Google knows it hasn't pointed me there yet.

So therefore I blog, in hopes to spark some conversation be it in my blog's comments or on other blogs.

I have few other odd-ball ideas around this topic but I'll start with this one and see where it goes before revealing more of my wacky thoughts...






Posted by ~Angela | Comments (0) | Add Comment | Permalink

 
Monday, January 14, 2008

Mac Rumor? Smell-O-Vision

"There's something in the air."

There seems to be a bunch of rumors out there about what tomorrow's MacWorld keynote will announce. Among the more popular rumors is that a super small/tiny/thin notebook will be revealed.

I say it's going to be Smell-O-Vision via Apple TV -- now that would be something in the air!

Posted by ~Angela | Comments (2) | Add Comment | Permalink