<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2835459232825933710</id><updated>2011-12-22T11:35:10.074-08:00</updated><category term='PHP'/><category term='xml'/><category term='Hover Technology'/><category term='Design'/><category term='ColdMVC'/><category term='SQL'/><category term='Java'/><category term='Javascript'/><category term='ColdFusion'/><category term='Theory'/><category term='How To&apos;s'/><title type='text'>e2e | eLectrolytes 2 eLectrons</title><subtitle type='html'>Web Development</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>64</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-1485191761486448298</id><published>2011-12-22T11:33:00.000-08:00</published><updated>2011-12-22T11:35:10.086-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><title type='text'>Full Calender JS - unique event id's</title><content type='html'>I was working with full calendar js dragging and dropping my tasks on to the calendar as events for a timesheet app and ran into a wierd issue. When I loaded up the available tasks to be dragged I set the event object's id key equal to the task's id as shown below.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="js"&gt;&lt;br /&gt;//---load in all of task to be dragged onto the calendar&lt;br /&gt;var loadTasks = function(){&lt;br /&gt;      &lt;br /&gt; $('##external-events div.external-event').each(function() {&lt;br /&gt;                &lt;br /&gt;  var self = $(this);&lt;br /&gt;  &lt;br /&gt;  var eventObject = {&lt;br /&gt;   title: $.trim(self.text())&lt;br /&gt;   ,id: $.trim(self.data("taskid")) //---RIGHT HERE&lt;br /&gt;   ,taskID:$.trim(self.data("taskid"))&lt;br /&gt;  };&lt;br /&gt;  &lt;br /&gt;  self.data('eventObject', eventObject);&lt;br /&gt;  &lt;br /&gt;  self.draggable({&lt;br /&gt;   zIndex: 999,&lt;br /&gt;   revert: true, &lt;br /&gt;   revertDuration: 0&lt;br /&gt;  });&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This will work if you don't drag the same task on the calendar twice. If you worked on a task from 8am to 9am and 1pm to 2pm if you grabbed the 8am to 9am event and attempting to resize it to 8am to 8.30am, full calendar js would move it and then it would also move the 1pm to 2pm event as well to 1pm to 1.30pm.&lt;br /&gt;&lt;br /&gt;Every event object you put on the calendar should have a unique id.&lt;br /&gt;&lt;br /&gt;If found this little snippet on the web that helped me make unique id's for event objects. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://snipplr.com/view/2574/" target="_blank"&gt;http://snipplr.com/view/2574/&lt;/a&gt;&lt;br /&gt;&lt;pre name="code" class="js"&gt;&lt;br /&gt;var uid = (&lt;br /&gt; function(){&lt;br /&gt;  var id=0;&lt;br /&gt;  return function(){&lt;br /&gt;   return id++ ;&lt;br /&gt;   };&lt;br /&gt;  }&lt;br /&gt;)();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And on the "drop" variable of the full calendar js invoking I reset the event's id and rerendered the event.&lt;br /&gt;&lt;pre name="code" class="js"&gt;&lt;br /&gt;, drop: function(date, allDay, jsEvent, ui) {   &lt;br /&gt;         &lt;br /&gt; var originalEventObject = $(this).data('eventObject');&lt;br /&gt; var copiedEventObject = $.extend({}, originalEventObject);&lt;br /&gt; copiedEventObject.id = uid(); //---RIGHT HERE&lt;br /&gt; copiedEventObject.start = date;&lt;br /&gt; copiedEventObject.end = new Date(date).hours().add(-1);&lt;br /&gt; copiedEventObject._end = new Date(date).hours().add(-1);&lt;br /&gt; copiedEventObject.allDay = allDay;&lt;br /&gt;&lt;br /&gt; $('##calendar').fullCalendar('renderEvent', copiedEventObject, true);&lt;br /&gt; &lt;br /&gt; saveEvent($(this).data("taskid"),'','',copiedEventObject.start,copiedEventObject.end,'');&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This fixed the issue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-1485191761486448298?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/1485191761486448298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/12/full-calender-js-unique-event-ids.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1485191761486448298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1485191761486448298'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/12/full-calender-js-unique-event-ids.html' title='Full Calender JS - unique event id&apos;s'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-3075251687578933270</id><published>2011-12-22T11:22:00.000-08:00</published><updated>2011-12-22T11:31:20.828-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Full Calendar JS</title><content type='html'>Using &lt;a href="http://arshaw.com/fullcalendar/" target="_blank"&gt;full calendar js&lt;/a&gt; I was able to make a timesheet app. The app involved dragging tasks from a left on to a day view of calendar. Simliar to this &lt;a href="http://arshaw.com/js/fullcalendar-1.5.2/demos/external-dragging.html" target="_blank"&gt;drag and drop events demo&lt;/a&gt;. I added trash can on the top of calendar to drag and drop events to be removed. Here is the js I used to make it happen. All of which is in document.ready. We will break down after this code snippet.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;var loadTasks = function(){&lt;br /&gt;      &lt;br /&gt; $('##external-events div.external-event').each(function() {&lt;br /&gt;          &lt;br /&gt;  var self = $(this);&lt;br /&gt;  &lt;br /&gt;  var eventObject = {&lt;br /&gt;   title: $.trim(self.text())&lt;br /&gt;   ,id: $.trim(self.data("taskid"))&lt;br /&gt;   ,taskID:$.trim(self.data("taskid"))&lt;br /&gt;  };&lt;br /&gt;  &lt;br /&gt;  self.data('eventObject', eventObject);&lt;br /&gt;  &lt;br /&gt;  self.draggable({&lt;br /&gt;   zIndex: 999,&lt;br /&gt;   revert: true, &lt;br /&gt;   revertDuration: 0&lt;br /&gt;  });&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;var saveEvent = function(taskID,orgStartObj,orgEndObj,newStartObj,newEndObj){&lt;br /&gt; &lt;br /&gt; var format = "yyyy-MM-dd HH:mm:ss";&lt;br /&gt; &lt;br /&gt; $.ajax({&lt;br /&gt;  url:'/timesheet/saveEvent'&lt;br /&gt;  ,type:'POST'&lt;br /&gt;  ,data:{&lt;br /&gt;   orginalStartTime:orgStartObj.toString(format)&lt;br /&gt;   ,orginalEndTime:orgEndObj.toString(format)&lt;br /&gt;   ,newStartTime:newStartObj.toString(format)&lt;br /&gt;   ,newEndTime:newEndObj.toString(format)&lt;br /&gt;   ,taskID:taskID&lt;br /&gt;  }&lt;br /&gt;  ,dataType:'json'&lt;br /&gt; });&lt;br /&gt; &lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;//---Check if inside the trashcan div&lt;br /&gt;var draggedOverTrashCan = function(draggedItem, dropArea) {    &lt;br /&gt; var itemOffset = draggedItem.offset;&lt;br /&gt; var trashCanOffset = $(dropArea).offset(); &lt;br /&gt;&lt;br /&gt; itemOffset.right = $(draggedItem.helper).outerWidth() + itemOffset.left;&lt;br /&gt; itemOffset.bottom = $(draggedItem.helper).outerHeight() + itemOffset.top;&lt;br /&gt; &lt;br /&gt; trashCanOffset.right = $(dropArea).outerWidth() + trashCanOffset.left;&lt;br /&gt; trashCanOffset.bottom = $(dropArea).outerHeight() + trashCanOffset.top;&lt;br /&gt;         &lt;br /&gt; // Compare&lt;br /&gt; if (itemOffset.right &gt;= trashCanOffset.left&lt;br /&gt;    &amp;&amp; itemOffset.bottom &gt;= trashCanOffset.top&lt;br /&gt;    &amp;&amp; itemOffset.top &lt;= trashCanOffset.bottom&lt;br /&gt;    &amp;&amp; itemOffset.left &lt;= trashCanOffset.right&lt;br /&gt; ){ &lt;br /&gt;     return true; &lt;br /&gt; }else{&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$('##calendar').fullCalendar({&lt;br /&gt; header: {left: 'prev,next today',center: 'title',right: 'month,agendaWeek,agendaDay'}&lt;br /&gt; , editable: true&lt;br /&gt; , firstHour: 6&lt;br /&gt; , slotMinutes: 15&lt;br /&gt; , defaultView: "agendaDay"&lt;br /&gt; , aspectRatio: "1.60"&lt;br /&gt; , year: #datePart("yyyy", now())#&lt;br /&gt; , month: #datePart("m", now())-1#&lt;br /&gt; , date: #datePart("d", now())#&lt;br /&gt; , events: #serializeJSON(viewBag.events)#&lt;br /&gt; , droppable: true&lt;br /&gt; , drop: function(date, allDay, jsEvent, ui) {   &lt;br /&gt;  &lt;br /&gt; var originalEventObject = $(this).data('eventObject');&lt;br /&gt;  var copiedEventObject = $.extend({}, originalEventObject);&lt;br /&gt;  copiedEventObject.id = uid();&lt;br /&gt;  copiedEventObject.start = date;&lt;br /&gt;  copiedEventObject.end = new Date(date).hours().add(-1);&lt;br /&gt;  copiedEventObject._end = new Date(date).hours().add(-1);&lt;br /&gt;  copiedEventObject.allDay = allDay;&lt;br /&gt;&lt;br /&gt;  $('##calendar').fullCalendar('renderEvent', copiedEventObject, true);&lt;br /&gt;  &lt;br /&gt;  saveEvent($(this).data("taskid"),'','',copiedEventObject.start,copiedEventObject.end,'');&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt; , eventResize: function(event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view){&lt;br /&gt;  &lt;br /&gt;  var newStart = event.start;&lt;br /&gt;  var newEnd = event.end;&lt;br /&gt;  var orgStart = new Date(newStart);&lt;br /&gt;  var orgEnd = new Date(newEnd).addMinutes(minuteDelta * -1);&lt;br /&gt;  &lt;br /&gt;  saveEvent(event.taskID,orgStart,orgEnd,newStart,newEnd);&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt; , eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view ){&lt;br /&gt;            &lt;br /&gt;     var newStart = event.start;&lt;br /&gt;  var newEnd = event.end;&lt;br /&gt;  var orgStart = new Date(newStart).addDays(dayDelta * -1);&lt;br /&gt;   orgStart.addMinutes(minuteDelta * -1);&lt;br /&gt;  var orgEnd = new Date(newEnd).addDays(dayDelta * -1);&lt;br /&gt;   orgEnd.addMinutes(minuteDelta * -1);&lt;br /&gt;  &lt;br /&gt;  saveEvent(event.taskID,orgStart,orgEnd,newStart,newEnd);&lt;br /&gt;       &lt;br /&gt; }&lt;br /&gt; ,eventDragStop:function(event, jsEvent, ui, view){&lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;  if (draggedOverTrashCan(ui, $('div##trash-can'))) {&lt;br /&gt;           &lt;br /&gt;       var format = "yyyy-MM-dd HH:mm:ss";&lt;br /&gt;       &lt;br /&gt;         $.ajax({&lt;br /&gt;    url:'/timesheet/deleteEvent'&lt;br /&gt;    ,type:'POST'&lt;br /&gt;    ,data:{&lt;br /&gt;     startTime:event.start.toString(format)&lt;br /&gt;     ,endTime:event.end.toString(format)&lt;br /&gt;     ,taskID:event.taskID&lt;br /&gt;     ,userID:'#viewBag.userID#'&lt;br /&gt;    }&lt;br /&gt;    ,dataType:'json'&lt;br /&gt;    ,success:function(){&lt;br /&gt;     $("##calendar").fullCalendar('removeEvents', event._id);&lt;br /&gt;    }&lt;br /&gt;   });&lt;br /&gt;   &lt;br /&gt;         &lt;br /&gt;     }     &lt;br /&gt; }&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;//--- add a trash can div to the top of the calendar    &lt;br /&gt;$('##calendar').children('.fc-content').prepend('&amp;lt;div id="trash-can" style="border: 2px solid ##C1454B;padding:15px 100px 15px;border-radius:5px;background:##DD9094;text-align:center;"&amp;gt;Drag Events Here To Remove&amp;lt;/div&amp;gt;');&lt;br /&gt;&lt;br /&gt;//---make the tasks available.&lt;br /&gt;loadTasks();&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;loadTasks() - is used to make the tasks in the left nav drag and droppable for the calendar. The task are created in ColdFusion like this.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;div id="external-events"&amp;gt;&lt;br /&gt; &amp;lt;ul&gt;&lt;br /&gt;  &amp;lt;cfloop query="viewBag.tasks"&amp;gt;&lt;br /&gt;   &amp;lt;li&amp;gt;&lt;br /&gt;    &amp;lt;div class="external-event ui-draggable" data-taskID="#viewBag.tasks.taskID#"&amp;gt;&lt;br /&gt;     &amp;lt;div&amp;gt;&amp;lt;strong&amp;gt;###viewBag.tasks.taskID# #viewBag.tasks.name#&amp;lt;/strong&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;     &amp;lt;div&amp;gt;&amp;lt;strong&amp;gt;Status: &amp;lt;/strong&amp;gt;#viewBag.tasks.taskStatusName#&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;   &amp;lt;/li&amp;gt;&lt;br /&gt;  &amp;lt;/cfloop&amp;gt;&lt;br /&gt; &amp;lt;/ul&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then document.ready I do this:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;var loadTasks = function(){&lt;br /&gt; &lt;br /&gt; //--- loop through each draggable task   &lt;br /&gt; $('##external-events div.external-event').each(function() {&lt;br /&gt;          &lt;br /&gt;  var self = $(this);&lt;br /&gt;  &lt;br /&gt;  //---set the event Object's title which will be seen on the calendar, set the id so that each event on the calendar is unique, and set any other values you want to be carried along with that event. in the case below taskID is an extra value I want. It will be used later to saveACalendarEvent.&lt;br /&gt;  var eventObject = {&lt;br /&gt;   title: $.trim(self.text())&lt;br /&gt;   ,id: $.trim(self.data("taskid"))&lt;br /&gt;   ,taskID:$.trim(self.data("taskid"))&lt;br /&gt;  };&lt;br /&gt;  &lt;br /&gt;  self.data('eventObject', eventObject);&lt;br /&gt;  &lt;br /&gt;  //---make the task draggable&lt;br /&gt;  self.draggable({&lt;br /&gt;   zIndex: 999,&lt;br /&gt;   revert: true, &lt;br /&gt;   revertDuration: 0&lt;br /&gt;  });&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;saveEvent() - is used to make an ajax call with the taskID, orginal start time, orginal end time, new start time, and new end time. I send the orginal and new dates so if I am resizing a task or moving the task on calendar I want to make sure I delete the old record.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;var saveEvent = function(taskID,orgStartObj,orgEndObj,newStartObj,newEndObj){&lt;br /&gt; &lt;br /&gt; var format = "yyyy-MM-dd HH:mm:ss";&lt;br /&gt; &lt;br /&gt; $.ajax({&lt;br /&gt;  url:'/timesheet/saveEvent'&lt;br /&gt;  ,type:'POST'&lt;br /&gt;  ,data:{&lt;br /&gt;   orginalStartTime:orgStartObj.toString(format)&lt;br /&gt;   ,orginalEndTime:orgEndObj.toString(format)&lt;br /&gt;   ,newStartTime:newStartObj.toString(format)&lt;br /&gt;   ,newEndTime:newEndObj.toString(format)&lt;br /&gt;   ,taskID:taskID&lt;br /&gt;  }&lt;br /&gt;  ,dataType:'json'&lt;br /&gt; });&lt;br /&gt; &lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;draggedOverTrashCan() - checks to see if the user drags a calendar event over the trash can. The trash can code gets prepended later in code.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;var draggedOverTrashCan = function(draggedItem, dropArea) {    &lt;br /&gt; var itemOffset = draggedItem.offset;&lt;br /&gt; var trashCanOffset = $(dropArea).offset(); &lt;br /&gt;&lt;br /&gt; itemOffset.right = $(draggedItem.helper).outerWidth() + itemOffset.left;&lt;br /&gt; itemOffset.bottom = $(draggedItem.helper).outerHeight() + itemOffset.top;&lt;br /&gt; &lt;br /&gt; trashCanOffset.right = $(dropArea).outerWidth() + trashCanOffset.left;&lt;br /&gt; trashCanOffset.bottom = $(dropArea).outerHeight() + trashCanOffset.top;&lt;br /&gt;         &lt;br /&gt; // Compare&lt;br /&gt; if (itemOffset.right &gt;= trashCanOffset.left&lt;br /&gt;    &amp;&amp; itemOffset.bottom &gt;= trashCanOffset.top&lt;br /&gt;    &amp;&amp; itemOffset.top &lt;= trashCanOffset.bottom&lt;br /&gt;    &amp;&amp; itemOffset.left &lt;= trashCanOffset.right&lt;br /&gt; ){ &lt;br /&gt;     return true; &lt;br /&gt; }else{&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;invoking the full calendar js&lt;br /&gt;drop() - handles dragging new events from off the calendar onto the calendar.&lt;br /&gt;&lt;br /&gt;eventResize(),eventDrop() - handles just that. Full calendar give you back the deltas from where the event used to be on the calendar. With those we can create the orginal date.&lt;br /&gt;&lt;br /&gt;eventDragStop() - used when event has stopped being dragged. For my use case, I want to know if they drug the task over the tash can so I can do an ajax call and delete the task. &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;$('##calendar').fullCalendar({&lt;br /&gt; header: {left: 'prev,next today',center: 'title',right: 'month,agendaWeek,agendaDay'}&lt;br /&gt; , editable: true&lt;br /&gt; , firstHour: 6&lt;br /&gt; , slotMinutes: 15&lt;br /&gt; , defaultView: "agendaDay"&lt;br /&gt; , aspectRatio: "1.60"&lt;br /&gt; , year: #datePart("yyyy", now())#&lt;br /&gt; , month: #datePart("m", now())-1#&lt;br /&gt; , date: #datePart("d", now())#&lt;br /&gt; , events: #serializeJSON(viewBag.events)#&lt;br /&gt; , droppable: true&lt;br /&gt; , drop: function(date, allDay, jsEvent, ui) {   &lt;br /&gt;  &lt;br /&gt;  var originalEventObject = $(this).data('eventObject');&lt;br /&gt;  var copiedEventObject = $.extend({}, originalEventObject);&lt;br /&gt;  copiedEventObject.start = date;&lt;br /&gt;  copiedEventObject.end = new Date(date).hours().add(-1);&lt;br /&gt;  copiedEventObject._end = new Date(date).hours().add(-1);&lt;br /&gt;  copiedEventObject.allDay = allDay;&lt;br /&gt;&lt;br /&gt;  $('##calendar').fullCalendar('renderEvent', copiedEventObject, true);&lt;br /&gt;  &lt;br /&gt;  saveEvent($(this).data("taskid"),'','',copiedEventObject.start,copiedEventObject.end,'');&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt; , eventResize: function(event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view){&lt;br /&gt;  &lt;br /&gt;  var newStart = event.start;&lt;br /&gt;  var newEnd = event.end;&lt;br /&gt;  var orgStart = new Date(newStart);&lt;br /&gt;  var orgEnd = new Date(newEnd).addMinutes(minuteDelta * -1);&lt;br /&gt;  &lt;br /&gt;  saveEvent(event.taskID,orgStart,orgEnd,newStart,newEnd);&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt; , eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view ){&lt;br /&gt;            &lt;br /&gt;     var newStart = event.start;&lt;br /&gt;  var newEnd = event.end;&lt;br /&gt;  var orgStart = new Date(newStart).addDays(dayDelta * -1);&lt;br /&gt;   orgStart.addMinutes(minuteDelta * -1);&lt;br /&gt;  var orgEnd = new Date(newEnd).addDays(dayDelta * -1);&lt;br /&gt;   orgEnd.addMinutes(minuteDelta * -1);&lt;br /&gt;  &lt;br /&gt;  saveEvent(event.taskID,orgStart,orgEnd,newStart,newEnd);&lt;br /&gt;       &lt;br /&gt; }&lt;br /&gt; ,eventDragStop:function(event, jsEvent, ui, view){&lt;br /&gt;  &lt;br /&gt;  if (draggedOverTrashCan(ui, $('div##trash-can'))) {&lt;br /&gt;           &lt;br /&gt;       var format = "yyyy-MM-dd HH:mm:ss";&lt;br /&gt;       &lt;br /&gt;         $.ajax({&lt;br /&gt;    url:'/timesheet/deleteEvent'&lt;br /&gt;    ,type:'POST'&lt;br /&gt;    ,data:{&lt;br /&gt;     startTime:event.start.toString(format)&lt;br /&gt;     ,endTime:event.end.toString(format)&lt;br /&gt;     ,taskID:event.taskID&lt;br /&gt;     ,userID:'#viewBag.userID#'&lt;br /&gt;    }&lt;br /&gt;    ,dataType:'json'&lt;br /&gt;    ,success:function(){&lt;br /&gt;     $("##calendar").fullCalendar('removeEvents', event._id);&lt;br /&gt;    }&lt;br /&gt;   });&lt;br /&gt;   &lt;br /&gt;         &lt;br /&gt;     }     &lt;br /&gt; }&lt;br /&gt;});&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This piece prepends a div to the top of the calendar to be used as a trash can.&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;$('##calendar').children('.fc-content').prepend('&amp;lt;div id="trash-can" style="border: 2px solid ##C1454B;padding:15px 100px 15px;border-radius:5px;background:##DD9094;text-align:center;"&amp;gt;Drag Events Here To Remove&amp;lt;/div&amp;gt;');&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-3075251687578933270?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/3075251687578933270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/12/full-calendar-js.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3075251687578933270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3075251687578933270'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/12/full-calendar-js.html' title='Full Calendar JS'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-438041811170031598</id><published>2011-12-22T11:19:00.000-08:00</published><updated>2011-12-22T11:22:12.223-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Railo Annotations</title><content type='html'>I've spent some time using Railo Coldfusion and recently purchased a home. I haven't had much time to write so I am catching up now.&lt;br /&gt;&lt;br /&gt;I got a message that Railo is finally going to support annotations. Why is this a good thing? Because I can now use &lt;a href="http://www.coldmvc.com/" target="_blank"&gt;ColdMVC&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-438041811170031598?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/438041811170031598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/12/railo-annotations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/438041811170031598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/438041811170031598'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/12/railo-annotations.html' title='Railo Annotations'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-4824095567361533902</id><published>2011-07-05T10:38:00.000-07:00</published><updated>2011-07-05T10:42:41.754-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>cfsavecontent vs CSS when wanting to add styles.</title><content type='html'>I ran into some confrontation when I decided to use a cfsavecontent and write some styles in &amp;lt;style/&amp;gt; tags and do a &amp;lt;cfhtmlhead/&amp;gt;. Another developer prefers everything in a .css file. While, yes all styles are in one place in the app, unneeded styles are being loaded on pages that don't need them. &lt;br /&gt;&lt;br /&gt;I prefer the other route of doing styles in style tags on the page I am working in and then adding them to the head section. Don't get me wrong I still have some global styles set in .css files. Most of the pages I am working on are all custom interfaces and the .css file(s) would be unnecessary large between pages. Not to mention lots and/or large .css files bring down browser load time. &lt;br /&gt;&lt;br /&gt;Thoughts?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-4824095567361533902?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/4824095567361533902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/07/cfsavecontent-vs-css-when-wanting-to.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/4824095567361533902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/4824095567361533902'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/07/cfsavecontent-vs-css-when-wanting-to.html' title='cfsavecontent vs CSS when wanting to add styles.'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-5134733575653016187</id><published>2011-07-05T10:35:00.000-07:00</published><updated>2011-07-05T10:43:13.136-07:00</updated><title type='text'>Submit button name when posting form in JS</title><content type='html'>I am sure plenty of people out there have had this issue. So I had a submit button named "submit" and tried to do form submit in js by doing $("#theform").submit(); and I kept getting this error saying that .submit() wasn't a function. After some digging apparently if you name a submit button in a form "submit" it overwrites the submit() with submit button element. Not cool.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-5134733575653016187?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/5134733575653016187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/07/submit-button-name-when-posting-form-in.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5134733575653016187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5134733575653016187'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/07/submit-button-name-when-posting-form-in.html' title='Submit button name when posting form in JS'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-5625879201473509745</id><published>2011-06-23T20:01:00.000-07:00</published><updated>2011-06-23T20:09:22.001-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><title type='text'>Developer Phases</title><content type='html'>1. How do I do that? (Entry)&lt;br /&gt;2. Yeah, I can do that. (Mid)&lt;br /&gt;3. Sigh. What was I thinking when I wrote this? (Adv)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-5625879201473509745?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/5625879201473509745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/06/developer-phases.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5625879201473509745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5625879201473509745'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/06/developer-phases.html' title='Developer Phases'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-2423233768839841138</id><published>2011-06-15T06:07:00.000-07:00</published><updated>2011-06-15T06:10:01.837-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hover Technology'/><title type='text'>Hover Bike</title><content type='html'>I am a big fan of hover technology and want to share this break through with a hover bike.&lt;br /&gt;&lt;br /&gt;http://gearpatrol.com/blog/2011/06/09/bmw-powered-twin-rotorhoverbike/&lt;br /&gt;&lt;br /&gt;It kind of reminds of a speeder bike from Star Wars.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-2423233768839841138?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/2423233768839841138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/06/hover-bike.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2423233768839841138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2423233768839841138'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/06/hover-bike.html' title='Hover Bike'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-2172629626795119882</id><published>2011-06-15T06:05:00.000-07:00</published><updated>2011-06-15T06:07:14.511-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Writing text over an image</title><content type='html'>I know alot of people have already done this, but I thought I would share writing text over image as well. Only because the first time you do it, it's really cool.&lt;br /&gt;&lt;br /&gt;Read in the image&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt; &amp;lt;cfimage name = "local.image" action="read" source="test.jpg"/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Turn on anti-aliasing ("softens jagged edges")&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;&amp;lt;cfset ImageSetAntiAliasing(local.image)/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Set the text color&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;&amp;lt;cfset ImageSetDrawingColor(local.image, "000000")/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Set extra attributes&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;&amp;lt;cfset local.attrs = {&lt;br /&gt;    Font = 'Arial',&lt;br /&gt;    Size = 36,&lt;br /&gt;    Style = 'bold'&lt;br /&gt;   }/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Draw over the image (image,text,x-position,y-position,attributes)&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;&amp;lt;cfset ImageDrawText(local.image, "Hello World!", 10, 10, local.attrs)/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-2172629626795119882?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/2172629626795119882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/06/writing-text-over-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2172629626795119882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2172629626795119882'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/06/writing-text-over-image.html' title='Writing text over an image'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-5651781766385182229</id><published>2011-06-15T06:04:00.001-07:00</published><updated>2011-06-15T06:05:12.506-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>SQL replace() blank stuff</title><content type='html'>Will never return 0&lt;br /&gt;&lt;pre class="sql" name="code"&gt;&lt;br /&gt;select replace('','',0)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Will return zero if the value is ''&lt;br /&gt;&lt;pre class="sql" name="code"&gt;&lt;br /&gt;select case when '' = '' then 0 else 1 end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-5651781766385182229?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/5651781766385182229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/06/sql-isnull-blank-stuff.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5651781766385182229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5651781766385182229'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/06/sql-isnull-blank-stuff.html' title='SQL replace() blank stuff'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-8313664635359439443</id><published>2011-06-15T06:03:00.001-07:00</published><updated>2011-06-15T06:03:53.800-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>SQL Selects ='s</title><content type='html'>Instead of writing a select in a query like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="sql" name="code"&gt;&lt;br /&gt;select &lt;br /&gt;[user].id,&lt;br /&gt; [user].name,&lt;br /&gt; snowboard.name as snowboard&lt;br /&gt;from [user]&lt;br /&gt; inner join snowboard on snowboard.id = [user].snowboard_id&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;try this&lt;br /&gt;&lt;br /&gt;&lt;pre class="sql" name="code"&gt;&lt;br /&gt;select &lt;br /&gt; [user].id,&lt;br /&gt; [user].name,&lt;br /&gt; snowboard = snowboard.name&lt;br /&gt;from [user]&lt;br /&gt; inner join snowboard on snowboard.id = [user].snowboard_id&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It helps all the columns line up and read nicer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-8313664635359439443?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/8313664635359439443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/06/sql-selects-s.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8313664635359439443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8313664635359439443'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/06/sql-selects-s.html' title='SQL Selects =&apos;s'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-2456580384004545796</id><published>2011-04-20T11:33:00.000-07:00</published><updated>2011-04-20T12:53:49.835-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>HQL vs. SQL</title><content type='html'>I've been playing with HQL for awhile now and want to share my thoughts of it against SQL. Some developers are hesitant to switch to HQL because of the querying. I don't blame them. Writing HQL can be tougher than SQL. After fighting threw some HQL queries I have found that SQL still has its place in an HQL application. Here are some of my findings:&lt;br /&gt;&lt;br /&gt;1. List pages and aggregates are faster and easier to write in SQL. Most of the time the data points that list pages and aggregates are going to be displayed are already hashed out and don't need to be changed much. &lt;br /&gt;&lt;br /&gt;2. HQL is great for getting and setting simple data quickly. SQL takes too much energy and time to insert or get a piece of data. The SQL queries you write are not going to be flexible enough for the new fields people are going to request.&lt;br /&gt;&lt;br /&gt;3. Some routines are more efficient to be ran in SQL. HQL can be slow and it brings back too much data sometimes.&lt;br /&gt;&lt;br /&gt;With the above findings I have organized my code to do saves and single entity gets with HQL and lists and routines with SQL. With this combo I have found it to be quick to get and set the data I need. It does take knowledge of both HQL and SQL to do this, but the languages are very similar and the learner curve isn't too bad. Here is an earlier post about the &lt;a href="http://jbanken.blogspot.com/2010/05/from-sql-to-hql.html"&gt;similarities&lt;/a&gt;.  I hope this brings down the hesitation for the SQL people to try and use HQL for what it's good for. &lt;br /&gt;&lt;br /&gt;I would like to hear peoples thoughts on this matter. It seems to come up a lot in HQL conversations, so comment away.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-2456580384004545796?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/2456580384004545796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/04/hql-vs-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2456580384004545796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2456580384004545796'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/04/hql-vs-sql.html' title='HQL vs. SQL'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-147779941692432452</id><published>2011-04-20T11:27:00.000-07:00</published><updated>2011-04-20T12:52:07.768-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: Quick start now available</title><content type='html'>After a long wait, ColdMVC finally has a quick start guide. Check it out here: &lt;a href="http://www.coldmvc.com/quickstart" target="_blank"&gt;http://www.coldmvc.com/quickstart.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-147779941692432452?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/147779941692432452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/04/coldmvc-quick-start-now-available.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/147779941692432452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/147779941692432452'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/04/coldmvc-quick-start-now-available.html' title='ColdMVC: Quick start now available'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-1581253321221661992</id><published>2011-03-28T06:57:00.001-07:00</published><updated>2011-03-28T07:00:26.504-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: get an object's parents</title><content type='html'>Awhile back I posted on flattening an array of objects with Parent-Child relationship (&lt;a href="http://jbanken.blogspot.com/2010/07/coldmvc-flatten-array-of-objects-with.html" target="_blank"&gt;link&lt;/a&gt;) and have been using it alot. But one issue I had with it was when I was looping through the array of objects I didn't know who my parents were for the current object I was working with. I already knew how deep thanks to the treeDepth property. I made this function to recursively go up the tree of objects and bring back an array of parent objects for an object.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cffunction name="getObjectsParents" access="public" output="false" returntype="array"&amp;gt;&lt;br /&gt; &amp;lt;cfargument name="object" required="true"/&amp;gt;&lt;br /&gt; &amp;lt;cfargument name="result" required="false" default="#[]#"/&amp;gt;&lt;br /&gt;  &lt;br /&gt; &amp;lt;cfif isObject(arguments.object.parent())&amp;gt;&lt;br /&gt;  &amp;lt;cfset arrayPrepend(arguments.result,arguments.object.parent())/&amp;gt;&lt;br /&gt;  &amp;lt;cfreturn getObjectsParents(arguments.object.parent(),arguments.result)/&amp;gt;&lt;br /&gt; &amp;lt;cfelse&amp;gt;&lt;br /&gt;  &amp;lt;cfreturn arguments.result/&amp;gt;&lt;br /&gt; &amp;lt;/cfif&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cffunction&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-1581253321221661992?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/1581253321221661992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/03/coldmvc-get-objects-parents.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1581253321221661992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1581253321221661992'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/03/coldmvc-get-objects-parents.html' title='ColdMVC: get an object&apos;s parents'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-1511671773441046796</id><published>2011-02-03T19:06:00.000-08:00</published><updated>2011-02-03T19:16:17.638-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: Number Tag</title><content type='html'>I've playing around with mobile web apps lately. ColdMVC has been a big help in getting them done quickly and "in the cloud". &lt;br /&gt;&lt;br /&gt;I've been looking for a house since the market is so good right now and one thing I noticed when searching for houses online is the when you type in a price range only the keypad shows up on my phone. No letters. Just numbers. It's really nice. I viewed the source when I got back to my laptop and found out they were doing it with &amp;lt;input type="number" &amp;gt;. I decided to hack a ColdMVC tag together to hanlde this. &lt;br /&gt;&lt;br /&gt;Here is how you call the tag...&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;c:number name="miles" value="#service.miles()#"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is my hacked in logic...&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfparam name="attributes.class" default="input"/&amp;gt;&lt;br /&gt;&amp;lt;cfparam name="attributes.value" default=""/&amp;gt;&lt;br /&gt;&amp;lt;cfif thisTag.executionMode eq "end"&amp;gt;&lt;br /&gt; &amp;lt;cfoutput&amp;gt;&lt;br /&gt;  &amp;lt;cfsavecontent variable="attributes.field"&amp;gt;&lt;br /&gt;   &amp;lt;input type="number" name="#attributes.name#" title="#attributes.name#" value="#attributes.value#" class="#attributes.class#"/&amp;gt;&lt;br /&gt;  &amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt; &amp;lt;/cfoutput&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;cfset thisTag.generatedContent = coldmvc.form.field(argumentCollection=attributes) /&amp;gt;&lt;br /&gt;&amp;lt;/cfif&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above logic doesn't supporting binding, but it works to use. It would be cool if this tag was managed my ColdMVC HTMLHelper.cfc then I would have to worry about the attributes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-1511671773441046796?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/1511671773441046796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/02/coldmvc-number-tag.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1511671773441046796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1511671773441046796'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/02/coldmvc-number-tag.html' title='ColdMVC: Number Tag'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-9088978564988589489</id><published>2011-02-02T07:02:00.000-08:00</published><updated>2011-02-02T07:04:01.787-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: Binding</title><content type='html'>I really like the binding option in the form tag of ColdMVC. It takes an object from the param scope, prefixes all the elements within it, with model's name (ex. user.first_name), and sets the value from the object. It's very handy. Here is an example of what it currently does:&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;c:form controller="user" action="save" bind="user"&amp;gt;&lt;br /&gt; &amp;lt;c:hidden name="id"/&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;c:input name="first_name"/&amp;gt;&lt;br /&gt; &amp;lt;c:input name="last_name"/&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;c:buttons&amp;gt;&lt;br /&gt;  &amp;lt;c:submit label="save"/&amp;gt;&lt;br /&gt; &amp;lt;/c:buttons&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/c:form&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If you wanted to bind the form to 2 or more objects it would be cool if you could use a bind tag and group a set of elements within a form.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;c:form controller="student" action="save"&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;c:bind key="user"&amp;gt;&lt;br /&gt;  &amp;lt;c:hidden name="id"/&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;c:input name="first_name"/&amp;gt;&lt;br /&gt;  &amp;lt;c:input name="last_name"/&amp;gt;&lt;br /&gt; &amp;lt;/c:bind&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;c:bind key="student"&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;c:input name="student_number"/&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;/c:bind&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;c:buttons&amp;gt;&lt;br /&gt;  &amp;lt;c:submit label="save"/&amp;gt;&lt;br /&gt; &amp;lt;/c:buttons&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/c:form&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Or even better on the tag itself. (I think this available already, but I am not sure).&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;c:form controller="student" action="save"&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;c:hidden name="id" bind="user"/&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;c:input name="first_name" bind="user"/&amp;gt;&lt;br /&gt; &amp;lt;c:input name="last_name" bind="user"/&amp;gt;&lt;br /&gt; &amp;lt;c:input name="student_number" bind="student"/&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;c:buttons&amp;gt;&lt;br /&gt;  &amp;lt;c:submit label="save"/&amp;gt;&lt;br /&gt; &amp;lt;/c:buttons&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/c:form&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-9088978564988589489?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/9088978564988589489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/02/coldmvc-binding.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/9088978564988589489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/9088978564988589489'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/02/coldmvc-binding.html' title='ColdMVC: Binding'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-8350655321140665574</id><published>2011-01-19T17:25:00.000-08:00</published><updated>2011-01-19T17:44:22.452-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Type Ahead Searches with jQuery</title><content type='html'>I was working on a mobile app and wanted to try a type ahead search to easy the user typing on a phone keyboard. I was able to make the ajax calls using jQuery to get the data, but I ran into some race conditions. As the user typed I made an ajax call but sometimes the first ajax call would take longer than the second. Thus updating the results with the first ajax calls data, because it finished later. &lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;I starting typing "b". Then it would fire off an ajax call to get all the data with the letter "b". &lt;br /&gt;&lt;br /&gt;Next I typed "a". So my search input box looked like this "ba". And firing off another ajax call to get all the data with the letters "ba". &lt;br /&gt;&lt;br /&gt;I didn't know this but you can put the ajax request in a variable and kill it. Check it out.&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;       var ajaxCall;&lt;br /&gt;       typeAheadSearch = function(){&lt;br /&gt;               if(ajaxCall != undefined){&lt;br /&gt;                       ajaxCall.abort();&lt;br /&gt;               }&lt;br /&gt;               &lt;br /&gt;               ajaxCall = jQuery.ajax({&lt;br /&gt;                       url: "http://www.somedomain.com/typeAheadSearch/_results.cfm",&lt;br /&gt;                       data:{search:jQuery("##search").val()},&lt;br /&gt;                       success:function(data){&lt;br /&gt;                               jQuery("##results").html(data);&lt;br /&gt;                       }&lt;br /&gt;               });&lt;br /&gt;       };&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I started a variable called "ajaxCall" to store the request in. The first thing I do in the typeAheadSearch() is kill the current request by calling abort(). The next thing that I didn't know you could is that jQuery's ajax() returns the request. This is so handy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-8350655321140665574?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/8350655321140665574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/01/type-ahead-searches-with-jquery.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8350655321140665574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8350655321140665574'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/01/type-ahead-searches-with-jquery.html' title='Type Ahead Searches with jQuery'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-6526038032956175051</id><published>2011-01-04T20:06:00.000-08:00</published><updated>2011-01-04T20:26:23.458-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>CF9 computed properties</title><content type='html'>I wanted to make a computed property in CF9 just like you can on a sql table (computed column). Dan Vega had a nice &lt;a href="http://www.danvega.org/blog/index.cfm/2010/9/7/ColdFusion-ORM-calculated-values" target="_blank"&gt;how-to&lt;/a&gt; awhile back but it didn't show a complex example. &lt;br /&gt;&lt;br /&gt;In my project I had a "project" class that had many ratings on it (Example: rating of 1-5, 1 being bad and 5 being great) and I wanted to have a computed property that gave me the average rating of a project. Here is what my hib file looks like for the "project" class. &lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;class entity-name="Project" lazy="true" name="cfc:myproject.app.model.Project" table="`Project`"&amp;gt;&lt;br /&gt;        &amp;lt;id name="id" type="int"&amp;gt;&lt;br /&gt;                &amp;lt;column length="10" name="ID" /&amp;gt;&lt;br /&gt;         &amp;lt;generator class="identity" /&amp;gt;&lt;br /&gt;        &amp;lt;/id&amp;gt;&lt;br /&gt;        &amp;lt;property name="name" type="string"&amp;gt;&lt;br /&gt;                &amp;lt;column name="Name" sql-type="varchar(max)" /&amp;gt;&lt;br /&gt;        &amp;lt;/property&amp;gt;&lt;br /&gt;  &amp;lt;property name="description" type="string"&amp;gt;&lt;br /&gt;        &amp;lt;column name="Description" sql-type="varchar(max)" /&amp;gt;&lt;br /&gt;        &amp;lt;/property&amp;gt;&lt;br /&gt;        &amp;lt;property type="float" &lt;br /&gt;                formula="(select (sum(r.rank)*100.0) / (count(pr.id) *100.0) from project as p inner join project_rating as pr on pr.project_id = p.id inner join rating as r on r.id = pr.rating_id where pr.project_id = id)" &lt;br /&gt;                name="rating"/&amp;gt;  &lt;br /&gt;&amp;lt;/class&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Some key things to point out:&lt;br /&gt;1. The formula is a sql query not a hql query. &lt;br /&gt;2. I wrapped my entire statement in (), don't know why but it worked.&lt;br /&gt;3. You always start the sql statement with the table of the class you are working on. Reason being is when you get to the "where" clause notice this piece "pr.project_id = id". "id" is not aliased because it grabs the current id of the object that is running the formula against. This is how the query will only run for single object and not all of the other db records in the project table.&lt;br /&gt;4. Alias every thing except the "where id" part.&lt;br /&gt;&lt;br /&gt;I struggled through these above. Hope this helps someone.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-6526038032956175051?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/6526038032956175051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2011/01/cf9-computed-properties.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6526038032956175051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6526038032956175051'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2011/01/cf9-computed-properties.html' title='CF9 computed properties'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-7173732412860121240</id><published>2010-12-30T18:45:00.000-08:00</published><updated>2010-12-30T19:00:05.378-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><title type='text'>DSL's or Domain Specific Languages</title><content type='html'>I saw this at Adobe MAX last year and I finally got a chance to try it out. DSL or Domain Specifically Languages are languages that only reside in a domain, in our case the web app we are developing. A good example of where DSLs are used is in gMail in the search box. If you haven't noticed it yet they are really handy, but they only work in gMail. Another good one is MS Outlook, they support crazy operators. Here is what one would look like:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.bankentechnology.com/bankentechnology/public/images/blog/dsl.png" alt="dsl"&gt;&lt;br /&gt;&lt;br /&gt;I grabbed this one from gMail. The convention seems to use a keyword followed by a ":". In the case above it's "from:". I have only found DSLs helpfully for search boxes. If you are going to use DSLs you need to have legend so your users know what keys are available. You need to support it everywhere or tell the user where it is supported. If you are going to use them you should do whatever it takes in the keys and language to make it easier for the user. DSLs should be quick to use. Some advanced DSLs might look like this "from:(name:*joe)" or something like that or if operators are involved. &lt;br /&gt;&lt;br /&gt;Once the user enters the DSLs you need to parse the string and do something with it. I create a query criteria snippet for sql or orm queries to allow the user to search across other things in the search box.&lt;br /&gt;&lt;br /&gt;DSLs aren't really user friendly that's why I would recommend "search areas". Search areas are much easier to read, but less flexible. I posted on it early tonight &lt;a href="http://jbanken.blogspot.com/2010/12/search-areas.html" "Search Areas"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-7173732412860121240?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/7173732412860121240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/12/dsls-or-domain-specific-languages.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7173732412860121240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7173732412860121240'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/12/dsls-or-domain-specific-languages.html' title='DSL&apos;s or Domain Specific Languages'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-8615604786647855656</id><published>2010-12-30T18:33:00.000-08:00</published><updated>2010-12-30T18:38:36.291-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><title type='text'>Getting all the URL params in Javascript</title><content type='html'>I've been updating a lot of href's lately and found these functions to be very handy. They basically take all the pars in a string and put them in a JS object. There is other functions out there that get you 1 url param, but I wanted them all. Reason being, is I need to see if that param exists and do some more checks on it for business logic, then take all the pars and turn then into a querystring and add them back to href again.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;getURLParameters = function(url){&lt;br /&gt;&lt;br /&gt;       var results = {};&lt;br /&gt;    &lt;br /&gt;       if(url == ""){&lt;br /&gt;               var url = window.document.URL.toString();&lt;br /&gt;       }&lt;br /&gt;       if (url.indexOf("?") &gt; 0){&lt;br /&gt;               var splitURL = url.split("?");&lt;br /&gt;               params = splitURL[1].split("&amp;");&lt;br /&gt;&lt;br /&gt;               for (var i=0;i&lt;params.length;i++){&lt;br /&gt;                       var param =  params[i].split("=");&lt;br /&gt;                       if (param[1] != "")&lt;br /&gt;                               results[param[0]] = unescape(param[1]);&lt;br /&gt;                       else&lt;br /&gt;                               results[param[0]] = "";&lt;br /&gt;               }&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       return results;&lt;br /&gt;};&lt;br /&gt;getURL = function(url){&lt;br /&gt;&lt;br /&gt;       if(url == ""){&lt;br /&gt;               var url = window.document.URL.toString();&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       if(url.indexOf("?") &gt; 0){&lt;br /&gt;               var splitURL = url.split("?");&lt;br /&gt;               url = splitURL[0];&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       return url;&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;getURL() actually serves two purposes. If a url isn't passed in get the current url. And it also cleans off all of params so all you get the base url.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-8615604786647855656?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/8615604786647855656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/12/getting-all-url-params-in-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8615604786647855656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8615604786647855656'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/12/getting-all-url-params-in-javascript.html' title='Getting all the URL params in Javascript'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-3429952826943636859</id><published>2010-12-30T18:23:00.000-08:00</published><updated>2010-12-30T18:40:47.205-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='Design'/><title type='text'>Search Areas</title><content type='html'>Had a task where a user didn't want to use the primary "search by" of searching in a list which is usually to search by "name" or "number". I did some research and found a way to keep the majority users satisfied, yet still giving the ability to the advanced user. Check it out...&lt;br /&gt;&lt;br /&gt;Regular search box:&lt;br /&gt;&lt;img src="http://www.bankentechnology.com/bankentechnology/public/images/blog/plain.png" alt="plain"/&gt;&lt;br /&gt;&lt;br /&gt;Search box with search areas:&lt;br /&gt;&lt;img src="http://www.bankentechnology.com/bankentechnology/public/images/blog/search_areas.png" alt="search_areas"/&gt;&lt;br /&gt;&lt;br /&gt;It's actually not to tricky to do. It's just a table with two cells. The left cell is the input box with a style of no boarders and right cell is a div with a pic in it. When you click the div with the pic in it another div below is shown with absolute positioning. I will let you figure out the javascript and css. It's not too hard.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.istockphoto.com/" target="_blank"&gt;iStockPhotography&lt;/a&gt; currently has something similar.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-3429952826943636859?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/3429952826943636859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/12/search-areas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3429952826943636859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3429952826943636859'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/12/search-areas.html' title='Search Areas'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-6308334084566180487</id><published>2010-12-30T18:21:00.000-08:00</published><updated>2010-12-30T18:22:53.578-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>MS SQL GUID lengths</title><content type='html'>Working with MS SQL and found out that errors with GUIDs are only thrown if the length of the GUID isn't met. The length of the GUID can be over the length of a regular GUID. This is kinda wierd because one would think this would error, but in fact MS SQL actually only will store the length of the GUID String up to the length of a normal GUID. Check out the examples below...&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="sql"&gt;&lt;br /&gt;create table Snowboarder(&lt;br /&gt; id uniqueidentifier not null,&lt;br /&gt; name varchar(200) not null,&lt;br /&gt; primary key (id)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;/*--will throw an error---*/&lt;br /&gt;insert into Snowboarder(&lt;br /&gt; id,&lt;br /&gt; name&lt;br /&gt;)values(&lt;br /&gt; '',&lt;br /&gt; 'Blank GUID'&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;/*--will work---*/&lt;br /&gt;insert into Snowboarder(&lt;br /&gt; id,&lt;br /&gt; name&lt;br /&gt;)values(&lt;br /&gt; 'D832DE4B-8453-4831-9505-6CA8CB4A4033',&lt;br /&gt; 'Regular GUID'&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;/*--will work, but it will only store the first guid---*/&lt;br /&gt;insert into Snowboarder(&lt;br /&gt; id,&lt;br /&gt; name&lt;br /&gt;)values(&lt;br /&gt; 'FE7A6068-080B-43B3-B392-3ABCE2E5FADF13725D91-B434-41B4-97A8-5607BF864EF5',&lt;br /&gt; 'Two GUIDS together'&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;/*--will throw an error because the first part is already in the db--*/&lt;br /&gt;insert into Snowboarder(&lt;br /&gt; id,&lt;br /&gt; name&lt;br /&gt;)values(&lt;br /&gt; 'D832DE4B-8453-4831-9505-6CA8CB4A40336448153D-A72F-42A8-BB35-17EE076D393C',&lt;br /&gt; 'Two GUIDS together with the first part already in the db'&lt;br /&gt;)&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-6308334084566180487?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/6308334084566180487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/12/ms-sql-guid-lengths.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6308334084566180487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6308334084566180487'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/12/ms-sql-guid-lengths.html' title='MS SQL GUID lengths'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-6411350630380081288</id><published>2010-12-30T18:18:00.000-08:00</published><updated>2010-12-30T18:20:56.548-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: AJAX call</title><content type='html'>Trying to make ajax calls with ColdMVC was a little difficult for me because I struggle with routes, but I found a way.  Here is what I did to make an AJAX call with ColdMVC.&lt;br /&gt;&lt;br /&gt;First I created a function on a Controller so I can return "hi" back from the AJAX call. Notice I have @view json.cfm above the function. Since ColdMVC uses routes I need to send the data to a view and cfoutput it on the page. &lt;br /&gt;&lt;br /&gt;TestController&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;/**&lt;br /&gt; * @accessors true&lt;br /&gt; * @extends coldmvc.controller&lt;br /&gt; */&lt;br /&gt;component {&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  @view json.cfm&lt;br /&gt; */&lt;br /&gt; function testMethod(){&lt;br /&gt;  params.json = "hi";&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is json.cfm. All that I do with it is output the variable "json".&lt;br /&gt;&lt;br /&gt;json.cfm&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt; &amp;lt;cfoutput&amp;gt;#params.json#&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And lastly I preform my AJAX call using jQuery. In the url setting of jQuery.ajax() I just link to the controller. In my case, my controller's name is TestController, so my route with just be "test" and then I can change out the method. In my case I am calling the "testMethod" on the controller. &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;ajaxCall = function(){&lt;br /&gt;  &lt;br /&gt; jQuery.ajax({&lt;br /&gt;  url:"#coldmvc.link.to('/test')#/test?returnformat=json",&lt;br /&gt;  type:"GET",&lt;br /&gt;  success:function(data){&lt;br /&gt;   jQuery("body").html(data);&lt;br /&gt;  }&lt;br /&gt; });&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you want to return json back just go to json.cfm and wrap params.json in SerializeJSON(). Then in your ajax call, do jQuery.parseJSON(). This is the only way I can think of right now to make an ajax call with ColdMVC, if there are any other techniques I would be more then happy to listen.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-6411350630380081288?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/6411350630380081288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/12/coldmvc-ajax-call.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6411350630380081288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6411350630380081288'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/12/coldmvc-ajax-call.html' title='ColdMVC: AJAX call'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-5486703524187941685</id><published>2010-10-19T20:04:00.000-07:00</published><updated>2010-10-19T20:09:55.264-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>CF9 hibernate file includes.</title><content type='html'>This was so cool I had to repost it. After you've defined a few hibernate.hbmxml files it gets annoying to have type the same properties on every class. My fingers were getting sore to complain a little. After a reference shown to me by Tony Nelson, Mark Mandal had a great &lt;a href="http://groups.google.com/group/cf-orm-dev/browse_thread/thread/cb3b109e91ef5a5e/aa823354f295af11?show_docid=aa823354f295af11&amp;pli=1" target="_blank"&gt;post&lt;/a&gt; on "includes in the hibernate file". Check it out.&lt;br /&gt;&lt;br /&gt;If you notice in the hibernate.hbmxml below there is a line that says "&amp;common;".&lt;br /&gt;   &lt;br /&gt;hibernate.hbmxml&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"&lt;br /&gt;                                   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&lt;br /&gt;[ &amp;lt;!ENTITY common SYSTEM "common.hbm.xml"&amp;gt; ]&lt;br /&gt;&amp;gt;&lt;br /&gt;&amp;lt;hibernate-mapping&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;class entity-name="User" lazy="true" name="cfc:beforeandafter.app.model.User" table="`User`"&amp;gt;&lt;br /&gt;        &amp;common;&lt;br /&gt;  &amp;lt;property name="firstName" type="string"&amp;gt;&lt;br /&gt;       &amp;lt;column name="First_Name" length="200" /&amp;gt;&lt;br /&gt;  &amp;lt;/property&amp;gt;&lt;br /&gt;  &amp;lt;property name="lastName" type="string"&amp;gt;&lt;br /&gt;       &amp;lt;column name="Last_Name" length="200" /&amp;gt;&lt;br /&gt;  &amp;lt;/property&amp;gt;&lt;br /&gt;  &amp;lt;property name="emailAddress" type="string"&amp;gt;&lt;br /&gt;       &amp;lt;column name="Email_Address" length="200" /&amp;gt;&lt;br /&gt;  &amp;lt;/property&amp;gt;&lt;br /&gt;  &amp;lt;property name="password" type="string"&amp;gt;&lt;br /&gt;       &amp;lt;column name="Password" length="200" /&amp;gt;&lt;br /&gt;  &amp;lt;/property&amp;gt;&lt;br /&gt;  &amp;lt;bag name="projects"&amp;gt;&lt;br /&gt;   &amp;lt;key column="User_ID" /&amp;gt;&lt;br /&gt;   &amp;lt;one-to-many class="cfc:beforeandafter.app.model.Project" /&amp;gt;&lt;br /&gt;  &amp;lt;/bag&amp;gt;&lt;br /&gt;  &amp;lt;bag name="projectRatings"&amp;gt;&lt;br /&gt;   &amp;lt;key column="User_ID" /&amp;gt;&lt;br /&gt;   &amp;lt;one-to-many class="cfc:beforeandafter.app.model.ProjectRating" /&amp;gt;&lt;br /&gt;  &amp;lt;/bag&amp;gt;&lt;br /&gt; &amp;lt;/class&amp;gt;&lt;br /&gt;&amp;lt;/hibernate-mapping&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&amp;common; points to file called common.hbm.xml. Within common.hbm.xml file I defined all my similiar properties and just include it on all my classes.&lt;br /&gt;&lt;br /&gt;common.hbm.xml&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;id name="id" type="int"&amp;gt;&lt;br /&gt; &amp;lt;column length="10" name="ID" /&amp;gt;&lt;br /&gt; &amp;lt;generator class="identity" /&amp;gt;&lt;br /&gt;&amp;lt;/id&amp;gt;&lt;br /&gt;&amp;lt;property name="isDeleted" type="boolean"&amp;gt;&lt;br /&gt; &amp;lt;column name="isDeleted" /&amp;gt;&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="createdBy" type="int"&amp;gt;&lt;br /&gt; &amp;lt;column length="10" name="Created_By" /&amp;gt;&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="createdOn" type="timestamp"&amp;gt;&lt;br /&gt;  &amp;lt;column name="Created_On" /&amp;gt;&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="updatedBy" type="int"&amp;gt;&lt;br /&gt;  &amp;lt;column length="10" name="Modified_By" /&amp;gt;&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="updatedOn" type="timestamp"&amp;gt;&lt;br /&gt;  &amp;lt;column name="Modified_On" /&amp;gt;&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Make sure your include file ends in .xml and not .hbmxml otherwise it won't work. Made my life a ton a easier. Thanks Mark and Tony for sharing this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-5486703524187941685?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/5486703524187941685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/10/cf9-hibernate-file-includes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5486703524187941685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5486703524187941685'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/10/cf9-hibernate-file-includes.html' title='CF9 hibernate file includes.'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-1770642403305101882</id><published>2010-08-10T19:21:00.000-07:00</published><updated>2010-08-10T19:25:22.254-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: Plugging in fckeditor</title><content type='html'>I am working on a CMS app and I wanted the &lt;a href="http://ckeditor.com/download" title="fckeditor"&gt;fckeditor&lt;/a&gt; in my app, while using ColdMVC. Here's what I did to get it in my app.&lt;br /&gt;&lt;br /&gt;I downloaded the fckeditor and put it in the public folder, like below...&lt;br /&gt;&lt;br /&gt;app&lt;br /&gt;&amp;gt;public&lt;br /&gt;&amp;gt;&amp;gt;plugins&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt;fckeditor&lt;br /&gt;&lt;br /&gt;Next, on a custom helper called "util.cfc", I added a function called editor().&lt;br /&gt;1. Create a fckeditor bean. &lt;br /&gt;2. Set the properties of the fckeditor. Specifically the basepath is really important. I used $.config.get('assetPath') to get to the directory where the fckeditor is located.&lt;br /&gt;3. Lastly, I wrap the fckeditor in ColdMVC's field() so it looks like the other fields.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt; &amp;lt;cffunction name="editor" access="public" output="false" returntype="string"&amp;gt;&lt;br /&gt;  &amp;lt;cfargument name="name" required="true"/&amp;gt;&lt;br /&gt;  &amp;lt;cfargument name="value" required="false" default=""/&amp;gt;&lt;br /&gt;  &amp;lt;cfargument name="width" required="false" default="100%"/&amp;gt;&lt;br /&gt;  &amp;lt;cfargument name="height" required="false" default="300px"/&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;cfset local.bean = application.coldmvc.beanFactory.getBean("fckeditor")/&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;cfset local.bean.basePath = "#$.config.get('assetPath')#plugins/fckeditor/"/&amp;gt;&lt;br /&gt;  &amp;lt;cfset local.bean.instanceName = arguments.name/&amp;gt;&lt;br /&gt;  &amp;lt;cfset local.bean.value = arguments.value/&amp;gt;&lt;br /&gt;  &amp;lt;cfset local.bean.width = arguments.width/&amp;gt;&lt;br /&gt;  &amp;lt;cfset local.bean.height = arguments.height/&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;cfif not StructKeyExists(arguments,"label")&amp;gt;&lt;br /&gt;   &amp;lt;cfset arguments.label = $.string.humanize(arguments.name)/&amp;gt;&lt;br /&gt;  &amp;lt;/cfif&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;cfoutput&amp;gt;&lt;br /&gt;   &amp;lt;cfsavecontent variable="local.field"&amp;gt;&lt;br /&gt;    #local.bean.create()#&lt;br /&gt;   &amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt;  &amp;lt;/cfoutput&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;cfreturn $.form.field(label=arguments.label,field=trim(local.field))/&amp;gt;&lt;br /&gt;  &lt;br /&gt; &amp;lt;/cffunction&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Finally on my view, I call the helper function editor() and pass in my value. The use case below is for the editing a layout record for a cms app.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt; &amp;lt;cfoutput&amp;gt;&lt;br /&gt;  &amp;lt;c:form action="save" bind="layout"&amp;gt;&lt;br /&gt;   &amp;lt;c:hidden name="id" value="#layout.id()#" /&amp;gt;&lt;br /&gt;   &amp;lt;c:input name="name" value="#layout.name()#" /&amp;gt;&lt;br /&gt;&lt;br /&gt;   #$.util.editor(label="Layout",name="layout.layout",value=layout.layout())#&lt;br /&gt;&lt;br /&gt;   &amp;lt;c:submit name="save" /&amp;gt;&lt;br /&gt;  &amp;lt;/c:form&amp;gt;&lt;br /&gt; &amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;One thing to note is that if you want to bind the fckeditor textarea to an object, so it can be used in ColdMVC's populate() for a save, you will need to prefix your instanceName in the fckeditor. I do this by wrapping the fckeditor in a helper function and use the "name" argument like this...&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;--- on my view I put in "layout.layout" as the name---&amp;gt;&lt;br /&gt; #$.util.editor(label="Layout",name="layout.layout",value=layout.layout())#&lt;br /&gt;&lt;br /&gt; &amp;lt;--- inside the editor()---&amp;gt;&lt;br /&gt; &amp;lt;cfset local.bean.instanceName = arguments.name/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-1770642403305101882?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/1770642403305101882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/08/coldmvc-plugging-in-fckeditor.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1770642403305101882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1770642403305101882'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/08/coldmvc-plugging-in-fckeditor.html' title='ColdMVC: Plugging in fckeditor'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-4227540205270804232</id><published>2010-08-05T07:01:00.000-07:00</published><updated>2010-08-05T07:04:47.302-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: Deploying my first app.</title><content type='html'>I just wanted to share some things I struggled with when deploying my first ColdMVC app. &lt;br /&gt;&lt;br /&gt;1. Deploying the code to the server.&lt;br /&gt;My web root on the hosted server looks like this:&lt;br /&gt;&lt;br /&gt;-&gt;myApp&lt;br /&gt;-&gt;coldMVC&lt;br /&gt;-&gt;hyrule&lt;br /&gt;&lt;br /&gt;2. Make sure the config.ini is setup correctly.&lt;br /&gt;config.ini file&lt;br /&gt;[default]&lt;br /&gt;controller=route&lt;br /&gt;action=render&lt;br /&gt;&lt;br /&gt;[development]&lt;br /&gt;development=true&lt;br /&gt;&lt;br /&gt;[production]&lt;br /&gt;datasource=myDataSourceName&lt;br /&gt;development=false&lt;br /&gt;sesURLs=true&lt;br /&gt;urlPath=&lt;br /&gt;assetPath=http://www.myDomain.com/myApp/public/&lt;br /&gt;tagPrefix=c&lt;br /&gt;&lt;br /&gt;In the block [production] you will see that sesURLs=true. This will get rid of /index.cfm on the tail of url. Example www.myDomain.com/public/&lt;br /&gt;&lt;br /&gt;Next, I changed my urlPath to nothing because I want urls to not have the public in front of them. Example www.myDomain.com/&lt;br /&gt;&lt;br /&gt;Finally, Since my urlPath doesn't point to the public folder any more all my assets ( css, js..etc) will be broken. So I point my assets back to the public folder. Examples http://www.myDomain.com/myApp/public/&lt;br /&gt;&lt;br /&gt;Note: If you haven't already, make sure you create a default controller and action to hit. This will be excuted if somebody hits your base url. Example www.myDomain.com&lt;br /&gt;&lt;br /&gt;3. Use apache or isapi rewrite rules to make the url prettier.&lt;br /&gt;With out the /public/index.cfm at the end of url the app can't do routes. In order to solve this I had to make isapi rewrite rules to point anything after www.myDomain.com to the http://www.myDomain.com/myApp/public/index.cfm files so routes would work again.&lt;br /&gt;.htaccess file&lt;br /&gt;RewriteEngine on&lt;br /&gt;&lt;br /&gt;#---redirect actions for www.myDomain.com&lt;br /&gt;RewriteCond %{HTTP_HOST} ^www.myDomain.com [QSA]&lt;br /&gt;RewriteCond %{SCRIPT_NAME} ^/index.cfm$&lt;br /&gt;RewriteRule ^(.*)$ http://www.myDomain.com/myApp/public/index.cfm/%{REQUEST_URI} [QSA]&lt;br /&gt;&lt;br /&gt;#---redirect assets for www.myDomain.com&lt;br /&gt;RewriteCond %{HTTP_HOST} ^www.myDomain.com [QSA]&lt;br /&gt;RewriteCond %{SCRIPT_NAME} !^/index.cfm$&lt;br /&gt;RewriteCond %{SCRIPT_NAME} !(css|js|images)&lt;br /&gt;RewriteCond %{SCRIPT_NAME} !-f&lt;br /&gt;RewriteCond %{SCRIPT_NAME} !-d&lt;br /&gt;RewriteRule ^(.*)$ http://www.myDomain.com/myApp/public/index.cfm/%{REQUEST_URI} [QSA,L]&lt;br /&gt;&lt;br /&gt;4. Make sure the production environment.txt has the production text in it.&lt;br /&gt;Since my app's config.ini file has block called [production] in it the environment.txt on the hosted server needs to have the text "production" in it.&lt;br /&gt;&lt;br /&gt;5. Remember to create a datasource.&lt;br /&gt;If the datasource name is not the same as your app folder name you need to add the datasource name in config.ini&lt;br /&gt;[production]&lt;br /&gt;datasource=myDataSourceName&lt;br /&gt;&lt;br /&gt;Other than the isapi rewrite rules, it was my first time writing them, deploying my first ColdMVC app went well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-4227540205270804232?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/4227540205270804232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/08/coldmvc-deploying-my-first-app.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/4227540205270804232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/4227540205270804232'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/08/coldmvc-deploying-my-first-app.html' title='ColdMVC: Deploying my first app.'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-8429720348749915083</id><published>2010-08-04T19:53:00.000-07:00</published><updated>2010-08-04T20:14:57.753-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>Select Top N Rows Per Group</title><content type='html'>I had an interesting sql task today. Someone asked me to get a max of three time-sheet entries per project. When an employee fills out a time-sheet they select a project for which the time is applied to. I was asked to grab a max of three of these entries and dump them in a csv for the accountant to audit. I was troubled on where to start this task. I am not an sql guy, so this was a challenge for me. I talked to the sql guys, but they were pretty busy today. One helped me but are minds together struggled to find the answer. After the googling, I tried a search result called "Cosmo Central" and found the anwser. Below is the piece that helped me so much...&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="sql"&gt;&lt;br /&gt;with data as(&lt;br /&gt;select row_number() over(partition by projects.name order by timesheet.id) as 'RowNumber’,&lt;br /&gt;timesheet.id, projects.name&lt;br /&gt;from timesheet&lt;br /&gt;inner join projects on projects.id = timesheet.project_id&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;select id, name&lt;br /&gt;from data&lt;br /&gt;where RowNumber &lt;= 3&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Resource Used:&lt;br /&gt;http://www.cosmocentral.com/2010/04/select-top-n-rows-per-group-ms-sql/&lt;br /&gt;&lt;br /&gt;Yes. It looks like I copied the post and re-posted, but I am more so happy that I found the answer that I wanted to share the solution again. The credit still goes to Cosmo Central. Thanks a bundle.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-8429720348749915083?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/8429720348749915083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/08/select-top-n-rows-per-group.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8429720348749915083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8429720348749915083'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/08/select-top-n-rows-per-group.html' title='Select Top N Rows Per Group'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-725044037410088744</id><published>2010-08-04T08:20:00.000-07:00</published><updated>2010-08-05T07:04:47.303-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: Basic CMS app request handling</title><content type='html'>I wanted to try make a cms app with ColdMVC so I took a stab at it. This is my first draft at a cms app. Below is a light weight request handler for cms views. We will break it down in a sec.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;/**&lt;br /&gt; * @accessors true&lt;br /&gt; * @extends coldmvc.Controller&lt;br /&gt; * @controller cmsview&lt;br /&gt; * @layout cms_public&lt;br /&gt; */&lt;br /&gt;component {&lt;br /&gt;&lt;br /&gt; property _CMSPage;&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt; * @events requestStart&lt;br /&gt; */&lt;br /&gt; function requestStart(){&lt;br /&gt;&lt;br /&gt;  var page = _CMSPage.findByAddress(getPath());&lt;br /&gt;&lt;br /&gt;  /*---check if the path is a cms page---*/&lt;br /&gt;  if(len(page.id()) gt 0){&lt;br /&gt;   $.event.action("render");&lt;br /&gt;   $.event.controller("cmsView");&lt;br /&gt;   $.event.view("cms/view/index.cfm");&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; function render(){&lt;br /&gt;  &lt;br /&gt;  var path = getPath();&lt;br /&gt;  var actual_path = expandPath("/app/views/#path#");&lt;br /&gt;&lt;br /&gt;  /*---handles pages that end in a slash. Ex: www.mydomain.com/public/index.cfm/products/---*/&lt;br /&gt;  if(right(path,1) eq "/"){&lt;br /&gt;   actual_path = actual_path &amp; "index.cfm";&lt;br /&gt;   path = path &amp; "index.cfm";&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /*---if the file exists render it, else run the page's html through the cms_public layout.---*/&lt;br /&gt;  if(fileExists(actual_path)){&lt;br /&gt;&lt;br /&gt;   $.event.view(path);&lt;br /&gt;  &lt;br /&gt;  }else{&lt;br /&gt;  &lt;br /&gt;   params.page = _CMSPage.findByAddress(getPath());&lt;br /&gt;   &lt;br /&gt;   if(len(params.page.id()) eq 0){&lt;br /&gt;    &lt;br /&gt;    render404();&lt;br /&gt;   &lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; /**&lt;br /&gt; * @events invalidController, invalidAction&lt;br /&gt; */&lt;br /&gt; function render404(){&lt;br /&gt; &lt;br /&gt;  params.page = _CMSPage.findByAddress("404");&lt;br /&gt; &lt;br /&gt;  if(len(params.page.id()) eq 0){&lt;br /&gt;   params.page._set("html","Sorry. We couldn't find the page you were looking for.");&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  $.event.controller("cmsView");&lt;br /&gt;  $.event.action("render404");&lt;br /&gt;  $.event.view("cms/view/index.cfm");&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; function getPath(){&lt;br /&gt; &lt;br /&gt;  var path = $.event.path();&lt;br /&gt;  &lt;br /&gt;  if(left(path,1) eq "/"){&lt;br /&gt;   path = replace(path,"/","");&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  return path;&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;When a request begins I use the event "requestStart" to check if it's a cms page. This happens here...&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt; * @events requestStart&lt;br /&gt; */&lt;br /&gt; function requestStart(){&lt;br /&gt;&lt;br /&gt;  var page = _CMSPage.findByAddress(getPath());&lt;br /&gt;&lt;br /&gt;  /*---check if the path is a cms page---*/&lt;br /&gt;  if(len(page.id()) gt 0){&lt;br /&gt;   $.event.action("render");&lt;br /&gt;   $.event.controller("cmsView");&lt;br /&gt;   $.event.view("cms/view/index.cfm");&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As you can see above we are checking if getPath() is a cms page. getPath() gets the tail end of the url. Example: If the url read "www.mydomain.com/public/index.cfm/contact_us/", getPath() would return "contact_us/". This happens here...&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt; function getPath(){&lt;br /&gt; &lt;br /&gt;  var path = $.event.path();&lt;br /&gt;  &lt;br /&gt;  if(left(path,1) eq "/"){&lt;br /&gt;   path = replace(path,"/","");&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  return path;&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If a cms page isn't found the request will run as usual. If a cms page is found it will go to render(). render() does a lot of checks. &lt;br /&gt;&lt;br /&gt;First, we check if there is no file extension, example ".cfm", on path. If there is none I put in an "index.cfm" at the end. I do this for the next check which checks to see if the file exists.&lt;br /&gt;&lt;br /&gt;Second, next we check if the file path actually exists in the app/views/ directory. If it does I render it. I do this because some pages might need to be coded where as other pages will be setup with a "web page generater" tool. &lt;br /&gt;&lt;br /&gt;Third, if the file doesn't exists I can assume it's a page that was created by web page generator tool. &lt;br /&gt;&lt;br /&gt;Lastly, I check if the page doesn't exists. I do this because my config.ini uses render() as defaults.&lt;br /&gt;[default]&lt;br /&gt;controller=cmsView&lt;br /&gt;action=render&lt;br /&gt;&lt;br /&gt;If someone requests "www.mydomain.com/public/index.cfm" the path won't exist. Therefore we excute the 404 handler, which is called render404().&lt;br /&gt;&lt;br /&gt;This happens here...&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt; function render(){&lt;br /&gt;  &lt;br /&gt;  var path = getPath(); &lt;br /&gt;  var actual_path = expandPath("/app/views/#path#");&lt;br /&gt;&lt;br /&gt;  /*---handles pages that end in a slash. Ex: www.mydomain.com/public/index.cfm/products/---*/&lt;br /&gt;  if(right(path,1) eq "/"){&lt;br /&gt;   actual_path = actual_path &amp; "index.cfm";&lt;br /&gt;   path = path &amp; "index.cfm";&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /*---if the file exists render it, else run the page's html through the cms_public layout.---*/&lt;br /&gt;  if(fileExists(actual_path)){&lt;br /&gt;&lt;br /&gt;   $.event.view(path);&lt;br /&gt;  &lt;br /&gt;  }else{&lt;br /&gt;  &lt;br /&gt;   params.page = _CMSPage.findByAddress(getPath());&lt;br /&gt;   &lt;br /&gt;   if(len(params.page.id()) eq 0){&lt;br /&gt;    &lt;br /&gt;    render404();&lt;br /&gt;   &lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If a page doesn't exists in the cms pages, an invalid controller or action is found I render404() is executed. I first check to see if a 404 page was created in the cms pages else I render my own html message.&lt;br /&gt;&lt;br /&gt;This happens here...&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt; * @events invalidController, invalidAction&lt;br /&gt; */&lt;br /&gt; function render404(){&lt;br /&gt; &lt;br /&gt;  params.page = _CMSPage.findByAddress("404");&lt;br /&gt; &lt;br /&gt;  if(len(params.page.id()) eq 0){&lt;br /&gt;   params.page._set("html","Sorry. We couldn't find the page you were looking for.");&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  $.event.controller("cmsView");&lt;br /&gt;  $.event.action("render404");&lt;br /&gt;  $.event.view("cms/view/index.cfm");&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As I have been going through these functions I didn't explain where the pages are getting renderer. If you noticed at the top of first block of code there was an annotation @layout cms_public. All cms pages, whether they are coded up or database driven, run through the layout cms_public.cfm. Here's what it looks like...&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfoutput&amp;gt;&lt;br /&gt;&amp;lt; !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&amp;gt;&lt;br /&gt;&amp;lt;html lang="en-us" xmlns="http://www.w3.org/1999/xhtml"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfif structKeyExists(params,"page")&amp;gt;&lt;br /&gt; #page.html()#&lt;br /&gt;&amp;lt;cfelse&amp;gt;&lt;br /&gt; #render()#&lt;br /&gt;&amp;lt;/cfif&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;All database driven pages run through a view in "views/cms/view/index.cfm" which looks like this...&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt; &amp;lt;cfoutput&amp;gt;#page.html()#&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thoughts on what I have so far?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-725044037410088744?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/725044037410088744/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/08/coldmvc-basic-cms-app-request-handling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/725044037410088744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/725044037410088744'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/08/coldmvc-basic-cms-app-request-handling.html' title='ColdMVC: Basic CMS app request handling'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-1913800979099752976</id><published>2010-07-25T08:00:00.000-07:00</published><updated>2010-07-25T08:25:20.698-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Declaring a variable with same name as a column in cfloop</title><content type='html'>I have a query with a column name json in it, which may or maynot contain a json string. If it does contain json I want to deserialize it, put it into an array loop, and output the results. I want to use the same in a variable as the column coming from the query because it reads good. When I did this I noticed that you can't declare a variable with the same name...even if you prefix the query column.&lt;br /&gt;&lt;br /&gt;Here's is my test case. We will break it down in a sec.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset query = queryNew("id,json")/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset queryAddRow(query)/&amp;gt;&lt;br /&gt;&amp;lt;cfset querySetCell(query,"id","1")/&amp;gt;&lt;br /&gt;&amp;lt;cfset querySetCell(query,"json","")/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset array = [{id=1,name="Joe"},{id=2,name="Tony"},{id=3,name="Ryan"}]/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset queryAddRow(query)/&amp;gt;&lt;br /&gt;&amp;lt;cfset querySetCell(query,"id","2")/&amp;gt;&lt;br /&gt;&amp;lt;cfset querySetCell(query,"json",serializeJSON(array))/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfloop query="query"&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;cfset json = []/&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;cfif len(query.json) gt 0&amp;gt;&lt;br /&gt;  &amp;lt;cfset json = deserializeJSON(query.json)/&amp;gt;&lt;br /&gt; &amp;lt;/cfif&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;cfloop from="1" to="#arrayLen(json)#" index="i"&amp;gt;&lt;br /&gt;  #i.name#&lt;br /&gt; &amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above test case will error out. Because you can't loop the following because ColdFusion thinks that variable "json" is a string, even though I declared it as an array.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfloop from="1" to="#arrayLen(json)#" index="i"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;First we make a query with a json string in it &lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset query = queryNew("id,json")/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset queryAddRow(query)/&amp;gt;&lt;br /&gt;&amp;lt;cfset querySetCell(query,"id","1")/&amp;gt;&lt;br /&gt;&amp;lt;cfset querySetCell(query,"json","")/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset array = [{id=1,name="Joe"},{id=2,name="Tony"},{id=3,name="Ryan"}]/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset queryAddRow(query)/&amp;gt;&lt;br /&gt;&amp;lt;cfset querySetCell(query,"id","2")/&amp;gt;&lt;br /&gt;&amp;lt;cfset querySetCell(query,"json",serializeJSON(array))/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Next we loop the query and check if there is a json string in the query column "JSON". I started an array with the same name as query column json. I did this so if there isn't any json after we deserialize the json it won't error when we try to loop the array.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset json = []/&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;cfif len(json) gt 0&amp;gt;&lt;br /&gt; &amp;lt;cfset json = deserializeJSON(query.json)/&amp;gt;&lt;br /&gt;&amp;lt;/cfif&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Lastly I try to loop the array "json" and output the data, but it errors out because it still is looking at the loop variable "json" not the variable I declared "json". Yes, I can solve this problem easily but changing my declared variable from "json" to "array" or something like that, but I wanted to be clear what I was loop...and I just wanted to use the variable name "json".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-1913800979099752976?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/1913800979099752976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/07/declaring-variable-with-same-name-as.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1913800979099752976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1913800979099752976'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/07/declaring-variable-with-same-name-as.html' title='Declaring a variable with same name as a column in cfloop'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-3452979864508323130</id><published>2010-07-24T19:40:00.000-07:00</published><updated>2010-08-05T07:04:47.303-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: Flatten an array of objects with children.</title><content type='html'>In record based systems "non object based" if you wanted to store a parent/child relationship you usually stored a parent_id on the same table. &lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;CMS example showing a page table where a page can have many pages underneath it.&lt;br /&gt;&lt;br /&gt;Page table.&lt;br /&gt;ID,Name,Address,Parent_ID&lt;br /&gt;1,Products,products/,null&lt;br /&gt;2,Tiles,products/tiles/,1&lt;br /&gt;&lt;br /&gt;Then in order to simulate an object based system, you usually loop the query and put the records in structs of structs.&lt;br /&gt;&lt;br /&gt;Example.&lt;br /&gt;&lt;br /&gt;result = {&lt;br /&gt;     id="1",&lt;br /&gt;     name="Products",&lt;br /&gt;     address="products/",&lt;br /&gt;     children=[&lt;br /&gt;          {&lt;br /&gt;          id="1",&lt;br /&gt;          name="Products",&lt;br /&gt;          address="products/",&lt;br /&gt;          children=[]&lt;br /&gt;          }&lt;br /&gt;     ]&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Notice there is children an array.&lt;br /&gt;&lt;br /&gt;Using ColdMVC we actually start with "struct of structs" or object based, instead of starting with a query. So we need to take the objects array, we are using array of objects because that is what is return from an hql query, and pull out the children and put them in the array, thus flattening the tree.&lt;br /&gt;&lt;br /&gt;To do this I run it through a helper function I made below. &lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cffunction name="flattenArrayTree" access="public" output="false" returntype="array"&amp;gt; &lt;br /&gt;  &amp;lt;cfargument name="array" required="true"/&amp;gt; &lt;br /&gt;  &amp;lt;cfargument name="result" required="false" default="#[]#"/&amp;gt; &lt;br /&gt;  &amp;lt;cfargument name="treeDepth" required="false" default="0"/&amp;gt; &lt;br /&gt;  &amp;lt;cfargument name="childrenPropertyName" required="false" default="children" hint="A property with an array of child objects."/&amp;gt; &lt;br /&gt;&lt;br /&gt;  &amp;lt;cfset var local = {}/&amp;gt; &lt;br /&gt;  &amp;lt;cfset var i = ""/&amp;gt; &lt;br /&gt;&lt;br /&gt;  &amp;lt;cfloop from="1" to="#arrayLen(arguments.array)#" index="i"&amp;gt; &lt;br /&gt;  &lt;br /&gt;   &amp;lt;cfset local.object = arguments.array[i]/&amp;gt; &lt;br /&gt;   &lt;br /&gt;   &amp;lt;cfset local.object.setTreeDepth(arguments.treeDepth)/&amp;gt; &lt;br /&gt;   &lt;br /&gt;   &amp;lt;cfset arrayAppend(arguments.result,local.object)&amp;gt; &lt;br /&gt;   &lt;br /&gt;   &amp;lt; !---make sure the "children" property exists is in the object---&amp;gt; &lt;br /&gt;   &amp;lt;cfif not structKeyExists(local.object,"set"&amp;arguments.childrenPropertyName)&amp;gt; &lt;br /&gt;   &lt;br /&gt;    &amp;lt;cfthrow detail="The argument childrenPropertyName which is currently #arguments.childrenPropertyName# does not exist as a property in the object"/&amp;gt; &lt;br /&gt;   &lt;br /&gt;   &amp;lt; /cfif&amp;gt; &lt;br /&gt;&lt;br /&gt;   &amp;lt;cfif arrayLen(local.object._get(arguments.childrenPropertyName)) gt 0&amp;gt; &lt;br /&gt;   &lt;br /&gt;    &amp;lt;cfset arguments.treeDepth++/&amp;gt; &lt;br /&gt;    &lt;br /&gt;    &amp;lt;cfset arguments.result = flattenArrayTree(local.object._get(arguments.childrenPropertyName),arguments.result,arguments.treeDepth)/&amp;gt; &lt;br /&gt;    &lt;br /&gt;    &amp;lt;cfset arguments.treeDepth--/&amp;gt; &lt;br /&gt;    &lt;br /&gt;   &amp;lt; /cfif&amp;gt; &lt;br /&gt;&lt;br /&gt;  &amp;lt; /cfloop&amp;gt; &lt;br /&gt;  &lt;br /&gt;  &amp;lt;cfreturn arguments.result/&amp;gt; &lt;br /&gt;&lt;br /&gt; &amp;lt; /cffunction&amp;gt; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You will notice I add a property called "treeDepth". In order to use the function you need to add a property to the model cfc called "treeDepth". Don't worry about it being added to db, if it's not mapped in hibernate file it won't be added to the db. I use the treeDepth property to know how far in a child object is. Technically...you don't need this, but I find a very handy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-3452979864508323130?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/3452979864508323130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/07/coldmvc-flatten-array-of-objects-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3452979864508323130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3452979864508323130'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/07/coldmvc-flatten-array-of-objects-with.html' title='ColdMVC: Flatten an array of objects with children.'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-5415371571925384053</id><published>2010-07-12T19:06:00.001-07:00</published><updated>2010-07-12T19:16:58.801-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>CF9 ormsetting dialect</title><content type='html'>I was just wondering why you need to specify a dialect in ORM, if you define this in your datasource?&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;Application.cfc&lt;br /&gt;this.ormSettings = { datasource="jbankenBlogspot",dialect="MySQLwithInnoDB" };&lt;br /&gt;&lt;br /&gt;I shouldn't have to specify dialect="MySQLwithInnoDB" if I did it already in my datasource. Maybe I am missing something here.&lt;br /&gt;&lt;br /&gt;The real hard part is that hibernate was throwing an error that was the same as if you had a bad path to your entity cfc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-5415371571925384053?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/5415371571925384053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/07/cf9-ormsetting-dialect.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5415371571925384053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5415371571925384053'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/07/cf9-ormsetting-dialect.html' title='CF9 ormsetting dialect'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-3236873731561413242</id><published>2010-07-07T20:01:00.000-07:00</published><updated>2010-08-05T07:04:47.304-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: Parse checkboxes or radios generically</title><content type='html'>I ran into an interesting issue awhile, back. I wanted to edit a product and click on checkboxes for one to many relationships to colors, categories, and sizes. When I post the form to the ProductController save() I wanted a generic way to convert checkbox  values (which are ids) to actually objects. Below are the steps I took followed by the code.&lt;br /&gt;&lt;br /&gt;First, I call private functions to parse the specific checkbox ids ( Ex. parseCategories()), but they all just call parseResource(). &lt;br /&gt;&lt;br /&gt;Next, while in parseResource() I look into the variables scope for the model (Ex. _Size) to dynamically get the object by using findByID().&lt;br /&gt;&lt;br /&gt;Lastly, I append the object to an array and populate the Product object and save it.&lt;br /&gt;&lt;br /&gt;ProductController.cfc &lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;/**&lt;br /&gt; * @accessors true&lt;br /&gt; * @action list&lt;br /&gt; * @extends coldmvc.Controller&lt;br /&gt; */&lt;br /&gt;component {&lt;br /&gt; property _Size;&lt;br /&gt; property _Color;&lt;br /&gt; property _Category;&lt;br /&gt;&lt;br /&gt; function save() {&lt;br /&gt;&lt;br /&gt;  var product = _Product.new();&lt;br /&gt;&lt;br /&gt;  params.product.categories = parseCategories(params.product.categories);&lt;br /&gt;  params.product.sizes = parseSizes(params.product.sizes);&lt;br /&gt;  params.product.colors = parseColors(params.product.colors);&lt;br /&gt;  &lt;br /&gt;  product.populate(params.product);&lt;br /&gt;&lt;br /&gt;  product.save();&lt;br /&gt;&lt;br /&gt;  redirect({controller="product",action="setup"},"productID=#product.id()#");&lt;br /&gt; }&lt;br /&gt;        &lt;br /&gt; private array function parseCategories(string categoryIDs) {&lt;br /&gt;  &lt;br /&gt;  return parseResource("Category",arguments.categoryIDs);&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; private array function parseSizes(string sizeIDs) {&lt;br /&gt;  &lt;br /&gt;  return parseResource("Size",arguments.sizeIDs);&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; private array function parseColors(string colorIDs) {&lt;br /&gt;  &lt;br /&gt;  return parseResource("Color",arguments.colorIDs);&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; private array function parseResource(string resource, string resourceIDs){&lt;br /&gt; &lt;br /&gt;  var resources = $.string.toArray(arguments.resourceIDs);&lt;br /&gt;&lt;br /&gt;  var result = [];&lt;br /&gt;  var i = "";&lt;br /&gt;  &lt;br /&gt;  for (i=1; i &lt;= arrayLen(resources); i++) {&lt;br /&gt;  &lt;br /&gt;   arrayAppend(result, variables["_#arguments.resource#"].findByID(resources[i]));&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  return result;&lt;br /&gt; &lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I wanted to share this just in case someone else is running into the issue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-3236873731561413242?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/3236873731561413242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/07/coldmvc-parse-checkboxes-or-radios.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3236873731561413242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3236873731561413242'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/07/coldmvc-parse-checkboxes-or-radios.html' title='ColdMVC: Parse checkboxes or radios generically'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-6376652441308004345</id><published>2010-06-24T06:52:00.000-07:00</published><updated>2010-06-24T07:08:46.314-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><title type='text'>CSS hierarchy  wish</title><content type='html'>Alot, of times I find myself having a wrapper around some elements in my html so that I can do some custom css inside of it. In the css case below the wrapper is a div with a class of "webfolio". &lt;br /&gt;&lt;br /&gt;div.webfolio h3{&lt;br /&gt;     font-size:1.5em;&lt;br /&gt;     color:#333;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div.webfolio div.article{&lt;br /&gt;     border:1px solid #666;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div.webfolio div.description{&lt;br /&gt;     color:#555;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Notice I have to write "div.webfolio" over and over. I just want to write it once, with everything (it's children) inside of it. I wish I could do it like this:&lt;br /&gt;&lt;br /&gt;div.webfolio{&lt;br /&gt;&lt;br /&gt;     h3{&lt;br /&gt;          font-size:1.5em;&lt;br /&gt;          color:#333;&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     div.article{&lt;br /&gt;          border:1px solid #666;&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     div.description{&lt;br /&gt;          color:#555;&lt;br /&gt;     }&lt;br /&gt;    &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;I just feel dirty writing the same name over and over. Yes, I realize if you get more than one or two deep in above css it would get harder to read. In a perfect world this could be prevented by code responsibility.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-6376652441308004345?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/6376652441308004345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/06/css-hierarchy-wish.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6376652441308004345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6376652441308004345'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/06/css-hierarchy-wish.html' title='CSS hierarchy  wish'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-8790348127987048907</id><published>2010-05-25T18:58:00.000-07:00</published><updated>2010-05-25T19:41:48.530-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>From SQL to HQL</title><content type='html'>Most of the development I have done has been with SQL records. Now that CF9 is out I've started playing around with HQL objects and it has been a learning curve but for the best. I struggled and continue to struggle with writing HQL, because my mind still wants to do SQL. I wanted to share what I have learned so far. &lt;br /&gt;&lt;br /&gt;Given the db schema below I will show how to write a piece in sql followed by a piece in hql.&lt;br /&gt;&lt;br /&gt;There is a PRODUCT table with a many to many relationship with the SIZE table and the PRODUCT table has many to many relationship with the CATEGORY table.&lt;br /&gt;&lt;br /&gt;PRODUCT -|-----= PRODUCT_SIZE =------|- SIZE&lt;br /&gt;PRODUCT -|-----= PRODUCT_CATEGORY =-----|- CATEGORY&lt;br /&gt;&lt;br /&gt;1. Get all the products&lt;br /&gt;SQL&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;select * from product&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;HQL&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;from Product&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2. Get all the products with price equal to $100.&lt;br /&gt;SQL&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;select * from product where price = '100'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;HQL&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;from Product where price = '100'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;3. Get all the products with size_id = 1.&lt;br /&gt;SQL&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;select * from product &lt;br /&gt;inner join product_size on product.id = product_size.product_id&lt;br /&gt;where product_size.size_id = 1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;HQL&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;select product&lt;br /&gt;from Product product&lt;br /&gt;join product.sizes size&lt;br /&gt;where size.id = 1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;4. Get all the products with size_id = 1 and category_id = 1.&lt;br /&gt;SQL&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;select * from product &lt;br /&gt;inner join product_size on product.id = product_size.product_id&lt;br /&gt;inner join product_category on product.id = product_category.product_id&lt;br /&gt;where product_size.size_id = 1&lt;br /&gt;and product_category.category_id = 1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;HQL&lt;br /&gt;&lt;pre class="coldfusion" name="code"&gt;&lt;br /&gt;select product&lt;br /&gt;from Product product&lt;br /&gt;where exists (&lt;br /&gt;from product.categories category&lt;br /&gt;where category.id = 1&lt;br /&gt;)&lt;br /&gt;and exists (&lt;br /&gt;from product.sizes size&lt;br /&gt;where size.id = 1&lt;br /&gt;)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note: HQL can't solve all queries, a good example is Accounting queries, but it does help with the majority of the light weight queries. I get the line "Well what's the point of using objects if records work fine.". I reply with "There is no point, but if you want to update all your queries with new properties, you will quickly find the point."&lt;br /&gt;&lt;br /&gt;Resources used:&lt;br /&gt;&lt;a href="http://www.barneyb.com/barneyblog/2010/05/05/embrace-your-hsql/"&gt;&lt;br /&gt;http://www.barneyb.com/barneyblog/2010/05/05/embrace-your-hsql/&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-8790348127987048907?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/8790348127987048907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/05/from-sql-to-hql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8790348127987048907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8790348127987048907'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/05/from-sql-to-hql.html' title='From SQL to HQL'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-7315965771473450675</id><published>2010-04-11T22:00:00.001-07:00</published><updated>2010-08-05T07:04:47.304-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdMVC'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdMVC: Create your own Helpers.</title><content type='html'>I wanted to try extending ColdMVC's helpers and create my own helper that formatted stuff for me and it turned out to be quite simple.&lt;br /&gt;&lt;br /&gt;First, I created my own directory in my project called "helpers".&lt;br /&gt;&lt;br /&gt;Second, I added a cfc named "format".&lt;br /&gt;&lt;br /&gt;Third, I extended the ViewHelper from ColdMVC. Not sure, If this is the correct Helper Util class I am suppose to be using...but it worked.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfcomponent extends="coldmvc.utils.ViewHelper"&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;!------&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;cffunction name="money" access="public" output="false" returntype="any"&amp;gt;&lt;br /&gt;  &amp;lt;cfargument name="amount" required="false" default="0"/&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;cfreturn dollarFormat(arguments.amount)/&amp;gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &amp;lt;/cffunction&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;!------&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfcomponent&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Lastly, I used my new helper function:&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;#$.format.money(product.getPrice())#&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you noticed in money() I set a default value of zero. For some odd reason when I put "product.getPrice()" in for the amount argument it has a value of [empty string] and it throws an error. The error says "The AMOUNT parameter to the money function is required but was not passed in.". But clearly there is a value of [empty string]. If any one knows what up give me hollar.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-7315965771473450675?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/7315965771473450675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/04/coldmvc-create-your-own-helpers.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7315965771473450675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7315965771473450675'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/04/coldmvc-create-your-own-helpers.html' title='ColdMVC: Create your own Helpers.'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-7886285356667333924</id><published>2010-04-11T21:36:00.000-07:00</published><updated>2010-04-11T21:45:28.017-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Entity Name is same for two CFCs</title><content type='html'>As I have been trying out CF9 and the ColdMVC I occasionally get this error "Entity Name Category is same for two CFCs". Where "Category" is my model cfc. This is ok if I really had two CFC's with the same name. Here's the rest of the error:&lt;br /&gt;&lt;br /&gt;Entity Name Category is same for two CFCs, superior.app.model.Category and superior.app.model.Category. &lt;br /&gt;&lt;br /&gt;As you can see, the error looks like it's pointing at the same file. Searching up and down my Eclipse project explorer I find no two cfc with the same name. Guess what...do a refresh on your model directory or where ever you put your VO's. You probably have two hibernate files, both containing your VO's name...mine was "Category".&lt;br /&gt;&lt;br /&gt;Get rid of one of them and it should work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-7886285356667333924?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/7886285356667333924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/04/entity-name-is-same-for-two-cfcs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7886285356667333924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7886285356667333924'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/04/entity-name-is-same-for-two-cfcs.html' title='Entity Name is same for two CFCs'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-8132545535531349425</id><published>2010-04-06T20:17:00.000-07:00</published><updated>2010-04-11T21:45:34.949-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Exploring ColdMVC</title><content type='html'>If you haven't checked out &lt;a href="http://bears-eat-beets.blogspot.com/2010/02/another-coldfusion-framework.html" target="_target" title="ColdMVC"&gt;ColdMVC&lt;/a&gt; yet you should. It's a light weight ColdFusion ORM framework I've being playing around with. The biggest thing I was impressed with is the tags on the views you can make...I am easily satisfied.&lt;br /&gt;&lt;br /&gt;Have you ever been tired of typing that same css container.&lt;br /&gt;Ex: &lt;br /&gt;&lt;pre name="code" class="html"&gt;&lt;br /&gt;&amp;lt;div class="buttons"&amp;gt;&lt;br /&gt;&amp;lt;!--- some buttons ---&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;With ColdMVC's tags that section turns into:&lt;br /&gt;&lt;pre name="code" class="html"&gt;&lt;br /&gt;&amp;lt;buttons&amp;gt;&lt;br /&gt;&amp;lt;!--- some buttons ---&amp;gt;&lt;br /&gt;&amp;lt;/buttons&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The tags help keep the view clean. The only worry that I have NOT ran into yet is that helper tags are very similar to html tags. Not sure how it will play out yet, but no problems so far.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-8132545535531349425?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/8132545535531349425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/04/exploring-coldmvc.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8132545535531349425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8132545535531349425'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/04/exploring-coldmvc.html' title='Exploring ColdMVC'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-2463308851317105262</id><published>2010-03-15T20:02:00.001-07:00</published><updated>2010-03-15T20:42:45.874-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><title type='text'>Just Do It : Programming to the Nike Approach.</title><content type='html'>After reading a recommended book by a &lt;a href="http://bears-eat-beets.blogspot.com/2010/02/passionate-programmer.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+bears-eat-beats+%28Bears+eat+beats.%29&amp;utm_content=Google+Reader" target="_blank"&gt;friend&lt;/a&gt;, I wanted to talk about the Nike's old marketing slogan, "Just Do It.", and it's relationship to my programming experiences. Nike's "Just Do It" slogan really helps me answer those 50/50 questions or "hmm, we could probably use this snippet of code in other places, but I am not sure if it should be reused" or "this might be a pretty good idea, but I am not sure if we have permission to do it." you have when you are programming. Do what you think is right. Basically, JUST DO IT! There have been so many times another programmer or myself have been stuck or afraid of making a business decision becomes of fears of the wrong outcome. The fact is "no one likes to make decisions" period, so presenting it to another person really just causes frustration. So just code it the way you think it needs to be done. &lt;br /&gt;&lt;br /&gt;Now, I am not saying you should do this for ever decision but most of the decisions left up to a developer are minor in the eyes of the user. They want you to tell them how they should work and they will tell you what's missing, named wrong, or doesn't work. So I invite you to be bold like Nike and "Just Do It.". &lt;br /&gt;&lt;br /&gt;Throw that extra icon or link in there. &lt;br /&gt;Set the smart default you think you would use the most. &lt;br /&gt;Constrain the user to a set of options to choose from to better focus the experience. &lt;br /&gt;&lt;br /&gt;Once it's coded and demo-able, have another couple set of eyes look at it. They will tell you what works and doesn't work, but at least you create some discussion on your concern by &lt;strong&gt;showing&lt;/strong&gt;. Showing is such a strong yet hard thing to accomplish in programming, because it's hard to finish something. By getting something to show you are very close if not finished with your task. People aren't dump, they will notice the changes you did and if they don't that means they don't care and your in the clear or you chose "what the user will naturally want" and it will work. Either way it's a silent win for you.&lt;br /&gt;&lt;br /&gt;If you spend too much time deciding how something should be done vs. doing it, more and more requests will be added and you will get overwhelmed with tasks. Just code it and demo it to a group of people, whom will spend the next week ripping and tweaking the piece you created, until they figure out what they want. Where this kinda sucks cause you will have to go back and look at your code, you will find out what worked and didn't, be able to create some direction for your self by involving others in your concerns, and be more prepared for the next task for which you can transfer the tips you learned. It also allows you to focus more on code instead of managing politics. &lt;br /&gt;&lt;br /&gt;In recap...Just Do It!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-2463308851317105262?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/2463308851317105262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/03/just-do-it-programming-to-nike-approach.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2463308851317105262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2463308851317105262'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/03/just-do-it-programming-to-nike-approach.html' title='Just Do It : Programming to the Nike Approach.'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-1818628196722896273</id><published>2010-03-15T17:49:00.000-07:00</published><updated>2010-03-15T18:16:07.341-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><title type='text'>Simplicity vs. DRY code</title><content type='html'>I was in a pickle today over whether or not to consolidate code or keep it a little bit wet for simplicity sake. I consider simplicity sake, going to a view and not having to unlock the rubric's cube of "if" logic. If you are not familiar with wet and dry code, wet is where you repeat yourself over and over and dry is where you "Don't Repeat Yourself (DRY)". I went with "Simplicity". I decided to consolidate parts of the view, yet repeat myself a little. I found this to be safe because I felt like the views would grow and I didn't want it to end up with a crazy page that only the maker has the key to unlocking its craziness. Yeah, we have all seen some of those old pages that are a disaster to debug and I didn't want to start that trend. Also, I wanted the next person behind me to get in and out of the view as quickly as possible. It wasn't very much fun going through every view and updating the same piece of code...but it was simple.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-1818628196722896273?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/1818628196722896273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/03/simplicity-vs-dry-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1818628196722896273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1818628196722896273'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/03/simplicity-vs-dry-code.html' title='Simplicity vs. DRY code'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-62017411564775523</id><published>2010-03-14T18:25:00.000-07:00</published><updated>2010-03-14T18:47:00.648-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><title type='text'>Small == Big</title><content type='html'>Have you ever tried to over architect something so that it fits all cases and solves world hunger?&lt;br /&gt;&lt;br /&gt;I think we have all ran into this problem before and I think it's due to fear. We are afraid that the wierd, the one-off case comes along and we have to re-work our code that we spent so much time and thought into. Let's be honest no-one likes to go back and repeat something all over again, just because of one little feature/request. Sadly, no matter what you do, it will quickly become out-dated and need to be looked at again. On the flip side, the cool part is that you get solve the issue in a new way.&lt;br /&gt;&lt;br /&gt;One thing that helps remind me not to over architect something is to start small. Solve your issue for one record. Example: "Add one user to the system". Solving for one record helps you identify the core pieces that make up the record.&lt;br /&gt;&lt;br /&gt;Next, go back and tweak your code to do a group of records. Example: "Add a group of users to the system." Processing records in a group helps save the end user time.&lt;br /&gt;&lt;br /&gt;And finally package your code, if you it's generic enough, to be used by other systems. Packaging helps the next developer who needs to solve a similar issue jump start there development efforts and gives them a feeling of "safety net" that someone else can help them if they get stuck.&lt;br /&gt;&lt;br /&gt;Going back and touching your code sucks but it can be made more fun if you try to solve for the group of records and packaging. It will help you discover a new solution to your issue and keep you interested in your re-work.&lt;br /&gt;&lt;br /&gt;Remeber:&lt;br /&gt;1. One record&lt;br /&gt;2. A group of records&lt;br /&gt;3. Package it for the next developer&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-62017411564775523?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/62017411564775523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/03/small-big.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/62017411564775523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/62017411564775523'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/03/small-big.html' title='Small == Big'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-3855356621424308684</id><published>2010-03-14T16:19:00.000-07:00</published><updated>2010-03-14T16:48:10.465-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>Indexed views, not using your indexes</title><content type='html'>I was working on an export where we were building a query in a string to be passed to a CLR through a stored proc to a small .NET assembly on the db server and ran into some issues with performance. Now, of course CF is slow at running queries...that's why we passed to it .NET to handle the execution, but I didn't think .NET would be slow. I couldn't figure out why my query was slow for the life of me. All the indexes were place, no extra joins were added and the query still took 20 minutes to run. After talking to a DB developer he told me that even though we indexed the sql "views" the indexes were not being used. I quickly freaked out wondering why SQL didn't use the indexes on the views like it uses the indexes on the tables. It should be assumed. Turns out the reason was that, "It is just one of those things". To fix the issue we added "with noexpand" to the joins to the indexed view and then query time went down to about 8 seconds. Ridiculous.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-3855356621424308684?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/3855356621424308684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/03/indexing-views-not-using-your-indexes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3855356621424308684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3855356621424308684'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/03/indexing-views-not-using-your-indexes.html' title='Indexed views, not using your indexes'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-2888435927205803751</id><published>2010-03-14T16:08:00.000-07:00</published><updated>2010-03-14T16:18:55.430-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>StructSort() does not sort your keys</title><content type='html'>Ran into an issue on Friday where I was trying to sort a struct numerically by it's keys. My struct looked something like this {"1"= query,"11"=query,"2"=query}. I first tried StructSort(struct) but it didn't work for me, it kept erroring on me. I wanted my keys to be sorted like this 1,2,11 but we all know CF automatically sorts your structs alphabetically.&lt;br /&gt;&lt;br /&gt;So I tested structSort() with a different struct like this {"1"= "1","11"="11","2"="2"}. Bam! It worked. Hmm...something is fishy here. StructSort() works with simply values, but not complex values...but it should be just looking at the struct's keys. Anyways got around it by doing this listSort(structKeyList(struct))&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-2888435927205803751?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/2888435927205803751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/03/structsort-does-not-sort-your-keys.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2888435927205803751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2888435927205803751'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/03/structsort-does-not-sort-your-keys.html' title='StructSort() does not sort your keys'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-5303893219772597078</id><published>2010-03-14T16:01:00.000-07:00</published><updated>2010-03-14T16:18:55.431-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Tell the join how to join.</title><content type='html'>I have been having a lot issues…with query execution plans lately (using CF and SQL). SQL has been choosing shitty plans thus making my query slow. If you have ever looked at execution plans, they are difficult read...unless you are a DB developer. I have had no idea wtf was going on with these plans…until now. Another developer sent this great &lt;a href="http://netindonesia.net/blogs/kasim.wirama/archive/2008/05/18/nested-loop-merge-join-and-hash-join-algorithm.aspx" target="_blank"&gt;link&lt;/a&gt; explaining what the joins are doing in the execution plan. You can then tell your joins in your query how to join.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;select * from [user]&lt;br /&gt;inner &lt;span style="font-weight: bold;"&gt;hash&lt;/span&gt; join enterprise_user on enterprise_user.user_id = [user].id&lt;br /&gt;&lt;br /&gt;An execution plan does more than just join identification, such as indexes, but the join thingy is all I really cared about at the moment.&lt;br /&gt;&lt;br /&gt;P.S. Only specify the “how to join” if you have to; if your query blows at running, let SQL try to calculate the best plan.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Use Case:&lt;/span&gt; Had a query in cfquery tags and it was choosing an execution plan with &lt;span style="font-weight: bold;"&gt;nested &lt;/span&gt;loop joins instead of the fast &lt;span style="font-weight: bold;"&gt;hash &lt;/span&gt;joins.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-5303893219772597078?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/5303893219772597078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/03/tell-join-how-to-join.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5303893219772597078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5303893219772597078'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/03/tell-join-how-to-join.html' title='Tell the join how to join.'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-5430589040290777781</id><published>2010-02-16T18:59:00.000-08:00</published><updated>2010-02-16T19:02:29.720-08:00</updated><title type='text'>Developer's Inspiration</title><content type='html'>I have read a lot of blogs of web designers who have a post about "Sources of Inspiration" and I just wanted to through one out there for the developers.&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom:1px solid #000;font-weight:bold;"&gt;Outdoors&lt;/div&gt;&lt;br /&gt;The outdoors is a great way to relief stress and concentrate on a single problem. In other words, "It gives you a chance to clear away all the daily bull shit and focus on the problem at hand." When I am talking about "The Outdoors" I am not talking about having your window open while you play video games. I am referring to remote areas usually where vehicles can't go. Examples of outdoor places would be the woods, a cliff, or a lake/river. I personally find the woods to be the most beneficial because of the silence and random things that can keep your eyes busy and  your mind relaxed, yet turning. &lt;br /&gt;&lt;br /&gt;We as developers don't care that much about the looks of that app or naming things in it...even though we should. I have had many walks in the woods where I have came up with a solution for a navigation issue by just looking at how the trees where aligned, just as an example of how the outdoors have inspired me.&lt;br /&gt;&lt;br /&gt;A few things that can create inspiration:&lt;br /&gt;• Hiking/walking in the woods&lt;br /&gt;• Mountain biking&lt;br /&gt;• Hunting/Archery&lt;br /&gt;• Golfing for pleasure.&lt;br /&gt;• Lawn mowing...because you get in the zone, at least I do, and nothing else matters. Until you mow over the flowers.&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom:1px solid #000;font-weight:bold;"&gt;Constructing Things&lt;/div&gt;&lt;br /&gt;One word...Lego’s. Lego’s, in case you don't know, are small little bricks that fit together and you can build things out of them. Kind of like pieces of code that form an app in nerd speak.  While the outdoors in the section above focus more on freedom, constructing things focuses on constraints. When you construct something you are usually limited by the resources you have available. Example you are building a bed and you only have steel, well how do you make the most out your steel to maximize the outcome of the bed. The constraints force you to be creative to solve a solution and often require you think in a different way. My uncle told me a quote once that helps describe this better than I am right now. He said, "Poverty is the fuel of innovation". Poverty is the problem and the constraint and it requires you to maximize the outcome. We as developers can relate to this easily by having very little time or resources as our constraint and a business requirement as our problem.&lt;br /&gt;&lt;br /&gt;A few of things that can create inspiration:&lt;br /&gt;• Lego’s&lt;br /&gt;• Carpentry&lt;br /&gt;• Chingling a roof&lt;br /&gt;• Arts and crafts...if you are in to that stuff.&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom:1px solid #000;font-weight:bold;"&gt;Kids&lt;/div&gt;&lt;br /&gt;Kids are great for inspiration because they see things in a simple way and don't care about the complexities. Often times we only see things in a overly complex way because we are trying to account for all the bullshit one-off requirements that we are trying to satisfy. Sometimes if we break these complexities into simple pieces it helps you see the hidden path through the labyrinth of craziness. A thing that web designers do that I am going to steal because developers don't do it enough is "The drawing board." This is the concept of writing all your complexities on a white board and moving them around and fine tuning them until you can see the path. Granted sometimes you need a really big white board but it does help to break things down. &lt;br /&gt;&lt;br /&gt;Another thing that kids do well is trying hard at something they suck at. An example of this would include watching 4th graders play basketball. The hoop is clearly too high but they don't care because they are focused at getting a basket. I was able to figure out how I could refactor an old spaghetti code app by watching some kids play basketball. Watching them help me separate the old code into modules with which I could slowing fix while keeping the old code working. How does this apply to the kids playing basketball you might ask? &lt;br /&gt;&lt;br /&gt;The kids all crowded around the bottom of the hoop = the spaghetti code.&lt;br /&gt;&lt;br /&gt;Pulling one kid aside and explaining to him that if you stand by the free throw line you will be open for a pass by teammate = separating the spaghetti code into modules.&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom:1px solid #000;font-weight:bold;"&gt;Video games and movies&lt;/div&gt;&lt;br /&gt;...nothing really to say here, we all know.&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom:1px solid #000;font-weight:bold;"&gt;Other blogs&lt;/div&gt;&lt;br /&gt;There is a ton of developers and designers blogging inspiration. Read them and take what you need&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-5430589040290777781?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/5430589040290777781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/02/developers-inspiration.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5430589040290777781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5430589040290777781'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/02/developers-inspiration.html' title='Developer&apos;s Inspiration'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-2464663352534607516</id><published>2010-02-01T21:37:00.000-08:00</published><updated>2010-02-01T21:57:33.058-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>value-of-select inside an xslt tag's attribute</title><content type='html'>I've been work with xslt lately and ran into an issue the other day while trying to put the value of a node inside a tag's attribute while in xslt. If you know a little about xslt...this will error out because you can't have a &amp;lt; or &amp;gt; inside the attribute. So what do you do? Well in the past I have been escaping the quotes in xslt and writing a ton of code to something so little...until now. Check it out:&lt;br /&gt;&lt;br /&gt;Here is my xml that I want to loop over.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfsavecontent variable="xml"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt; &amp;lt;boarders&amp;gt;&lt;br /&gt;  &amp;lt;boarder&amp;gt;&lt;br /&gt;   &amp;lt;id&amp;gt;1&amp;lt;/id&amp;gt;&lt;br /&gt;   &amp;lt;name&amp;gt;Joe&amp;lt;/name&amp;gt;&lt;br /&gt;   &amp;lt;board&amp;gt;Forum&amp;lt;/board&amp;gt;&lt;br /&gt;  &amp;lt;/boarder&amp;gt;&lt;br /&gt; &amp;lt;/boarders&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!---Here I am putting the value of the id node in the href attribute of an a tag by escaping quotes. Pretty gross huh?---&amp;gt;&lt;br /&gt;&amp;lt;cfsavecontent variable="xslt"&amp;gt;&lt;br /&gt;&amp;lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" &amp;gt;&lt;br /&gt;   &amp;lt;xsl:variable name="XML" select="/"/&amp;gt;&lt;br /&gt;   &amp;lt;xsl:template match="/"&amp;gt;&lt;br /&gt;    &amp;lt;html&amp;gt;&lt;br /&gt;      &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;      &amp;lt;body&amp;gt;&lt;br /&gt;      &amp;lt;xsl:for-each select="$XML"&amp;gt; &lt;br /&gt;       &amp;lt;xsl:text disable-output-escaping="yes"&amp;gt;&amp;lt;&amp;lt;/xsl:text&amp;gt;a&lt;br /&gt;       href='test.cfm?id=&lt;br /&gt;       &amp;lt;xsl:value-of select="boarders/boarder/id"/&amp;gt;&lt;br /&gt;       '&amp;lt;xsl:text disable-output-escaping="yes"&amp;gt;&amp;gt;&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;       &amp;lt;xsl:value-of select="boarders/boarder/name"/&amp;gt;&lt;br /&gt;       &amp;lt;xsl:text disable-output-escaping="yes"&amp;gt;&amp;lt;/a&amp;lt;/xsl:text&amp;gt;&lt;br /&gt;      &amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;    &amp;lt;/body&amp;gt;&lt;br /&gt;   &amp;lt;/html&amp;gt;&lt;br /&gt;  &amp;lt;/xsl:template&amp;gt;&lt;br /&gt; &amp;lt;/xsl:stylesheet&amp;gt;&lt;br /&gt;&amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfoutput&amp;gt;&lt;br /&gt;#xmltransform(xml,xslt)#&lt;br /&gt;&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now check this out. The same xslt with {} to access the node. Alot cleaner.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfsavecontent variable="xslt"&amp;gt;&lt;br /&gt; &amp;lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" &amp;gt;&lt;br /&gt;   &amp;lt;xsl:variable name="XML" select="/"/&amp;gt;&lt;br /&gt;   &amp;lt;xsl:template match="/"&amp;gt;&lt;br /&gt;    &amp;lt;html&amp;gt;&lt;br /&gt;     &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;     &amp;lt;body&amp;gt;&lt;br /&gt;     &amp;lt;xsl:for-each select="$XML"&amp;gt; &lt;br /&gt;      &lt;br /&gt;     &amp;lt;a href="test.cfm?id={boarders/boarder/id}"&amp;gt;&amp;lt;xsl:value-of select="boarders/boarder/name"/&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt; &lt;br /&gt;     &amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;    &amp;lt;/body&amp;gt;&lt;br /&gt;   &amp;lt;/html&amp;gt;&lt;br /&gt;  &amp;lt;/xsl:template&amp;gt;&lt;br /&gt; &amp;lt;/xsl:stylesheet&amp;gt;&lt;br /&gt;&amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt;&amp;lt;a href="http://www.w3.org/TR/xslt#dt-attribute-value-template"&amp;gt;http://www.w3.org/TR/xslt#dt-attribute-value-template&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;&amp;lt;cfoutput&amp;gt;&lt;br /&gt;#xmltransform(xml,xslt)#&lt;br /&gt;&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It, the {}, also supports xslt variables as well.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfsavecontent variable="xslt"&amp;gt;&lt;br /&gt; &amp;lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" &amp;gt;&lt;br /&gt;   &amp;lt;xsl:variable name="XML" select="/"/&amp;gt;&lt;br /&gt;   &amp;lt;xsl:template match="/"&amp;gt;&lt;br /&gt;    &amp;lt;html&amp;gt;&lt;br /&gt;      &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;      &amp;lt;body&amp;gt;&lt;br /&gt;      &amp;lt;xsl:for-each select="$XML"&amp;gt; &lt;br /&gt;      &lt;br /&gt;       &amp;lt;xsl:variable name="boarder_Var"&amp;gt;&lt;br /&gt;        &amp;lt;xsl:value-of select="boarders/boarder/id"/&amp;gt;&lt;br /&gt;       &amp;lt;/xsl:variable&amp;gt;&lt;br /&gt;       a href="test.cfm?id={$boarder_Var}"&amp;gt;&amp;lt;xsl:value-of select="boarders/boarder/name"/&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;   &lt;br /&gt;      &amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;    &amp;lt;/body&amp;gt;&lt;br /&gt;   &amp;lt;/html&amp;gt;&lt;br /&gt;  &amp;lt;/xsl:template&amp;gt;&lt;br /&gt; &amp;lt;/xsl:stylesheet&amp;gt;&lt;br /&gt;&amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfoutput&amp;gt;&lt;br /&gt;#xmltransform(xml,xslt)#&lt;br /&gt;&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Use Case:&lt;/b&gt;&lt;br /&gt;I wanted to merge some data into a set of links that the user clicks on that returns the value to an FCKeditor.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-2464663352534607516?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/2464663352534607516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/02/value-of-select-inside-xslt-tags.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2464663352534607516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2464663352534607516'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/02/value-of-select-inside-xslt-tags.html' title='value-of-select inside an xslt tag&apos;s attribute'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-1364330205297420696</id><published>2010-02-01T21:24:00.000-08:00</published><updated>2010-02-01T21:57:33.059-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Playing with cfloop's file attribute</title><content type='html'>I was playing around with cfloop's file attribute and how it only grabs the rows you want to loop over...not the entire file. So cool. I am amazed at how well and easy it is to use. Here's what I got:&lt;br /&gt;&lt;br /&gt;&amp;lt;!---data.csv---&amp;gt;&lt;br /&gt;ID,Name,Board,Gender&lt;br /&gt;1,Joe,Forum,M&lt;br /&gt;2,Jamie,Nitro,F&lt;br /&gt;3,Jake,Forum,M&lt;br /&gt;4,Ben,Burton,M&lt;br /&gt;5,Ken,Elan,M&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset columns = "ID,Name,Board,Gender"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset boarders = arrayNew(1)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfloop from="2" to="6" file="C:/workspace/examples/file_looping/data.csv" index="row"&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;cfset boarder = structNew()/&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;!---loop through the columns and create a struct of the row's data---&amp;gt;&lt;br /&gt; &amp;lt;cfloop from="1" to="#listLen(columns)#" index="column"&amp;gt;&lt;br /&gt;  &amp;lt;cfset boarder[listGetAt(columns,column)] = listGetAt(row,column)/&amp;gt;&lt;br /&gt; &amp;lt;/cfloop&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;!---append the boarder struct to the boarders array---&amp;gt;&lt;br /&gt; &amp;lt;cfset arrayAppend(boarders,boarder)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfdump var="#boarders#"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I put the rows in an array of structs to work with it more easily.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Use case:&lt;/b&gt;&lt;br /&gt;It works great for imports where you want to throttle the amount of data you process at a time. Example you only want to pull records 1-99 process them, then 100-199 and so on.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-1364330205297420696?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/1364330205297420696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2010/02/playing-with-cfloops-file-attribute.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1364330205297420696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1364330205297420696'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2010/02/playing-with-cfloops-file-attribute.html' title='Playing with cfloop&apos;s file attribute'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-9147558534923709823</id><published>2009-12-01T19:07:00.000-08:00</published><updated>2009-12-01T19:22:19.913-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>listAppend()...Why?</title><content type='html'>I ran into an annoyance twice this week with the listAppend() in Coldfusion. Below is two ways of storing stuff, an array and a list. &lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&lt;!---borders as an array---&gt;&lt;br /&gt;&amp;lt;cfset borders = arrayNew(1)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset arrayAppend(borders,"Joe")/&amp;gt;&lt;br /&gt;&amp;lt;cfset arrayAppend(borders,"Jamie")/&amp;gt;&lt;br /&gt;&amp;lt;cfset arrayAppend(borders,"Jake")/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;!---borders as a list---&gt;&lt;br /&gt;&amp;lt;cfset borders = ""/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset borders = listAppend(borders,"Joe")/&amp;gt;&lt;br /&gt;&amp;lt;cfset borders = listAppend(borders,"Jamie")/&amp;gt;&lt;br /&gt;&amp;lt;cfset borders = listAppend(borders,"Jake")/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I used both ways a ton this week and kept wanting to call listAppend() the same way arrayAppend() is called...but sadly listAppend() doesn't work like that. For some weird reason you need to set boarders (the list var) back to itself because listAppend() doesn't just add it to the variable above just like arrayAppend() does. listAppend() returns you the list with the new append value. Why? I just want to use it like arrayAppend()...it's cleaner and smaller code. Maybe I am missing an important point of listAppend() or don't understand a concept fully, but this is bugging me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-9147558534923709823?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/9147558534923709823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/12/listappendwhy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/9147558534923709823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/9147558534923709823'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/12/listappendwhy.html' title='listAppend()...Why?'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-1668741865184005108</id><published>2009-11-29T15:29:00.000-08:00</published><updated>2009-11-29T16:22:25.343-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><title type='text'>Break it up</title><content type='html'>I attended an Adobe MAX session a few weeks ago (&lt;a href="http://tv.adobe.com/watch/max-2009-envision/the-business-value-of-user-experience" title="The Business Value of User Experience" target="_blank"&gt;The Business Value of User Experience&lt;/a&gt;) and I began to relate to some of the struggles that others have had with interfaces and user experiences. Things like how to accommodate multiple types users and guiding users through processes are the major points I picked up from the session.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Handling Multiple User Audiences.&lt;/span&gt;&lt;br /&gt;We have all ran into this issue before and if you haven't...you should. How do we handle power users vs. regular users? Power users are the small group of individuals that are going to stretch the app to the boundaries. Regular users are going to do their tasks and are usually just looking to get their "computer work" done asap. So how do we address the power user's needs without confusing or frustrating the regular user's UX? How do we break up complex problems when we code? We break up the code into smaller, more manageable chunks. So we break up the UI when we have complex options or features.&lt;br /&gt;&lt;br /&gt;The biggest thing to remember when handling multiple audiences is don't wreck the majority audience's UX. If you need to implement extra options or features in the UI for the power users, separate them from the core options or features. What I am saying is only show what is needed and have a place separate from the main screens, to make the options available for the power users. The power users will find those options, they don't care where the options or features are they just needed the ability to have them. The regular users don't care about the extra options or features and don't even need to know about them. Keep the regular users processes straight forward. Aim for no frustrate or hassle with them. A good example of how to implement this is do what MS did. They implemented an "Advanced" option, usually in the navigation form of a button to hide all the extra options and features. Another word that works well is "Settings".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Guiding the User.&lt;/span&gt;&lt;br /&gt;We have all been guided through wizards that we click "Next...Next...Next" all the way through. This is a great way to walk users through a complex problem. But sometimes users don't need a multi-screen wizard to walk them through a process. Sometimes they just need some clarity or steps to verify against as they complete a screen. A good way to do this is by displaying a vertical wizard. A vertical wizard doesn't have to be a complex process that the user is being walked through. It can simply provide clarity to know that what they are filling out is used for something. A good example of this is &lt;a href="http://www.flickr.com/photos/jannejanne/3461696829/" title="Campaign Monitor's" target="_blank"&gt;Campaign Monitor's&lt;/a&gt; sign up wizard.&lt;br /&gt;&lt;br /&gt;A last random note is to remember that your users are people. Remember that people hate making decisions, but always want the decisions available.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-1668741865184005108?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/1668741865184005108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/11/break-it-up.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1668741865184005108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1668741865184005108'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/11/break-it-up.html' title='Break it up'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-7748627665167672160</id><published>2009-09-24T19:40:00.000-07:00</published><updated>2009-09-24T20:14:34.407-07:00</updated><title type='text'>The cowering developer.</title><content type='html'>I wanted to talk a little bit about ownership and the frustrations I have with developers who don't own up their work. We all do it, just in varying degrees.&lt;br /&gt;&lt;br /&gt;Have you ever noticed that some developers never own up to there work? A developer added some logic that made if confusing for you to follow, but they won't own up to their work. Trying to get anything out of them is like talking to a wall. I wonder what they're afraid of. I've put up with this for too long and need to talk about it. &lt;br /&gt;&lt;br /&gt;Some developers feel it's "ok" to NOT take ownership or responsibility of their work. I think they are afraid of confrontation. If I want to know who did something, I am not looking to target someone and humiliate them. I am trying to solve an issue with which I am having trouble following their trail. I feel that the developer thinks that if they speak up that they will have to fix something or possibly "do more work". Yes, there are some immature developer that do make you fix it and will call you out in front to make themselves feel smarter, but I feel that most are just trying to solve an issue for which they need an assist with. &lt;br /&gt;&lt;br /&gt;These "cowering" developers create more frustration, waste time and resources, and push the work off on other developers. I am sick of watching irresponsible developers go home to their friends and family while other developers clean up the messes. I am sure there is some angry significant others out there whom have a few words to say. I am sick of having long arguments in the same area of the developer who wrote the piece but they are just sitting there and listening and don't have the courage to stand up and assist.&lt;br /&gt;&lt;br /&gt;Yes I know there are cases where we had to throw some not so good code in because of some crazy business logic, but it doesn't mean you are stuck with that piece forever. Others will come behind, follow your trail, and try to tweak/fix your piece. They may need help or point them in the right direction. If you choose to "cower" in the corner, it will be noticed and remembered. Swallow some pride and own up to the code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-7748627665167672160?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/7748627665167672160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/09/cowering-developer.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7748627665167672160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7748627665167672160'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/09/cowering-developer.html' title='The cowering developer.'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-3251955961620660032</id><published>2009-09-20T15:46:00.000-07:00</published><updated>2009-09-20T16:00:47.482-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><title type='text'>PHP and checkboxes with the same name</title><content type='html'>If you have worked with ColdFusion before you know that if have checkboxes in the form that have the same name they come into the form scope as a comma separated list. I tried to pull the same trick using PHP but only go the last checkbox's value. Confused I did a little a research and found out that if you put [] behind your name PHP interprets it as an array but keeps everything to the left of the [] as your name when comeing in through the $_REQUEST scope. See below.&lt;br /&gt;&lt;pre name="code" class="html"&gt;&lt;br /&gt;&amp;lt;form name="the_form" method="post"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type="checkbox" name="boarder" value="Joe" &amp;gt;&lt;br /&gt;&amp;lt;input type="checkbox" name="boarder" value="Jamie" &amp;gt;&lt;br /&gt;&amp;lt;input type="checkbox" name="boarder" value="Jake" &amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In ColdFusion when you submit this form you would get an variable in the form scope&lt;br /&gt;called "boarder" with the values "Joe,Jamie,Jake" in a comma seperated list. In PHP you would get "Jake". To solve this I added [] to the checkbox name.&lt;br /&gt;&lt;pre name="code" class="html"&gt;&lt;br /&gt;&amp;lt;form name="the_form" method="post"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type="checkbox" name="boarder[]" value="Joe" &amp;gt;&lt;br /&gt;&amp;lt;input type="checkbox" name="boarder[]" value="Jamie" &amp;gt;&lt;br /&gt;&amp;lt;input type="checkbox" name="boarder[]" value="Jake" &amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now in PHP you would get an variable in the $_REQUEST scope called "boarder" which is type array with first element "Joe, the second element "Jamie", and the third element "Jake". Notice the variable name is still "boarder" even though we specified "boarder[]". &lt;br /&gt;&lt;br /&gt;I am not choosing sides on PHP or ColdFusion they are both cool, but I found it interesting that you can tell PHP what type this var is through the html form.&lt;br /&gt;&lt;br /&gt;I found my answer at:&lt;br /&gt;http://www.computing.net/answers/webdevel/php-amp-checkboxes/1122.html#postfp&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-3251955961620660032?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/3251955961620660032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/09/php-and-checkboxes-with-same-name.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3251955961620660032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3251955961620660032'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/09/php-and-checkboxes-with-same-name.html' title='PHP and checkboxes with the same name'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-4181550834000622563</id><published>2009-09-07T09:27:00.001-07:00</published><updated>2009-09-07T09:49:55.929-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Adding a node to an existing xml object</title><content type='html'>So I struggled with an interesting task the other day, that should have been easy. I had an xml object with which I was to add additional node too. Sounds simple right. The part I struggled with was the ColdFusion function "xmlElemNew()". I kept wanting to put in that third optional argument. Enough blabbing, here's how I did it. &lt;br /&gt;&lt;br /&gt;Here is my xml file or xml object.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;boarders&amp;gt;&lt;br /&gt; &amp;lt;boarder&amp;gt;&lt;br /&gt;  &amp;lt;name&amp;gt;Joe&amp;lt;/name&amp;gt;&lt;br /&gt;  &amp;lt;board&amp;gt;Forum&amp;lt;/board&amp;gt;&lt;br /&gt;  &amp;lt;gender&amp;gt;M&amp;lt;/gender&amp;gt;&lt;br /&gt; &amp;lt;/boarder&amp;gt; &lt;br /&gt;&amp;lt;/boarders&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I want to add another boarder.&lt;br /&gt;&lt;br /&gt;Here I am reading from a file but the same thing works for an xml object.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset xml = xmlParse("boarders.xml")/&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I create my new boarder node, using the variable xml as my "xml document".&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset boarder = XmlElemNew(xml,"boarder")/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Next I create some extra nodes "name,gender, and board" and append it to the boarder node using arrayAppend(). Each time I make the "extra nodes" I set the value of the node by using XmlText, which is an attribute of xml object in ColdFusion. Finally we add the node the children of the boarder node created earlier. &lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;!---name---&amp;gt;&lt;br /&gt;&amp;lt;cfset name = XmlElemNew(xml,"name")/&amp;gt;&lt;br /&gt;&amp;lt;cfset name.XmlText = "Jamie"/&amp;gt;&lt;br /&gt;&amp;lt;cfset arrayAppend(boarder.XmlChildren,name)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!---gender---&amp;gt;&lt;br /&gt;&amp;lt;cfset gender = xmlElemNew(xml,"gender")/&amp;gt;&lt;br /&gt;&amp;lt;cfset gender.XmlText = "F"/&amp;gt;&lt;br /&gt;&amp;lt;cfset arrayAppend(boarder.XmlChildren,gender)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!---board---&amp;gt;&lt;br /&gt;&amp;lt;cfset board = xmlElemNew(xml,"board")/&amp;gt;&lt;br /&gt;&amp;lt;cfset board.XmlText = "Nitro"/&amp;gt; &lt;br /&gt;&amp;lt;cfset arrayAppend(boarder.XmlChildren,board)/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Once we are ready to add the node the xml object we just arrayAppend() just like we did with the above nodes "name,gender,and board".&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset arrayAppend(xml.boarders.XmlChildren,boarder)&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfdump var="#xml#"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfabort/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That's it. &lt;br /&gt;&lt;br /&gt;To recap quick:&lt;br /&gt;1. Create the node using XmlElemNew().&lt;br /&gt;2. Set the node value using XmlText().(optional)&lt;br /&gt;3. Append the node to the parent node using arrayAppend().&lt;br /&gt;&lt;br /&gt;Took me forever to figure it out. Sad I know.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-4181550834000622563?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/4181550834000622563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/09/adding-node-to-existing-xml-object.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/4181550834000622563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/4181550834000622563'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/09/adding-node-to-existing-xml-object.html' title='Adding a node to an existing xml object'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-8986940365222295405</id><published>2009-09-02T20:57:00.001-07:00</published><updated>2009-09-19T08:11:48.924-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>PDF's 101</title><content type='html'>I wanted to share my first experience with pdf's and how simple ColdFusion makes working with. Previously, when I had to do something with a PDF it was changing some styles on a .cfm that's content was wrapped in cfdocument tags, so I didn't really learn much. I got put on a project that had us generate pdfs and learned a lot from the experience. When I first started working on the project I was nervous because I didn't know XML or XSLT, but quickly realized they are not hard at all. Here is a small example of my process for creating a pdf. My goal was no files, which means I save the pdf in the database, but in this example I will show where you can either create a file or save it to the database.&lt;br /&gt;&lt;br /&gt;First we have some data that we want to display on a PDF. I like snowboarding so I made an array of structs with data regarding each boarder. Mostly we would have a whole bunch of queries who's data we would to display but I just want to keep it simple.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset boarders = arrayNew(1)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset boarder = structNew()/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.id = 1/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.name = "Joe"/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.board = "Forum"/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.gender = "M"/&amp;gt;&lt;br /&gt;&amp;lt;cfset arrayAppend(boarders,boarder)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset boarder = structNew()/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.id = 2/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.name = "Ben"/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.board = "Burton"/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.gender = "M"/&amp;gt;&lt;br /&gt;&amp;lt;cfset arrayAppend(boarders,boarder)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset boarder = structNew()/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.id = 3/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.name = "Jake"/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.board = "Santa Cruz"/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.gender = "M"/&amp;gt;&lt;br /&gt;&amp;lt;cfset arrayAppend(boarders,boarder)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset boarder = structNew()/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.id = 4/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.name = "Jamie"/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.board = "Nitro"/&amp;gt;&lt;br /&gt;&amp;lt;cfset boarder.gender = "F"/&amp;gt;&lt;br /&gt;&amp;lt;cfset arrayAppend(boarders,boarder)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!---dump the data---&amp;gt;&lt;br /&gt;&amp;lt;cfdump var="#boarders#" label="boarders"/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;After we have our data we need make some xml. If you haven't work with xml, think of it like html, but you can make your own tag names. Here I create a node called "boarder" which I store properties about the boarder like name, board, and gender. The xml will act as our data when working with the pdf. Later the xslt will be our styles for the pdf.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset xml = arrayNew(1)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfloop from="1" to="#arrayLen(boarders)#" index="i"&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;cfsavecontent variable="boarder"&amp;gt;&lt;br /&gt;  &amp;lt;cfoutput&amp;gt;&lt;br /&gt;   &lt;br /&gt;   &amp;lt;boarder&amp;gt;&lt;br /&gt;    &amp;lt;id&amp;gt;#boarders[i].id#&amp;lt;/id&amp;gt;&lt;br /&gt;    &amp;lt;name&amp;gt;#boarders[i].name#&amp;lt;/name&amp;gt;&lt;br /&gt;    &amp;lt;board&amp;gt;#boarders[i].board#&amp;lt;/board&amp;gt;&lt;br /&gt;    &amp;lt;gender&amp;gt;#boarders[i].gender#&amp;lt;/gender&amp;gt;&lt;br /&gt;   &amp;lt;/boarder&amp;gt;&lt;br /&gt;   &lt;br /&gt;  &amp;lt;/cfoutput&amp;gt;&lt;br /&gt; &amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;cfset arrayAppend(xml,boarder)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!---dump the xml---&amp;gt;&lt;br /&gt;&amp;lt;cfloop from="1" to="#arrayLen(xml)#" index="i"&amp;gt;&lt;br /&gt; &amp;lt;cfdump var="#xmlParse(xml[i])#" label="#i#"&amp;gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;After we have the data the next piece is to create some xslt. Remember xslt is the styles of the xml. If you haven't worked with xslt, the basic idea is you loop through your xml nodes "the custom tags you made" and output the data. You loop through a node by doing &amp;lt;xsl:for-each select="boarder"&amp;gt;. If you want the value of node you do this &amp;lt;xsl:value-of select="name"/&amp;gt;. This should get you by, you will have to search W3schools for the rest.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfsavecontent variable="xslt"&amp;gt;&lt;br /&gt; &amp;lt;cfoutput&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;xsl:stylesheet version="1.0"&lt;br /&gt;  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;xsl:template match="/"&amp;gt;&lt;br /&gt;    &amp;lt;html&amp;gt;&lt;br /&gt;    &amp;lt;body&amp;gt;&lt;br /&gt;   &amp;lt;xsl:for-each select="boarder"&amp;gt;&lt;br /&gt;   &lt;br /&gt;       &amp;lt;table border="1"&amp;gt;&lt;br /&gt;&lt;br /&gt;           &amp;lt;tr&amp;gt;&lt;br /&gt;             &amp;lt;td&amp;gt;Name:&amp;lt;/td&amp;gt;&lt;br /&gt;             &amp;lt;td&amp;gt;&amp;lt;xsl:value-of select="name"/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;           &amp;lt;/tr&amp;gt;&lt;br /&gt;&lt;br /&gt;           &amp;lt;tr&amp;gt;&lt;br /&gt;             &amp;lt;td&amp;gt;Gender:&amp;lt;/td&amp;gt;&lt;br /&gt;             &amp;lt;td&amp;gt;&amp;lt;xsl:value-of select="gender"/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;           &amp;lt;/tr&amp;gt;&lt;br /&gt;         &lt;br /&gt;           &amp;lt;tr&amp;gt;&lt;br /&gt;             &amp;lt;td&amp;gt;Board:&amp;lt;/td&amp;gt;&lt;br /&gt;             &amp;lt;td&amp;gt;&amp;lt;xsl:value-of select="board"/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;           &amp;lt;/tr&amp;gt;&lt;br /&gt;         &lt;br /&gt;       &amp;lt;/table&amp;gt;&lt;br /&gt;       &lt;br /&gt;      &amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;    &amp;lt;/body&amp;gt;&lt;br /&gt;    &amp;lt;/html&amp;gt;&lt;br /&gt;  &amp;lt;/xsl:template&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;/xsl:stylesheet&amp;gt;&lt;br /&gt;  &lt;br /&gt; &amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;---dump the xslt---&amp;gt;&lt;br /&gt;&amp;lt;cfdump var="#xslt#"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The next piece is where we actually merge the xml and xslt together to create html. Once we have the html we can run it through cfdocument tags and get it in pdf format.&lt;br /&gt;&lt;br /&gt;I start an array to hold the info regarding each document.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset documents = arrayNew(1)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfloop from="1" to="#arrayLen(xml)#" index="i"&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;cfset document = structNew()/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;        I get the xml which we create earlier.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt; &amp;lt;cfset document.xml = xml[i]/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;        I get the xslt which we create earlier.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt; &amp;lt;cfset document.xslt = xslt/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;        I merge the xml and xslt together using xmlTransform(), a built in ColdFusion function and it will return my html.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt; &amp;lt;cfset document.html = xmlTransform(xml[i],document.xslt)/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt; I wrap my html in cfdocument tags with a format of pdf. This will return me a binary object of the pdf. Earlier I mentioned about creating a file or saving it to the database...this is that point.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt; &amp;lt;cfdocument name="document.binary" format="pdf"&amp;gt;&lt;br /&gt;  &amp;lt;cfoutput&amp;gt;#document.html#&amp;lt;/cfoutput&amp;gt;&lt;br /&gt; &amp;lt;/cfdocument&amp;gt;&lt;br /&gt; &lt;/pre&gt;&lt;br /&gt;        Since I didn't want to create any files I convert the binary object to base64 so I can save it in my MSSQL database. I can always pull the base64 from the databased and use toBinary() to convert it back to a binary object.&lt;br /&gt; &lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset document.base64 = toBase64(document.binary)/&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;cfset arrayAppend(documents,document)/&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!---dump the documents array---&amp;gt;&lt;br /&gt;&amp;lt;cfdump var="#documents#" label="documents"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;At this point you can be done or if you want, since we have the all the pdfs in the array called documents, we can loop through them and merge them into one pdf so we can print 1 document instead of each document individually.&lt;br /&gt;&lt;br /&gt;Pretty basic here. The only thing crazy is I loop through the documents again an apply them as source to the main pdf, named "final", I want to merge. The pointer is important because you can't directly throw the variable into the pdfparam source attribute...it requires a variable name, this took me along time to figure out.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;!--- merge documents ---&amp;gt;&lt;br /&gt;&amp;lt;cfpdf action="merge" name="final"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfloop from="1" to="#arrayLen(documents)#" index="i"&amp;gt;&lt;br /&gt; &amp;lt;cfset pointer = documents[i].binary/&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;cfpdfparam source="pointer"/&amp;gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfpdf&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That's it, all the documents we created early are all merged into 1 single pdf, we can print them once. Now we just can the content tag to display the pdf to the browser.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfcontent type="application/pdf" variable="#toBinary(final)#" reset="no" /&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Pretty harmless huh.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-8986940365222295405?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/8986940365222295405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/09/pdfs-101.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8986940365222295405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8986940365222295405'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/09/pdfs-101.html' title='PDF&apos;s 101'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-7005515743635910417</id><published>2009-08-25T20:17:00.000-07:00</published><updated>2009-09-02T21:46:49.698-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Connecting Coldfusion to a Java class.</title><content type='html'>For a while now I've want to know how to call Java from ColdFusion but didn't know how. After waking up any Java memories I had from making my "hello world" I found out it was really easy to do.&lt;br /&gt;&lt;br /&gt;1. user.java&lt;br /&gt;Remember Java is case sensitive unlike ColdFusion.&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;public class user{ &lt;br /&gt;      public String getName(){&lt;br /&gt;&lt;br /&gt;            String name = "joe";  &lt;br /&gt;            return name;&lt;br /&gt;      }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;2. Drop the user.java file C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\classes directory.&lt;br /&gt;--NOTE I am using localhost mulitserver and this is where I put it.&lt;br /&gt;&lt;br /&gt;3. Test.cfm&lt;br /&gt;I create a test.cfm and create an object of user. I can now work with the object.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset user = createObject("java", "user")&amp;gt;&lt;br /&gt;&amp;lt;cfdump var="#user#"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset name = user.getName()/&amp;gt;&lt;br /&gt;&amp;lt;cfdump var="#name#"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-7005515743635910417?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/7005515743635910417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/08/connecting-coldfusion-to-java-class.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7005515743635910417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7005515743635910417'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/08/connecting-coldfusion-to-java-class.html' title='Connecting Coldfusion to a Java class.'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-7425923029260761005</id><published>2009-08-10T18:37:00.000-07:00</published><updated>2009-08-10T19:06:59.440-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='Design'/><title type='text'>PHP and singleton's</title><content type='html'>So I wanted to have use singletons in php, but couldn't find any good tuts that didn't involve cake or zend. I did quite a bit research and asking around and here is what I came up with. I framed the findings around Coldspring which is a ColdFusion dependency injection tool, which basically means it handles your objects for you.&lt;br /&gt;&lt;br /&gt;First I have an xml file where I define where my objects (classes) are. If you are not familiar with MVC, I would first suggest reading up on it. But anyways, below I define some objects paths so I don't have to worry about where they are. As you can see I have an objects controller, service, and gateway.&lt;br /&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="ISO-8859-1"?&amp;gt;&lt;br /&gt;&amp;lt;objects&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;object name="objectsController" type="controller" address="app/controllers/objectsController.php"/&amp;gt;&lt;br /&gt;&amp;lt;object name="objectsService" type="service" address="app/services/objectsService.php"/&amp;gt;&lt;br /&gt;&amp;lt;object name="objectsGateway" type="model" address="app/models/objects/objectsGateway.php"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/objects&amp;gt;&lt;br /&gt;&lt;br /&gt;The next step is to read in the xml nodes. So below is a function that I feed a path to my xml file (above) and it returns me the nodes in PHP.&lt;br /&gt;&lt;br /&gt;public function loadSimpleXML($xmlPath){&lt;br /&gt;         if (file_exists($xmlPath)) {&lt;br /&gt;             $xml = simplexml_load_file($xmlPath);&lt;br /&gt;             return $xml;&lt;br /&gt;         }else{&lt;br /&gt;             exit('Failed to open '.$xmlPath);&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;The next step I loop the nodes with the name "object" and do stuff with it.&lt;br /&gt;&lt;br /&gt;//create singletons array to hold objects in&lt;br /&gt;$singletons = array();&lt;br /&gt;&lt;br /&gt;//get the count of the nodes&lt;br /&gt;$cnt = count($xml-&gt;object);&lt;br /&gt;&lt;br /&gt;//loop object nodes&lt;br /&gt;for($i = 0; $i &lt; $cnt; $i++) {     $object = $xml-&gt;object[$i];&lt;br /&gt; &lt;br /&gt;   //get object name and address&lt;br /&gt;   $name = $this-&gt;getAttribute($object,"name");&lt;br /&gt;   $address = $this-&gt;getAttribute($object,"address");&lt;br /&gt; &lt;br /&gt;   //include the file&lt;br /&gt;   $this-&gt;loadClass($address);&lt;br /&gt; &lt;br /&gt;   //create an instances of the object&lt;br /&gt;   $pointer = (string)$name[0];&lt;br /&gt;   $singletons[$pointer] = new $pointer;&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Alot of stuff happened in the above function so I will break it down by a few lines. First we get the node by doing:&lt;br /&gt;&lt;br /&gt;$object = $xml-&gt;object[$i];&lt;br /&gt;&lt;br /&gt;After we get the node I call a function to get the attributes of the node. In my case I just want the name and where the object file is at.&lt;br /&gt;&lt;br /&gt;$name = $this-&gt;getAttribute($object,"name");&lt;br /&gt;$address = $this-&gt;getAttribute($object,"address");&lt;br /&gt;&lt;br /&gt;public function getAttribute($node,$name){&lt;br /&gt;$attrs = $node-&gt;attributes();&lt;br /&gt;&lt;br /&gt;return $attrs[$name];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Next I have to include the file. In PHP I found out you need to include the file if you want to use it. To do this I created a function that does a require_once(). I know you don't need a function for it but I figure it didn't hurt and this way if I have to do anything before my include or after I have the ability to do it now. In case you don't $this is used to call a function within a object file. Also you notice I have a variable call $GLOBALS["siteroot"]. I actually load up an environment xml file that takes of these properties but to be straight...the variable just contains the site root of my project, so no biggie here.&lt;br /&gt;&lt;br /&gt;$this-&gt;loadClass($address);&lt;br /&gt;&lt;br /&gt;public function loadClass($classPath){&lt;br /&gt;  require_once($GLOBALS["siteroot"].$classPath);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The next part was the hard part...dynamically creating an instance of the object. I found out that I needed to use a pointer to use "new", which took forever to figure out, because me and pointers don't mix (I just wanna chain stuff together). Anyways here's what I got.&lt;br /&gt;&lt;br /&gt;//create an instances of the object&lt;br /&gt;$pointer = (string)$name[0];&lt;br /&gt;&lt;br /&gt;//append object to an array objects so they can be used later.&lt;br /&gt;$singletons[$pointer] = new $pointer;&lt;br /&gt;&lt;br /&gt;Later I store the $singleton's array in the $GLOBAL scope because it's the only scope that I know is some what persistant...but it's not. I don't think PHP has a persistant scope without creating a session. If any one has any ideas on where I can put this $singletons array so I don't to have read it from the xml everytime (if you caught the globals...I am techinically not fully using the singleton's pattern because I have no scope to put it in) I would greatly appreciate it, but I have found this works pretty slick for now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-7425923029260761005?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/7425923029260761005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/08/php-and-singletons.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7425923029260761005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7425923029260761005'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/08/php-and-singletons.html' title='PHP and singleton&apos;s'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-429882570304995246</id><published>2009-08-09T21:25:00.000-07:00</published><updated>2009-08-10T19:06:14.993-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><title type='text'>Robot Coders</title><content type='html'>In most trades people do what they are told, it gets done, and life goes on. Development requires you think into the future to prevent issues, which may bring a developer to challenging the validity of the task. Challenging a task could potentially bring up new ideas or issues. I am not saying challenge every thing that is assign to you, but do a quick check against the current state of the app. A quick check could create a new module or even a product. It could also bring up trickle down issues that may occur from bringing in a new change or feature.&lt;br /&gt;&lt;br /&gt;From what I've seen so far,in the 2 years of coding, is that some developers are mindless coders. They are like robots whom take input and return results. While management loves this, development hates it. The problem with coding this way is you get crap code that only serves a one-off purpose from either a quick decision or sales promise and harms the purpose of a feature or even the app. I just think things should be thought through a little more before they are coded up, and it is the responsibility of the coder , as a last resort, to take care of this. I am not asking for a design meeting, but 5 to 10 minutes of quick thinking or maybe a peer's opinion may bring something important up that will save time and money in the long run.&lt;br /&gt;&lt;br /&gt;A few things I do before coding something up are:&lt;br /&gt;1. What parts will be affected?&lt;br /&gt;2. Will this change the current purpose of the code in a way that is not desired or maybe &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;interpreted&lt;/span&gt; incorrectly?&lt;br /&gt;3. How much code do I need to change?&lt;br /&gt;4. Do the database relationships support what I am going to do?&lt;br /&gt;5. Do I have the time to make the changes without throwing some spaghetti code together?&lt;br /&gt;6. Will my changes effect/prevent someone else's ability to work?&lt;br /&gt;7. Do I need a hand with the design or amount of this task?&lt;br /&gt;8. Are the changes worth my time right now or are there bigger fish to fry first?&lt;br /&gt;&lt;br /&gt;These are just a few things that go through my mind before I begin a task. I think the robot coders should become human again, by learning to think outside the box or for themselves and not by an outside entity. What goes though your guy's mind before you begin coding?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-429882570304995246?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/429882570304995246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/08/robot-coders.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/429882570304995246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/429882570304995246'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/08/robot-coders.html' title='Robot Coders'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-3192328888986795482</id><published>2009-06-15T19:47:00.000-07:00</published><updated>2009-09-02T21:47:49.529-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Select into from ColdFusion query object</title><content type='html'>So I got a question from a friend of mine who had a query returned in ColdFusion and wanted to do a "select into" with the query object. He found out how to do it one statement. Check it out.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&amp;lt;cfquery datasouce="ds"&amp;gt;&lt;br /&gt;SELECT COLUMN_1,COLUMN_2,COLUMN_3&lt;br /&gt;INTO DATABASE_TABLE&lt;br /&gt;FROM QUERYOBJECT.THEQUERY&lt;br /&gt;&amp;lt;/cfquery&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-3192328888986795482?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/3192328888986795482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/06/select-into-from-coldfusion-query.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3192328888986795482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/3192328888986795482'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/06/select-into-from-coldfusion-query.html' title='Select into from ColdFusion query object'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-2777130165143866172</id><published>2009-05-21T09:01:00.000-07:00</published><updated>2009-09-02T21:49:50.833-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Default on bit column in sql.</title><content type='html'>&lt;pre name="code" class="sql"&gt;alter table tablename&lt;br /&gt;add constraint DF_tablename_columnname default ((0)) for columnname&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-2777130165143866172?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/2777130165143866172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/05/default-on-bit-column-in-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2777130165143866172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/2777130165143866172'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/05/default-on-bit-column-in-sql.html' title='Default on bit column in sql.'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-8438620804235019664</id><published>2009-05-18T19:32:00.000-07:00</published><updated>2009-09-02T21:51:28.120-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Merging cfdocuments into pdf without creating a file</title><content type='html'>&lt;span&gt;So I was working with a dms and wanted to try not writing and reading pdf files but instead using the cf and db to display the data. I struggled with invoking cfpdfparam source attribute on cfpdf action="merge" because it doesn't take straight up binary, which is what cfdocument is returning. So I created a pointer variable and passed that in and it accepted. Kinda wierd it wouldn't accept it but oh well. Check it out.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;!--- get the pages ---&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;cfset pages = beans.docService.getPagesByVersionID(versionID=versionID)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;!--- create array to hold cfdocuments ---&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;cfset documents = []/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;!--- loop pages and create cfdocuments ---&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;cfloop query="pages"&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;cfdocument name="pdf_name" format="pdf" pageheight="#pages.height#"           pagewidth="#pages.width#" pagetype="#pages.doc_page_type_Name#"                     orientation="pages.document_orientation_type_name#"&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;!--- get the page layout ---&amp;gt;&lt;/span&gt;&lt;br /&gt;            &amp;lt;cfset layout[id] = beans.docService.getLayoutByID(pages.layout_id)                     /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;!--- get xmltransform---&amp;gt;&lt;/span&gt;&lt;br /&gt;            &amp;lt;cfsilent&amp;gt;&lt;br /&gt;                     &amp;lt;cfset html[id] = xmltransform(xml,layout[id].xslt) /&amp;gt;&lt;br /&gt;            &amp;lt;/cfsilent&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;!--- set margins ---&amp;gt;&lt;/span&gt;&lt;br /&gt;            &amp;lt;cfdocumentsection&lt;br /&gt;      marginbottom="#pages.bottom_margin#"&lt;br /&gt;      marginleft="#pages.left_margin#"&lt;br /&gt;      marginright="#pages.right_margin#"&lt;br /&gt;      margintop="#pages.top_margin#"&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;!--- output data ---&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &amp;lt;cfoutput&amp;gt;#html[id]#&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&lt;br /&gt;            &amp;lt;/cfdocumentsection&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;/cfdocument&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;!--- add binary cfdocument to the  ---&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;cfset arrayappend(documents,pdf_name) /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!--- merge cfdocuments into 1 pdf. this will return some binary ---&amp;gt;&lt;br /&gt;&amp;lt;cfpdf action="merge" name="final"&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;cfloop from="1" to="#arraylen(documents)#" index="i"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!--- set pointer for cfpdfparam source, this part took me forever to figure out because the source attribute is looking for a pointer variable. you can't just pass in the binary  ---&amp;gt;&lt;br /&gt;            &amp;lt;cfset pointer = documents[i]/&amp;gt;&lt;br /&gt;&lt;br /&gt;            &amp;lt;cfpdfparam source="pointer"&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfpdf&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!--- output the pdf ---&amp;gt;&lt;br /&gt;&amp;lt;cfcontent type="application/pdf" variable="#tobinary(final)#" reset="No"  &amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-8438620804235019664?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/8438620804235019664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/05/merging-cfdocuments-into-pdf-without.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8438620804235019664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/8438620804235019664'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/05/merging-cfdocuments-into-pdf-without.html' title='Merging cfdocuments into pdf without creating a file'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-4537510294525287003</id><published>2009-05-13T19:24:00.001-07:00</published><updated>2009-08-10T19:07:10.861-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><title type='text'>The litte things</title><content type='html'>As I logged into my bank accounts online I realized how much of the little things are missing from a page. Details such as label tags on radio and checkboxes, titles on links, and directions steps in a wizard are just to name a few. When working with presentation, people remember every little detail. So remember to think of the little things.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-4537510294525287003?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/4537510294525287003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/05/litte-things.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/4537510294525287003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/4537510294525287003'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/05/litte-things.html' title='The litte things'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-7604923365364073737</id><published>2009-04-22T20:24:00.000-07:00</published><updated>2009-09-02T21:50:41.431-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Coldfusion writing simple xslt</title><content type='html'>I think it would be kinda cool to not have to write xslt as much any more, so a coworker and I created some helper functions to handle tables for us. So instead of writing xslt to create a table tag where we can pump xml into we created coldfusion functions with which can shoot args and write the xslt for us.&lt;br /&gt;&lt;br /&gt;Here we call a beginTable() with which we can give it attributes.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cffunction name="beginTable" access="public" returntype="string" output="false" &amp;gt;&lt;br /&gt;&lt;br /&gt;     &amp;lt;cfset var local = {} /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset arguments = getArguments(arguments) /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfsavecontent variable="local.string"&amp;gt;&lt;br /&gt;&amp;lt;cfoutput&gt;&lt;br /&gt;&amp;lt;xsl:call-template name="beginTable"&amp;gt;&lt;br /&gt;&lt;br /&gt;#renderXSLTParams(argumentCollection=arguments)#&lt;br /&gt;&lt;br /&gt;&amp;lt;/xsl:call-template&amp;gt;&lt;br /&gt;&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfreturn local.string&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cffunction&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;First we can getArguments which handles our common attributes of the tag we are trying to create. getArguments() can be used to set out defaults but of simplicity we just loop a list of common attributes.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cffunction name="getArguments" access="public" output="false" returntype="struct"&amp;gt;&lt;br /&gt;     &amp;lt;cfargument name="args" required="true" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset var local = {} /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset local.args = arguments.args /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfloop list="class,style,title,alt,id,height,width,colspan,cellspacing,cellpadding,align,border,src,value" index="local.i"&gt;&lt;br /&gt;&amp;lt;cfset local.args[lcase(local.i)] = getKey(lcase(local.i),local.args,"#local.i#") /&amp;gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfreturn local.args /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cffunction&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Second, we write the xlst beginTable template and create the xslt params using renderXSLTParams.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cffunction name="renderXSLTParams" access="public" returntype="string" output="false" &amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset var local = {} /&amp;gt;&lt;br /&gt;&amp;lt;cfset var i = "" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfsavecontent variable="local.string"&amp;gt;&lt;br /&gt;&amp;lt;cfoutput&amp;gt;&lt;br /&gt;&amp;lt;cfloop collection="#arguments#" item="i"&amp;gt;&lt;br /&gt; &amp;lt;xsl:with-param name="#lcase(i)#"&amp;gt;&lt;br /&gt;  &amp;lt;cfif (FindNoCase('%',arguments[i],1) or FindNoCase('px',arguments[i],1) )&gt;&lt;br /&gt;   &amp;lt;xsl:text&gt;#arguments[i]#&lt;br /&gt;  &amp;lt;cfelse&amp;gt;&lt;br /&gt;   &amp;lt;xsl:value-of select="#lcase(arguments[i])#"/&gt;&lt;br /&gt;  &amp;lt;/cfif&amp;gt;&lt;br /&gt; &amp;lt;/xsl:with-param&amp;gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&amp;lt;/cfsavecontent&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfreturn local.string/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cffunction&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That takes care of creating the xslt snippet for the begin table tag, now we have to load the tag at the bottom of the xslt so we can call the template and invoke the params. To do this we output the load function which contains all our template snippets.&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cffunction name="load" access="public" output="false" returntype="string" &amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset var local = {}/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfsavecontent variable="local.string"&amp;gt;&lt;br /&gt;&amp;lt;cfoutput&amp;gt;&lt;br /&gt;&amp;lt;xsl:template name="beginTable"&amp;gt;&lt;br /&gt; #getTemplateParams()#&lt;br /&gt; &amp;lt;xsl:text disable-output-escaping="yes"&amp;gt;&amp;lt;&amp;lt;/xsl:text&amp;gt;table&lt;br /&gt;  #getXSLTParams()#&lt;br /&gt; &amp;lt;xsl:text disable-output-escaping="yes"&amp;gt;&amp;gt;&amp;lt;/xsl:text&gt;&lt;br /&gt;&amp;lt;/xsl:template&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;xsl:template name="endTable"&amp;gt;&lt;br /&gt;   &amp;lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;&amp;lt;/xsl:text&amp;gt;/table&lt;xsl:text escaping="yes"&gt;&lt;br /&gt;&amp;lt;/xsl:template&amp;gt;&lt;br /&gt;&lt;br /&gt;         &amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfreturn local.string/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cffunction&amp;gt;&lt;br /&gt;&lt;br /&gt;In the load function we call getTemplateParams() to create our template params.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cffunction name="getTemplateParams" access="public" returntype="string" output="false" &amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset var local = {}/&amp;gt;&lt;br /&gt;&amp;lt;cfset var i = ""/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset arguments = getArguments(arguments)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfsavecontent variable="local.string"&amp;gt;&lt;br /&gt;&amp;lt;cfoutput&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfloop collection="#arguments#" item="i"&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;xsl:param name="#lcase(i)#"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfreturn local.string/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cffunction&amp;gt;&lt;br /&gt;&lt;br /&gt;Next we call getXSLTParams(). to actually invoke the xslt params&lt;br /&gt;&lt;br /&gt;&amp;lt;cffunction name="getXSLTParams" access="public" returntype="string" output="false" &amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset var local = {}/&amp;gt;&lt;br /&gt;&amp;lt;cfset var i = ""/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset arguments = getArguments(arguments)/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfsavecontent variable="local.string"&amp;gt;&lt;br /&gt;&amp;lt;cfoutput&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfloop collection="#arguments#" item="i"&amp;gt;&lt;br /&gt;&amp;lt;xsl:if test="$#lcase(i)# != '' "&amp;gt;&lt;br /&gt;  #lcase(i)# ='&lt;xsl:value-of select="$#lcase(i)#"&gt;&lt;br /&gt;&amp;lt;/xsl:if&amp;gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&amp;lt;/cfsavecontent&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfreturn local.string/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cffunction&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And that should do it.&lt;/xsl:value-of&gt;&lt;/xsl:text&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-7604923365364073737?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/7604923365364073737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/04/coldfusion-writing-simple-xslt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7604923365364073737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/7604923365364073737'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/04/coldfusion-writing-simple-xslt.html' title='Coldfusion writing simple xslt'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-1166261233054258558</id><published>2009-04-09T18:40:00.000-07:00</published><updated>2010-03-09T10:51:40.539-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>Accessing a queries row by row number</title><content type='html'>query.column[rownumber]&lt;br /&gt;&lt;br /&gt;I was asked to do a task which involved a select box with arrows on each side of it. The arrows were to be used for the next and previous record in the select box when the page first rendered. For awhile I have wanted to use a query row number to access data directly and now get the chance to.&lt;br /&gt;&lt;br /&gt;I used the current selected id and loop the query just got the above and below row from the current row by accessing the query struct.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="coldfusion"&gt;&lt;br /&gt;&amp;lt;cfset the_id="124"/&amp;gt;&lt;br /&gt;&amp;lt;cfset above_id=""/&amp;gt;&lt;br /&gt;&amp;lt;cfset below_id=""/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cfloop query="the_query"&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;cfif the_id = the_query.id&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;cfset above_id= the_query.id[currentrow + 1] /&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;cfset below_id= the_query.id[currentrow - 1] /&amp;gt;&lt;br /&gt;        &amp;lt;cfbreak /&amp;gt;&lt;br /&gt;   &amp;lt;/cfif&amp;gt;&lt;br /&gt;&amp;lt;/cfloop&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-1166261233054258558?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/1166261233054258558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/04/accessing-queries-row-by-row-number.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1166261233054258558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/1166261233054258558'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/04/accessing-queries-row-by-row-number.html' title='Accessing a queries row by row number'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-901413649421185729</id><published>2009-03-23T20:36:00.000-07:00</published><updated>2009-08-10T19:06:59.441-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='How To&apos;s'/><title type='text'>javascript for each loop</title><content type='html'>I ran into an issue today with the javascript for each loop. The for each loop would run one extra time and return the value "each" for the variable "field" in example below.&lt;br /&gt; &lt;br /&gt;Example 1&lt;br /&gt;for(var field in array){&lt;br /&gt;     //some code&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;To solve this I switched up the for each loop to do it this way instead.&lt;br /&gt;&lt;br /&gt;Example 2&lt;br /&gt;array.each(function(field){&lt;br /&gt;    //some code&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;Not sure what the difference is between Example 1 and Example 2.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-901413649421185729?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/901413649421185729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/03/javascript-for-each-loop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/901413649421185729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/901413649421185729'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/03/javascript-for-each-loop.html' title='javascript for each loop'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-6391031271533128287</id><published>2009-03-19T20:38:00.000-07:00</published><updated>2009-06-15T19:51:52.294-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>cfqueryparam cf_sql_decimal scale default</title><content type='html'>A few months ago I was debugging some code that was rounding to the nearest int even though the data being entered was of decimal type. I checked the code to see if round() or numberformat() was being used, but they weren't. I started throwing dumps in the cfquery and noticed that before the decimal var entered in the cfqueryparam it was a decimal, but when the query was ran it was of type int. I was totally confused on how the number was being formatted. Turns out there is a scale attribute I was unaware of on cfqueryparam. The scale attribute is defaulted to 0 and is only applicable to cf_sql_numeric and cf_sql_decimal. I think it's kinda pointless for cf_sql_decimal to have zero decimals. Anyways I ended up adding scale to cfqueryparam with a value of 2 and fixed the issue.&lt;br /&gt;&lt;br /&gt;I can see why scale of zero would make sense for cf_sql_numeric but not for cf_sql_decimal.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-6391031271533128287?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/6391031271533128287/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/03/cfqueryparam-decimal-default.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6391031271533128287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6391031271533128287'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/03/cfqueryparam-decimal-default.html' title='cfqueryparam cf_sql_decimal scale default'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-5476189537716544784</id><published>2009-03-16T19:53:00.000-07:00</published><updated>2009-08-10T19:07:19.373-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><category scheme='http://www.blogger.com/atom/ns#' term='ColdFusion'/><title type='text'>ColdFusion and PDF font-size pt vs px</title><content type='html'>So a few months ago I was walking by a developers desk and stopped when I saw him frustrated with some ColdFusion PDF output. He was working  with font size's in using pixels (Ex. font-size:15px;) and it was not rendering the same in FireFox and IE. I sat down with him for a bit and we both thought using pixels instead of points (Ex. font-size:15pt) would be compatible across browsers. Our idea was wrong. I went back to my desk and played around with the compatibility of different pixel sizes in the two browsers but had no luck. Giving up with the pixel's idea, I then tried pt. Using pt worked far better then px when dealing with PDF.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-5476189537716544784?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/5476189537716544784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/03/coldfusion-and-pdf-font-size-pt-vs-px.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5476189537716544784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/5476189537716544784'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/03/coldfusion-and-pdf-font-size-pt-vs-px.html' title='ColdFusion and PDF font-size pt vs px'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2835459232825933710.post-6484747297510962300</id><published>2009-03-16T19:31:00.000-07:00</published><updated>2009-03-19T20:32:43.137-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hover Technology'/><title type='text'>Air Boards / Hover Boards</title><content type='html'>So I was driving to a ski resort to snowboard with my girlfriend and it was 50 degrees. My thoughts as I drove with the A/C blasting, were "I am going to loose 10 pounds in sweet today" and "What were thinking? It's way to warm to be doing this". As  I rolled down the window to let some fresh air in, I started thinking about the movie Back to the Future and those crazy cool air boards they had in the movie. We arrived at the ski resort and went snowboarding, threw some snowballs at each other and sweated are butts off. We ended up going home early, so I hopped on Google to do a little research on air boards.&lt;br /&gt;&lt;br /&gt;I found a website on how to create an airboard &lt;a href="http://www.wikihow.com/Create-a-Hoverboard"&gt;http://www.wikihow.com/Create-a-Hoverboard&lt;/a&gt; . It's sounds super easy, reasonably inexpensive (criagslist) to do. Here's a calculator that I found super handy to calculate dims,lift,and power &lt;a href="http://www.rqriley.com/hc-calc.html"&gt;http://www.rqriley.com/hc-calc.html&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2835459232825933710-6484747297510962300?l=jbanken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jbanken.blogspot.com/feeds/6484747297510962300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jbanken.blogspot.com/2009/03/air-boards.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6484747297510962300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2835459232825933710/posts/default/6484747297510962300'/><link rel='alternate' type='text/html' href='http://jbanken.blogspot.com/2009/03/air-boards.html' title='Air Boards / Hover Boards'/><author><name>Joe Banken</name><uri>http://www.blogger.com/profile/15033883883686350884</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-_8OSrG-tt_c/ThWuGkPBK7I/AAAAAAAAAIQ/7vUKtTjrNBg/s220/n33802567_30896158_1123.jpg'/></author><thr:total>0</thr:total></entry></feed>
