<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>&lt;!--- CFChris ---&gt; - Web 2.0</title>
			<link>http://www.cfchris.com/cfchris/index.cfm</link>
			<description>The blog of Chris Phillips, a ColdFusion developer with a passion for improvement.</description>
			<language>en-us</language>
			<pubDate>Sun, 05 Sep 2010 07:45:30 -0700</pubDate>
			<lastBuildDate>Mon, 03 May 2010 16:34:00 -0700</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>me@cfchris.com</managingEditor>
			<webMaster>me@cfchris.com</webMaster>
			
			
			
			
			
			<item>
				<title>Textarea Auto Grow</title>
				<link>http://www.cfchris.com/cfchris/index.cfm/2010/5/3/Textarea-Auto-Grow</link>
				<description>
				
				I have seen instances where I&apos;m on a form on a website and there is some mechanism by which the textarea automatically grows to fit what I&apos;m typing. I&apos;ve also seen this not work too well, and eventually half the bottom line is cut off or the bottom of the textarea has expanded further than it needs to.

A while ago a super simple solution to this popped into my head. And today I happened to need just such a solution. So, I wrote up a vary small JavaScript function to add to our utility library.
				 [More]
				</description>
						
				
				<category>JavaScript</category>				
				
				<category>Web 2.0</category>				
				
				<pubDate>Mon, 03 May 2010 16:34:00 -0700</pubDate>
				<guid>http://www.cfchris.com/cfchris/index.cfm/2010/5/3/Textarea-Auto-Grow</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>PSA: Browser Back Button Differences</title>
				<link>http://www.cfchris.com/cfchris/index.cfm/2010/1/11/PSA-Browser-Back-Button-Differences</link>
				<description>
				
				At work, we had some old display code that was supposed to prevent users from submitting the same form twice. In the form&apos;s submit event, there was a window scoped boolean being set. If validation errors needed to be displayed, then the boolean was un-set. And at the very top of the submit action it would just &apos;return&apos; if it saw the boolean. Maybe it will make more sense if you look at the submit event handler.
				 [More]
				</description>
						
				
				<category>JavaScript</category>				
				
				<category>Web 2.0</category>				
				
				<pubDate>Mon, 11 Jan 2010 16:37:00 -0700</pubDate>
				<guid>http://www.cfchris.com/cfchris/index.cfm/2010/1/11/PSA-Browser-Back-Button-Differences</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>How To: Prototype Resize Handle</title>
				<link>http://www.cfchris.com/cfchris/index.cfm/2009/2/18/How-To-Prototype-Drag-Corner</link>
				<description>
				
				This is just a short post to share some JavaScript that I wrote to be able to add a drag corner to an html element to make it resizable.

I did this using prototype.js. As an example the two divs below have been made resizable. (Go ahead. Drag the bottom right corner around.)

&lt;div id=&quot;SomeDiv&quot; style=&quot;position: relative; width: 200px; height:100px; border: 2px solid black; padding: 3px;&quot;&gt;
	Div One
	&lt;div class=&quot;corner&quot; id=&quot;DragHandle&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;

&lt;div id=&quot;DivTwo&quot; style=&quot;position:relative; width:150px; height:75px; border:1px dashed red;&quot;&gt;
	Div Two
	&lt;div class=&quot;corner&quot; id=&quot;DragHandleTwo&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;

&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
	
	function DragCorner(container, handle) {
		var container = $(container);
		var handle = $(handle);
		
		/* Add property to container to store position variables */
		container.moveposition = {x:0, y:0};
		
		function moveListener(event) {
			/* Calculate how far the mouse moved */
			var moved = {
							x:(event.pointerX() - container.moveposition.x),
							y:(event.pointerY() - container.moveposition.y)
						};
			/* Reset container&apos;s x/y utility property */
			container.moveposition = {x:event.pointerX(), y:event.pointerY()};
			/* Border adds to dimensions */
			var borderStyle = container.getStyle(&apos;border-width&apos;);
			var borderSize = borderStyle.split(&apos; &apos;)[0].replace(/[^0-9]/g,&apos;&apos;);
			/* Padding adds to dimensions */
			var paddingStyle = container.getStyle(&apos;padding&apos;);
			var paddingSize = paddingStyle.split(&apos; &apos;)[0].replace(/[^0-9]/g,&apos;&apos;);
			/* Add things up that change dimensions */
			var sizeAdjust = (borderSize*2) + (paddingSize*2);
			/* Update container&apos;s size */
			var size = container.getDimensions();
			container.setStyle({
					height: size.height+moved.y-sizeAdjust+&apos;px&apos;,
					width:size.width+moved.x-sizeAdjust+&apos;px&apos;
				});
		}
		
		/* Listen for &apos;mouse down&apos; on handle to start the move listener */
		handle.observe(&apos;mousedown&apos;, function(event) {
			/* Set starting x/y */
			container.moveposition = {x:event.pointerX(),y:event.pointerY()};
			/* Start listening for mouse move on body */
			Event.observe(document.body,&apos;mousemove&apos;,moveListener);
		});
		
		/* Listen for &apos;mouse up&apos; to cancel &apos;move&apos; listener */
		Event.observe(document.body,&apos;mouseup&apos;, function(event) {
			Event.stopObserving(document.body,&apos;mousemove&apos;,moveListener);
		});
	}
	
	DragCorner(&apos;SomeDiv&apos;,&apos;DragHandle&apos;);
	
	DragCorner(&apos;DivTwo&apos;,&apos;DragHandleTwo&apos;);
	
