Wednesday May 7, 2008 9:48 AM
Word Count:
285
This morning I was reading an entry by Ben Nadel on using single character wild cards. The article was a good one and I learned something new but I also posted comment saying how it would be great if we could use multiple filters. Steve Withington posted a response showing that indeed you could do this. This of course had me a little confused because I was always told that you could only use one filter. If your not sure what I am talking about lets look at the following example. The following example reads a directory named cfgrid and does not apply any filters and therefore will list the entire contents of the directory.
<cfset filters = "">
<cfdirectory action="list" directory="#ExpandPath('.')#/cfgrid" filter="#filters#" listinfo="name" name="dir">
<cfdump var="#dir#">

As you can see from the example above the entire directory is listed. The directory contains png,cfm & cfc file extensions. If we wanted to list just the png files we could apply a filter to the results.
<cfset filters = "*.png">
<cfdirectory action="list" directory="#ExpandPath('.')#/cfgrid" filter="#filters#" listinfo="name" name="dir">
<cfdump var="#dir#">

I was always told that you could only filter by one file extension. In fact this is right from the docs which would really back up that statement.
File extension filter applied to returned names, for example, *.cfm. One filter can be applied.
As I noted earlier you learn something new everyday. Here is an example of how to create multiple filters.
<cfset filters = "*.cfm|*.cfc">
<cfdirectory action="list" directory="#ExpandPath('.')#/cfgrid" filter="#filters#" listinfo="name" name="dir">
<cfdump var="#dir#">

