Saturday, April 30, 2005

Vivid Color

This site demonstrates how to get the most mileage out of your color pallete (Flash based home page), and bring it into your everyday life.

A great way to get back at your neighbors that let their pet soil your lawn (He, he).

Friday, April 29, 2005

Practical aggregation in CFCs

Basic aggregation with cfcs is pretty straight forward. There are plenty of examples where you have a simple 1-to-1 relationship between a parent object and its child. For example, you may have created an "Address" property that contains a series of string properties (line1, line2, apt, city, state, zip, etc.).

Elsewhere, you might create a "Customer" object that has properties like customerNumber, name, phone that are strings. You also give it a property called mailingAddress that has a type of Address (defined by the address object created earlier).

But what happens when you have to relate more than one child instance to the parent?

Suppose we're working with a set of objects like the ones shown in the diagram. Here, things are starting to get a little more complicated. We now have a parent object(car) that needs to contain several instances of our wheel object. In order to handle this, we create a wheelArray property in Car. Each wheel that needs to be on our car can now occupy a position in our array.

Lets skip ahead here and presume that all of the classes have a full set of basic getters and setters as well as a constructor that returns the object. We've also created an instance of our car object called myCar and that all of the properties have been populated with default values.

We can now reference one of the wheels and set its air pressure by doing something like this:


wheelArray = myCar.getWheelArray();
wheelArray[1].setAirPressure(32);


Say we now need to tell our car that the 3rd lug nut on wheel 1 is a locking lug. We could take the pattern above a step further by doing this:


lugArray = wheelArray[1].getLugArray;
lugArray[3].setLocking(true);


We can continue down the chain working with setting temporary variables for a few levels of nested objects, but eventually we run into problems. I've run into problems where the referencing of objects seems to fall apart and executing setter methods doesn't change the value of the object. I think this is due to the way CF creates copies of complex objects. Deep levels only get copied by reference.

The way I've gotten around this issue is to create additional getters for properties that return arrays of objects. You require a single argument to reference a specific item in the array. In the example here, Car.cfc would get a new getter like this (note, I put all my properties into a structure called instance):


<cffunction name="getWheel" access="public" output="false" returntype="Wheel">
<cfargument name="arrayIndex" required="true" type="numeric" />
<cfreturn variables.instance.wheelArray[arguments.arrayIndex] />
</cffunction>


We can now set the air pressure of a specific wheel without assigning the array to a temporary variable.


myCar.getWheel(1).setAirPressure(32);

Setting the lug can be done in one line now, too.

myCar.getWheel(1).getLug(3).setLocking(true);


