Previous Issue Current Issue Main page Next Issue
Fusion Authority Fusion Authority
The House of Fusion Technical Magazine
Issue: 127

August 23, 2003
September 3, 2003
This is an opt-in magazine. To join, leave or change subscription mode, please visit the signup page. All content of this magazine is copyright Fusion Authority, Inc. It may not be reproduced without permission.

Community
Over 150 User Groups to Participate in Worldwide Macromedia User Group Meeting!
 
News
Macromedia Announces MX 2004 Product Family
 
Tech and Tags
What's New at CFLib.org?
 
Views
This is Reprehensible!
 
Techniques
How to Strip Tags in Three Easy Lessons
 

Community

Over 150 User Groups to Participate in Worldwide Macromedia User Group Meeting!

Excitement is building for the September 3rd Macromedia Event. Over 150 user groups around the world will be participating in a live broadcast showcasing Macromedia's upcoming releases of Dreamweaver MX 2004, Flash MX 2004, Fireworks MX 2004, and the all-new Flash Professional MX 2004. As a bonus, each participating user group will be raffling off a copy of Studio MX 2004.

The event will be broadcast over Macromedia's Breeze Live, making this a nice demonstration of the power of Macromedia's newest collaboration tool.

The meeting will be broadcast multiple times during the day to user groups around the world. If you want to catch the excitement, check out the URL below to find a user group near you that's involved.

See Macromedia MX 2004 Live

[Top]


News

Macromedia Announces MX 2004 Product Family

New Releases of Dreamweaver, Flash and Fireworks and a new Product (Flash MX Professional)

by Judith Dinowitz

August 25, 2003 -- Macromedia announced their next generation of MX products, MX 2004, with improvements in speed, power and intuitive features that will make it easier for Web professionals (both programmers and designers) to create a much better experience on the Web. The products announced included: Studio MX 2004, Dreamweaver MX 2004, Flash MX 2004, Fireworks MX 2004, Flash Player 7, and a new product called Flash Professional MX 2004 that has both Michael and myself very excited. (More on that later.)

Studio MX 2004

Studio MX 2004 consists of Dreamweaver MX 2004, Flash MX 2004 (or Flash MX Professional 2004), Fireworks MX 2004 and Freehand MX, as well as the ColdFusion MX 6.1 Developer edition. Before I get into the details of any of the new products individually, let me speak on a more general level about what Macromedia customers can expect. Eliza Laffin, Sr. Product Manager for Studio, said that in this release of Studio MX, Macromedia has focused on making the product more: A major aspect of this new release is that all of the products in Studio MX 2004 are more deeply integrated, and that things can be started in one product and easily finished in another. Fireworks' Roundtrip support now includes server-side code and nested tables, and the "check-in/check out" lightweight version control system will prevent you from creating two versions of the same file. It's very easy to import Fireworks images directly into Dreamweaver, or to define CSS styles in Dreamweaver and leverage them in Flash. Macromedia has created a symbol that shows this interoperability between the three new products (Dreamweaver, Flash and Fireworks). (View that symbol here.)

In addition, all of the products in Studio MX 2004 share a common look and feel, as in the new Start Page above common to all three new products.

There are two new concepts that you'll see in Macromedia's discussion of their MX 2004 releases: MX Elements and Halo. Both of them deserve a short definition, as they represent Macromedia's attempt to create a standard or sample look-and-feel for Web development, and to make things easier for their customers.

