Rob Gonda's Blog

ISAPI Rewrite to be tested

I've been talking about it for a while, but I finally downloaded ISAPI Rewrite. It is a tool that runs on top of your IIS (web server), and rewrites the URL's before they hit ColdFusion... what does it mean? what you can have better urls that do not look dynamic, and even though you could do that with CF in the form of index.cfm/var/value, you can now do the same and take the load off your CF server. In addition to that, you can even remove the index.cfm completely, so the urls look even cleaner. It is possible to translate:
/search/books to index.cfm?event=search&keyword=books ... how nice is that?

There's a great article at bpurcell.org that talks about all the different uses of this tool. I will be trying it out all this week and probably blog results within a few days.

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!

Skype hits 100M subscriber mark

These are amazing numbers... Skype is great (and I don't use it much, hehe) ... but free peer-to-peer VoIP with a 100 million network sounds like a great deal to me.

Skype said Friday that it now has more than 100 million registered users of its free Internet-based calling service, nearly double the number of registered users it had in September 2005.

Skype, which is only two-and-a-half years old, is a peer-to-peer software service that lets people make phone calls from their PCs to other PCs anywhere in the world for free. The service works by turning voice signals into IP packets and sending them directly over the public Internet. Last year, Skype was bought by eBay in a deal valued between $2.5 billion and $4 billion. When the merger was announced in September, Skype had 54 million registered users.

Source: news.com

Smaller URLs made easy

I just found out about wapurl, a service that allows to take a long URL and convert it into a very short one using their API. WapURL is trying to target the mobile world, making a good point about sending long URL's through SMS.

Their service is nothing new, I know; TinyURL has been doing this for the longest time... TinyURL provides a way to integrate with IE, but since I'm a Firefox user it's no good :)

WapURL provides a Firefox extension that allows to simply right click in any page and select their API from the context menu ... and voila, a tiny url is provided on the fly. I am not really sure how much will I use this, but it is handy for sending mapped addresses, or anything with an obnoxiously long query string.

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!

FlashObject / SWFObject v1.4 released

I've been using Flash/SWFObject lately for all my Flash project (a lot!)... SWFObject is an open source JavaScript to embed swfs in html pages... it helps with SEO because it overwrite a standard xhtml DIV, includes option for express install, and most importantly, gets around the new Microsoft facacta. It even loads your swfs when viewing locally in IE, where you usually would get an Active X Alert...

The new release includes the following small changes:

   1.  [updated] SWFObject.write() now returns true or false depending on whether the SWF content was written to the page or not (true if it is, false if it is not)
   2. [changed] The ‘com’ namespace has been removed, now everything lives in the ‘deconcept’ namespace only, instead of ‘com.deconcept’ namespace
   3. [updated] I made a couple of very small changes to get rid of warnings in the mozilla script debugger when the debugger was in strict mode
   4. added ‘the mark of the web’ to the examples pages to (hopefully) prevent the ActiveX bar from appearing at the top of the page when viewing these files locally in IE on Windows.
   5. [changed] And last, but certainly not least: FlashObject is now known as SWFObject because of legal reasons
Ray just blogged about the Adobe's Official Fix today... SWFObject is as easy to implement, plus it is SEO Friendly, checks for Flash Versions, includes express install ... I would strongly suggest using it instead.


btw Adobe, we're still waiting for a Flash Form / CFChart FIX!

DOM Builder: Less inhuman

So everyone that have met me, knows that JavaScript is less than pleasant :) but anything that we can do to make it suck less is welcome ... DOM is inhuman ... there's a reason why we write html pages using tags and not DOM ... but anyways, sometimes, especially when you're writing AJAX applications you may need to use some JS and DOM, and the DOM builder may come handy.


var html = DomBuilder.apply();

var form = html.FORM(
  html.DIV(
    html.INPUT({type : 'text', name : 'email'}),
    html.INPUT({type : 'text', name : 'password'}),
    html.INPUT({type : 'submit'}),
  )
);

A Ditigal Man: Tribute to Neil Peart

I'm a big Rush fan, but whether you like Rush or not, you will appreciate this animated video. The video is a 3d rendering of Peart playing Rush's famous YYZ with many camera angles, showing the drum lines from a number of different perspectives... It's really amazing.

The video was created with 3D Studio Max R3 and hand keyframed using a video reference of me air-drumming along to the song.

Matrix Rob Sketch

This is a sketch that iChameleon did for me at the last xmas party ... yes, of course they got it from this web site :) There's one for every associate ... it was a fun night.
The Rob Matrix Sketch - xmas party 2005 - Rob Gonda

Right, forgot to mention, my business card says I'm "The Rob" :) again, we all have nicknames... if you get to know me you would find out that I'm not _that_ egocentric... heh...

More Entries

This blog is running version 5.9.003. Contact Blog Owner