I think (but I'm not sure) that this works because no arrays are getting returned by the string of components and none are getting assigned to temporary variables. There is an unbroken chain of objects being returned until we get to the last method that does the actual work. Hopefully, somebody can verify that this is the case.

It took me a long time through trial and error to figure out a way to handle this (I have another method for dealing with this that involves recursive variable assignments, but I can pretty much guarantee that it will NEVER wind up as a best practice). For me, this is one of those things that seems so simple once you know about it, but is a real time waster until you do.

For me, it seems that "reading the books" only gets me so far. Inevitably putting the concepts into practice gets more complicated when I'm trying to build a real application.

Thanks to Brendan O'Hara for his article Design Patterns in ColdFusion: Composite Pattern for getting me started.

Thursday, April 28, 2005

CF driven weapon of mass disgust-tion.

Exploding toads puzzle German scientists - Science - MSNBC.com

Bwwwaaaahaahhah! They said it couldn't be done. They said it would never work. Now, straight from the same country that explored the benefits of the Giant Buttered Cat Array , proof that event gateways can interact with other stuff!

The Code:
<cfscript>
toad.explode("Hamburg pond");
</cfscript>
Looks like all those German ColdFusion developers dropping their half-finished Mountain Dew Code Red bottles in the drink has had a disasterous effect. Why do I think it was the soft drink? Toads can't burp, of course.

I guess you could say they "croaked" (c'mon, you know somebody would have to say it. I'm just getting it out of the way so a more serious discussion can take place.)

NOTE: ColdFusion is not actually being implicated in the story. It was just my sorry attempt at making a joke.

Sunday, April 24, 2005

VSS.Net disappoints

I just sat through the MSDN webcast about the upcoming release of VSS. The main feature that I was interested in was the ability to set up remote access over HTTP. What a letdown. The feature is only available inside Visual Studio 2005 with access to an install of IIS. The remote vss user has a severly limited set of capabilities. You're pretty much limited to check in and check out. You can't even look at a file's history.

SourceGear has been providing a solid remote experience as an add on for several years including a nearly complete set of features (diff, pinning, view history, etc.).

After the Adobe/Macromedia announcement, I've been doing some investigation into moving into a .Net environment or a java environment just to hedge my bets a little bit.

I have to say that after looking at some of the .Net readiness information and presentations that I'm not sold. Out of the whole Visual Studio.net platform, the only one that looks really interesting is SQL server, mainly for the new security and encryption capabilities. I don't think I can stomach the constant product tying that seems to lurk around every corner of the MS developer stack.

Avalon looks interesting, especially the 3d stuff. Unfortunately, the demo I saw showed nothing in the way of real business productivity. Plus the windows only capabilty is severly limiting. I think it may be a day late and a dollar short when compared to flash/flex. I think Avalon is probably going to need to get to at least a 2.0 release before it can even hope to begin displacing the CURRENT flash and flex installs. I'm sure there is more in store for us for both flash and flex.

As for alternate source control packages, I'm going to look at both subversion and the one from Seapine.

Java is starting to look like a much more palatable technology than .Net. You just don't have the feeling that the maker of the products is laughing at you for buying into their technology.

Saturday, April 23, 2005

Dreamweaver and Flash tweak wanted.

My development team is one of those rare outfits that prefers to use Dreamweaver as our editor for ColdFusion, javascript and css. I know there are better point solutions for each one, but having them all rolled into one package is handy. Cfeclipse is pretty terriffic, but I miss the split view for cf pages and I've gotten used to the integrated css features in Dreamweaver.

I have a short laundry list of enhancements that I would like to see in DW that I have submitted to the wish list over the years.

One feature that would be great to add to both DWMX04 and FlashMX04 would be to prevent typing in any file that is read only or not checked out.

Here's what happens to us occasionally.

  1. One of your co-workers edits a page and checks it into source control.
  2. At some later date, you open the page just to see what is in it while you are working on something else.
  3. You realize after review that you would like to make some changes, but you've forgotten that you don't have the file checked out and are looking at an old file on your local machine.
  4. After you've made a bunch of changes you go to save it and realize that you can't.
  5. All too often, this is what happens next. You hit ctrl-a to select the content of the file you've just edited. Then you do a ctrl-c to copy the file to the clipboard.
  6. Next you check the file out (and don't realize the DW/Flash just did a get latest replacing your old file on your local drive).
  7. Ctrl-a again and then ctrl-v to paste your changes on top of the just checked out file. What you may not realize is that you just replaced your co-workers edits on the file.
  8. You save the file and check it back in.
  9. Your co-worker's changes are now removed from the code repository and relegated to history. Grrr...
If DW/Flash would prevent you from typing in the read only file, you would be forced to check out/get the file before you edit it. This would preserve your co-worker's work.

I've seen this behavior in some other editor, but I can't for the life of me remember what it was. Is there some other Macromedia product or a prior version that worked this way?

Tuesday, April 19, 2005

Morning rebound for MACR and ADBE

Macromedia hits new 52 week high in early morning trading. Most likely showing investor confidence on the Adobe purchase of Macromedia as well as some bargain hunting.

Adobe also gets a bump in after hours trading and continues to move up shoing signs that it may recover quickly from the selloff accompanying the acquisition announcement.

Other tech stocks appear mixed.

Migrating ASP.net to ColdFusion

A very interesting read. This is a pretty vailid comparison of the two technologies as long as you keep in mind that it is written to go the other direction (cf to asp.net)and is on the Evil Empire's website. There are also a few points that could be clarified because it was written before cfmx7 was released.

I found it interesting to note where cf offers built in functionality that requires third party add ons for asp.net (ie., charting).

Of course there is no mention of Flash and amf, which I find one of the most compelling features of cf now. There is also no mention of Avalon which could toss a new wrinkle in the comparison.

Has anybody looked at visual studio 2005 and found any hooks for Avalon? I'd be interested to hear what you have found.

Sunday, April 17, 2005

Firefox 1.0.3 critical update released 4/15

Three biggies in this one.

MFSA 2005-37 Code execution through javascript: favicons

MFSA 2005-39 Arbitrary code execution from Firefox sidebar panel II

MFSA 2005-41 Privilege escalation via DOM property overrides

You can get the update inside the options panel under advanced or by going to getfirefox.com.

Thursday, April 14, 2005

Updated CFC generator for Enterprise Architect

I made two minor changes to the MDG xml file to import into your Enterprise Architect projects. The first was to standardize on true/false instead of yes/no for boolean attributes. I didn't really have any solid reasoning for doing this other than I like the consistency and it makes the code similar to the approach used by other languages (thanks for the heads up on this one, Tracy).

The other change was to utilize the property setter functions in the constructor instead of accessing the properties directly. We have an application that requires a lot of massaging of data for presentation vs. storage that required us to do a bit of preprocessing. The setters take care of it handily and if referenced consistently, avoids having to duplicate code in a few places. If we find that the processing has changed a bit, changing the setter fixes both the setter (which might be referenced in many places) as well as the constructor which is used to sometimes create empty instances.

If you are using Enterprise Architect for your UML modeling, feel free to grab the MDG xml (click to view, right click to save) file I've put together and use it. Let me know if you make any cool changes.

Wednesday, April 13, 2005

Simon Horwith delivers solid session.

Simon Horwith's Blog

I caught Simon's discussion last night at the MDCFUG meeting about the new features of cfform.

What a terrific discussion. Simon has an engaging delivery style that just makes you want more. He was also adept at managing the online activity while he was talking by bringing it into the live discussion. We would periodically see notes or messages from both viewers of the Breeze presentation and the people supporting the discussion at Macromedia. It really tied the whole experience together.

On top of that, Simon actually knows a bit about the subject matter ;).

If you get the chance to make it to cfunited, check out Simon's session on design patterns.

If you haven't guessed, one of the best speakers I've seen in a while.

Tuesday, April 12, 2005

Yet another huge ID theft

Lexis Nexis ID theft much worse than thought - Spam, Scams & Viruses - MSNBC.com

I guess it always has to get worse before it gets better. This theft and the Choicepoint theft were done at companies where there is a more vigilant approach to security than most businesses. It points out how vulnerable our systems are even when security is a top priority.

While the company is downplaying the incident claiming that the breach was caused by their legitimate customers allowing their ids and passwords to be stolen, I think the company needs to bear the bulk of the responsibility for the incident. Current estimates put the impacted identities at about 310,000 people. Oops.

I think it's probably time for people to start seriously think about finding a way to require identity verification to access these sensitive systems online. Maybe some of the two factor id systems like the one Verisign is trying to sell need to be investigated.

Unfortunately, these types of systems blow apart the business models of some of the online companies. It can easily add $10 to the cost of acquiring a new customer. Some volume plays (eBay, for example) would have a tough time covering that type of expense and continuing to make money.

Whatever winds up getting developed to help secure systems better, I think it's pretty safe to say that username/password has come near the end of its useful life for sensitive systems.

Saturday, April 09, 2005

Should I take a jacket?

There is a saying in DC that goes something like this:

"If you don't like the weather here, hold on a minute..."

If I'm on site on a project, I find that I sometimes don't have a good view of a window to keep an eye on weather conditions. "Okay, Mike, while you're here, you can use this broom clos... eh..office to work in. Mind the bucket."

Not knowing the current weather can sometimes be a bad thing.

You've done it before. You find yourself coding for eight solid hours with your eyes glued to the screen and the headphones on when you finally look up. Everyone has gone home including the cleaning crew, and there are six inches of partly cloudy covering the roads for your ride home. You only worked late because you didnt' want to break your rhythm.

I'm afraid the weather bug might take out a credit card in my name and since I have so much free time on my hands, I thought I would do something to help my problem.

Like any normal developer, I decided to slap toghether something just to see if I could do it.

Well this one was almost trivial. Just using the built in components and the NOAA xml service, I was able to put together the weather box you should be seeing to the left.

No server-side technology is used, which means you can run it just about anywhere.

Feel free to grab the swf if you want. Use the code below to embed the flash file in your page. You want to edit the four locations I highlighted to point to the location of your copy of the swf file and the call letters of your local NOAA weather station. If you're interested in .fla, just send me a note and you're free to hack. Just show me any mods you make to the .fla.


<!-- Weather panel -->

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="200" height="300" id="weather" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Web address of swf file" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="FlashVars" value="NOAAStation=KBWI" />
<embed FlashVars="NOAAStation=KBWI" src="Web address of swf file" quality="high" bgcolor="#ffffff" width="200" height="300" name="weather" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<!-- end Weather panel -->