MX Elements are a series of interface building blocks and a new generation of embedded, interactive design patterns and behaviors. The MX Elements for HTML and for Flash make it faster for customers to build effective interfaces by bringing together a range of technologies including components, templates, CSS style sheets, and behaviors. (You'll here more about this when we discuss Flash MX Professional.)

So what is Halo? In its press release, Macromedia describes Halo as a distinctive new look and feel that all of the MX Elements share, and says that it hopes that Halo will "make the digital world a brighter, friendlier place."

I spoke to Michael Gough, chief creative officer at Macromedia, to get a better idea of what Halo is, and discovered that Halo is an idea in flux (and therefore difficult to pin down.) As it stands now, Halo is being touted as a set of standards for web-based applications, irrespective of the technology used, that Macromedia has created. Using such consistent rules creates a standardized look and feel for the web. The flux part is that this look and feel is supposed to be extendable so that in time, others will add their own ideas to Halo, expanding it outward. Macromedia has started by replicating desktop functionality in this look and feel, but I was told that in the coming months, other customized looks will be added to Halo and more information will be out on Macromedia's site.

If done well, Halo could indeed be on the cutting edge of emerging Web standards, focusing both on models of interaction on the Web and distinctive look and feels. The danger here is that if the standards are left too open, then Halo could lose its status as a standard and just be a collection of ideas that everyone says would be good, that each customer would follow in his or her own way. Such a thing has happened to earlier versions of Fusebox, where people were using something that was Fusebox-ish, but not exactly Fusebox.

Let's go into some of the individual products in Studio:

Dreamweaver MX 2004

One of the most exciting new features that Laffin showed us in Dreamweaver MX 2004 was its new CSS (Cascading Style Sheets) support. She said that one of the reasons CSS is not used as universally as it could be because it's been too difficult to implement. Dreamweaver MX 2004 is trying to make using CSS much easier. Laffin showed us an example of CSS in action in Dreamweaver, and it looked like something even a CSS rookie (like myself) could get into.

For example, the Tag Inspector in this version of Dreamweaver contains a Relevant CSS Panel, which shows the CSS styling attributes that affect the page element the user is editing. Within that panel, you can change the various CSS attributes directly, and they'll be automatically updated within the page itself. Using CSS, you can even add hover effects to links with two simple attribute settings. You can even cut and paste directly from Word and Excel, and Dreamweaver will automatically generate the CSS for you, behind the scenes.

The main complaint that many programmers in the ColdFusion community have is that Dreamweaver runs too slowly and takes up too much memory. The following stats should allay developers' fears somewhat: Jennifer Taylor, Product Manager for Dreamweaver and HomeSite, said that Macromedia engineers noted the following performance enhancements on a Windows machine running Dreamweaver MX 2004:

Some of the other features worth noting in Dreamweaver MX 2004 include:

Fireworks MX 2004

Laffin said that a team of dedicated engineers worked on optimizing Fireworks, and improved performance by 85%!

These features are new in Fireworks:

Flash MX 2004

Lucian Beebe, Product Manager for Flash MX, gave us an inside look at what was coming.

Beebe said that for this release, Macromedia focused on streamlining Flash development for users and helping people who are new to Flash do projects faster. Performance in the Flash Player 7 is twice as fast as it was in Player 6. The Data grid in Firefly (the Flash Data Connection Kit) is now 50% faster for sorting components in a grid with the new Flash player.

Flash Player 7 is much easier to deploy, and has more support for standards, including HTML, MP3, SOAP, H.263 and Unicode. Flash MX 2004 contains controls for certain options that are commonly used in Powerpoint, such as fade, fly in and fly out, and it can import files from formats such as PDF, Photoshop and Illustrator. The Flash version of CSS will handle text formatting right now, but not positioning, so we're not at the point where we can position an object in Dreamweaver and then import it into Flash with the CSS positioning intact.

The new version of Actionscript, ActionScript 2.0, in Flash MX 2004 is more object-oriented. Other improvements include support for globalization and Unicode, a new chart wizard, and new timeline effects.

Flash MX Professional 2004

Now, for the product that Michael and I are very happy about, because we feel it makes Flash much more accessible to hardcore programmers:

The first thing you'll notice when you open up Flash MX Professional 2004 is the lack of the traditional Flash timeline. It's still available if you'd like to use it, but in Flash Professional's new interface, you can see that things are organized in terms of the Web application rather than a timeline for events. The top left-hand bar in the screen shot above lists a series of pages for the application, with the highlighted page appearing in the middle window as one would see it on the site. The main bottom panel contains the ActionScript code and is broken up into actions. On the right, you'll see some of the new features of Flash Professional that make it much more geared to programmers: a file setup with the all the files for the current project, the Components area, and the Component Inspector.

As Beebe described it, in Flash Professional, you don't need to know anything about the timeline to program in Flash. Everything can be done with components. Flash Professional is a forms-based development environment, so it's much more friendly to programmers. It also contains some very nice features that ColdFusion programmers will love:

In Flash MX Pro, the ActionScript is visible in the bottom panel and everything is approachable, without the use of key frames.

Two Versions of Flash: How do they interact?

Now that there are two new versions of Flash MX, how does Macromedia handle compatibility between the versions (and between the new MX 2004 files and old MX files)?

Where are we now?

Remember that while Macromedia has announced these products, they will not be released for approximately another month. This means that customer feedback may still play an important role within the coming weeks. This does not automatically translate to new features as the beta is closed, but it can have an effect on minor things such as documentation, marketing and future direction. If you have any wishes or suggestions about these products, you can send that information to www.macromedia.com/go/wish/. For more information about these products, check out the following links:

Macromedia Announces the Next Generation of MX

Macromedia Announces Macromedia Studio MX 2004

Macromedia Announces Macromedia Dreamweaver MX 2004

Macromedia Announces Macromedia Flash MX 2004

Macromedia Announces Macromedia Flash MX Professional 2004

Macromedia Announces Integration with Leading Professional Video Tools

Macromedia Announces Fireworks MX 2004

Macromedia Flash Player 7 Doubles Performance of Rich Content and Applications

[Top]



Tech and Tags

What's New at CFLib.org?

HTMLTrans
Converts the characters in a string to encoded special characters. (CF Version: 5)
 
IPConvert
Converts IPs to integers and back for efficient database storage. (CF Version: 5)
 
Is7bit
Determines whether a string is 7bit. (CF Version: 5)
 
IsListInList
Checks if all elements of list X are found in list Y. (CF Version: 5)
 
IsViaSoap
Returns true if the current request is SOAP based. (CF Version: MX)
 
IsXML
Checks to see if a string is valid XML. (CF Version: MX)
 
isDefinedValue
Checks that a variable is defined and that the variable is not an empty value. Optionally lets you check that the variable is a specific value. (CF Version: 5)
 
wrap
Wraps a chunk of text at a given character count. (CF Version: 5)
 
XSLTCF5
Processes an XSL Template against an XML document and returns the transformed content. (CF Version: 5)
 
CountLines
This function returns the number of lines in a text file. (CF Version: 5)
 
ListCountSubstring
Counts the number of list elements that contain a given substring. (CF Version: 5)
 
REGet
Returns all the matches of a regex from a string. (CF Version: 5)
 
webmasterEmail
creates a webmaster@... address out of any URL. (CF Version: 5)
 
CardinalToOrdinal
Convert cardinal number strings to ordinal number strings. (CF Version: 5)
 
containsLeapYear
Function that determines if a given date range contains a leap year. (CF Version: 5)
 
dateLetters
Adds the st,nd,rd,th after a day of the month. (CF Version: 5)
 
fadeList
Creates a comma separated list of hex colors forming a gradient between the start color and the end color over a specified number of steps. (CF Version: 5)
 
getCurrentFinYear
Returns the current two-part financial year in a specified format. (CF Version: 5)
 
ListReFindNoCase
Searches a given list for a given regex and returns the index number of the first item found. (CF Version: 5)
 
ListRemoveNulls
Removes null entries from lists. (CF Version: 5)
 
parseInt
Parse out the first set of numbers in a string. (CF Version: 5)
 
queryDiff
Returns information about the differences between two queries with the same columns. (CF Version: 5)
 
ReGroupStructureBy
Pass an Array of structures and the name of a column that exists within each, and it will create a Grouped "Structure of Array of Structures". (CF Version: 5)
 
SoundexDifference
Returns the difference between the SOUNDEX values of two strings. (CF Version: 5)
 

[Top]


Views

This is Reprehensible!

by Michael Dinowitz

Do you want to know I wrote my own spam filter? Do you want to know why I am so against RBLs (real-time black hole lists)? The reason is really simple: because I cannot trust someone else to do the right thing. This was exemplified perfectly by the owner of the Osirusoft Black Hole list. What did he do that was so wrong? He black-listed the world.

Let me explain. Osirusoft was one of the major RBLs around, and as such was used by many people to check if email that they were receiving was spam or not. These many people range from technical gurus who can write mailservers from scratch to salespeople who wouldn't know what an email header meant, let alone how to define spam. The one thing that binds all these people together is that they were using a software or service that looked at Osirusoft as an authority. It looked at Osirusoft and said, "Tell me what I need to know. Is this message spam?" When the owner of Osirusoft banned the world, he made these people see the same message: that everyone was a spammer.

The reason why Osirusoft went down is because it was under a heavy DDoS attack (Denial of Service) and the owner decided to shut it down. He told people to stop using his service, but rather than just turning it off, he made his point by banning everyone.

If I was using Osirusoft as an RBL, that would mean that every list that I run would have the same problem, and I can't have that. For that reason, I do not use any outside RBLs. I do compile a list of IPs and domains that are spammers no matter what, to block, and have provided that to the community in the House of Fusion spam section -- but again, the question of trust comes up. Do you trust my material? All I can say is that having stored and analyzed many tens of thousands of spam messages -- I do.

Osirusoft Blacklists the World

[Top]


Techniques

How to Strip Tags in Three Easy Lessons

by Ben Doom

One particular request I've seen on CF-Talk and CF-Regex on numerous occasions is for a method for "stripping tags" from text. So I said to myself, "Self, let's write an article about this so people will stop asking, and know how to do it themselves." And so I shall.

This article will cover the basics of how to use Regular Expressions, one of the coolest and geekiest inventions ever, to rid our code of embedded tags.

As the title of this article implies, there are three steps to this process. The first step is to define our goal as tightly as possible. In this case, we need to define exactly how we want to strip tags. The second step is to look around to see if we are simply re-inventing the wheel, or if we have a problem to which there is no satisfactory solution available. Finally, in step three, we'll write some code.

Before I begin, I want you to understand that this is not meant to be a rigorous or complete study of regular expressions. It's designed to give you a good idea of where to start. Tweaking your code to suit your particular needs will almost certainly be necessary.

Step One: Define the Goal

As programmers, we've all gotten into messes because what seemed obvious to us wasn't necessarily so obvious to others. After all, when you say "strip tags," you know exactly what you mean. The question is, when you ask someone to help you do it, do they know what you want? The phrase "stripping tags" is a deceptively simple one. While it seems clear, people use it to mean all kinds of things. Some of its implied definitions have included: As you can see, it's important to define our goal in specific terms.

For the purpose of this article, we will do three things. First, we will remove all opening and closing anchor tags while leaving the contained text in place. Second, we will remove all script tags and their contents. Finally, we will remove any tag that contains a JavaScript call.

Two: Reinventing the wheel.

I'm frequently told not to reinvent the wheel. Most of the time, this is good advice. After all, there are some well constructed and sturdy regular expression "wheels" already available. Let's look at some other possible meanings of the phrase "strip tags" and some tools already available for the task.

One example I gave was to convert tags into content that displays as text rather than being interpreted and processed as code. When this question was asked, a dozen people responded, "htmleditformat()". Enough said about this one.

More commonly, I am asked about the possibility of stripping (or leaving) specific tags. For this, I generally point to a solution developed by S. Isaac Dealey: a UDF called StripTags() available from the Common Function Library (http://www.cflib.org/udf.cfm?ID=774).

Finally, there's a really simple regular expression to remove all HTML-style tags from a document. I'm sure you could find it by looking in the House of Fusion archives or by Googling. I'll leave this one as an exercise for the student.

However, we've already determined that we need a custom solution. Besides, you wouldn't learn anything if we didn't write some code. So, on to step three.

Three: Deciphering the Code

As a reminder, our task is threefold:
  1. Remove <script> tags and their contents


  2. Since this is the simplest of the three operations, we'll tackle it first by defining a regular expression pattern that describes a script tag.

    <script.*?>

    Though simple, this is a very powerful piece of code. The .*? section tells the regular expression that we're looking for anything at all (.), as much as necessary (*), but no more than we need to find the first > (?). So, this finds any tag which begins <script and ends in a >.

    Next, we need to represent a closing script tag:

    </script>

    and what's in between:

    .*?

    Therefore, the <script> block can be represented by properly concatenating these three things:

    <script.*?>.*?</script>


    Now, we use rereplacenocase() to perform a case-insensitive search and replace across all the contents of the variable "text" (where we've ostensibly placed our target text):

    text = ReReplaceNoCase (text, "<script.*?>.*?</script>", "", "all");


    The first task is done.

  3. Remove <a> tags but keep the text between them


  4. Not surprisingly, since we're performing much the same action as we did for <script> tags, our code will begin similarly. Specifically, we can begin by replacing "script" with "a":

    text = ReReplaceNoCase(text, "<a.*?>.*?</a>", "", "all");		


    We've decided we want to keep the information between anchor tags. There are two ways to do that. One way would be to use two ReReplace() calls to remove only the opening and closing tags. However, a more elegant way is to store the text between the anchor tags and re-insert it.

    In a regular expression, we use parentheses for (among other things) storing a string in a backreference. You can think of a backreference as a variable internal to a regex call. So we'll stick parentheses around the bit between the tags:

    text = ReReplaceNoCase (text, "<a.*?>(.*?)</a>", "", "all");		


    That stores it, but we still have to re-insert it. Essentially, we want to replace the whole link with just the text. So instead of replacing the substring matched by our regular expression with an empty string, we will replace it with our backreference. Backreferences are numbered from one. Therefore, to call our first backreference, we use a backslash followed by the number one: "\1".

    text = rereplacenocase(text, "<a.*?>(.*?)</a>", "\1", "all");		


    Task two is done as well.

  5. Remove all tags that call JavaScript


  6. First, we know we want to find every tag that contains the word JavaScript, so let's start with some brackets and text:

    < javascript >

    We can make our pattern a little more explicit by knowing that JavaScript calls generally look like this:

    < ="javascript:" >

    Next, we need something to represent "any tag." We could turn to our old friend ".*?" but that pattern could cause some serious problems. For example, it would match

    <b>="javascript:"</b>

    Since that's not our goal, we can't use ".*?". But we know that the javascript comes before a closing bracket. So we will create a character class that allows anything except a closing bracket:

    [^>]

    We can use a similar technique to create a placeholder for the JavaScript function itself. We know that it cannot contain a double quote, since that's used to delimit the whole JavaScript call, so we define a character class of "not double quotes" like so:

    [^"]

    If we take that character class and again use "*" to represent the possibility that there could be zero or more of these characters, we get

    <[^>]*="javascript:[^"]*"[^>]*>


    To clarify:

    < Start with the open bracket of the tag containing the call.
    [^>]  Followed by any character other than a closed bracket
    *  As many times as necessary
    ="javascript: This begins a JavaScript call
    [^"] Not including any quote marks
    * As many times as necessary
    " Followed by a quotation mark
    [^>] Followed by any character other than a closed bracket
    * As many times as necessary
    > Ending with a closed bracket


    So now we simply pull out our delightfully case insensitive, regular expression based replace function:

    text = ReReplaceNoCase (text, '<[^>]*="javascript:[^"]*"[^>]*>', '', 'all');


    We've finished with our third task.

Where to Go Next

In many ways, regular expressions are like any programming language. It's a different idiom, I'll grant, but the process is the same. Define the problem; look for outside solutions; write or modify code as necessary.

Looking for more help? Here are some resources for the RegEx-challenged:


Benjamin C. Doom is a dashing and debonair young geek from London, KY. He first encountered Regular Expressions in Perl as an Assistant to the Network Administrator (or, as he was more commonly known, Utility Geek) while attending Macalester College in St. Paul, MN. He currently earns his lunch money as a ColdFusion programmer at Moonbow Software, Inc. (http://www.moonbow.com)

[Top]



This is an opt-in magazine. To join, leave or change subscription mode, please visit the signup page. All content of this magazine is copyright Fusion Authority, Inc. It may not be reproduced without permission.