Amcom Home Page

 When ColdFusion Report Builder seems to mangle reports

We were working on an existing ColdFusion Report Builder (CFRB) report, and it ran fine and all that. But the mere act of just saving it seemed to corrupt the reports display.

What we found was that some of the item/fields don't retain all the metadata that they're supposed to. Turned out they were set to not visible or they were set too small.

Additionally another issue is that your desktop needs to have all the fonts utilized by the report.

Thanks to Jon Hirschi for figuring this out!

 Importing Excel Spreadsheets. The Easy Way

Recently I was asked to import data into our system using a spreadsheet provided by the client. There are, of course, numerous ways to go about this, including using tools built into SQL Server (DTS/SSI). However, I wanted to provide tool that the client could use to perform these imports themselves, in the future.

The obvious choice was a web-based tool. The client is used to web-based interfaces and I could also leverage some new functionality in ColdFusion 9. I knew that ColdFusion now has the cfspreadsheet tag, and it was a great opportunity to test this.

The spreadsheet provided to me was over 42,000 rows of data. This seemed like a lot for a spreadsheet! After reading through the documentation on the cfspreadsheet tag, I determined, for my use, that converting the contents to a query object was probably going to make it easiest to work with. I simply provided a form for the client to upload the Excel file to the server. Once the file was uploaded, I used the following to process the file and convert it to a query object:

<cfspreadsheet action="read"
   src="#variables.uploadedFile#"
   query="mySpreadsheet"
   headerrow="1"/>

I'll explain each of these attributes in minor detail:

action - This is what type of action we want to perform on the spreadsheet. The choice are read, update and write.

src - The source of the Excel spreadsheet. In my case, this is a dynamic value, but does require an absolute path!

query - The name I am giving to my query object for future reference headerrow - the row number in the spreadsheet which contains the column names

I'd like to point out that if you do not define headerrow you will need to reference your column names as such: col_1, col_2, etc. If you do provide the headerrow attribute you MUST reference the columns by name.

Now referencing your spreadsheet data is simple! If you want to output the data to the screen, simply use cfoutput like you normally would for a query!

<cfoutput query="mySpreadsheet">
#column1# #column2#<br />
</cfoutput>

It's that simple!

Instead of creating a query object you also have the ability to create a csv or html from your spreadsheet. to do this, using the following

<cfspreadsheet action="read"
   src="#variables.uploadedFile#"
   name="mySpreadsheet"
   headerrow="1"
format="html/csv" />

By leaving out the format attribute, it will return a string. Regardless of which format you choose, you can output the data to the screen like this:

<cfoutput>#mySpreadsheet#</cfoutput>

As you can see, the cfspreadsheet tag has made working with Excel files much easier!

I would like to point out a couple of caveats I experienced while working with the cfspreadsheet tag:

1. There's a bug, which I have yet to report, but will do soon. Essentially, if your spreadsheet contains pound signs (#), the read will fail. Hopefully this will get fixed soon.

2. Spreadsheets with large amounts of data, such as my project with 42,000+ rows, may completely fail when using HTML or CSV format. I have a fairly beefy machine (multi-core, 6GB RAM) and could not get mine to process the file in HTML or CSV format. Your mileage may vary.

Overall, it looks like cfspreadsheet is a very valuable addition to the CFML language. Hopefully it will get updated over time to include other spreadsheet formats too, like Open Office! It certainly saved me considerable time in my project and will prove a valuable tool for the client for future use. Also, I know how to leverage this for future projects now, time well spent!

 Report builder and style issues

I started working with Report Builder today and things were going along just fine. I was making some changes to the report, and adding in a bunch of styles, then ended up with some really wierd results once i shut the reports down and tried to open them back up again.

What appeared to be happening was that items that i had set up with a style were not staying set and that the report builder was forgetting the association with style. But that turned out not to be the case.

I decided to investigate a bit more and found out the following:

if you use a value outside of a normally used default value, in my case, we were using a font size of 7 (I know, really small right?) and it's not in a defined style, when you exit the file and load it back in, it will "forget" those values.

To replicate:

create a new file, and create a text label. enter some text in there. change the font size to 7. save the file. then close the file. Open the file up, and you'll see that the size has moved back up to the default font size.... How fun!!

The work around is to define a style with the minimum size/style that you want and assign it to the text area that you define.

Summary

This is my first time working with Report Builder in Coldfusion. I remember the hype about it a few years ago when they launched it, but it looks like it hasn't lived up to the hype... in some senses it seems like it would be easier/quicker/faster/more flexible/ to just create the report in CF and the pump it into pdf.

 Browser Memory Utilization

We have a large body of users who remote desktop into a small terminal services farm to run a web based intranet app.

The application was originally aimed at Internet Explorer (because of its integrated window security for automatic login), and the servers are nearing the edge of comfortability.

So while we look at expanding on the hardware side of things, we also took at look on the software side - specifically the browser (currently supporting IE7).

After doing some tests, we found some surprisingly results. Keep in mind this was by no means an exhaustive analysis, but a quick evaluation to see if any browser has a clear advantage with our intranet apps.

The Results
To our surprise, IE8 actually runs the leanest overall:

