2.0 is here!

2.0 is here - but I'll be writing about it up on my main blog: http://www.coldfusionjedi.com.

Comments
Sergey's Gravatar Looks like V2 has a bug.
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 4. Is anyone got something similar?
# Posted By Sergey | 10/15/07 7:43 AM
Raymond Camden's Gravatar I didn't do much testing with Access. Did you set the proper dbtype in the settings file?
# Posted By Raymond Camden | 10/15/07 7:49 AM
Sergey's Gravatar Yep!
# Posted By Sergey | 10/15/07 7:53 AM
Raymond Camden's Gravatar I'd need to know the full bug. Turn on Robust Exception Handling and paste it in.
# Posted By Raymond Camden | 10/15/07 9:18 AM
Tim's Gravatar I am getting a couple of errors when attempting to log in to the admin for the first time. This is the first part of the error (too long to post it all here but you can click the link and trry the normal login to see the error) - [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the keyword 'group'.
# Posted By Tim | 10/18/07 12:33 AM
Raymond Camden's Gravatar That looks like you didn't do your settings right for SQL Server. Did you set the dbtype?
# Posted By Raymond Camden | 10/18/07 7:20 AM
Tim's Gravatar Yes, here are the settings that I have in the ini file:

[settings]
Editing per request of poster. -Ray

Also, since I saw that you had released version 2.001 and I hadn't set up any informtaion in the forum, I deleted the tables and reinstalled everything using the files in the 2.001 zip. Then I had my hosting company confirm my DSN to the MS SQL db just to make sure that was ok. Then I did a simple SELECT * FROM galleon_users and dumped the results to verify that it was working with the DSN
# Posted By Tim | 10/18/07 11:35 AM
Raymond Camden's Gravatar Should I be able to hit your site? I can't.
# Posted By Raymond Camden | 10/18/07 11:49 AM
Tim's Gravatar http://65.36.177.57/forum/ - the error shows up when you try to log in as admin (still using defaults)
# Posted By Tim | 10/18/07 2:02 PM
Raymond Camden's Gravatar I had erased your settings, but you did set dbtype to sqlserver, right?
# Posted By Raymond Camden | 10/18/07 2:07 PM
Raymond Camden's Gravatar Ahah. You chahnged your settings, but forgot to reinit the cache. I hit your forums with ?reinit=1 in the url and it works fine now.
# Posted By Raymond Camden | 10/18/07 2:08 PM
Tim's Gravatar Awesome! Thanks.. I missed that step. Thanks for your help.

Tim
# Posted By Tim | 10/18/07 2:13 PM
Tim's Gravatar THe pages are up and running fine but when I make a change or try to add anything in the admin it doesn't save. It looks as though it saves, gives no error but doesn't update the info. I was able to register as a normal user and the info saved to the database but I I couldn't update any info. I was able to delete the user. I tried the ?reinit=1 again to see if that might do somwthing butit didn't work. Also, having the same problem on the Forum Options areas.
# Posted By Tim | 10/19/07 12:09 AM
Raymond Camden's Gravatar I'm a bit confused. So you were able to make a user and logon ok? Please be more clear when you say more info. Do you mean no forums can be made? No threads? Do they show up in the db?
# Posted By Raymond Camden | 10/19/07 9:29 AM
Tim's Gravatar Example 1:
If I go go the login.cfm page and register as a new user - it saves that info to the database and sends the confirmation e-mail. If I then log in as the admin and go to the User Editor page I will see that user listed. When I click on their username and go to their profile I see all of the information entered in the user profile. If I a make a change, let's say, change the password, and click save, the page processes still showing the new information (at that point it looks like it has updated the info). However, if I go back to the listing of users (users.cfm), and click on the user name and go to the User Editor page (users_edit.cfm), the old or original information is still there and has not been updated to the new info.

Example 2:
If I go to the forum admin and click on the Conferences option under forum options – I am now on the /forum/admin/conferences.cfm conferences page. I click Add Conferences which takes me to the Conference Editor page (forum/admin/conferences_edit.cfm?id=0). I enter all the info (name, desc, etc.,) and click on the save button. The page processes and again looks like everything saves (with the exception that if you highlight an option other that the default, you notice that after the page processes the default is highlighted again no matter what you chose). Then I click on the Conferences link under Forum options to see the forum listings and the conference is not there.