&lt;/script&gt;

&lt;style type=&quot;text/css&quot;&gt;
	div.corner {
		background-color: silver;
		cursor: se-resize;
		height: 25px;
		width: 25px;
		position: absolute;
		bottom: 0px;
		right: 0px;
	}
&lt;/style&gt;

And below is the code that makes it possible. If you take a look at it and read the comments, You&apos;ll see that it&apos;s actually pretty simple. The thing that had me stuck for a while was asking Prototype how tall or wide something is isn&apos;t the whole story. Border and padding add to width and height. I have some code in there that will compensate for that. However, I only covered situations where the border/passing were uniform all the way around. Anyway, love to hear what you think about this.

&lt;code&gt;
&lt;div id=&quot;SomeDiv&quot; style=&quot;position: relative; width: 200px; height:100px; border: 2px solid black; padding: 3px;&quot;&gt;
	Div One
	&lt;div class=&quot;corner&quot; id=&quot;DragHandle&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;

&lt;div id=&quot;DivTwo&quot; style=&quot;position:relative; width:150px; height:75px; border:1px dashed red;&quot;&gt;
	Div Two
	&lt;div class=&quot;corner&quot; id=&quot;DragHandleTwo&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;

&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;

	function DragCorner(container, handle) {
		var container = $(container);
		var handle = $(handle);
		
		/* Add property to container to store position variables */
		container.moveposition = {x:0, y:0};
		
		function moveListener(event) {
			/* Calculate how far the mouse moved */
			var moved = {
							x:(event.pointerX() - container.moveposition.x),
							y:(event.pointerY() - container.moveposition.y)
						};
			/* Reset container&apos;s x/y utility property */
			container.moveposition = {x:event.pointerX(), y:event.pointerY()};
			/* Border adds to dimensions */
			var borderStyle = container.getStyle(&apos;border-width&apos;);
			var borderSize = borderStyle.split(&apos; &apos;)[0].replace(/[^0-9]/g,&apos;&apos;);
			/* Padding adds to dimensions */
			var paddingStyle = container.getStyle(&apos;padding&apos;);
			var paddingSize = paddingStyle.split(&apos; &apos;)[0].replace(/[^0-9]/g,&apos;&apos;);
			/* Add things up that change dimensions */
			var sizeAdjust = (borderSize*2) + (paddingSize*2);
			/* Update container&apos;s size */
			var size = container.getDimensions();
			container.setStyle({
					height: size.height+moved.y-sizeAdjust+&apos;px&apos;,
					width:size.width+moved.x-sizeAdjust+&apos;px&apos;
				});
		}
		
		/* Listen for &apos;mouse down&apos; on handle to start the move listener */
		handle.observe(&apos;mousedown&apos;, function(event) {
			/* Set starting x/y */
			container.moveposition = {x:event.pointerX(),y:event.pointerY()};
			/* Start listening for mouse move on body */
			Event.observe(document.body,&apos;mousemove&apos;,moveListener);
		});
		
		/* Listen for &apos;mouse up&apos; to cancel &apos;move&apos; listener */
		Event.observe(document.body,&apos;mouseup&apos;, function(event) {
			Event.stopObserving(document.body,&apos;mousemove&apos;,moveListener);
		});
	}
	
	DragCorner(&apos;SomeDiv&apos;,&apos;DragHandle&apos;);
	
	DragCorner(&apos;DivTwo&apos;,&apos;DragHandleTwo&apos;);
	
&lt;/script&gt;
&lt;/code&gt;
				
				</description>
						
				
				<category>JavaScript</category>				
				
				<category>Web 2.0</category>				
				
				<pubDate>Wed, 18 Feb 2009 15:01:00 -0700</pubDate>
				<guid>http://www.cfchris.com/cfchris/index.cfm/2009/2/18/How-To-Prototype-Drag-Corner</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Real World AJAX Presentation Code</title>
				<link>http://www.cfchris.com/cfchris/index.cfm/2008/11/14/Real-World-AJAX-Presentation-Code</link>
				<description>
				
				Last night I presented my &quot;Real World AJAX&quot; talk to PDXRIA (our local Portland Adobe User Group). I said I would post the code. So, here it is! (Download link below)