Here are some other observations/notes:

  • Chrome and IE8 by default run each frame, pop-up window, and tab as a separate process (you'll see multiple .exe's running in the task manager). Most people don't know this and so it appears that the one Chrome process they look at seems like it's using incredibly low amounts of memory (but if you add it up, it's not as mindblasting).
  • We configured Chrome and IE8 to run as a single process.
  • Any theme, extension, add-on, toolbar, etc... to FireFox significantly increases memory usage. In the tests above, this was a FireFox running barebones.
  • Chrome seems to have a significant advantage on pages that have a lot of JavaScript involved (e.g. the my.yahoo.com portal when logged in) - and IE8 did the worst.
  • On the flipside with regular HTML pages that used simple JavaScript (e.g. form validation), IE8 did the best. Though Chrome was close on some of those occasions.
  • Was unable to test Safari 3 and 4, they flat out didn't work on the Intranet.

The next thing that would be interesting is to go through a series of planned steps for a period of an hour and see how well they do.

 Split Screen View in Eclipse

Most IDEs offer what's known as a "split screen" view. In such a view, while editing a single file, you can horizontally "split" the page in the editor and scroll each section individually. This is useful when you've got a particularly long file to edit, and you need to see some code at the top of the page while editing code at the bottom (or really, editing any part of the page that might depend on another part that would have otherwise scrolled off of the page).

A co-worker is trying to make the change from his current IDE to Eclipse and recently asked whether or not this functionality is there. The answer is yes. Kind of. It's not a "true" split screen view, but here's how to get as close to it as is currently possible within Eclipse.

[More]

 MAX 2008: New ColdFusion IDE Announced ("Bolt")

BoltLike many folks, I wasn't fortunate enough to be able to attend MAX this year, but thru the magic of the interwebs we were all able to "listen in" on today's keynote.

Some interesting information about FlexBuilder and Dreamweaver... but the big news for me, as well as a lot of ColdFusion developers, was the announcement of Bolt, a new Eclipse-based ColdFusion IDE.

There is not a lot of information available yet. The product isn't available for download. The best you can do is sign up for Adobe's prerelease program at http://www.adobe.com/go/boltprerelease. What little information there is can be found at http://labs.adobe.com/wiki/index.php/Bolt.

Looking forward to hearing more about Bolt as information becomes available, as well as eventually test-driving a beta.

PS - Yes, I'm aware that the Bolt image above isn't the ColdFusion IDE Bolt. Best I could do for now. Hopefully Disney doesn't sue. :)

UPDATE:
via Kristen Schofield's blog, what I assume to be the actual Bolt logo:

 Structures and Pointers

This is one of those entries that's kind of embarrassing to write, because I'd like to think that after doing this for as long as I have, it wouldn't have been an issue that stumped me for an hour. But it did. And I'd like to think that it may potentially stump somebody else, so let's get it out in the open and try to save somebody else an hour.

I had data that related to 3 distinct entities. Let's say those entities were representations of an employee (a nice textbook-ish example). Employees have names, phone numbers, and departments. I want to store that information in a structure for each employee, and put each structure into an array. Here's how I went about doing that:

<cfscript>
	employees		= arrayNew(1);
	employeeStruct	= structNew();
	// populate employeeStruct, append to array
	employeeStruct.name		= "Bob Smith";
	employeeStruct.phone	= "800.555.1212";
	employeeStruct.dept		= "Marketing";
	arrayAppend(employees, employeeStruct);
	// populate employeeStruct, append to array
	employeeStruct.name		= "John Jones";
	employeeStruct.phone	= "800.555.1313";
	employeeStruct.dept		= "HR";
	arrayAppend(employees, employeeStruct);
	// populate employeeStruct, append to array
	employeeStruct.name		= "Frank Wilson";
	employeeStruct.phone	= "800.555.1414";
	employeeStruct.dept		= "IT";
	arrayAppend(employees, employeeStruct);
</cfscript>

[More]

 Use SeeFusion's HTML interface when CPU is pegged

We love SeeFusion - its been a life safer in helping isolate slow running pages and queries.

But when CPU/Memory is totally pegged on the server its Flex interface may not load. As an alternative you can load it's HTML only interface which gives you a chance to spot the offending page/query.

To do this add /html to the SeeFusion URL. E.g instead of http://machine:8999, use http://machine:8999/html.

You can also kill a process from this page, but when it does that it'll redirect you back to the Flex interface. If it's still not loading, just go back manually to the HTML page to see if the process has been killed.

When killing processes with SeeFusion, you may need to do it a few times. The first attempts will try to do it gracefully, whereas subsequent attempts will try a hard kill.

 AJAX/JS Framework Showdown - jQuery vs Spry

In an ongoing effort to put together our development standards at Amcom, we're currently researching AJAX/JS frameworks. The choices have been essentially narrowed down to Spry or jQuery.

I haven't done a considerable amount of work with either, but my personal preference leans towards jQuery. I'm more familiar with it than Spry (while I haven't really gotten my hands too dirty with it, I've used a number of jQuery plugins), and being someone who likes JavaScript I'm comfortable with the syntax.

The boss, however, being a big Flex guy, really gravitates towards the Spry syntax, as it's more familiar to him. The boss, being a fair and noble kind of boss (yes, he reads the blog), told me to go out and do an objective analysis of the two and see if one comes out significantly ahead of the other.

I built a few demo apps using each (http://amcomtech.net/labs/ajaxframeworks/) and from a technical perspective I have to admit, it's still kind of a tie.

[More]

 My Introduction to Image Manipulation in ColdFusion8

One of our client web sites allows users to generate custom marketing materials and save them as PDF files. We had a request yesterday to allow users to save these PDFs as images so that they could embed them directly into e-mails, as opposed to sending as attachments. Sounded like a job for some of the new image manipulation capabilities of ColdFusion 8. I'd not yet had the opportunity to play around with this new functionality, so I was looking forward to it.

At first, I thought it was going to be as easy as using <cfpdf> with the "thumbnail" action. The hitch that I ran into was that some of the PDFs are multiple pages, and <cfpdf action="thumbnail"> generates a thumbnail image for each page. So the challenge was combining each of those individual thumbnails into a single image file. That's where I really got to get my hands dirty with the new built-in image functions. Here's what I came up with (breakdown follows the code):

[More]

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner