Rob Gonda's Blog

BlogCFC 5 Beta Announced

Ray just announced blogCFC 5 Beta. For those who do not know, my blog runs blogCFC v4. I wanted to recode the entire thing in MVC, but I chose to wait until blogCFC 5 final is released.

Here's a list of changes.

  • An admin. No more stinking design mode.
  • Send to Friend. Send blog entries to a friend. Or to an enemy. Whomever.
  • Preview mode on articles.
  • Category SES URLs.
  • Related Entries (Thanks to Jeff Coughlin and Charlie Griefer).
  • Hey look, a pure CSS layout! Not here of course, but you can see it over at the BlogCFC blog. The admin is NOT pure CSS. I may ask Scott to take a look once I feel the admin is done. The CSS work was all done by Scott Stroz, so please thank him and visit his wish list. (His wish list, and Jeff and CJ's can be found in the word doc/pdf in the install folder. PLEASE thank them before me. I've been thanked!)
  • New "Orange Crush" visual theme. Hmmmm. Orangy!
  • More cow bell.
  • Admin lets you quickly delete comments, trackbacks. You can also edit settings (although this is a bit dangerous). This is a nice way to update your spam list.
  • Draft mode. It's not really called draft, but you can write an entry and leave the Released flag to false.
  • Delayed entries really work now. Seriously, I mean it. It works.
  • If you searched for poo, and clicked More Entries, it registered as a new search hit. It won't anymore. I still register a search hit if you follow it from the stats page.
  • If you use an image as an enclosure, it will automatically be placed in the entry, top left. This was a user-submitted idea.

Thanks again Ray!

AJAX Intensive: Only 10 seats left

So, for those who didn't know yet, I'm going to CFUnited! yeah! but not only that, I'm teaching a pre-conference class: CU214 - Ajax intensive for ColdFusion Developers. I was supposed to do a Breeze presentation tomorrow, and for those who RSVP'ed, I'm sorry... I postponed it to 6/8 ... I don't have the time right now.

The class has only 10 seats left, so if you are thinking of attending, hurry up ... it will sell out soon.

Hope to see you all there, I know you'll enjoy the session as much as I will.

MSSQL and Pagination

Ray posted a nice entry about ColdFusion and Pagination, useful and easy to implement. I commented that it should only be used for small recordsets, because even if you do not show all records, transferring 100k entries from the DB to the application server to only display 10 or 20 is not efficient at all.

Some people suggested using LIMIT and OFFSET, which can only by done with mysql.... I hate to admit it, but mssql is so much better than mysql, expect for that ... I can't believe that we still don't have that functionality... anyways, Adam also posted a link to an msdn article explaining a couple of different approaches to tackle this problem.

I, on the other hand, have been using a stored procedure for years to achieve this goal. I have it in production retrieving pages out of a table with over 5 million records... at it works flawlessly. Let me add that you do need indexes, defragging, maintenance, lots of RAM ... this SP doesn't do miracles :)

You can download the SP here. It works perfectly with mssql 2000 / 2005. Let me emphasize that I did not write this. I got it from a sql exchange article a few years ago. Yes, it can be improved I guess, since one of its major limitations is lacking of a way to query over left/right outer joins. You can query aggregated functions, embedded  selects, inner joins (ansi format) ... You can still get around them using views, which is how I've done it in the past... in fact, if the query is too complicated, you might as well write a view for it anyways.

As far as the ColdFusion side, here's an invocation I have to one of my tables:

    <!---
        get multiple users in pagination
    --->
    <cffunction name="getUsers" access="public" output="No" returntype="struct">
        <cfargument name="UserName" required="No" type="string" default="" />
        <cfargument name="Alias" required="No" type="string" default="" />
        <cfargument name="ageFrom" required="No" type="numeric" default="0" />
        <cfargument name="ageTo" required="No" type="numeric" default="0" />
        <cfargument name="gender" required="No" type="string" default="0" />
        <cfargument name="Race" required="No" type="string" default="0" />
        <cfargument name="Admin" required="No" type="numeric" default="0" />
       
        <cfargument name="groupNumber" required="No" type="numeric" default="1" />
        <cfargument name="groupSize" required="No" type="numeric" default="5" />
       
        <cfset var returnStruct = structNew() />
        <cfset var qGetUsers = '' />
        <cfset var recordcount = '' />
       
       
        <cfset var SqlCols = '' />
        <cfset var SqlWhere = '' />
        <cfset var OrderBy = '' />
       
        <!--- columns --->
        <cfsavecontent variable="SqlCols">
            pk_users, UserName, Alias, gender, Age, race
        </cfsavecontent>
       
        <!--- condition --->
        <cfoutput>
            <cfsavecontent variable="SqlWhere">
                0 = 0
                <cfif arguments.Admin>
                    AND    Admin = 1
                <cfelse>
                    AND    Admin = 0
                </cfif>
                <cfif len(arguments.UserName)>
                    AND UserName like '#arguments.UserName#%'
                </cfif>
                <cfif len(arguments.Alias)>
                    AND Alias like '#arguments.Alias#%'
                </cfif>
                <cfif arguments.ageFrom>
                    AND AGE >= #arguments.ageFrom#
                </cfif>
                <cfif arguments.ageTo>
                    AND AGE <= #arguments.ageTo#
                </cfif>
                <cfif arguments.gender neq '0'>
                    AND gender like '#arguments.gender#%'
                </cfif>
                <cfif arguments.Race neq '0'>
                    AND Race = '#arguments.Race#'
                </cfif>
            </cfsavecontent>
        </cfoutput>
       
        <!--- order --->
        <cfsavecontent variable="OrderBy">
            UserName
        </cfsavecontent>
       
       
        <!--- query --->
        <cfstoredproc procedure="sp_selectnextn" datasource="#variables.instance.dsn#">
            <cfprocresult name="qGetUsers" resultset="1">
            <cfprocresult name="recordcount" resultset="2">
             <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="TableName" value="users">
             <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="Columns" value="#SqlCols#">
             <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="IdentityColumn" value="pk_users">
             <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="GroupNumber" value="#arguments.groupNumber#">
             <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="GroupSize" value="#arguments.groupSize#">
             <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="SqlWhere" value="#SqlWhere#">
             <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="SqlOrderBy" value="#OrderBy#">
        </cfstoredproc>

        <cfset returnStruct.rs = qGetUsers />
        <cfset returnStruct.rc = recordcount.countAll />
       
        <cfreturn returnStruct />
    </cffunction>

It basically takes the table(s), columns, primary key to use for pagination, page size and number, where statement, and order by statement. There is a limitation of size of your statements ... You won't be able to use a Where clause larger than 4000 characters.

The original SP did not have the full recordcount, which allows to calculate the number of pages. It does require more CPU, but I didn't want to just guess if there's a next page given the count in one particular page.

If you have any comments or suggestions, feel free to add them below.

Enjoy!

who is using sIFR?

so I came across this link maybe a year ago, sIFR is rich typography for html pages... the idea is to write your regular xhtml compatible code and then run a JavaScript that will replace it with SWFs using nicer fonts is JS and Flash Player are available. It's a nice idea and I'm planning to play with it ... but how many of you are using it? Can you post links to check them out?

I'd like to integrate this with a CMS system ... so I'll write dynamic content pages with a bunch of dynamic classes, set the iSFR using a small back end admin, and then have it replace the headers of the entire site... doable? I hope so, cuz it looks really good.

I noticed that the install comes with two swfs files... why two? sorry, I haven't even read instructions (as a good tech guy), so I'm assuming it will be fully dynamic and I won't have to open Flash, ever. I should be able to embed a bunch of fonts in the flash files and just specify which one I want to use ... anyways, I'll post my experience using it in a few days... I just wanted to get some comments here.

ColdFusion CFMX7 Cumulative Hot Fix 2 big Error

Today the weirdest thing happened... we're running CFMX7 on our development servers for one big client, and have two clustered CFMX7 production servers too... I have the latest cumulative hot fixes on the Dev server and I realized that the production one wasn't patched... I've patched a few servers thus far, and they all worked perfectly fine afterwards... any hoo ... I update my production server and BAM! it goes down. I couldn't open any page... I was getting Null Pointers errors all over the place. After debugging and trying a few things I found that it was because I had an Application.cfc ... The weird thing is that it didn't matter what code I had there, any Application.cfc will generate Null Pointers errors... the same code works fine in my dev environment ... has any of you ever seen this behavior? I had to manually remove the hotfix 2 and install hotfix 1, which is what I'm running there now ... It really baffles me... Anyone else had problems with Hot Fix 2? Application.cfc ... null pointer errors?