I have included the PDF slide presentation too. There are not a lot of slides. This is a code heavy talk. It uses a very simple CRUD application to demonstrate adding AJAX to an existing application. There are three versions in the zip. One completely paged based. Another one with some &apos;partial page update&apos; style AJAX to improve the user experience. And a final one with some DHTML and DOM building. The code uses an in memory query object instead of a database. So, you should be able to drop it in a folder and run it with no setup.

When I give the presentation, I show how you can turn JavaScript off and the second version still works (it gracefully degrades). I really need to add about 10 more slides with some of the stuff that I ramble off while I&apos;m showing the code examples. If I get around to polishing it off, I&apos;ll re-post the updated slides and code.

Also, I built the slides in OpenOffice.org Impress. If you would like to give this talk to your user group, or somewhere else, let me know.
				
				</description>
						
				
				<category>JavaScript</category>				
				
				<category>Web 2.0</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Fri, 14 Nov 2008 19:52:00 -0700</pubDate>
				<guid>http://www.cfchris.com/cfchris/index.cfm/2008/11/14/Real-World-AJAX-Presentation-Code</guid>
				
				<enclosure url="http://www.cfchris.com/cfchris/enclosures/RealWorldAJAX.zip" length="230208" type="application/zip"/>
				
			</item>
			
		 	
			
			
			<item>
				<title>Thank You Adobe!</title>
				<link>http://www.cfchris.com/cfchris/index.cfm/2007/7/13/Thank-You-Adobe</link>
				<description>
				
				The Adobe &lt;a href=&quot;http://onair.adobe.com/schedule/cities/portland.php&quot; target=&quot;_blank&quot;&gt;on Air Bus Tour&lt;/a&gt; was in Portland last night. It was a very exciting event. The bus crew did a great job presenting the unique opportunity that &lt;a href=&quot;http://www.adobe.com/go/air&quot; target=&quot;_blank&quot;&gt;AIR&lt;/a&gt; gives both Flash and HTML developers to build cross-platform desktop application with their current skill-set.

I managed to answer a trivia question and get a bag of &lt;b&gt;seven&lt;/b&gt; &lt;a href=&quot;http://www.oreilly.com/&quot; target=&quot;_blank&quot;&gt;O&apos;Reilly&lt;/a&gt; books! Add the 3 beers I had, the excellent catered food, the free training, and the networking opportunities and I have only one thing to say.

Thank you Adobe!
				
				</description>
						
				
				<category>Web 2.0</category>				
				
				<category>Adobe AIR</category>				
				
				<category>Conferences</category>				
				
				<pubDate>Fri, 13 Jul 2007 13:38:00 -0700</pubDate>
				<guid>http://www.cfchris.com/cfchris/index.cfm/2007/7/13/Thank-You-Adobe</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Google Gears Could Help Make Your Apps Work Offline</title>
				<link>http://www.cfchris.com/cfchris/index.cfm/2007/5/30/Google-Gears-Could-Help-Make-Your-Apps-Work-Offline</link>
				<description>
				
				I saw this story about &lt;a href=&quot;http://code.google.com/apis/gears/index.html&quot; target=&quot;_blank&quot;&gt;Google Gears&lt;/a&gt; on Ryan&apos;s blog earlier. It is such cool news that I wanted to make sure it got spread. Having a consistent cross-browser, cross-platform way to implement an &quot;occasionally connected&quot; work-flow for web-applications seems like huge news to me. Plus, Google + Adobe + Mozilla = Happy if you ask me.

I&apos;ve already installed Gears and tried it with Google Reader under both WinXP and PCLinuxOS 2007.

Please go and check out the &lt;a href=&quot;http://code.google.com/apis/gears/api_database.html&quot; target=&quot;_blank&quot;&gt;JavaScript syntax for executing SQL&lt;/a&gt; against a &lt;i&gt;local&lt;/i&gt; SQLite database.

&lt;blockquote&gt;&quot;&lt;a href=&quot;http://blogs.zdnet.com/Stewart/?p=399&quot; rel=&quot;bookmark&quot; title=&quot;Permalink&quot;&gt; What Google Gears means for Rich Internet Applications and Apollo&lt;/a&gt; by &lt;a href=&quot;http://zdnet.com&quot;&gt;ZDNet&lt;/a&gt;&apos;s Ryan Stewart -- Some big news today that Google is announcing an open source project called &quot;Google Gears&quot; which is an open source collaboration between Google, Adobe, Mozilla, and Opera that enables offline web applications in the browser. It seems very similar to the announcement that Mozilla made about the offline features in Firefox 3 and will be [...]&quot;&lt;/blockquote&gt;
				
				</description>
						
				
				<category>Web 2.0</category>				
				
				<category>JavaScript</category>				
				
				<category>Google</category>				
				
				<pubDate>Wed, 30 May 2007 23:56:00 -0700</pubDate>
				<guid>http://www.cfchris.com/cfchris/index.cfm/2007/5/30/Google-Gears-Could-Help-Make-Your-Apps-Work-Offline</guid>
				
			</item>
			
		 	
			</channel></rss>