Wednesday, January 27, 2010

WDDX in ColdFusion 9

So, I have been using CF8 and Flex 3 to build an application. I am getting to the point of having a stable 1.0 release, and as such, I am looking forward to the second phase of the project. The second phase is going to be based on a new database architecture, and as such, I thought that it would be a good time to flip everything to Flex 4 and CF9, so that I can take advantage of some of the DCD features of Flex 4 and the ORM features of CF9.

In some preliminary testing, I have run into the following issue:

I make good use of ColdFusion Reports (CFRs) in the current release, and I pass a query object that is built and passed into the CFR from a constructing component. When the system has created the query object, and the user flags it as a 'passed' report, the query is stored into the Database as a WDDX encoded object. This of course will allow me at a later time to do other actions on the object if needed, as I can just extract the data and convert it back to CFML, and I will have a Query Object in my code to work with and pass to the CFR.

Anyways, over the holidays, I formatted my system, and started over, and at that time I decided that I would be using CF9 as my main Development CF engine, as opposed to CF8. Last week, I was fine-tuning my read/write routine, and adding some flags as to WHEN those things would happen, and I ran into a roadblock. I created the query just fine and sent it to the CFR where it was rendered properly. I took the same Query and converted it to WDDX and saved it to the DB, then retrieved it and converted back to a Query Object and the CFR fails with an extra '<'. Now, dumping the query, it looks fine, so I can't say where the error is occurring. The real kicker of course, is that the code works fine on CF8. It will convert to WDDX and back again with no issues from the CFR.

I have filed a bug (81726) and would appreciate some votes for this. This bug will stop me from going to CF9. I guess I need to test out converting the query to JSON, but I thought that JSON did not keep its CF type when converted back, and everything would come out as a struct, when I need a query. Any suggestions?

Cheers!

Wednesday, January 20, 2010

Charts in ColdFusion Reports

So, I have taken to using ColdFusion Reports quite a bit more than I am used to I guess. I find them pretty usable most of the time. The interface for editing them is not the greatest, but I am hoping for a BIG improvement to come with CF10 - maybe an integration with CFB v. 2?

Anyways, my current beef is with the charting. I have a couple of SIMPLE bar charts, it generates just fine, not a big deal. However my client thinks that the labels would look sooo much nicer (along the X axis) if they were on an angle... Has anyone come across this? Is there a way to modify the CFR to handle this, or just the way that the chart is created? The CFR is not a human-readable format.

Would it be easier to create the chart in CF and save it as an image to insert into the CFR? That however seems like a ridiculous amount of work when Charts are built-in...

Thanks for any direction. If I come up with a solution, I will blog about it.

Cheers!

Thursday, January 7, 2010

Flex Builder Debugging

So, I am a sorta newb a Flex. I have been working in it on and off now for about a year. Most of the stuff I had worked on was pretty basic and I got by with using Alert.show to tell me what was going on, being 'ignorant' of debugging mode - Ignorant meaning, I knew it was there, and that I could use it, but I never did.

Well, now I have a bigger, little project on the go, and after seeing Jeffry Houser do a quick little Flextras Friday on the debugging mode, I thought I should go for it. I added a couple of watch statements and a trace() or two, and, WOW what a difference in debugging. Yeah, I know I should have learned about it way earlier, but hey, better late than never!

So, although this is a short one, I will say to all new/less experienced/ignorant (see above) Flex Developers. Time to take a look at what is built in to Flex Builder. My next step? To check out Debugging in Flash Builder 4! In the coming weeks/months I will be doing a LOT of Flex 4 work, so I better get better at using the debugging!

ANT and CFBuilder

SO, I am an ANT Newbie. I noticed though that CFBuilder has ANT built in, which I thought was cool, I mean, I see blog posts and twitter posts about ANT, but I would have to say that I wasn't overly tempted to try it for myself. Well this is a new year, so I am pushing my boundaries.

Anyways, so I looked at ANT a bit last week, and found it intriguing. All the samples that were on the site though were for Java mostly (not a big surprise really, but I don't compile any code before deployment). So, I Monday, I sent out a Twit to see if there was anyone with a good CF reference for ANT to do the simple stuff. I just want to copy some files from one location to another, so I can test it and then deploy. Marc Esher sent me over to http://www.mxunit.org/ where he had done a presentation on ANT and CF for CFUnited.

I downloaded the zip file, and found the reference file I was looking for. I worked on it a bit, and then forgot about it as phone calls and emails pored in... damn first day back from vacation.

So, later in the day, I was working along in CFB and accidentally hit CTRL-B, and I got a lovely console message telling me that my Build File wasn't right, the build.xml gained focus in CFB and the line with the error was selected... Was I ever shocked. So, I opened the sample again, and set back to work at it. I am impressed, with ANT, as well as its integration to CFB.

CFB popped up a content menu with ANT Tasks that I could choose from as well as descriptions of each - just like it does for CF tags, nice. So, I trundled along (it took about 5 minutes to get it working exactly the way I want it to) and finished off my first build script, then I hit CTRL-B again, but on purpose this time. ANT just ran along and boom, all the files I had wanted moved, were moved. The ones I didn't weren't. I would have to say I was a little excited.

So, I will be doing some more digging into the ANT docs, and Marc's preso and sample code, as I know that ANT can handle FTP'ing as well, so that is my next step. Oh, and the step after that? Well CFB as a plugin to FB4 and see if I can't get my Flex applications to build when I run the ANT script. That way I can run the routine and have the SWF compile and move with the CFCs needed to power it. I guess I need to figure out a way to have options in ANT, so that I can select if I want to run a 'Release build' or maybe just update the SVN... all from the same build file..

You know the more I think about how cool ANT is, the happier I am that the CFBuilder team included it! (I have never been one to continually add plugins to Eclipse, so this is just so easy... I like easy!)

Wednesday, January 6, 2010

Regarding Lists and ColdFusion

So, I have a question of sorts I guess, and am looking to see if there is anything wrong with what I plan on doing...

So, I am developing a couple of sites at the moment, and they both are presenting me with a similar problem, from the database side of things. Now, I am no DBA and don't ever profess to be, however, I always set up and design my own DBs. Both sites have existing information that is in a database, so I am looking to integrate it for some functionality moving forward.

Heres the thing:

I have a table filled with pesticide information (you know the things you can spray on crops to control weeds/insect/mold) and each pesticide has a column for whether the product is applicable to a certain crop (so, pesticide X is OK on corn, but bad for green beans) however the architect of the database set up a column for each crop. This table is HUGE must be about 50 columns of crops, and most are empty....

So, in my thought process, I planned on doing a little normalization and streamlining of the data. Take the pesticides and place them in a table separate from what they can be applied on, and then in the OK to apply table, I would just use the ID and then a list to show which crops were OK to apply on.

Now, from my perspective this seems like a good solution, however I think that there is one small holdup. (I am not too concerned about it cause I don't think it will happen, and if it does, its' not my problem, basically, but I am trying to be a good guy). ColdFusion has a ton of ways to access, and manipulate lists, so I can easily check if a crop is in a list for a product etc (although I think that this methodology might also get me in trouble, as I identify what is applicable to a given crop) however, not everything has these features.

From an SQL standpoint, what is the issue (if any) of storing information in lists? or am I better off to set up a table that places the crops in their own cell for each product?

Currently the table would be something like this:

ProductCrops
123corn,green beans,asparagus

Is this better?
ProductCrop
123corn
123green beans

I am curious as to what people think is the best way to handle this data... what is the more efficient methodology?