MVC'ing and Ajaxifying BlogCFC : interest?

I know Ray just announced the development of BlogCFC 5.0, and I really admire and respect Ray for his contributions to the CF community. I just came up with the idea of porting blogCFC to an MVC framework, not Model-Glue, but a methodology that I use every day and it has proven to be extremely scalable to me. I also use ajaxCFC with my framework, and will be adding Ajax components to the blog; it won't be a one page RIA, but only small usability elements that would be nice to have.

So the question is ... should I wait until Ray released blogCFC 5, or should I branch it to a new version, using MVC and Ajax, branch a new open source project, and write a journey of my project ... again, just like Ray did with the Model-Glue series .. you see Ray! You're an inspiration :)

I'll take votes, hehe ... I know I want to write this, but I'm skeptical about missing some nice additions once the new version is out. It will be impossible to migrate those without rewriting them too.

Who votes for branching now and says wait? please back your side...

The Fourth Meal: Flash Masterpiece

Check out iChameleon Group's latest project: the Fourth Meal, for Taco Bell. Version 1 just got released today and there is still much more to come. This release includes a chat of customizable Avatars that can move around and talk to each other in various rooms, and a few games...

Ok, so the title is a little skewed, I wouldn't take it as far as a masterpiece, but it's a really nice Flash Site with awesome graphics and creative work.

BTW, it is using Adobe's FlashCom and CFMX7. I just can't wait to blog about v2 and the power of ColdFusion gateways.

Comments?

Ajax Intensive: 33%

We're still three month away from CFUnited, and there're only 20 spots left in my Ajax intensive class. The class is limited to 30 seats, which have never been sold out to-date, but IMO they will this time; and soon! If you are attending CFUnited, you must come in a day early and attend this class. Reserve your seat now before it's too late.
By the way, if you have any doubt of the material, please do not hesitate to drop me an email. I will also be giving a brief preview at CFLive, using Breeze next month. More details to be posted soon.

Slides for the SEOMUG Spring Conference

I just got back from dinning with Jeremy Geelan, a really nice guy I must insist. He gave a keynote at the conference, and I had two sessions. We had about 300 delegates, not bad at all. It was indeed the best conference and value ever for the $25 cover fee ;)

My first session was ajax101, a kickstart providing you all basic information on AJAX. The second, was an ajax301 (yes, I skept one) providing a higher level AJAX solution, using ColdFusion, Model Glue, AjaxCFC, and optionally XML Sockets. For this second session, I showed how to develop Ajax application without coding a single line of JavaScript (for some basic examples). Furthermore, you could reuse 100% of your traditional html application, including models, controllers, and even the views.

You can download the slides I used for the sessions, and I'll compile the examples I used soon too. Most of the examples are available though my ajaxCFC download, including all the Model Glue examples, sockets, etc ... except the Model Glue framework itself. I should make a copy available anyways, because I use a BER (head version on an svn server) version for all my examples.

I mentioned in my sessions that I will do my best to answer all questions and emails, and I keep my word. Please comment here or if it's too lengthy, just drop me an email.

I hope you enjoyed the sessions as much as I did.

p.s. more on other sessions and pictures to be posted soon.

Download slides for ajax101 and ajax301.

BlueDragon's smart move

Here's one for you ... is .NET 2.0 better than ColdFusion? I wouldn't say better... but they did just release their Atlas tools for Ajax development... I haven't seen those yet... the server has to run Microsoft Windows, with .NET 2.0, and all that good stuff ... so it's restricted on the server side, but as long as they make the client side compatible with all browsers and platforms they should be o.k... there are so many toolkits out there that only work with IE, or don't want to work with Safari or Opera browsers.

I digress. BlueDragon announced that Atlas will be compatible with BlueDragon.net, which should be an interesting combination...

More Entries

This blog is running version 5.9.003. Contact Blog Owner