Example 3:
If I go to the Galleon Settings page, and change the Items Per Page to 10 instead of 17, click save, the page processes and Items per page will still say 10. If I then click on the Conferences tab and then click the Galleon Settings link to go back to the settings page, the items per page is back at 17 instead of 10. I realize this is updating this should update the ini file so I also tried the ?reinit=1 to see if that had anything to do with the new settings not showing up here and it didn’t affect the results.

Sorry for the hassle and thanks for the help.
Tim
# Posted By Tim | 10/19/07 11:11 AM
Raymond Camden's Gravatar In all the examples, you said that visually things didn't seem to change. What do you see if you look in the DB directly?
# Posted By Raymond Camden | 10/19/07 11:16 AM
Tim's Gravatar The galleon_conferences table is empty and the galleon_users table shows the two recods with no information change (the original unedited info).
# Posted By Tim | 10/19/07 2:14 PM
Raymond Camden's Gravatar Let's focus on users first. WHen you edited the user in the Admin, when you saved, there was no error, right?
# Posted By Raymond Camden | 10/19/07 2:57 PM
Tanvir Ansari's Gravatar Ray,
I am doing this on c drive. I did settings correctly.

I did installation on my C drive Coldfusion developer edition with SQL server 2005 express edition. I did re-init=1 as well. The coldfusion gives error saying [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the keyword 'group'. This error occurs in user.cfc

If I change the group column to groupname, even in database (group changed to groupname)the code starts working. But then I will have to globally replace group with groupname everywhere, that is tedious task.

Your code at that line is:
<cfquery name="qGetGroups" datasource="#variables.dsn#">
         select   id,
         <cfif variables.dbtype is not "mysql">
         [group]
         <cfelse>
         #variables.tableprefix#groups.group
         </cfif>
         from   #variables.tableprefix#groups
      </cfquery>

seems like it gets confused with [group] with the "group by" clause of sql .

I created a short program to see that, but running this query standalone gives results correctly, but it fails here.
# Posted By Tanvir Ansari | 1/23/08 6:07 PM
Raymond Camden's Gravatar What did you set for your dbtype in the settings?
# Posted By Raymond Camden | 1/23/08 8:57 PM
Tanvir Ansari's Gravatar Ray,

My appologies. I did make a mistake in the setting.ini file. I had made changes to SQL server but then, I downloaded the source code again from your site and that overwrote the changes and I forgot about that.

Here is my new problem. I do not have a budget to host the site for $20/month, so I chose godaddy.com, they take $2/month for coldfusion. But they do not allow createObject or CFObject. I see a lot of createObject for instantiation. I have been converting them to CFINVOKE. But in objectfactory.cfc, I do not know how to convert the following to cfinvoke as there is no method defined for that. And also can you explain me this code. And why is there no init() in the galleon.cfc?

case "galleonSettings":
obj = createObject('component','galleon');
if (arguments.singleton) { // scope singleton            addSingleton(arguments.objName, obj);
   }
   return obj;
   break;
# Posted By Tanvir Ansari | 1/24/08 9:33 AM
Raymond Camden's Gravatar That entire area is cfscript, so you would need to convert it to tag based code. Or - write a UDF named makeObject (or some such). That UDF would use cfinvoke. THen change all createObjects to makeObject.
# Posted By Raymond Camden | 1/24/08 12:25 PM
Tanvir Ansari's Gravatar Ray,

I did convert it for example:
case "conference":
obj = createObject('component','conference').init();
if (arguments.singleton) { // scope singleton
addSingleton(arguments.objName, obj);
}
// inject dependencies through setter
obj.setSettings( get('galleonSettings', arguments.singleton) );
obj.setForum( get('forum', arguments.singleton) );
obj.setUtils( get('utils', arguments.singleton) );
return obj;         

I did change that to
<cfinvoke component ="conference" method="init" returnvariable="obj">
</cfinvoke>
<cfscsript>
if (arguments.singleton) { // scope singleton
addSingleton(arguments.objName, obj);
}
// inject dependencies through setter
obj.setSettings( get('galleonSettings', arguments.singleton) );
obj.setForum( get('forum', arguments.singleton) );
obj.setUtils( get('utils', arguments.singleton) );
return obj;
<cfscript>

I think the above code is a mix of tag based + cfscript syntax. But its valid syntax, and this works fine.

But I am just confused as to how to convert the below one to CFINVOKE as there is no method when you do createObject.

case "galleonSettings":
obj = createObject('component','galleon');
if (arguments.singleton) { // scope singleton
addSingleton(arguments.objName, obj);
}
return obj;

And on Cfinvoke, I have to supply a method.

And as I asked earlier, why there is no init() in the Galleon.cfc? There must be a reason why you do not have that. I am learning by looking at your code & your blogs.
# Posted By Tanvir Ansari | 1/24/08 1:22 PM
Raymond Camden's Gravatar You would need to add an init method to galleon.cfc that just does a return this.
# Posted By Raymond Camden | 1/24/08 1:47 PM
Tanvir Ansari's Gravatar I had added init & returned this (galleon). But when I try to reinitialise the application by using reinit=1 in URL. I get error message.

Value must be initialized before use.
Its possible that a method called on a Java object created by CreateObject returned null.

The error occurred in C:\ColdFusion8\wwwroot\Forums\Application.cfm: line 31
29 :    
30 :    <!--- Get main settings --->
31 :    <cfset application.settings = application.factory.get('galleonSettings').getSettings()>
32 :

And basically it is coming because I converted in objectfactory.cfc all the createObject to cfinvoke, I did same in Application.cfm as well.

I am just getting a feeling that there is no workaround for createObject(). This application can not be coded using CFINVOKE tag.
# Posted By Tanvir Ansari | 1/24/08 4:56 PM
Tanvir Ansari's Gravatar Below is the Application.cfm that I changed:
<cfsetting enablecfoutputonly="true" showdebugoutput="false">
<!---
   Name : Application.cfm
   Author : Raymond Camden
   Created : June 01, 2004
   Last Updated : October 29, 2007
   History : Reset for V2
             : Fix for IE login issue (rkc 10/15/07)
             : Remove BlueDragon mod (not needed in latest BD, thanks to Vince B for letting me know!) (rkc 10/29/07)
   Purpose       :
--->

<cfset appName = "galleonForums">
<cfset prefix = getCurrentTemplatePath()>
<cfset prefix = reReplace(prefix, "[^a-zA-Z]","","all")>
<cfset prefix = right(prefix, 64 - len(appName))>

<cfapplication name="#prefix##appName#" sessionManagement=true loginstorage="session">

<cferror type="exception" template="error.cfm">

<cfif not isDefined("application.init") or isDefined("url.reinit")>

   <cfset structDelete(application, "userCache")>

   <!--- get user CFC --->
   <cfinvoke component="cfcs.objectfactorynew" method="init" returnvariable="application.factory">
   </cfinvoke>
   
   <!--- Get main settings --->
   <cfinvoke method="getSettings" returnvariable="application.settings" component="cfcs.galleon">
   </cfinvoke>

   <cfset application.settings.attachmentdir = getDirectoryFromPath(getCurrentTemplatePath()) & "attachments">
   <cfset application.settings.avatardir = getDirectoryFromPath(getCurrentTemplatePath()) & "images/avatars">

   <cfif not directoryExists(application.settings.attachmentdir)>
      <cfdirectory action="create" directory="#application.settings.attachmentdir#">
   </cfif>
   <cfif not directoryExists(application.settings.avatardir)>
      <cfdirectory action="create" directory="#application.settings.avatardir#">
   </cfif>
   
   <!--- get user CFC --->
   <cfinvoke component="cfcs.objectfactory" method="get" returnvariable="application.user" >
      <cfinvokeargument name="objName" value="user">
   </cfinvoke>

   <!--- get utils CFC --->
   <cfinvoke method="get" returnvariable="application.utils" component="cfcs.objectfactorynew">
      <cfinvokeargument name="objName" value="utils">
   </cfinvoke>

   <cfdump var="#application.user#">
   <cfabort>   
   <!--- get conference CFC --->
   <cfinvoke method="get" returnvariable="application.conference" component="cfcs.objectfactorynew">
      <cfinvokeargument name="objName" value="conference">
   </cfinvoke>
   
   <!--- get forum CFC --->

   <cfinvoke method="get" returnvariable="application.forum" component="cfcs.objectfactorynew">
      <cfinvokeargument name="obj" value="forum">
   </cfinvoke>


   <!--- get thread CFC --->
   
   <cfinvoke method="get" returnvariable="application.thread" component="cfcs.objectfactorynew">
      <cfinvokeargument name="obj" value="thread">
   </cfinvoke>

   <!--- get message CFC --->

   <cfinvoke method="get" returnvariable="application.message" component="cfcs.objectfactorynew">
   </cfinvoke>

   <!--- get rank CFC --->
   
   <cfinvoke method="get" returnvariable="application.rank" component="cfcs.objectfactorynew">
      <cfinvokeargument name="obj" value="rank">
   </cfinvoke>

   <!--- get security CFC --->

   <cfinvoke method="get" returnvariable="application.permission" component="cfcs.objectfactorynew">
      <cfinvokeargument name="obj" value="permission">
   </cfinvoke>
   
   <!--- hard coded rights for now --->
   <cfset application.rights.CANVIEW = "7EA5070B-9774-E11E-96E727122408C03C">
   <cfset application.rights.CANPOST = "7EA5070C-E788-7378-8930FA15EF58BBD2">
   <cfset application.rights.CANEDIT = "7EA5070D-CB58-72BA-2E4A3DFC0AE35F35">
<!---
   <!--- get image CFC if we need it --->
   <cfif application.settings.allowavatars>
      <cfset application.image = application.factory.get('image')>
      <cfset application.image.setOption("throwonerror", false)>
   </cfif>
   --->
   <cfset application.init = true>
   
</cfif>

<!--- include UDFs --->
<cfinclude template="includes/udf.cfm">

<cfif isDefined("url.logout")>
   <cfset structDelete(session, "user")>
   <cflogout>
</cfif>

<!--- handle security --->
<cflogin>

   <!--- are we trying to logon? --->
   <cfif isDefined("form.logon") or isDefined("form.logon.x")>
      <cfif isDefined("form.username") and isDefined("form.password")>
         <cfif application.user.authenticate(trim(form.username), trim(form.password))>
            <!--- good logon, grab their groups --->
            <cfset mygroups = application.user.getGroupsForUser(trim(form.username))>
            <cfset session.user = application.user.getUser(trim(form.username))>      
            <cfloginuser name="#trim(form.username)#" password="#trim(form.password)#" roles="#mygroups#">
         </cfif>
      </cfif>
   </cfif>
   
</cflogin>

<!--- Used by index, forums, and threads ---->
<!--- however, if threads, default to lastpost --->
<!--- however, don't do this in the admin ;) --->
<cfif not structKeyExists(variables, "isAdmin")>
   <cfif findNoCase("threads.cfm", cgi.script_name)>
      <cfparam name="url.sort" default="lastpostcreated">
      <cfparam name="url.sortdir" default="desc">
   <cfelse>
      <cfparam name="url.sort" default="name">
      <cfparam name="url.sortdir" default="asc">
   </cfif>
</cfif>

<cfsetting enablecfoutputonly=false>


This is ObjectFactory.cfc -- get Method

<cffunction name="get" access="public" output="No" returntype="any">
      <cfargument name="objName" required="false" type="string" />
      <cfargument name="singleton" required="false" type="boolean" default="true" />
      <cfset obj = "">
      <cftry>
      <cfscript>
         if (arguments.singleton and singletonExists(arguments.objName)) {
            return getSingleton(arguments.objName);
         }
      </cfscript>
      <cfswitch expression="arguments.objName">
         <cfcase value="conference">
               <cfinvoke component ="conference" method="init" returnvariable="obj">
               </cfinvoke>
               <cfscript>
                  if (arguments.singleton) { // scope singleton
                     addSingleton(arguments.objName, obj);
                  }
                  // inject dependencies through setter
                  obj.setSettings( get('galleonSettings', arguments.singleton) );
                  obj.setForum( get('forum', arguments.singleton) );
                  obj.setUtils( get('utils', arguments.singleton) );
                  return obj;
               </cfscript>
         </cfcase>
         <cfcase value="forum">
               <cfinvoke component ="forum" method="init" returnvariable="obj">
               </cfinvoke>
               <cfscript>
                  if (arguments.singleton) { // scope singleton
                     addSingleton(arguments.objName, obj);
                  }
                  // inject dependencies through setter
                  obj.setSettings( get('galleonSettings', arguments.singleton) );
                  obj.setThread( get('thread', arguments.singleton) );
                  obj.setConference( get('conference', arguments.singleton) );                  
                  obj.setUtils( get('utils', arguments.singleton) );
                  return obj;
               </cfscript>
         </cfcase>
         <cfcase value="galleonSettings">
            <!---
            <cfinvoke component ="galleon" method="init" returnvariable="obj">
            </cfinvoke>
            --->
            <cfscript>
                  obj=createObject("component","galleon");
                  if (arguments.singleton) { // scope singleton
                     addSingleton(arguments.objName, obj);
                  }
                  return obj;
            </cfscript>
         </cfcase>   

         <cfcase value="message">
               <cfinvoke component ="message" method="init" returnvariable="obj">
               </cfinvoke>
               <cfscript>
                  if (arguments.singleton) { // scope singleton
                     addSingleton(arguments.objName, obj);
                  }
                  // inject dependencies through setter
                  obj.setSettings( get('galleonSettings', arguments.singleton) );
                  obj.setThread( get('thread', arguments.singleton) );
                  obj.setForum( get('forum', arguments.singleton) );
                  obj.setConference( get('conference', arguments.singleton) );
                  obj.setUser( get('user', arguments.singleton) );
                  obj.setUtils( get('utils', arguments.singleton) );
               return obj;
               </cfscript>   
         </cfcase>

         <cfcase value="permission">
            <cfinvoke component ="permission" method="init" returnvariable="obj">
            </cfinvoke>
            <cfscript>
               if (arguments.singleton) { // scope singleton
                  addSingleton(arguments.objName, obj);
               }
               // inject dependencies through setter
               obj.setSettings( get('galleonSettings', arguments.singleton) );
            return obj;
            </cfscript>
         </cfcase>

         <cfcase value="rank">
            <cfinvoke component ="rank" method="init" returnvariable="obj">
            </cfinvoke>
            <cfscript>                  
                  if (arguments.singleton) { // scope singleton
                     addSingleton(arguments.objName, obj);
                  }
                  // inject dependencies through setter
                  obj.setSettings( get('galleonSettings', arguments.singleton) );
                  obj.setUtils( get('utils', arguments.singleton) );
               return obj;
            </cfscript>
         </cfcase>
      
         <cfcase value="thread">
            <cfinvoke component ="thread" method="init" returnvariable="obj">
            </cfinvoke>
            <cfscript>      
                  if (arguments.singleton) { // scope singleton
                     addSingleton(arguments.objName, obj);
                  }
                  // inject dependencies through setter
                  obj.setSettings( get('galleonSettings', arguments.singleton) );
                  obj.setUtils( get('utils', arguments.singleton) );
                  obj.setForum( get('forum', arguments.singleton) );
                  obj.setMessage( get('message', arguments.singleton) );
               return obj;
            </cfscript>
         </cfcase>
         
         <cfcase value="user">
            <cfinvoke component ="user" method="init" returnvariable="obj">
            </cfinvoke>
            <cfscript>                  
                  if (arguments.singleton) { // scope singleton
                     addSingleton(arguments.objName, obj);
                  }
                  // inject dependencies through setter
                  obj.setSettings( get('galleonSettings', arguments.singleton) );
                  obj.setUtils( get('utils', arguments.singleton) );
               return obj;
            </cfscript>
         </cfcase>

         <cfcase value="utils">
            <cfinvoke component ="utils" method="init" returnvariable="obj">
            </cfinvoke>
            <cfscript>                  
                  if (arguments.singleton) { // scope singleton
                     addSingleton(arguments.objName, obj);
                  }
                  // inject dependencies through setter
               return obj;
            </cfscript>
         </cfcase>

         <cfcase value="image">
            <cfinvoke component ="image" method="init" returnvariable="obj">
            </cfinvoke>
            <cfscript>   
                  if (arguments.singleton) { // scope singleton
                     addSingleton(arguments.objName, obj);
                  }
                  // inject dependencies through setter
               return obj;
            </cfscript>
         </cfcase>
         <cfdefaultcase>
         </cfdefaultcase>
      </cfswitch>
      <cfcatch>
         <cfdump var="#cfcatch#">
      </cfcatch>
      </cftry>   
   </cffunction>
# Posted By Tanvir Ansari | 1/24/08 5:51 PM
Ken's Gravatar I just wanted to add, that WC3 testing will trigger a bunch of flags cause of not properly using "&" mainly in your hyper-links, etc.
Just thought you might want to run through your code and make sure it's up to WC3 standards.
# Posted By Ken | 3/2/08 4:58 AM
Ken's Gravatar errr "& a m p ; ".... minus the spaces :D
# Posted By Ken | 3/2/08 4:59 AM
Raymond Camden's Gravatar Can you point out an example of one of the bad urls?
# Posted By Raymond Camden | 3/3/08 7:03 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.5.006.