<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rob O&#039;Brien</title>
	<atom:link href="http://blog.robobrien.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.robobrien.com</link>
	<description>ColdFusion. eCommerce. Marketing. Ramblings.</description>
	<lastBuildDate>Fri, 10 Jun 2011 20:56:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>IE9 + jQuery&#8217;s bgiframe</title>
		<link>http://blog.robobrien.com/ie9-jquery-bgiframe/</link>
		<comments>http://blog.robobrien.com/ie9-jquery-bgiframe/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 20:34:27 +0000</pubDate>
		<dc:creator>Rob  O&#39;Brien</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.robobrien.com/?p=371</guid>
		<description><![CDATA[With the release of Internet Explorer 9 on Monday (Mar 14th), I've been going through my various websites to ensure everything is working as expected in the new browser. For the most part, I have seen no problems and, in fact, I have only seen benefits of new CSS3 and HTML5 standards in IE9 (rounded [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.robobrien.com%2Fie9-jquery-bgiframe%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.robobrien.com%2Fie9-jquery-bgiframe%2F&amp;source=RobOBrien&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>With the release of Internet Explorer 9 on Monday (Mar 14th), I've been going through my various websites to ensure everything is working as expected in the new browser. For the most part, I have seen no problems and, in fact, I have only seen benefits of new CSS3 and HTML5 standards in IE9 (rounded corners, woohoo!). But, this post is dedicated to the only issue I've found so far... the "bgiframe" plugin for jQuery.</p>
<h1>The Perfect Storm</h1>
<p>There's a specific scenario in which this plugin will fail:</p>
<ol>
<li>Windows Vista (<a href="http://bit.ly/eFzZFE">Windows NT 6.0</a>) <strong>or</strong> Windows Media Center in Windows 7 (Media Center PC 6.0)
<li>Internet Explorer 9
<li>Document rendering in Standards Mode (as opposed to Quirks Mode)
</ol>
<p>Got it? Good.</p>
<h1>Why does it fail?</h1>
<p>IE9 on these versions of Windows has the following User Agent (or very similar):</p>
<div class="CodeBlock"><pre class="text">&nbsp;
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8 )
&nbsp;</pre></div>
<p>The part we're interested in is the Windows versions, "Windows NT 6.0" and "Media Center PC 6.0". Clearly, these are the OS version, not the <strong>browser</strong> version. Unfortunately, the bgiframe plugin's browser version check is a bit too rudimentary to realize this. Here's the code from the most recent version (June 2007) of this plugin:</p>
<div class="CodeBlock"><pre class="javascript">&nbsp;
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span> $.<span style="color: #006600;">browser</span>.<span style="color: #006600;">msie</span> &amp;&amp; <span style="color: #0066FF;">/<span style="color: #CC0000;">6.0</span>/</span>.<span style="color: #006600;">test</span><span style="color: #66cc66;">&#40;</span>navigator.<span style="color: #006600;">userAgent</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #009900; font-style: italic;">/* ...other stuff here... */</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre></div>
<p>This RegEx test looks for the existence of "6.0" anywhere in the UA string. As you saw above, we have "6.0" in there twice, even though I'm using IE9. </p>
<p>So, we need to fix this little flub to make it very specific to our needs:</p>
<div class="CodeBlock"><pre class="javascript">&nbsp;
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span> $.<span style="color: #006600;">browser</span>.<span style="color: #006600;">msie</span> &amp;&amp; parseInt<span style="color: #66cc66;">&#40;</span>$.<span style="color: #006600;">browser</span>.<span style="color: #006600;">version</span><span style="color: #66cc66;">&#41;</span> === <span style="color: #CC0000;">6</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #009900; font-style: italic;">/* ...other stuff here... */</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre></div>
<p>In this way, we utilize jQuery's browser version sniffer (which has the added benefit of jQuery upgrades, if the sniffer ever gets updated) and we also ensure that we're targeting IE6 directly, not a random instance of "6.0" from any number of OS's or plugins which add to the UA string. After all, that's what this plugin is designed to do -- fix the <a href="http://bit.ly/i9yiVN ">IE6 z-index bug</a>.</p>
<p>The other component of this is "Standards Mode" rendering. This bug didn't come to light for me until now because the website I work on renders in Quirks Mode (don't get me started on this!), so the Javascript engine was more forgiving.  When in Standards Mode, IE9 yells about this line in the plugin:</p>
<div class="CodeBlock"><pre class="javascript">&nbsp;
<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">insertBefore</span><span style="color: #66cc66;">&#40;</span> document.<span style="color: #006600;">createElement</span><span style="color: #66cc66;">&#40;</span>html<span style="color: #66cc66;">&#41;</span>, <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">firstChild</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre></div>
<p>I haven't taken the time to understand why, but it doesn't like "this.insertBefore()" in this use. But, that's for another day.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robobrien.com/ie9-jquery-bgiframe/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Creating a URL Scope in Javascript</title>
		<link>http://blog.robobrien.com/creating-a-url-scope-in-javascript/</link>
		<comments>http://blog.robobrien.com/creating-a-url-scope-in-javascript/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 20:13:09 +0000</pubDate>
		<dc:creator>Rob  O&#39;Brien</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.robobrien.com/?p=343</guid>
		<description><![CDATA[A Little Background I am involved in a project with a major airline, which has allowed me to devote the majority of my coding effort to Front-End (HTML/CSS/JS) development. This position has really allowed me to hone my Javascript skills and it's been a lot of fun to dive into best practices &#8212; I'm a [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.robobrien.com%2Fcreating-a-url-scope-in-javascript%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.robobrien.com%2Fcreating-a-url-scope-in-javascript%2F&amp;source=RobOBrien&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<h1>A Little Background</h1>
<p>I am involved in a project with a major airline, which has allowed me to devote the majority of my coding effort to Front-End (HTML/CSS/JS) development. This position has really allowed me to hone my Javascript skills and it's been a lot of fun to dive into best practices &#151; I'm a nerd and I love it.</p>
<p>However, as a ColdFusion developer, I've missed some of the functionality that CF has built-in. There's a great project out there for CF developers called <a href="http://bit.ly/f5GsMm" target="_blank" rel="nofollow">CFJS</a>, which mimics CF functionality in JS. You should really check out, but this project doesn't include something very useful: The URL scope. </p>
<p><span id="more-343"></span></p>
<h1>The Problem</h1>
<p>What's the best way to access URL parameters in Javascript? </p>
<p>CF has the URL scope, which is something always took for granted. But JS doesn't have this concept, so what can we do to solve this?</p>
<h1>The Solution</h1>
<p>In order to mimic the URL scope concept from CF, I created a tiny little function in Javascript to parse a URL and provide us with a URL scope. </p>
<p><i>* Note: This solution is definitely not limited to CF developers. I think it's very useful for all JS developers.</i></p>
<p>Do a Google search for "<a href="http://bit.ly/efNYqW" target="_blank" rel="nofollow">javascript url query</a>" and you'll most likely find a function like this:</p>
<div class="CodeBlock"><pre class="javascript">&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> gup<span style="color: #66cc66;">&#40;</span><span style="color: #000066;">name</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000066;">name</span> = <span style="color: #000066;">name</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/<span style="color: #66cc66;">&#91;</span>\<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>/</span>, <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\[</span>&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/<span style="color: #66cc66;">&#91;</span>\<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>/</span>, <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\]</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #003366; font-weight: bold;">var</span> regexS = <span style="color: #3366CC;">&quot;[<span style="color: #000099; font-weight: bold;">\\</span>?&amp;]&quot;</span> + <span style="color: #000066;">name</span> + <span style="color: #3366CC;">&quot;=([^&amp;#]*)&quot;</span>;
    <span style="color: #003366; font-weight: bold;">var</span> regex = <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #66cc66;">&#40;</span>regexS<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #003366; font-weight: bold;">var</span> results = regex.<span style="color: #006600;">exec</span><span style="color: #66cc66;">&#40;</span>window.<span style="color: #006600;">location</span>.<span style="color: #006600;">href</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>results == <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">&quot;&quot;</span>;
    <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">return</span> results<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre></div>
<p>So, for example, if you have this URL:</p>
<p>http://blog.robobrien.com/?bob=123&frank=321&tom=213#top</p>
<p>You would get the value of "frank" like this:</p>
<div class="CodeBlock"><pre class="javascript">&nbsp;
<span style="color: #009900; font-style: italic;">/* Get value */</span>
<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>gup<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'frank'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #009900; font-style: italic;">/* Test for existence */</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>gup<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'frank'</span><span style="color: #66cc66;">&#41;</span> != <span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'Frank is alive! '</span> + gup<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'frank'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre></div>
<p>It's popular. It works. It's dandy. But, can we make it better? I don't like that it re-parses the URL every time we call "gup()", I don't like that we have to test for an empty string to determine a parameter's existence (what if it exists, but is blank?), and I don't like that it uses RegExp (who can read that?!)</p>
<p>Here's the solution I created and have used in multiple projects:</p>
<div class="CodeBlock"><pre class="javascript">&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>location<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> url = window.<span style="color: #006600;">url</span> = <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>,
		query = location.<span style="color: #006600;">search</span>.<span style="color: #006600;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #66cc66;">&#41;</span>,
		arrParams = <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>,
		param = <span style="color: #3366CC;">''</span>;
		len = <span style="color: #CC0000;">0</span>,
		i = <span style="color: #CC0000;">0</span>;
	url._location = location;
&nbsp;
	arrParams = query.<span style="color: #006600;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&amp;&quot;</span><span style="color: #66cc66;">&#41;</span>;
	len = arrParams.<span style="color: #006600;">length</span>
	<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #66cc66;">&#40;</span>i=<span style="color: #CC0000;">0</span>; i&lt;len; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		param = arrParams<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;=&quot;</span><span style="color: #66cc66;">&#41;</span>;
		url<span style="color: #66cc66;">&#91;</span>param<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> = unescape<span style="color: #66cc66;">&#40;</span>param<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span>document.<span style="color: #006600;">location</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre></div>
<p>Bam! We're done. Errr... wait, what?</p>
<p>Rather than just saying, "Here's a function. Use it!" Let's dig a little deeper...</p>
<p>First, I want to tackle the structure of the function. It may look a little odd at first, but it makes our lives better. This is an anonymous, self-executing function. That means it does not have a name assigned to it and it will execute itself as soon as it's loaded. There are two reasons I do this. </p>
<ol>
<li>I only need to run the function once (which is also a performance boost over gup), so there's no need to name it and add a variable to the global namespace.
<li>It helps with minification.
</ol>
<p>Next, let's talk about the "var" declaration. This ensures that all of our variables are local to the function. This means they're not available outside of the function and, more importantly, we don't have to worry about outside variables conflicting with our local variables. This will also help with minification.</p>
<p>Finally, the meat of our function: Parsing the URL. Every major browser supports the Javascript's Location Object. It contains information about the current URL for your page. So, we pass "document.location" into our function and start tearing it apart. </p>
<p>The first thing we do is save the Location Object to a new variable, "url._location". This is done for no other reason than convenience. Since all of our parsed data will live in the "window.url" object, let's make the rest of it available here, too. </p>
<p>Then, we split the query string into pieces (an array) and loop over them to create dynamically named name-value pairs within the "url" object. By doing this, we make the URL params into native JS variables for easy access. That's all there is to it.</p>
<p>So, take our earlier example URL:</p>
<p>http://blog.robobrien.com/?bob=123&frank=321&tom=213#top</p>
<p>After using our new function, we can reference the URL variables more elegantly:</p>
<div class="CodeBlock"><pre class="javascript">&nbsp;
<span style="color: #009900; font-style: italic;">/* Get value */</span>
<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>url.<span style="color: #006600;">frank</span><span style="color: #66cc66;">&#41;</span>; 
&nbsp;
<span style="color: #009900; font-style: italic;">/* Test for existence */</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'frank'</span> <span style="color: #000066; font-weight: bold;">in</span> url<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'Frank is alive! '</span> + url.<span style="color: #006600;">frank</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre></div>
<p>If you use a development tool like Firebug (you are, right?), then you can go to your "Script" tab and on the right side, in the "Watch" tab, type in "url" and explore the new object we've created.</p>
<p>Here's a screenshot:</p>
<p><img src="http://blog.robobrien.com/wp-content/uploads/2010/12/URLScope.PNG"></p>
<h1>On Minification</h1>
<p>Minification is a monster all its own. I've mentioned it a few times in this article, so I want to address it quickly, but I won't go into detail.</p>
<p>First, what is minification? You would have to be under a rock or brand new to JS if you haven't heard of it. It's a way to make your code smaller, but still retain its functionality. It's an important concept in website performance. Read its <a href="http://bit.ly/hxNM1l" target="_blank" rel="nofollow">Wikipedia</a> article for more info.</p>
<p>I write all of my JS in a way that will (hopefully) maximize the benefits of minifcation. Not only will you boost your site's performance, but the process of writing minifiable (that can't be a real word...?) code will help you write better, more solid code. </p>
<p>I use Google's online <a href="http://bit.ly/dYAZRk" target="_blank" rel="nofollow">Closure Compiler</a> to minify my code. I definitely minify all of my code before using it on a production website, but I also minify it as I develop, too. This way, I can see the effects of minification and tweak my code to squeeze more bytes out of my scripts.</p>
<p>Our new function, for example, minifies down to this:</p>
<div class="CodeBlock"><pre class="javascript">&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>c<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #003366; font-weight: bold;">var</span> d=window.<span style="color: #006600;">url</span>=<span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>,e=c.<span style="color: #006600;">search</span>.<span style="color: #006600;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #66cc66;">&#41;</span>,a=<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>,b=<span style="color: #3366CC;">&quot;&quot;</span>;i=len=<span style="color: #CC0000;">0</span>;d._location=c;a=e.<span style="color: #006600;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&amp;&quot;</span><span style="color: #66cc66;">&#41;</span>;len=a.<span style="color: #006600;">length</span>;for<span style="color: #66cc66;">&#40;</span>i=<span style="color: #CC0000;">0</span>;i&lt;len;i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>b=a<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;=&quot;</span><span style="color: #66cc66;">&#41;</span>;d<span style="color: #66cc66;">&#91;</span>b<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>=unescape<span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span>document.<span style="color: #006600;">location</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre></div>
<p>The original code is 325 bytes and is now 196 bytes. That's nearly a 40% savings. Granted, it may not seem like much at this small scale, but it will definitely add up over the life of a project and a lot more JS.</p>
<p>Hopefully that gets you off on the right foot. I look forward to your comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robobrien.com/creating-a-url-scope-in-javascript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New Site: TweetPhrases</title>
		<link>http://blog.robobrien.com/new-site-tweet-phrases/</link>
		<comments>http://blog.robobrien.com/new-site-tweet-phrases/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 20:39:52 +0000</pubDate>
		<dc:creator>Rob  O&#39;Brien</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://blog.robobrien.com/?p=205</guid>
		<description><![CDATA[Social Media Recently, I've been working on a few projects that involve Twitter. Integration, promotion, brand building, etc. I've also become involved in a local Social Media Club to keep the pulse of the online community and stay on top of the latest trends. It's really given me a chance to use Twitter and, more [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.robobrien.com%2Fnew-site-tweet-phrases%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.robobrien.com%2Fnew-site-tweet-phrases%2F&amp;source=RobOBrien&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<h1>Social Media</h1>
<p>Recently, I've been working on a few projects that involve Twitter. Integration, promotion, brand building, etc. I've also become involved in a local Social Media Club to keep the pulse of the online community and stay on top of the latest trends. It's really given me a chance to use Twitter and, more importantly, watch how other people use Twitter. It's led me to a new project that I'd like to share with you...</p>
<h1>A little back-story...</h1>
<p>What's been really interesting to me, personally, is how I react to what other people are willing to throw out onto the web without much thought or hesitation. It's not always a good thing, but neither is it always a bad thing. It actually makes for some really interesting reading. Sometimes, I'll find something interesting and decide to create a connection. Other times, a random person will say something to nonsensical or irrelevant that I'll unfollow them on the spot. It's the ebb and flow of social interaction. It's how all people function in real life.</p>
<p>But what always piqued my curiosity was how common phrases are used throughout our society on a macro level. Not just online, although Twitter gives us a great way to instantly view them. They've manifested themselves in Twitter hash tags, but I think they should be a little more organic than that in order to open up the social interaction. Even at the loss of subject-specific focus. So, I started searching Twitter for a few common phrases and really liked what I found. They were intriguing. Emotionally charged. And yes, sometimes complete crap. All-in-all, very interesting. So, I launched a website to share those phrases (and more)  with the world.</p>
<h1>TweetPhrases.com</h1>
<p>So, the whole point of this article is to launch my site, yea? The new site is <a href="http://tweetphrases.com/">TweetPhrases.com</a>. It's simple. It's straightforward. It's an ever evolving, real time look at what people are saying on Twitter. Limited only, of course, by the use of a selected phrase. The presentation of the tweets is what I really love. It's bold and in your face. Boom!</p>
<p>Check it out. Let me know what you think. If there are other phrases I should consider, don't be afraid to suggest them. I'm viewing this as a social experiment, so I want it to be very organic.</p>
<h1>Geek Love</h1>
<p>I have to give a little love to <a href="http://www.adobe.com/products/coldfusion/" target="_blank" rel="nofollow">ColdFusion</a>, the language used to create TweetPhrases. I am, after all, a ColdFusion developer and I like to promote it whenever I get the chance. It's a great language that allowed me to pop up this site very quickly.</p>
<p>Finally, I would be completely remiss if I didn't acknowledge great inspiration from another website, <a href="http://twistori.com/" target="_blank" rel="nofollow">Twistori</a>. When I came up with my concept, I quickly realized there was something similar out there already. They have a great site and I want to thank them for my inspiration.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robobrien.com/new-site-tweet-phrases/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Twitter Localization: A Small Business&#8217; Dream Come True</title>
		<link>http://blog.robobrien.com/twitter-localization-a-small-business-dream-come-true/</link>
		<comments>http://blog.robobrien.com/twitter-localization-a-small-business-dream-come-true/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 11:12:32 +0000</pubDate>
		<dc:creator>Rob  O&#39;Brien</dc:creator>
				<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Small Business]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://blog.robobrien.com/?p=182</guid>
		<description><![CDATA[Twitter was founded in 2006. In a few short years, it has gone from a "micro-blogging" site of 140-character updates to an essential internet tool that allows real-time information sharing en masse. It's no wonder that it has been transformed from a "What are you doing?" service into a "What's happening in the world?" service. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.robobrien.com%2Ftwitter-localization-a-small-business-dream-come-true%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.robobrien.com%2Ftwitter-localization-a-small-business-dream-come-true%2F&amp;source=RobOBrien&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Twitter was founded in 2006. In a few short years, it has gone from a "micro-blogging" site of 140-character updates to an essential internet tool that allows real-time information sharing en masse. It's no wonder that it has been transformed from a "What are you doing?" service into a "What's happening in the world?" service.</p>
<p>Because of this fundamental shift in how Twitter is used, internet marketers are flocking to the service and promoting their products, their services, and most importantly (to them) themselves. Twitter has become a bot-filled, automated marketing machine. With a flood of self-promoting, easy-money-making, do-no-work-and-sit-at-home marketing "gurus" out there hocking "the next big thing", how are legitimate businesses supposed to differentiate themselves and properly promote their brand online? Even more to the point: How are <strong>local </strong> businesses supposed to cut through the clutter?</p>
<p>There's nothing inherently wrong with automation. In fact, I'm a big supporter of automating monotonous, time-consuming tasks that could be better performed by a computer. After all, I am a programmer. However, these bot-using, spam-creating, shameless internet marketers are a stain on Twitter's potential.</p>
<p>So, in trying to find a balance between legitimate marketing and revolting spam, the question becomes: <em>"How does one take advantage of Twitter's opportunities without getting lost in the clutter?"</em></p>
<p>It's more obvious than you might think: <strong>Go <em>Local</em></strong>.</p>
<p>As Twitter has grown in popularity, users have focused on its global reach. Most people who use Twitter want everyone to know everything about what they have to say. More followers, more friends, more people, more voices... more more more. In reality, the real gold mine is in <strong><em>focused & local</em></strong> marketing.</p>
<p>This is the X-marks-the-spot-treasure for local businesses, civic organizations, and non-profits. For any group that has a local interest, Twitter can become an essential part of any marketing plan. </p>
<p>Do you own a neighborhood deli? Use Twitter to find local people talking about where to go for lunch and tell them about your specials.</p>
<p>A bar or restaurant? Connect with people who want to go out on a weekend night and offer them coupons.</p>
<p>How about the local skating rink? Establish a rapport with locally-based skaters, hockey players, roller derby enthusiasts, etc. and entice them to join a team or attend a public session.</p>
<p>The trick is to find people interested in your business or industry, then connect with them to build your customer base. All on a local level. As a local business owner, you wouldn't waste marketing dollars on a TV ad halfway across the country. You're interested in the people of your community. And guess what - they're interested in you, too. All you have to do is open a line of dialogue to pull them in.</p>
<p>The shift from a global to a local mindset in Twitter marketing is in its infancy. However, a company that has realized the importance of this opportunity is <a href="http://tweetmatix.com/?a=z">Tweetmatix.</a> </p>
<p><em>Full disclosure:  I have worked as a consultant with Tweetmatix since its inception.</em></p>
<p>Tweetmatix is a company focused on making Twitter a local resource for small business -- and I have to say, they do it simply and elegantly. Realizing that most people still find Twitter to be a confusing and/or unknown service, Tweetmatix has successfully allowed a straightforward interface to act as an intuitive gateway to the behind-the-scenes power that Twitter has to offer.</p>
<p>It is not a simple-minded, autofollowing service like the many websites which have sprung up across the internet. Rather, Tweetmatix is completely focused on quality connections instead of a high quantity of followers that the other services promote. </p>
<p>The icing on the cake: Tweetmatix does it locally. Something I've yet to see any other service focus upon. </p>
<p>It's the difference between a scalpel and a spoon -- or to put it in marketing terms: This is the difference between running an ad in every newspaper across the country vs. adding a flyer to the neighborhood association welcoming basket. The reach is smaller and more focused. The fact is: People who are too far away from your business will never become your customer anyway, why waste the time and effort? You'll only dilute your message.</p>
<p>When you decide to market your business or group on Twitter, your goal should be to build quality connections to potential customers and maintain brand loyalty within that group. A smaller group who is willing to spend money with you is infinitely more valuable than an enormous group of worldwide followers who will never spend a penny on your products.</p>
<p>I'm excited for this shift towards local Twitter marketing. Actually -- more to the point -- I'm excited to see the shift <em>away</em> from spam-based marketing. I really believe in the power of Twitter; I just don't want to see that value go down the toilet as Twitter users pull away from the service on account of spam. Quality over quantity will help all legitimate marketing interests thrive well into the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robobrien.com/twitter-localization-a-small-business-dream-come-true/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Compound Assignment Operators in ColdFusion</title>
		<link>http://blog.robobrien.com/compound-assignment-operators-in-coldfusion/</link>
		<comments>http://blog.robobrien.com/compound-assignment-operators-in-coldfusion/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 15:45:20 +0000</pubDate>
		<dc:creator>Rob  O&#39;Brien</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://blog.robobrien.com/?p=131</guid>
		<description><![CDATA[As the ColdFusion community gears up for the release of ColdFusion 9, I'd like to take a step back for a moment to reflect on a great addition to CF 8 that probably gets overlooked quite a bit, since it's not a feature that would draw a lot of attention. Enter: Compound Assignment Operators! oooOOoooo... [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.robobrien.com%2Fcompound-assignment-operators-in-coldfusion%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.robobrien.com%2Fcompound-assignment-operators-in-coldfusion%2F&amp;source=RobOBrien&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>As the ColdFusion community gears up for the release of <a href="http://labs.adobe.com/technologies/coldfusion9/" target="_blank">ColdFusion 9</a>, I'd like to take a step back for a moment to reflect on a great addition to CF 8 that probably gets overlooked quite a bit, since it's not a feature that would draw a lot of attention. </p>
<h1>Enter: Compound Assignment Operators!</h1>
<p>oooOOoooo... sexy, right?</p>
<p>A little history... Back in the day when I was cutting my teeth on C programming, I was able to manipulate variables with a few shorthand strokes of the keyboard. It was easy; it was elegant. To accomplish the same tasks in CF, I needed to be redundant in my typing. I hated it.</p>
<p>Then, as I was preparing a new write-up in my <a href="http://blog.robobrien.com/tag/udf/">UDF Series</a>, I realized that I used a compound operator in the function. I started to explain what it was all about and how/why to modify the function if you're still using releases prior to CF8. But, I also realized that I'm long-winded. That means that my explanation turned into a full-blown rant, worthy of its own post. So, here we are.</p>
<h1>Examples</h1>
<p>Let's dig right into some examples to help understand where we were before compound operators. </p>
<p>Here's an example of incrementing a value in CF7 (using cfscript):</p>
<div class="CodeBlock"><pre class="c">&nbsp;
myValue = myValue + <span style="color: #cc66cc;">5</span>;
&nbsp;</pre></div>
<p>...or like this (using tags):</p>
<div class="CodeBlock"><pre class="cfm">&nbsp;
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> myValue <span style="color: #0000FF">=</span> myValue + <span style="color: #FF0000;">5</span>&gt;</span>
&nbsp;</pre></div>
<p>To accomplish the same task in C (and most other languages):</p>
<div class="CodeBlock"><pre class="c">&nbsp;
myValue += <span style="color: #cc66cc;">5</span>;
&nbsp;</pre></div>
<p>The difference should be pretty obvious. The C style is clean, simple and elegant. CF7 is redundant.</p>
<p>Now, I'll admit that my code isn't always the cleanest or most elegant. But, it really bummed me out that I was required to type the variable name twice in ColdFusion. It may not seem like a big deal, but it all adds up over time when you consider all of the code that you output in a day... a month... a career.</p>
<p>Then comes CF8 and the world (or maybe just me) rejoices!</p>
<h1>How it Works</h1>
<p>Using a compound operator is so simple that it may not be immediately clear what's happening. In this example, we're using the compound operator "+="  to perform two concurrent actions on <i>myValue</i>; both the + and the =. It's nicely explained by Adobe this way: <i>"The variable on the right is used as both an element in the expression and the result variable. Thus, the expression a += b is equivalent to a = a +b."</i> [<a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Expressions_03.html" target="_blank">source</a>]</p>
<p>Now that we've learned a new trick, we can use it in CF8+ like this:</p>
<div class="CodeBlock"><pre class="cfm">&nbsp;
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> myValue +<span style="color: #0000FF">=</span> <span style="color: #FF0000;">5</span>&gt;</span>
&nbsp;</pre></div>
<p>Ahhh... that's reeeeal nice!</p>
<p>Note that I did use the compound operator in a tag. I've seen 2 other blog posts that explicitly state that you can use these operators <i>only</i> in &lt;cfscript&gt;. I'm not sure if they're outdated or just incorrect, but you can definitely use compound operators within tags. Of course, use within &lt;cfscript&gt; works as well.</p>
<h1>Other Operators</h1>
<p>In addition to, well, addition... you can also subtract (-=), multiply (*=), and divide (/=). You can also use it for modulus (%=) and concatenation of strings (&=). There's also incrementing & decrementing by 1 (++ and --). That's pretty spiffy.</p>
<p>You should check out the <a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Expressions_03.html" target="_blank">Adobe LiveDocs</a> for a full explanation.</p>
<h1>Bottom Line</h1>
<p>The addition of Compound Operators brings CF inline with more traditional syntax of other languages. I was glad to discover it in CF8 and I'm hoping to spread the word to anyone who hasn't discovered this little gem.</p>
<h1>Has this solution saved you time?</h1>
<p>I'm a firm believer in sharing knowledge for the sake of helping someone else. No strings attached. However, we all have bills to pay and hosting to maintain. If you feel like this post has saved you even an hour of development time, would you consider donating that hour to me?</p>
<div style="text-align: center; margin-bottom: 30px;">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="7224945" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" />
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.robobrien.com/compound-assignment-operators-in-coldfusion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>UDF Series: LastDayOfMonth()</title>
		<link>http://blog.robobrien.com/udf-series-lastdayofmonth/</link>
		<comments>http://blog.robobrien.com/udf-series-lastdayofmonth/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 17:49:53 +0000</pubDate>
		<dc:creator>Rob  O&#39;Brien</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[UDF]]></category>

		<guid isPermaLink="false">http://blog.robobrien.com/?p=106</guid>
		<description><![CDATA[Starting today and continuing sporadically, I will release some of my UDF library to the public. None of it is ultimately earth-shattering nor are all of them unique (CFLib.org is a great collection), but I realized that I do have some decent functions or variations of existing functions that could be helpful to other developers. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.robobrien.com%2Fudf-series-lastdayofmonth%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.robobrien.com%2Fudf-series-lastdayofmonth%2F&amp;source=RobOBrien&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Starting today and continuing sporadically, I will release some of my UDF library to the public. None of it is ultimately earth-shattering nor are all of them unique (<a href="http://cflib.org/" target="_blank">CFLib.org</a> is a great collection), but I realized that I do have some decent functions or variations of existing functions that could be helpful to other developers.</p>
<p>To start things off, here's a very simple function that will return the last day of any given month. It's easy, straightforward and very useful. I'm surprised that it's not directly included in CF.</p>
<div class="CodeBlock"><pre class="cfm">&nbsp;
<span style="color: #333333;"><span style="color: #990000;">&lt;cffunction</span> <span style="color: #0000FF;">name</span>=<span style="color: #009900;">&quot;LastDayOfMonth&quot;</span> <span style="color: #0000FF">access</span>=<span style="color: #009900;">&quot;public&quot;</span> returntype=<span style="color: #009900;">&quot;date&quot;</span><span style="color: #990000;">&gt;</span></span>
	<span style="color: #333333;"><span style="color: #990000;">&lt;cfargument</span> <span style="color: #0000FF;">name</span>=<span style="color: #009900;">&quot;Date&quot;</span> <span style="color: #0000FF;">type</span>=<span style="color: #009900;">&quot;date&quot;</span> <span style="color: #0000FF">required</span>=<span style="color: #009900;">&quot;yes&quot;</span><span style="color: #990000;">&gt;</span></span>
	<span style="color: #333333;"><span style="color: #990000;">&lt;cfreturn</span> <span style="color: #0000FF;">CreateDate</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">year</span><span style="color: #0000FF;">&#40;</span>Arguments.Date<span style="color: #0000FF;">&#41;</span>,<span style="color: #0000FF;">month</span><span style="color: #0000FF;">&#40;</span>Arguments.Date<span style="color: #0000FF;">&#41;</span>,<span style="color: #0000FF;">DaysInMonth</span><span style="color: #0000FF;">&#40;</span>Arguments.Date<span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #990000;">&lt;/cffunction&gt;</span></span>
&nbsp;</pre></div>
<p>In order to use it, just pass in any valid date value:</p>
<div class="CodeBlock"><pre class="cfm">&nbsp;
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> LastDay <span style="color: #0000FF">=</span> LastDayOfMonth<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">now</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> LastDay <span style="color: #0000FF">=</span> LastDayOfMonth<span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;3/17/2009&quot;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> LastDay <span style="color: #0000FF">=</span> LastDayOfMonth<span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;March 17, 2009&quot;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
&nbsp;</pre></div>
<p>And you'll get a nice and tidy date value back:</p>
<div class="CodeBlock"><pre class="cfm">&nbsp;
{ts '2009-03-31 00:00:00'}
&nbsp;</pre></div>
<p>That's all there is to it. Like I said, nothing earth-shattering. Hopefully just helpful knowledge.</p>
<h1>Has this solution saved you time?</h1>
<p>I'm a firm believer in sharing knowledge for the sake of helping someone else. No strings attached. However, we all have bills to pay and hosting to maintain. If you feel like this post has saved you even an hour of development time, would you consider donating that hour to me?</p>
<div style="text-align: center; margin-bottom: 30px;">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="7224945" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" />
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.robobrien.com/udf-series-lastdayofmonth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is Twitter Down?</title>
		<link>http://blog.robobrien.com/is-twitter-down/</link>
		<comments>http://blog.robobrien.com/is-twitter-down/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 13:40:31 +0000</pubDate>
		<dc:creator>Rob  O&#39;Brien</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://blog.robobrien.com/?p=85</guid>
		<description><![CDATA[As I was developing more Twitter features for app's integration this morning, my requests suddenly stopped responding. I thought to myself, "Crap, did I hit my rate limit again?" and "Did I get my IP blacklisted?" But, then I realized what was going on... Twitter is down! I found a great site. I presume it [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.robobrien.com%2Fis-twitter-down%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.robobrien.com%2Fis-twitter-down%2F&amp;source=RobOBrien&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>As I was developing more Twitter features for app's integration this morning, my requests suddenly stopped responding. I thought to myself, "Crap, did I hit my rate limit again?" and "Did I get my IP blacklisted?" But, then I realized what was going on... Twitter is down!</p>
<p>I found a great site. I presume it checks Twitter's status in real time: <a href="http://istwitterdown.com/">IsTwitterDown.com</a> Another great tool (for all websites) is <a href="http://isthisdown.com/">IsThisSiteDown.com</a></p>
<p>Twitter's own <a href="http://status.twitter.com/">status page</a> shows that it's up. Lame.</p>
<p>What I think is most interesting about today's outage is the perception of feeling lost -- or maybe more appropriately, disconnected. Yes, I was in the middle of developing features that required Twitter's participation, but I there was still a sense of "I want to talk about Twitter being down, but where? Twitter is down!" It really made me realize that there's nothing that even closely compares to Twitter. Not for real-time communication en masse.</p>
<p>Twitter: Please don't go away again. You complete me.</p>
<p>UPDATE: What's even more interesting is that Facebook also seems to be having difficulties this morning. I wonder if it's an influx of traffic from would-be Twitter users.</p>
<p>UPDATE #2: There was mention of AT&T having issues today as well. I do have UVerse internet service and an iPhone, but I'm not sure what any problems I encountered were ISP-related. Can anyone confirm AT&T troubles?</p>
<p>UPDATE #3: I'm sure everyone knows by now, but Twitter is reporting a DOS attack. By the way, Chuck Norris doesn't have to attack you, his thoughts give you Denial-of-Sanity and you attack yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robobrien.com/is-twitter-down/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating Twitter and OAuth with ColdFusion</title>
		<link>http://blog.robobrien.com/integrating-twitter-and-oauth-with-coldfusion/</link>
		<comments>http://blog.robobrien.com/integrating-twitter-and-oauth-with-coldfusion/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 22:07:18 +0000</pubDate>
		<dc:creator>Rob  O&#39;Brien</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[Twitter4J]]></category>

		<guid isPermaLink="false">http://blog.robobrien.com/?p=7</guid>
		<description><![CDATA[Update: This article was written in 2009 and Twitter4J has significantly changed since that time. Several visitors have said that the instructions here do not reflect the most recent method names in Twitter4J. It seems that the newest version -- 2.2.x -- is incompatible with 2.1.x. You can view the official version logs for more [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.robobrien.com%2Fintegrating-twitter-and-oauth-with-coldfusion%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.robobrien.com%2Fintegrating-twitter-and-oauth-with-coldfusion%2F&amp;source=RobOBrien&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div id="update" style="border: 1px solid red;background-color: pink;padding: 12px;margin-bottom: 10px;width: 540px;">
<strong>Update:</strong> This article was written in 2009 and Twitter4J has significantly changed since that time. Several visitors have said that the instructions here do not reflect the most recent method names in Twitter4J. It seems that the newest version -- 2.2.x -- is incompatible with 2.1.x. You can view the <a href="http://twitter4j.org/en/versions.html" target="_blank">official version logs</a> for more info.
<div style="margin-top: 10px;">I hope to find time to update this article in the near future. Until then, I believe the <strong>process</strong> described in the article is still valid.</div>
</div>
<h1>Adventures of Twitter Integration</h1>
<p>So, it turns out that the timing of my new blog couldn't be better. I actually have something valuable to share!</p>
<p>Recently, I was tasked with integrating Twitter into a website that I work on (<a href="http://www.rinktime.com/" target="_blank">RinkTime.com</a>). I initially thought it would be a piece of cake because there's always another developer out there who has shared code for a similar concept. Imagine my surprise (and ultimately, frustration) when there wasn't any example or even good documentation to learn from.</p>
<p>Well, I finally figured it out and now I'd like to share my knowledge with the ColdFusion community.</p>
<p><span id="more-7"></span></p>
<h1>The Goal</h1>
<p>My goal was to integrate Twitter using ColdFusion and the <a href="http://oauth.net/">OAuth</a> protocol. Twitter has said that they want to switch over to OAuth in the future, so I want to develop my app in a way that won't be obsolete 6 months or a year down the road. Plus, I won't have to deal with the security of users' login credentials.</p>
<p>My first stop was the <a href="http://apiwiki.twitter.com/Libraries#Coldfusion" target="_blank">Twitter API wiki</a>, which has a couple ColdFusion libraries for the Twitter API, but neither takes advantage of OAuth. I bet they're both great solutions, but the lack of OAuth was a deal breaker for me.</p>
<p>Then I found <a href="http://yusuke.homeip.net/twitter4j/en/index.html" target="_blank">Twitter4J</a> by <a href="http://twitter.com/yusukeyamamoto" target="_blank">Yusuke Yamamoto</a>. It's a Java solution with OAuth support. Score!</p>
<h1>The Authentication Process</h1>
<p>This is where I had the most trouble. I just couldn't seem to get a straight answer on the step-by-step details for the authentication process. It's actually pretty straightforward -- if it's laid out nicely. Luckily, that's exactly what I've done here:</p>
<ol>
<li>Within the application, generate a Request Token and a Request Secret.</li>
<li>Using Twitter's authorization URL, you send the user to Twitter's website so that the user can Allow or Deny access to your application.</li>
<li>Presuming the user allows access, they are then redirected back to your application based upon the Callback URL you specify when registering with Twitter.</li>
<li>Once the user is back on your site, you have to swap out the Request Tokens for Access Tokens. This is the magic step where you finally gain access to the user's Twitter account.</li>
<li>Store the Access Tokens for future use however you'd like -- I store them in a database. They never expire, although they can be rejected in the future if the user chooses, so make sure you do your error checking.</li>
<li>Each time you want to access the user's account, you pull out the Access Tokens and go to town.</li>
</ol>
<p>Of course, there's a lot more that goes on behind-the-scenes, but for the scope of this write-up, that's all we really need to know.</p>
<h1>The Solution</h1>
<ol>
<li>Register your application with Twitter <a href="http://twitter.com/oauth_clients/">here</a> and keep the Consumer Key &amp; Secret values handy.</li>
<li>Download <a href="http://yusuke.homeip.net/twitter4j/en/index.html">Twitter4J</a></li>
<li> Install the JAR file in ColdFusion. You'll want to place it in an existing Class Path (like "C:\ColdFusion8\lib\") or you can set up a new Class Path in "CF Admin &gt; Server Settings &gt; Java and JVM". Then restart CF.</li>
<li>Create the Java object in your application with the Twitter values from Step 1:
<div class="CodeBlock"><pre class="cfm">&nbsp;
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> Twitter <span style="color: #0000FF">=</span> <span style="color: #0000FF;">createObject</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;java&quot;</span>, <span style="color: #009900;">&quot;twitter4j.Twitter&quot;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> Twitter.setOAuthConsumer<span style="color: #0000FF;">&#40;</span>TwitterConsumerKey,TwitterConsumerSecret<span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
&nbsp;</pre></div>
</li>
<li>Now we start the authentication process, which is where things get fun. First, we generate our Request tokens to send to Twitter. We have to save the Request Token and Request Secret values for later use when the user is transferred back to the application. I've chosen to do so in Session variables, but this can be accomplished however you'd prefer.
<div class="CodeBlock"><pre class="cfm">&nbsp;
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> RequestToken <span style="color: #0000FF">=</span> Twitter.getOAuthRequestToken<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> Session.oAuthRequestToken <span style="color: #0000FF">=</span> RequestToken.<span style="color: #0000FF;">getToken</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> Session.oAuthRequestTokenSecret <span style="color: #0000FF">=</span> RequestToken.getTokenSecret<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #990000;">&lt;cflocation</span> url=<span style="color: #009900;">&quot;#RequestToken.getAuthorizationURL()#&quot;</span> addtoken=<span style="color: #009900;">&quot;No&quot;</span><span style="color: #990000;">&gt;</span></span>
&nbsp;</pre></div>
</li>
<li>At this point, the user is on Twitter's site and have the opportunity to Allow or Deny access.</li>
<li>After Allowing access, the user is transferred back to your site and you exchange the Request Tokens for Access Tokens:
<div class="CodeBlock"><pre class="cfm">&nbsp;
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> AccessToken <span style="color: #0000FF">=</span> Twitter.getOAuthAccessToken<span style="color: #0000FF;">&#40;</span>Session.oAuthRequestToken,Session.oAuthRequestTokenSecret<span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #808080; font-style: italic; background-color:#FFFF99;">&lt;!--- Store the Access Tokens, via: AccessToken.getToken() and AccessToken.getTokenSecret() ---&gt;</span></span>
&nbsp;</pre></div>
</li>
<li>Now, with Access Tokens in hand, you have full access to the account.
<p style="margin-top: 10px;"><em>Update: The Authorization process (4-7 above) is only required once per user in order to obtain the user's unique Access Tokens. Only Step 9 needs to be executed each time you want to access the account.</em></p>
</li>
<li>Finally, to use your new powers, you only have to instantiate the Twitter object,  load up a users Access Tokens, and then have fun with all of the methods Twitter4J offers.
<div class="CodeBlock"><pre class="cfm">&nbsp;
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> Twitter <span style="color: #0000FF">=</span> <span style="color: #0000FF;">createObject</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;java&quot;</span>, <span style="color: #009900;">&quot;twitter4j.Twitter&quot;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> Twitter.setOAuthConsumer<span style="color: #0000FF;">&#40;</span>TwitterConsumerKey,TwitterConsumerSecret<span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> Twitter.setOAuthAccessToken<span style="color: #0000FF;">&#40;</span>StoredAccessToken,StoredAccessSecret<span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> Twitter.updateStatus<span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;My first custom Twitter update! Thanks @RobOBrien!&quot;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span>
&nbsp;</pre></div>
</li>
</ol>
<p>Obviously, this only scratches the surface of what you can do with Twitter4J and how you implement the authorization process. What I've explained is a bare bones solution. I've actually wrapped it up in some CFCs and integrated it into my larger application, but that's up to your own situation and techniques.</p>
<p>I hope that this will help prevent the frustration that I had to endure to get this working. If you have any questions, let me know, but I can't promise any true support on this. I'm just sharing the knowledge.</p>
<p>Many thanks to Yusuke for all the work he's put into this library.</p>
<p>Have fun!</p>
<h1>Has this solution saved you time?</h1>
<p>I'm a firm believer in sharing knowledge for the sake of helping someone else. No strings attached. However, we all have bills to pay and hosting to maintain. If you feel like this post has saved you even an hour of development time, would you consider donating that hour to me?</p>
<div style="text-align: center; margin-bottom: 30px;">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="7224945" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" />
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.robobrien.com/integrating-twitter-and-oauth-with-coldfusion/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
		<item>
		<title>You know what&#8217;s interesting?</title>
		<link>http://blog.robobrien.com/you-know-whats-interesting/</link>
		<comments>http://blog.robobrien.com/you-know-whats-interesting/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 14:37:01 +0000</pubDate>
		<dc:creator>Rob  O&#39;Brien</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://blog.robobrien.com/?p=4</guid>
		<description><![CDATA[Absolutely nothing. No, really... at least not about me. That's why I have never started a blog. However, as of today, I now have my own blog on the internets. I'm doing so primarily to test out new software and stay up-to-date on what other people are using. As a Web Developer, I just can't [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.robobrien.com%2Fyou-know-whats-interesting%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.robobrien.com%2Fyou-know-whats-interesting%2F&amp;source=RobOBrien&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Absolutely nothing.</p>
<p>No, really... at least not about me. That's why I have never started a blog.</p>
<p>However, as of today, I now have my own blog on the <a title="Wikipedia: Internets" href="http://en.wikipedia.org/wiki/Internets" target="_self">internets</a>.  I'm doing so primarily to test out new software and stay up-to-date on what other people are using. As a Web Developer, I just can't afford to fall behind in the latest trends, right? Turning your back on the web for a minute will leave you in the dust!</p>
<p>Regardless, hopefully I'll come up with some random knowledge to share with the world, but the fact of the matter is that I probably won't. I just don't have that much to say.</p>
<p>I'll probably talk about <a href="http://www.adobe.com/products/coldfusion/">ColdFusion</a> Development or maybe even my Travel and Adventure around the country. But, certainty not anything which will be of any interest to anyone but me and (maybe) a few friends.</p>
<p>So, welcome to my blog. It's going to be one heck of a <em>boring</em> ride.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robobrien.com/you-know-whats-interesting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

