Dan Mackey On ColdFusion Development

ColdFusion, Java, .NET, AJAX, DHTML development and general programming. Daniel is owner and Administrator of CFTagStore.com and works for an Application Development Company in Ireland called Digital Crew. His interests cover all areas of programming in multiple languages with a particular interest in Internet Technologies.

All Articles tagged : WebDev
2007-08-02 17:35:00.0

Securing Your RSS Feeds Using Basic HTTP Authentication and ColdFusion

We are working on a project at the moment that requires secure RSS feeds. We need it to be secure in both browsers and Feed readers such as FeedDemon so decided that Basic HTTP Authentication was the best way forward.

The snippet of code below demonstrates how to force the user agent (browser/feed reader) to prompt for a username and password which in turn ties into our existing users table without messing around with IIS permissions and users etc

<cfset REQUEST.userAuthenticated = false>
 
<cflogin>
    <cfif isDefined("CFLOGIN")>	
	<cfquery name="checkUser" datasource="myDatasource">
	SELECT	u.userId
	FROM	users AS u
	WHERE	u.userName = <cfqueryparam value="#CFLOGIN.name#">
	    AND u.password = <cfqueryparam value="#CFLOGIN.password#">
	</cfquery>
	
	<cfif checkUser.recordcount NEQ 0>
		<cfset REQUEST.userAuthenticated = true> 
	</cfif>
   </cfif>
</cflogin>

<cfif NOT REQUEST.userAuthenticated>
   <cfheader statuscode="401">
   <cfheader name="WWW-Authenticate" value="Basic realm=""My RSS Feed""">
   <cfabort>
<cfelse>	
	<!----------- Continue With RSS output ------------------->
	Output your RSS Code Here
</cfif>

One small sticking problem which took some time to figure out:

On my local development server, the above worked perfectly. When I uploaded it to the production server running Windows Server 2003 Web Edition, the authentication popped up but kept popping up no matter what was entered in the username and password fields. The Realm header text was also not the one entered in the code above. After alot of digging it turned out to be a simple option on IIS that needed to be turned off.

The option to turn off is Directory Security -> Annonymous Access and Authentication Control - Edit - Integrated Windows Authentication

Once you disable Integrated Windows Authentication the whole thing works like a dream!

Not only is this a good way of securing your RSS feeds, its also perfect for Web Services or even securing your whole application. The draw back is that you cant style the login form as it uses the built in browser dialog.

Tags: ColdFusion | IIS | RSS | Security | Tips | WebDev
Add to your del.icio.us    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [1] - Leave a comment
2007-06-29 10:00:00.0

Setting IIS Maximum Connections To More Than 10

Every project I am working on, I test against 5 different browsers: Safari, Mozilla, IE7, Opera and IE6 on the same machine. Since Safari has entered the browser lineup, I have been receiving an annoying "HTTP 403.9 - Access Forbidden: Too many users are connected" message.

To solve this issue, do the following:

  1. Download the Administrative Plugin MetaEdit from Microsoft : http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B301386
  2. Install Application (Comes with old files so skip these in the installation)
  3. Go to Administrative Tool in Control Panel and launch MetaEdit 2.2
  4. Navigate to the key LM/W3WSVC/MaxConnections
  5. Change the value from 10 to the number of connections you need. I chose : 2000000000 to be extra safe ;-)

This will work on:

  • Microsoft Internet Information Server 5.1 on Windows XP Professional
  • Microsoft Internet Information Server 4.0, when used with:
    Microsoft Windows NT 4.0
    Microsoft Windows 2000 Standard Edition
  • Microsoft Internet Information Services 5.0, when used with:
    Microsoft Windows NT 4.0
    Microsoft Windows 2000 Standard Edition
Add to your del.icio.us    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [3] - Leave a comment
2006-09-22 13:03:00.0

Apple G4 Arrived Today...

After 15 years I have finally given in and purchased an Apple G4. I really need to get the thumb out and make my apps truely cross-platform so this morning handed the cash over and took delivery of my first Apple computer.

I am actually looking forward to re-writing CF_FileManager and getting it truely cross-platform and especially running in Safari. Same goes for all my Custom Tags and Applications on CFTagStore.com

Add to your del.icio.us    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [2] - Leave a comment
2006-08-07 22:07:00.0

Test Web Apps on Safari using Windows

Apple’s WebKit (the rendering component powering the Safari web browser) has been ported to Windows, complete with a browser called Swift.