Friday April 25, 2008 9:12 AM
Word Count:
84
Last nights Cleveland CFUG was a cfObjective preview with 3 great presentations. If you were unable to attend I have great news for you. The meeting was recorded via ColdFusion Meetup and can be found below. We were lucky enough to have 3 presenters last night and I thought all of them brought something to the table. You can head over the ColdFusion Meetup to get a description of all 3 presentations.
ColdFusion Meetup Recordings
Tuesday April 22, 2008 4:45 PM
Word Count:
602
cfObjective Preview
April, 2008 Meeting:
The April meeting will be held on Thursday, April 24, 2008, from 6:00PM - 8:00PM, at the Cleveland offices of Lodestone Digital LLC, located at 4500 Rockside Rd., Suite 150, Independence, OH 44131. If you are unable to attend the meeting in person you will be able to watch our 3 presenters by way of the ColdFusion Meetup. If you would like to join the meeting online go to http:/experts.acrobat.com/cfmeetup/.
We are going to talk a little bit about the cfObjective conference coming up in May. If you are not familiar with this conference the details are below. You should really check out the website to get a detail view of the session list. We are lucky enough to have Raymond Camden, Brian Meloche & Todd Sharp presenting to us at the meeting. All of our presenters are speaking at the conference and this meeting will give you a preview of their presentation. All of the presentations are short previews designed to show you what the cfObjective conference has to offer.
cf.Objective() 2008
http://cfobjective.com
The Only Enterprise ColdFusion Conference...
May 1 - May 4, 2008 at the Crowne Plaza, Downtown St. Paul, MN!
Introduction to Model-Glue
Raymond Camden http://www.coldfusionjedi.com
This is an introduction to the Model-Glue framework. Basics will be covered but time will also be spent looking at real world Model-Glue.
Integrating ColdFusion 8 AJAX with Model-Glue Applications
Todd Sharp http://www.cfsilence.com
This presentation will examine several aspects ColdFusion 8 Ajax capabilities and how they can be leveraged to simplify adding Ajax functionality to your Model-Glue applications. A short introduction to the CF8 Ajax features will show Data tools and UI components and will highlight appropriate uses of these elements. The heart of the presentation will examine best practices for utilizing ColdFusion 8 Ajax functionality within your Model-Glue application. This section will examine when it is appropriate to route Ajax requests through your controller and when you should create and utilize a remote facade. Also included will be a short section demonstrating how to tap into the underlying raw Ajax frameworks on which the CF8 elements are built to extend them to meet your particular application.
ColdFusion as a Different Type of "Glue"
Brian Meloche http://www.brianmeloche.com
Is ColdFusion really "the glue" that Adobe says it is? We always hear about functions like PDF generation, image manipulation, Outlook integration and all of the new functionality, but is that all that ColdFusion is good for? Is ColdFusion for intranet use only? Can ColdFusion be a different type of glue? This topic will cover using ColdFusion as the front end to an enterprise-level, customer facing application, integrating it with a business object back-end from enterprise-level systems. This will cover what types of things you would need to integrate, levels of integration, ways to integrate, including MQ Series and WebMethods, WSDL vs. REST, direct vs. indirect integration, integrating with external applications, and data replication.
Join the meeting at http://experts.acrobat.com/cfmeetup/
Thursday April 10, 2008 2:16 PM
Word Count:
229
If you had a chance to read my review of Flex Camp Cleveland then you already know how much I enjoyed the conference. One of my favorite presentations from the day was by Kris Schultz and It was an Introduction to Object Oriented Programming. As I stated in my review, OOP is nothing new to me but I really enjoyed this presentation. Kris walks through some of the terms and concepts behind OOP. The presentation is geared towards beginners but If you are coming from another language its a nice intro in OOP in ActionScript 3.
Today Kris sent me an email to let me know that he recorded his presentation from Flex Camp Cleveland. I was very excited not only because I was going to be able to watch it again but this would give me a chance to tell others about it. Even if you are not interested In Flex I believe this presentation could be helpful to you. If you are interested in Flex / ActionScript 3 then I would consider this presentation a must watch. Thanks again to Kris for letting me know this was up. The link to his presentation is below, enjoy!
http://www.createandgrow.com/presentations/flexCampCleveland2008/video.html
Wednesday April 9, 2008 12:08 AM
Word Count:
457
The first ever Flex Camp Cleveland was held Monday April 7 2008. Flex Camp Cleveland is an all-day event for
beginning Flex developers, organized by the Cleveland Flex Users
Group (CLEFUG). I was lucky enough to attend the all day event and I would like to share some notes with you on both the event itself and the speakers presentations. First off I want to say thank you and Congratulations to Mick Keily and JD Schrock for all their hard work as I think the event was a big success. There was a great turnout of over 150 people and I think they did a great job of selecting a great location to host the event. The Middleburg Heights Community Center turned out to be a great host so hats off to them for the venue. The registration for the event was an all time low of $25 and I think this is a great way to get people to come out. Once I got to the event the registration process was very easy and I got a nice Flex Camp shirt that I can now show off.
The keynote was given by Ben Forta from Adobe and as always he did a great job. I think he ended up cramming an 1.5 hour presentation into 50 minutes. His presentation was a brief overview of flex and a quick getting started tutorial. Here are some notes from his presentation.
- One way to explain Flex is code based flash or flash for developers
- For the longest time the first thing people thought of flash was Skip Intro
- Flash has been a designers tool forever
- Flex SDK is Free / Open Source
- We see more and more business applications popping up,
not that you could not produce it before but now the tooling is
different.
- He went through a walk through of Flex builder
- You do not need to buy Flex builder to build applications but it sure provides some nice features
- Walk through of how to build an application using the CF/Flex Wizard - Can it get any easier
- AMF (Flash Remoting) is the preferred way of retrieving data
- Design view has an embedded version of the flash player so it is an actual representation of what your code will produce (Did not know this)
- An exclamation point in the outline view points out something is wrong (Nice Tip)
- Flex applications are compiled down to ActionScript there for you could build Flex applications entirely in ActionScript if you wanted to.
[More]
Friday April 4, 2008 9:15 AM
Word Count:
338
There is still room if you are thinking of attending Flex Camp Cleveland on April 7th. This is the deal of the century for only $25.00! If you would like to register head over to http://www.flexcampcleveland.com. I will be there and hope to see you all there. Here is more information from one of the organizers Mick Keily.
Registration has been strong and we have a good turnout--at least a hundred attendees. We will also accept walk-ins until we reach capacity but we would prefer online registrations to guarantee a lunch and a conference T-shirt for everyone.
We also have several great raffle prizes lined up so far:
- 2 copies of Flex 3 Pro from Adobe
- 1 one-year subscription to Lynda.com online education
- Numerous software books from O'Reilly and Peachpit
Plus, everyone will receive a 35% discount for a copy of the hot-off-the-press Adobe Flex 3 Training from the Source.
Please note that the check-in process begins at 8:15am and the first presentation will be at 9am. We have bagels and coffee available for you in the morning, and a box lunch and a snack during the day.
By the way, the Middleburg Heights Community Center is just past the third traffic light east of the Bagley Road exit on I-71, on the left (north side). Look for the American flags for the driveway.
Also, there is WiFi available within the conference center but a laptop is not required. The seating will be theater style.
Hope to see you on Monday!
Friday March 28, 2008 2:48 PM
Word Count:
945
A couple weeks ago I wrote an tutorial on how to create a custom Grid Editor. The tutorial explained how you could tap into the power of Ext to create a select menu editor. In the example we used state as the edit field. This is a perfect example of where you would want to pick from a list rather than key in your answer. It has come to my attention that this functionality is baked right in to ColdFusion 8. This raises 1 important question for me, is nobody is reading my articles or did nobody know this was baked in?
So to get started with this tutorial you need a little knwoledge of how editing works with the html grid. Lucky for you I wrote a quick start on basic editing using the grid. The following code should look pretty similair if you have been following along. Here we are just running a query and setting up some basic properties for our grid. If you double click in any of the cells you should be able to edit the data.
<cfquery name="getArtists" datasource="cfartgallery">
SELECT artistId, firstname, lastname, address, city, state, postalcode, email
FROM Artists
</cfquery>
<cfset args = structNew()>
<cfset args.name = "ArtistGrid">
<cfset args.format = "html">
<cfset args.query = "getArtists">
<cfset args.stripeRows = true>
<cfset args.selectColor = "##D9E8FB">
<cfset args.selectmode = "edit">
<cfset args.onchange = "cfc:artists.editArtist({cfgridaction},{cfgridrow},{cfgridchanged})">
<cfform>
<cfgrid attributeCollection="#args#">
<cfgridcolumn name="artistid" display="false">
<cfgridcolumn name="firstname" header="First Name">
<cfgridcolumn name="lastname" header="Last Name">
<cfgridcolumn name="email" header="Email Address">
<cfgridcolumn name="address" header="Address">
<cfgridcolumn name="city" header="City">
<cfgridcolumn name="state" header="State" >
</cfgrid>
</cfform>
The real power comes from the cfgridcolumn tag that has a couple of attributes that I did not know existed.
- select - Determines selection behavior if the cfgrid selectmode attribute value is column, edit, or single; ignored for row or browse values.
- values - Formats cells in column as drop-down list boxes; specify items in drop-down list, for example:
values = "arthur, scott, charles, 1-20, mabel"
- valuesDisplay - Maps elements in the values attribute to string to display in the drop-down list. Delimited strings and/or numeric ranges.
So with this knowledge you can set some values for a user to select from when editing a column. The great thing about this is we can grab our values from anywhere such as a list, query or even a web service. In my example I am just setting the state abbreviations and display values using lists.
<cfset state_abbr = "AL,AK,AZ,AR,CA,CO,CT,DE,DC,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY">
<cfset state_name = "Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware,District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky,Louisiana,Maine,Maryland,Massachusetts,Michigan,Minnesota,Mississippi,Missouri,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York,North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Pennsylvania,Rhode Island,South Carolina,South Dakota,Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming">
<cfform>
<cfgrid attributeCollection="#args#">
<cfgridcolumn name="artistid" display="false">
<cfgridcolumn name="firstname" header="First Name">
<cfgridcolumn name="lastname" header="Last Name">
<cfgridcolumn name="email" header="Email Address">
<cfgridcolumn name="address" header="Address">
<cfgridcolumn name="city" header="City">
<cfgridcolumn name="state" header="State" width="125" select="true" values="#state_abbr#" valuesdisplay="#state_name#">
</cfgrid>
</cfform>
This makes it really easy to for you to create select menu editors. Here is a quick image of my example.
Friday March 21, 2008 11:02 AM
Word Count:
446
I know there are many users out there who love cfscript and many who really don't care for the syntax. I am really on the fence, I like the syntax but do not use it much because of the lack of support for certain tags and on the presentation layer it just does not mix well for me. One of the main reasons that Adobe is yet to support full scripting is the cfqueryparam tag. I am hoping that in the next version of ColdFusion they find a way to resolve this.
I have been doing some ActionScript 3 development lately and I really love the language. So with that I have a small proposal for CF9 that I am sure some people will be with and some are going to hate it. Day to day I write many Components so I think it would be really cool to write components using scripting. With that said here is an example of what I would like to be able to do.
<cfcomponent output="false" format="script">
variables.dsn = "";
public function init(String:dsn):User{
variables.dsn = arguments.dsn;
return this;
}
public function getUsers():query {
var q = new cfquery();
q.name = "q";
q.datasource = variables.dsn;
q.sql = "SELECT * FROM Users"
q.execute();
return q;
}
public function getUser(Numeric:id):Struct {
var q = new cfquery();
q.name = "q";
q.datasource = variables.dsn;
q.sql = "SELECT * FROM Users WHERE id = " + arguments.id;
q.execute();
return queryRowToStruct(q);
}
</cfcomponent>
So go ahead rip it apart! Again this is just an idea and I would love to hear pros and cons of this approach from others.
Friday March 21, 2008 10:58 AM
Word Count:
114
I would really like to find out what developers are looking for in the next version of ColdFusion. I am trying to put together a wish list to pass on to the engineering team (I know I am behind on this, sorry guys) and I am drawing a blank. I have a list of about 5 things right now so I could really use some feedback. After I get some feedback I will expand on this next week and we will see if we can grow this list to help the team out. Remember they are building the product for you, let your voice be heard!
Thursday March 20, 2008 9:25 AM
Word Count:
1740
As you all know by now the grid in ColdFusion 8 is powered by the Ext framework. If you dive into the documentation you will find out that there is more that you can do with it then advertised. We have been looking at ways to customize the grid, today we will learn about event listeners. The grid has the ability to announce events as they are happening even if you are not listening for them. Events can include clicking on a row double clicking on a cell or even using a keyboard shortcut. Just knowing that the gird announces these events will do you no good, you need the ability to listen for them.
The grid gives you 2 methods to listen for events. The following methods will append an event handler to this component the on method is just shorthand for addListener.
- addListener( String eventName, Function handler, [Object scope], [Object options] ) : void
- on( String eventName, Function handler, [Object scope], [Object options] ) : void
These methods belong to the grid so to use them you need to have the grid object. Fortunately for you ColdFusion provides an easy way to get the grid object. If you have been following my examples than the following should look familiar. I am using the cfartgallery data source that ships with CF8 so you can follow along at home. The code below will run a query and create a grid with the name of ArtistGrid. The name is important because that is how we will get our grid object later on. Finally the last line will call the init method when the page loads.
<cfquery name="getArtists" datasource="cfartgallery">
SELECT artistId, firstname, lastname, address, city, state, postalcode, email
FROM Artists
</cfquery>
<cfset args = structNew()>
<cfset args.name = "ArtistGrid">
<cfset args.format = "html">
<cfset args.query = "getArtists">
<cfset args.stripeRows = true>
<cfset args.selectColor = "##D9E8FB">
<cfset args.selectOnLoad = false>
<cfform>
<cfgrid attributeCollection="#args#">
<cfgridcolumn name="artistid" display="false">
<cfgridcolumn name="firstname" header="First Name">
<cfgridcolumn name="lastname" header="Last Name">
<cfgridcolumn name="email" header="Email Address">
<cfgridcolumn name="address" header="Address">
<cfgridcolumn name="city" header="City">
<cfgridcolumn name="state" header="State">
<cfgridcolumn name="postalcode" header="Zip">
</cfgrid>
</cfform>
<cfset ajaxOnLoad("init")>
Now that our grid is setup we can setup our init method. Remember I said ColdFusion makes it easy, I was not lying, the getGridObject will get our grid for us.
<script type="text/javascript">
function init(){
//get the grid component
grid = ColdFusion.Grid.getGridObject("ArtistGrid");
</script>
Now that we have our grid object we can start adding listeners. Lets say we wanted to call a method when a row is clicked. Here we are listening to for a row to be clicked and then calling a method named editArtist. Our editArtist method also get some information about the row being clicked. So How did i know what information would be passed?
<script type="text/javascript">
function init(){
//get the grid component
grid = ColdFusion.Grid.getGridObject("ArtistGrid");
//Fires when a row is clicked
grid.addListener("rowclick",editArtist);
}
function editArtist(grid,rowIndex,e){
var record = grid.getDataSource().getAt(rowIndex);
console.log(record);
}
</script>
If we look at the documentation for the grid event listeners we will get some more details about them. The arguments are what will get passed to use when that event is fired.
- bodyscroll : ( Number scrollLeft, Number scrollTop ) - Fires when the body element is scrolled
- cellclick : ( Grid this, Number rowIndex, Number columnIndex, Ext.EventObject e ) - Fires when a cell is clicked
- cellcontextmenu : ( Grid this, Number rowIndex, Number cellIndex, Ext.EventObject e ) - Fires when a cell is right clicked
- celldblclick : ( Grid this, Number rowIndex, Number columnIndex, Ext.EventObject e ) - Fires when a cell is double clicked
- click : ( Ext.EventObject e ) - The raw click event for the entire grid.
- columnmove : ( Number oldIndex, Number newIndex ) - Fires when the user moves a column
- columnresize : ( Number columnIndex, Number newSize ) - Fires when the user resizes a column
- contextmenu : ( Ext.EventObject e )The raw contextmenu event for the entire grid.
- dblclick : ( Ext.EventObject e ) - The raw dblclick event for the entire grid.
- dragdrop : ( Grid this, Ext.GridDD dd, String targetId, event e ) - Fires when dragged row(s) are dropped on a valid DD target
- dragenter : ( Grid this, Ext.GridDD dd, String targetId, event e ) - Fires when the dragged row(s) first cross another DD target while being dragged
- dragout : ( Grid this, Ext.GridDD dd, String targetId, event e ) - Fires when the dragged row(s) leave another DD target while being dragged
- dragover : ( Grid this, Ext.GridDD dd, String targetId, event e ) - Fires while row(s) are being dragged. "targetId" is the id of the Yahoo.util.DD object the selected rows are being dr...
- enddrag : ( Grid this, Ext.GridDD dd, event e ) - Fires when a drag operation is complete
- headerclick : ( Grid this, Number columnIndex, Ext.EventObject e ) - Fires when a header is clicked
- headercontextmenu : ( Grid this, Number columnIndex, Ext.EventObject e ) - Fires when a header is right clicked
- headerdblclick : ( Grid this, Number columnIndex, Ext.EventObject e ) - Fires when a header cell is double clicked
- keydown : ( Ext.EventObject e ) - The raw keydown event for the entire grid.
- keypress : ( Ext.EventObject e ) - The raw keypress event for the entire grid.
- mousedown : ( Ext.EventObject e ) - The raw mousedown event for the entire grid.
- mouseout : ( Ext.EventObject e ) - The raw mouseout event for the entire grid.
- mouseover : ( Ext.EventObject e ) - The raw mouseover event for the entire grid.
- mouseup : ( Ext.EventObject e ) - The raw mouseup event for the entire grid.
- render : ( Grid grid ) - Fires when the grid is rendered
- rowclick : ( Grid this, Number rowIndex, Ext.EventObject e ) - Fires when a row is clicked
- rowcontextmenu : ( Grid this, Number rowIndex, Ext.EventObject e ) - Fires when a row is right clicked
- rowdblclick : ( Grid this, Number rowIndex, Ext.EventObject e ) - Fires when a row is double clicked
- startdrag : ( Grid this, Ext.GridDD dd, event e ) - Fires when row(s) start being dragged
And that is how we are able to find out more information about the event that is happening. In our editArtist method we are getting passed the rowIndex, this allows us to look up what record what clicked. As you can see event listeners can be very powerful and just another way that you can customize your grid components. Please feel free to leave me any questions you might have about them.
More Entries