We dont have a Mac with OSX in the office and there are many times I would like to test my Web Apps on Safari so I was delighted to find this little golden nugget:

http://www.getwebkit.org/

Downloading and installing now and I'll update with my experiences....

Tags: Apple | Safari | WebDev
Add to your del.icio.us    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [1] - Leave a comment
2006-07-29 12:38:00.0

ColdFusion And AJAX Organizational Chart - Beta

About 2 weeks ago before I started my , I worked on a quick proof-of-concept ColdFusion and Ajax enabled Organizational Chart widget.

My main aim was to create a widget that would render in modern browsers and would allow the adding of nodes to the chart using AJAX so the whole page didnt have to be reloaded.

I faced some interesting problems:

  • I wanted to use pure CSS and DIVs but soon found out this was impossible for the moment so had to settle for a mix of CSS and normal TABLE elements.
  • The logic in finding the current parent to append new elements to needed quite a bit of thought to work on all browsers.
  • Deleting nodes a few levels up had to take sub-nodes into consideration.
  • The user-interface had to be very simple and in context with each node.

I decided on the following:

  • I created a custom tag which runs using recursion. This allows the whole chart to be generated using one line of code and you can choose which node to start rendering from.
  • Because the chart is built using a recursive custom tag and I can choose any start node, implementing the AJAX was easy, easy easy.... All I have to do when an add node icon is clicked, the parent node id is passed using AJAX and the custom tag is called with a start ID of the passed parent and the returned HTML is rendered without reloading the page.
  • I used the extremely handy CFSAVECONTENT to render the HTML from the custom tag and simply return the resultant variable. This made the code really easy, flexible and readable.

The main way to use the tag is:

  • To create a node, you click the Add Node icon from the parent node.
  • To edit a node, you double-click an existing node.
  • To delete a node, you click the Delete Node icon on the node to be deleted.

The editing of nodes is not complete. I envisage this to dynamically create a text area in the node and update the TEXT of the node on the fly using . Another option in the future would be to pop-up a menu that allows you to change the TYPE of node.

Things I would like to see added:

  • Panning of a VIEW area for large charts
  • Ability to change each nodes type
  • Add the ability to render each node with rounded corners using the brilliant NiftyCude library.
  • Ability to export the chart in a variety of formats : graphics or PDF

The funny thing is, I developed this 2 weeks ago on one of my 3 hour after-work learning stints where I generally read new things through blogs or try proof-of-concept ideas that may help in future projects. About 2 days ago, I got an email from someone through who had an idea for a CFOrgChart type tag/application with the same ideas I had planned.

Funny how things happen...

Now the fun part...try the demo : demos/cforgchart/index.cfm

PS: Please use with care and dont ruin it for other people by deleting all nodes. This is only a demo and I havent performed any checking or locking of nodes yet.

PPS: Can someone (Karl :-) ) check this on Safari and report back?

Add to your del.icio.us    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [12] - Leave a comment
2006-06-08 13:38:00.0

ColdFusion Mutltiple File Upload

Peter has outdone himself yet again on his work on our Flash based ColdFusion multiple file upload control we decided to write.

We had one concern while developing this product and that was the look and feel of the product and to build in from the start all the features developers would need while using it themselves. We work well as a team and together we made a list of features we wanted to include and call it version 1.

One of the aims of this product is to show the current progress and speed of each file being uploaded. Our last ColdFusion based multiple file upload control used an activeX control and gave a progress bar which changed as each file went up only showing the overall progress but the new control uses a progress bar for each file and also an overall progress bar.

Its a thing of beauty to watch work and you can find out more at CFTopper where Peter has written a post and uploaded a screenshot.

Add to your del.icio.us    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [2] - Leave a comment
2006-05-17 21:04:00.0

Google Web Toolkit Released....

Google have released their Widget Library to help developers make Web 2.0 applications faster and easier.

The toolkit is the standard Google kit used to make GMail, Google Groups etc

Plenty of online demos. First impression is that they look very basic but as you play with them and start thinking how you would do it, you begin to realise the power of them.

http://code.google.com/webtoolkit/

May look into this toolkit for an upcoming Web 2.0 app Peter and myself are planning...

The fact that they are cross-browser with no loss of functionality is the best bit. They also have a nice tool that allows you to write your AJAX apps in Java and they have a tool that runs through and converts your code to cross-browser compatible DHTML.

Add to your del.icio.us    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [0] - Leave a comment