<?xml version="1.0" encoding="utf-8"?>

			<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">

			<channel>
			<title>Dan Vega</title>
			<link>http://www.danvega.org/blog</link>
			<description>Dan Vega&apos;s home on the web</description>
			<language>en-us</language>
			<pubDate>Thu, 17 May 2012 03:26:22 -0500</pubDate>
			<lastBuildDate>Fri, 20 Apr 2012 13:24:00 -0500</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>danvega@gmail.com</managingEditor>
			<webMaster>danvega@gmail.com</webMaster>
			<itunes:subtitle></itunes:subtitle>
			<itunes:summary></itunes:summary>
			<itunes:category text="Technology" />
			<itunes:category text="Technology">
				<itunes:category text="Podcasting" />
			</itunes:category>
			<itunes:category text="Technology">
				<itunes:category text="Tech News" />
			</itunes:category>
			<itunes:keywords></itunes:keywords>
			<itunes:author></itunes:author>
			<itunes:owner>
				<itunes:email>danvega@gmail.com</itunes:email>
				<itunes:name></itunes:name>
			</itunes:owner>
			
			<itunes:explicit>no</itunes:explicit>
			
			<item>
				<title>Runners, I need your advice</title>
				<link>http://www.danvega.org/blog/2012/4/20/Runners-I-need-your-advice</link>
				<description>
				
				&lt;p&gt;&lt;img src=&quot;http://www.danvega.org/blog/images/4-20-2012 1-48-47 PM.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I have always loved running but it&apos;s been more of a casual thing until now. This year I plan on kicking up my running game and just last night I recorded my longest non stop run ever of &lt;a href=&quot;http://nikerunning.nike.com/nikeos/p/nikeplus/en_US/plus/?sitesrc=twit_ab_plus#//runs/detail/753336695/421633379/all/allRuns/&amp;ref=http://t.co/eCiFg08c&quot; target=&quot;_blank&quot;&gt;8 Miles&lt;/a&gt;. I have some short term goals and some long term goals that I want to accomplish and to do so I need to start running more often and longer.

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Run a sub 20 5K&lt;/strong&gt; - My personal best is a 21:30 but that was a couple of years ago. I ran a 14:30 2 miler about a month ago so I think this goal can be accomplished with some work.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Run a half Mararthon&lt;/strong&gt; - I am going to sign up for the Akron half marathon in September. I am fairly confident I can do this but i would like to get my pace under 9&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Olympic Triathlon&lt;/strong&gt; 1 Mile Swim / 24 Mile Bike / 6.2 Mile Run in August&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Marathon&lt;/strong&gt; - My ultimate fitness goal is to run a marathon and right now i am shooting for the Cleveland Marathon in 2013. &lt;/li&gt;
&lt;/ul&gt;

&lt;/p&gt;

&lt;p&gt;Right now I run around Lakewood but its apparent after my 8 mile run last night that I may need to find new places for longer runs. I also use my iPod with the &lt;a href=&quot;http://nikeplus.nike.com/plus/products/&quot; target=&quot;_blank&quot;&gt;Nike+&lt;/a&gt; connector and the chip in my shoe. I love this because it constantly gives me feedback on miles,time and pace. I usually just drop my iPod in my pocket and go. I used to have an arm band but it had a plastic cover and it was really hard to use the buttons on it when I started sweating so I gave up on it.&lt;/p&gt;

&lt;p&gt;Now that you know my story this is what I need from you. I will be mixing in a combination of swimming, strength training and biking with my runs so I am curious what type of schedule I should get on. I don&apos;t mind working out 2x a day but somehow I need to get all of this training in.  I also want to find a way to use Spotify. I use it on my iPhone while I am in the gym but its just too bulky to run with. I could get an arm band but does anyone have a recommendation of one that fits good and doesn&apos;t have a plastic cover? The other problem with this is the Nike+ app on the iPhone asks you to choose a playlist on your phone and I would like to use Spotify. Does this mean I will need to move to the Nike+ watch instead of using the app on the phone? &lt;/p&gt;

&lt;p&gt;Thank you to all the runners out there who constantly give me tips and tricks and I look forward to your advice. I think with some hard work I can accomplish these goals and I look forward to the next year of training / events. &lt;/p&gt; 
				</description>
				
				<category>Random</category>
				
				<pubDate>Fri, 20 Apr 2012 13:24:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/4/20/Runners-I-need-your-advice</guid>
				
				
			</item>
			
			<item>
				<title>Tail files with PowerShell</title>
				<link>http://www.danvega.org/blog/2012/4/17/Tail-files-with-PowerShell</link>
				<description>
				
				&lt;p&gt;PowerShell is a pretty useful shell when you start learning what it can do. I have been using it a lot more lately and I want to show you a couple of tips for reading in files. The &lt;a href=&quot;http://technet.microsoft.com/en-us/library/dd347719.aspx&quot; target=&quot;_blank&quot;&gt;Get-Content cmdlet&lt;/a&gt; allows us to read in the contents of a file.

&lt;textarea class=&quot;brush: text&quot;&gt;
Get-Content &quot;path-to-file&quot; 
&lt;/textarea&gt;

You can also use the alias gc and just the file name if you are already in that directory. In this example I am already in the ColdFusion logs directory and I want to output the feed log file.

&lt;textarea class=&quot;brush: text&quot;&gt;
gc feed.log
&lt;/textarea&gt;&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.danvega.org/blog/images/4-17-2012 9-15-15 AM1.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;What about larger files? You probably wouldn&apos;t want to output every single line of a very large file. When you read in a file using get content it will actually store it as an array so you could use the array notation below to return the first two lines.

&lt;textarea class=&quot;brush: text&quot;&gt;
(gc feed.log)[0..1]
&lt;/textarea&gt;

An easier way to do this though is using the total count parameter. 

&lt;textarea class=&quot;brush: text&quot;&gt;
gc feed.log -totalcount 2
&lt;/textarea&gt;

Because get content returns an object you can use the &lt;a href=&quot;http://technet.microsoft.com/en-us/library/dd315291.aspx&quot; target=&quot;_blank&quot;&gt;Select-Object cmdlet&lt;/a&gt; to grab the last n number of records. 

&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
gc feed.log | Select-Object -last 1
&lt;/textarea&gt;
&lt;/p&gt;

&lt;p&gt;So these are a couple of useful things we can do while reading in files in PowerShell. The point of this post was to show you how to Tail a file so let&apos;s get back on track. The tail command is a useful Unix command that allows you to watch a file in real time. This is especially useful when you are monitoring log files. You can accomplish this using PowerShell pretty easily using the Wait parameter. 

&lt;textarea class=&quot;brush: text&quot;&gt;
gc feed.log -Wait
&lt;/textarea&gt;

Now PowerShell will display the lines of this file as they get added. Pretty useful and easy to do!
&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://www.danvega.org/blog/images/4-17-2012 9-29-31 AM.png&quot; /&gt;&lt;/p&gt; 
				</description>
				
				<category>Random</category>
				
				<pubDate>Tue, 17 Apr 2012 09:10:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/4/17/Tail-files-with-PowerShell</guid>
				
				
			</item>
			
			<item>
				<title>My First Tough Mudder</title>
				<link>http://www.danvega.org/blog/2012/4/16/My-First-Tough-Mudder</link>
				<description>
				
				&lt;p&gt;
&lt;img src=&quot;http://www.danvega.org/blog/images/toughmudder_main.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;About two and half months ago a friend told me about this event called the Tough Mudder. I was intrigued and  intimidated so I decided to look into it. The &lt;a href=&quot;http://toughmudder.com/&quot; target=&quot;_blank&quot;&gt;Tough Mudder&lt;/a&gt; website describes the event as

&lt;blockquote&gt;Tough Mudder events are hardcore 10-12 mile obstacle courses designed by British Special Forces to test your all around strength, stamina, mental grit, and camaraderie. With the most innovative courses, half a million inspiring participants, and more than $2 million dollars raised for the Wounded Warrior Project, Tough Mudder is the premier adventure challenge series in the world.&lt;/blockquote&gt;

And here is the official video for the event.&lt;br/&gt;&lt;br/&gt;

&lt;div align=&quot;center&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/vh5HdPM_QuE&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;My initial thoughts were are you freaking nuts, there is no way I am doing that. Then I got to talking to more people and watching some videos and finishing became a real possibility. I was already working out a lot but with no running races in sight I needed something to motivate my workouts. I like to set goals because they help push me in my everyday workouts. I couldn&apos;t think of a bigger goal then finishing this event so I took the plunge and signed up. &lt;/p&gt;  [More]
				</description>
				
				<category>Random</category>
				
				<pubDate>Mon, 16 Apr 2012 09:41:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/4/16/My-First-Tough-Mudder</guid>
				
				
			</item>
			
			<item>
				<title>Looking for a ColdFusion developer in Cleveland</title>
				<link>http://www.danvega.org/blog/2012/4/13/Looking-for-a-ColdFusion-developer-in-Cleveland</link>
				<description>
				
				&lt;p&gt;Yesterday I announced my &lt;a href=&quot;http://www.danvega.org/blog/2012/4/12/I-am-joining-First-Comp&quot; target=&quot;_blank&quot;&gt;plans to join First Comp&lt;/a&gt;. Today I would like to help my current employer fill my position. I really like the people here and the company is doing some great things. This is why I want to help them as much as I can to find my replacement. If you are in the Cleveland area and have the following skill set please contact me. 

&lt;ul&gt;
&lt;li&gt;HTML/CSS/JavaScript - Strong front end development skillset&lt;/li&gt;
&lt;li&gt;ColdFusion&lt;/li&gt;
&lt;li&gt;jQuery&lt;/li&gt;
&lt;/ul&gt;

&lt;/p&gt;

&lt;p&gt;It really is a great place to work for an individual who wants the freedom to take a project from start to finish as they see fit. If you have any questions about the position please let me know. &lt;/p&gt; 
				</description>
				
				<category>Web Development</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Fri, 13 Apr 2012 09:06:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/4/13/Looking-for-a-ColdFusion-developer-in-Cleveland</guid>
				
				
			</item>
			
			<item>
				<title>I am joining First Comp</title>
				<link>http://www.danvega.org/blog/2012/4/12/I-am-joining-First-Comp</link>
				<description>
				
				&lt;p&gt;Today is one of those life changing days that are few and far between. This morning I am sad to announce that I will be leaving my current position of Senior Web Developer at STERIS, effective April 27, 2012. This position was a great learning experience for me and I am grateful for the opportunities I had here. I have made some really great friends here and I am going to miss them more than anything. In the end I really wish things could of been different here.&lt;/p&gt;

&lt;p&gt;As one road ends, another begins. I am happy to announce that I am joining &lt;a href=&quot;https://www.firstcomp.com/firstcomp/&quot; target=&quot;_blank&quot;&gt;First Comp&lt;/a&gt;, based out of Omaha NE. This is an amazing opportunity for me and one in the end that was just too good to pass up. First off I get the chance to remain in Cleveland and work remote. I know anyone outside of Cleveland doesn&apos;t really get it but I love my city. Cleveland is home and some big things are happening here and I am excited for my future here. If you&apos;re ever in town please hit me up so I can show you why it&apos;s so great.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.danvega.org/blog/images/cleveland_blog.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The main reason I took this leap is for the incredible opportunity to grow as a developer. I was never the smartest guy but what I lacked in education I made up for with hard work. I know this sounds strange but when I got a hold of a computer and started looking at code, it&apos;s all I could think of. I told myself that I will be a programmer one day and I like to think I have done pretty well for myself. In all of that though I lost site of the bigger picture. I don&apos;t want this to just be a means to end, I want to become a superstar developer and to do that I have a long road ahead of me. This is why this move made perfect sense for me. I get a chance to work with some really amazing people. Our team will consist of 16 developers, 5 Q&amp;A testers and my bosses boss is former ColdFusion Product Manager, &lt;a href=&quot;http://www.cfinsider.com/&quot; target=&quot;_blank&quot;&gt;Jason Delmore&lt;/a&gt;. Jason and I have become friends over the years but to have him as a resource at work is just going to be awesome. &lt;/p&gt;

&lt;p&gt;In closing I just want to say absolutely blessed I am. We tend to worry about what we don&apos;t have in life to much and today this amazing opportunity has been placed in front of me and I plan on taking full advantage of it. As soon as I get up and running at First Comp I will try and blog about the experience there. We are still looking for more developers so if you want to join one heck of a team visit &lt;a href=&quot;https://careers.firstcomp.com/default.cfm/PID=1.8&quot; target=&quot;_blank&quot;&gt;our careers page.&lt;/a&gt;&lt;/p&gt; 
				</description>
				
				<category>Random</category>
				
				<pubDate>Thu, 12 Apr 2012 11:54:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/4/12/I-am-joining-First-Comp</guid>
				
				
			</item>
			
			<item>
				<title>Hyrule Updates</title>
				<link>http://www.danvega.org/blog/2012/4/10/Hyrule-Updates</link>
				<description>
				
				&lt;p&gt;Thanks to a some contributions from a friend, we will call him Lance, we were able to make some important updates to the project over the last week. If you have never heard of or used &lt;a href=&quot;https://github.com/cfaddict/hyrule&quot; target=&quot;_blank&quot;&gt;Hyrule&lt;/a&gt; please check back soon as I am going to start a new series on using the framework. In the meantime here is a quick intro to the framework.

&lt;blockquote&gt;Hyrule is a validation framework for ColdFusion. Contrary to popular belief it&apos;s not just for ORM (Hibernate) based applications. The Hyrule framework will work with ColdFusion 9+ applications that use a model driven behavior for business objects. All this means is that use a class (component) to describe your objects such as user, person or employee.&lt;br/&gt;&lt;br/&gt;

This framework gives you multiple ways to declare your validation rules or as the framework refers to them, constraints. Once you have defined your constraints you can pass in an object to the framework and it will let you know if it passes validation. This approach gives you a simple way to perform data validation in your object oriented based applications.&lt;br/&gt;&lt;br/&gt;

This framework was created because there was a real need for it. When I started building most of my applications in a model driven form it became clear that there had to be an easier way of validating data. My inspiration was and still is the Hibernate Validator project from the Java community. &lt;/blockquote&gt;
&lt;/p&gt;

&lt;p&gt;Now let&apos;s talk about the changes we made.&lt;br/&gt;&lt;br/&gt;

&lt;strong&gt;Documentation:&lt;/strong&gt; The download now contains the 1st draft of our documentation. While it isn&apos;t perfect I think it&apos;s enough to get you started. If you are just getting stated and find anything in the docs confusing please let me know. If you want to view the &lt;a href=&quot;http://64.244.59.238/hyrule/docs/&quot; target=&quot;_blank&quot;&gt;docs online you can check them out here&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;

&lt;strong&gt;Rule Parser:&lt;/strong&gt; The core rule parsing engine was refactored. This was an important update for us to move forward. The most important change to you is that you no longer need to define a validator for annotation based rules. Annotations, property attributes and the new constraints struct all live in the metadata parser.&lt;br/&gt;&lt;br/&gt;

&lt;strong&gt;Display Name:&lt;/strong&gt; There are times when humanizing the property name (what we do by default) just won&apos;t cut it.  Take for instance a user component that has a variable named ssn. When we display the error to the user we want the property to display as Social Security Number. You can use the displayName attribute to override the default property display name. When the required constraint fails the message will read &quot;The field Social Security Number must contain a value.&quot;

&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
component accessors=&quot;true&quot; {

	property name=&quot;firstname&quot; required=&quot;true&quot;;
	property name=&quot;lastname&quot; required=&quot;true&quot;;
	property name=&quot;ssn&quot; required=&quot;true&quot; isvalid=&quot;ssn&quot; displayname=&quot;Social Security Number&quot;;

}
&lt;/textarea&gt;

&lt;strong&gt;Constraints Struct:&lt;/strong&gt; You can now declare constraints using a constraints struct stored in the this scope of an object.

&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
component accessors=&quot;true&quot; {

	property String firstname;
	property String lastname;
	property String email;
	property String username;
	property String password;

	this.constraints = {
		firstname = {required=true,min=5},
		lastname = {required=true,min=3},
		email = {required=true,type=&quot;email&quot;,unique=true},
		username = {required=true,size=&quot;6..15&quot;,unique=true},
		password = {required=true}
	};

	public User function init(){
		return this;
	}

}
&lt;/textarea&gt;

There are two cons to using this approach. First off any variables stored in the this scope are publically exposed. Second, say we have an employee object that extends our user object above. If we added another struct called constraints it would override the parent objects constraints. To avoid this collision you must define all of the constraints individually in a child object.

&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
/**
 * @accessors true
 * @extends User
 */
component {

	property Numeric salary;

	this.constraints.salary = {required=true};

	public Employee function init(){
		return this;
	}


}
&lt;/textarea&gt;

&lt;strong&gt;IsValid Constraint:&lt;/strong&gt; Instead of adding individual constraints for types like creditcard,email and ssn we implemented a catch all constraint. This will validate any type that the built in isValid() function supports except regex and range, which we already have constraints for. At the property level you must declare this constraint as isValid=&quot;type(ssn,email,etc)&quot; but using the constraints struct you can use the type constraint. This is because a property already has an attribute called type to define its data type.

&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
component accessors=&quot;true&quot; {

	property String fullname;
	property String email;
	property String ssn;
	property String phone;

	this.constraints = {
		fullname = {required=true},
		email = {required=true,type=&quot;email&quot;,unique=true},
		ssn = {required=true,type=&quot;ssn&quot;,unique=true},
		phone = {type=&quot;telephone&quot;}
	};

	public User function init(){
		return this;
	}

}
&lt;/textarea&gt;

&lt;strong&gt;Tests:&lt;/strong&gt; All of the MxUnit tests have been updated and are green across the board. If you ever have questions on how the constraints work this is a good place to look.&lt;br/&gt;&lt;br/&gt;

&lt;strong&gt;Bug Fixes:&lt;/strong&gt; There were a ton of bug fixes and a few other enhancements.
&lt;/p&gt;

&lt;p&gt;I feel really good about where the project is right now. Please grab the source code using the link below and try it out. We could really use your feedback to make this framework better.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/cfaddict/hyrule&quot; target=&quot;_blank&quot;&gt;https://github.com/cfaddict/hyrule&lt;/a&gt;&lt;/p&gt; 
				</description>
				
				<category>Hyrule</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Tue, 10 Apr 2012 08:40:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/4/10/Hyrule-Updates</guid>
				
				
			</item>
			
			<item>
				<title>Writing efficient code</title>
				<link>http://www.danvega.org/blog/2012/3/29/Writing-efficient-code</link>
				<description>
				
				&lt;p&gt;What is efficient code? 

&lt;blockquote&gt;Efficient: Achieving maximum productivity with minimum wasted effort or expense.&lt;/blockquote&gt;

In some instances this means writing less code but but that&apos;s not always the case. When we first start off as eager programmers (and wanna be hackers) our goal is simply to get something to work. As we gain experience we start to recognize patterns and problems that we have encountered before. With this experience we should have a understanding of how to better solve a problem. This is where refactoring comes into play and has become one of the greatest tools I have. The reason I bring this up is because I was writing some jQuery today and came across a problem that I would have solved differently even 3 years ago. I would like to share this example with you.
&lt;/p&gt;

&lt;p&gt;I have 2 select boxes that are not related to each other in any way. I do want to force the user to select something from the 1st drop down before a choice from the 2nd one can be made. I have decided to disable the 2nd drop down so that when the page loads they can&apos;t interact with it.

&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
&lt;div class=&quot;control-group&quot;&gt;
	&lt;label class=&quot;control-label&quot; for=&quot;devicetype&quot;&gt;Device Type&lt;/label&gt;
	&lt;div class=&quot;controls&quot;&gt;
		&lt;select id=&quot;devicetype&quot; name=&quot;devicetype&quot;&gt;
			&lt;option value=&quot;&quot; selected&gt;Select Device Type&lt;/option&gt;
			&lt;option value=&quot;Cart Washer&quot;&gt;Cart Washer&lt;/option&gt;	
		&lt;/select&gt;
	&lt;/div&gt;
&lt;/div&gt;			
&lt;div class=&quot;control-group&quot;&gt;
	&lt;label class=&quot;control-label&quot; for=&quot;devicetype&quot;&gt;Sample Type&lt;/label&gt;
	&lt;div class=&quot;controls&quot;&gt;
		&lt;select id=&quot;sampletype&quot; name=&quot;sampletype&quot; disabled&gt;
			&lt;option value=&quot;&quot; selected&gt;Select Sample Type&lt;/option&gt;
			&lt;option value=&quot;Water&quot;&gt;Water&lt;/option&gt;						
		&lt;/select&gt;
	&lt;/div&gt;
&lt;/div&gt;
&lt;/textarea&gt;

When the user selects an item from the first drop down and that items value is not empty (default) we will enable the drop down. If we add a change handler to the first drop down we should be able to accomplish this. 

&lt;textarea class=&quot;brush: javascript&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(function(){

	$(&quot;#devicetype&quot;).change(function(){
		var device = $(this).val();

		if( device == &quot;&quot; ){
			$(&quot;#sampletype&quot;).attr(&quot;disabled&quot;,true);				
		} else {
			$(&quot;#sampletype&quot;).attr(&quot;disabled&quot;,false);
		}

	});

});
&lt;/script&gt;
&lt;/textarea&gt;

First we grab the value of the first drop down and if its not empty we enable the second drop down. If the second drop down is enabled and for whatever reason select the default (Select Device Type) then we need to disable the second drop down. Here in lies another problem, If I disable the second drop down I would like to revert to its default state. Now I could set the value of the drop to empty which will accomplish this. 

&lt;textarea class=&quot;brush: javascript&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(function(){

	$(&quot;#devicetype&quot;).change(function(){
		var device = $(this).val();

		if( device == &quot;&quot; ){
			$(&quot;#sampletype&quot;).val(&quot;&quot;);
			$(&quot;#sampletype&quot;).attr(&quot;disabled&quot;,true);
							
		} else {
			$(&quot;#sampletype&quot;).attr(&quot;disabled&quot;,false);
		}

	});

});
&lt;/script&gt;
&lt;/textarea&gt;
&lt;/p&gt;

&lt;p&gt;This would of been my thinking 3 years ago but wiser Dan knows there is a better way to accomplish the same task. The disabled attribute of our second drop down is tied to the state of the first drop down. What we can do is use that state, in the form of a ternary operator to make our &quot;if&quot; decision for us. We can also chain our methods and set the value of this drop down to empty. 

&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(function(){
	$(&quot;#devicetype&quot;).change(function(){
		var device = $(this).val();

		$(&quot;#sampletype&quot;)
			.val(&quot;&quot;)
			.attr(&quot;disabled&quot;,device == &quot;&quot; ? true : false);
	});
});
&lt;/script&gt;
&lt;/textarea&gt;
&lt;/p&gt;

&lt;p&gt;I know this is a fairly small example of writing efficient code but we could write a book on this subject (many have). Next time you are looking at a problem no matter how small or trivial just ask yourself if there is a better solution to your problem. If there is you will be doing your future self a big favor!

&lt;/p&gt; 
				</description>
				
				<category>jQuery</category>
				
				<category>Web Development</category>
				
				<pubDate>Thu, 29 Mar 2012 12:14:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/3/29/Writing-efficient-code</guid>
				
				
			</item>
			
			<item>
				<title>Component output script vs tags</title>
				<link>http://www.danvega.org/blog/2012/3/29/Component-output-script-vs-tags</link>
				<description>
				
				&lt;p&gt;There was a discussion about output in a component &lt;a href=&quot;http://www.bennadel.com/blog/2354-ColdFusion-10-Script-vs-Tags-And-My-Coding-Methodology.htm&quot; target=&quot;_blank&quot;&gt;yesterday on a post by Ben Nadel&lt;/a&gt;. I thought I would take a chance to clear this up today because even after a comment I left on the post I was a little bit confused.&lt;/p&gt;

&lt;p&gt;Long before ColdFusion 9 and script components were available to us (CF8) we wrote all of our business logic in tag based components. You might have a person service component that looked something like this.


&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
&lt;cfcomponent&gt;

	&lt;cffunction name=&quot;init&quot; access=&quot;public&quot; returntype=&quot;PersonService&quot;&gt;
		&lt;cfreturn this&gt;
	&lt;/cffunction&gt;

	&lt;cffunction name=&quot;sayHello&quot; access=&quot;public&quot; returntype=&quot;string&quot;&gt;
		&lt;cfargument name=&quot;fullname&quot; type=&quot;string&quot; required=&quot;true&quot;/&gt;
		&lt;cfset var msg = &quot;Hello &quot; &amp; arguments.fullname&gt;
		&lt;cfreturn msg&gt;
	&lt;/cffunction&gt;

&lt;/cfcomponent&gt;
&lt;/textarea&gt;

We were always taught that best practice was to set output = false for both the component and the function. This is because the generated content can produce unwanted white space. It may not seem like a big deal but extra white space can cause file sizes to be larger and even create problems in the case where functions need to generate content. 
&lt;/p&gt;

&lt;p&gt;So now that we are using script components do we still need to tell our functions and components to suppress white space? 

&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
component {

	public UserService function init(){
		return this;
	}

	public String function sayHello(String fullname){
		return &quot;Hello &quot; &amp; arguments.fullname;
	}

}
&lt;/textarea&gt;

The answer is no. By default a script component will not generate any white space. It will however generate any content you wish to display. So if you explicitly tell it to output content it will. 

&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
component {

	public UserService function init(){
		return this;
	}

	public void function sayHello(String fullname){
		writeOutput(&quot;Hello &quot; &amp; arguments.fullname);
	}

}
&lt;/textarea&gt;

Of course if you don&apos;t want any output you can set output = false on the function above it will suppress all output. 
&lt;/p&gt; 
				</description>
				
				<category>ColdFusion</category>
				
				<pubDate>Thu, 29 Mar 2012 08:23:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/3/29/Component-output-script-vs-tags</guid>
				
				
			</item>
			
			<item>
				<title>Testing REST Services in Chrome</title>
				<link>http://www.danvega.org/blog/2012/3/1/Testing-REST-Services-in-Chrome</link>
				<description>
				
				&lt;p&gt;I was &lt;a href=&quot;http://www.danvega.org/blog/2012/2/29/Help-with-calling-a-rest-webservice&quot;&gt;having some issues&lt;/a&gt; yesterday implementing a rest service. At the end of the day I learned a valuable lesson that will stick with me going forward and one that I would like to share with you today. If you need to write code against 3rd party APIs do yourself a favor and test them first. There is no point in writing code and trying to figure out if there is something wrong on your end until you know the service is working as you expect it to.&lt;/p&gt;

&lt;p&gt;A friend at work pointed me to an application called REST Console that you can find in the Chrome Web Store. I use Chrome all the time so this was a perfect fit. Once you install it you can setup your web service with options for everything from data attributes to custom headers. When the service is ready to go you can perform your operation (GET/POST/PUT/DELETE) and view the response in a number of formats. Now that I know the service is working as it should I can feel confident writing code against it. Here is a quick screenshot of the service i tested along with the response.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.danvega.org/blog/images/rest_console.jpg&quot; /&gt;&lt;/p&gt; 
				</description>
				
				<category>Web Development</category>
				
				<pubDate>Thu, 01 Mar 2012 08:18:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/3/1/Testing-REST-Services-in-Chrome</guid>
				
				
			</item>
			
			<item>
				<title>Coldbox Bootstrap Starter Template</title>
				<link>http://www.danvega.org/blog/2012/2/29/Coldbox-Bootstrap-Starter-Template</link>
				<description>
				
				&lt;p&gt;Most of my new applications these days are built using &lt;a href=&quot;http://coldbox.org/&quot; target=&quot;_blank&quot;&gt;ColdBox&lt;/a&gt; and &lt;a href=&quot;http://twitter.github.com/bootstrap/&quot; target=&quot;_blank&quot;&gt;Bootstrap&lt;/a&gt;. Whenever I start a new project I take some time to customize Coldbox to my liking that included converting the components to script and setting up the layouts &amp; views using Bootstrap. I decided to create a starter template so I would no longer have to do this. If you use &lt;a href=&quot;http://coldbox.org/download/extras&quot; target=&quot;_blank&quot;&gt;Coldbox Platform Utilities&lt;/a&gt; for ColdFusion Builder you can just drop this in your Application Templates folder and it will be an option when creating a new project. If not, just copy all of the files to your new project template. When you fire up the project you should have something that looks like this. This is just a very basic starter template and I would love this just to be the starting point. Please provide any feedback so we can make improvements to this application template.&lt;/p&gt;

&lt;p&gt;
&lt;img src=&quot;http://www.danvega.org/blog/images/cb-bootstrap-template.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You can download the template at &lt;a href=&quot;https://github.com/cfaddict/cb-bootstrap&quot;&gt;https://github.com/cfaddict/cb-bootstrap&lt;/a&gt;&lt;/p&gt; 
				</description>
				
				<category>ColdBox</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Wed, 29 Feb 2012 08:49:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/2/29/Coldbox-Bootstrap-Starter-Template</guid>
				
				
			</item>
			
			<item>
				<title>Help with calling a rest webservice</title>
				<link>http://www.danvega.org/blog/2012/2/29/Help-with-calling-a-rest-webservice</link>
				<description>
				
				&lt;p&gt;I am currently working on implementing &lt;a href=&quot;http://api7.publicaster.com/Default.aspx&quot; target=&quot;_blank&quot;&gt;a new rest service&lt;/a&gt; and I am having some issues. In the following example I am performing a basic GET operation to return a count of lists that I have in my account. 

&lt;textarea class=&quot;brush: coldfusion&quot;&gt;
&lt;cfscript&gt;
   
   subscriber = {
      editLink = &quot;null&quot;,
      Item = {
         Data = [
            {
             Key = &quot;FullName&quot;,
             Value = &quot;Dan Vega&quot;
            },
            {
             Key = &quot;Facility&quot;,
             Value = &quot;Mentor&quot;  
            },
            {
             Key = &quot;MailingAddress&quot;,
             Value = &quot;1234 Main Street&quot;  
            },
            { 
             Key = &quot;Title&quot;,
             Value = &quot;Senior Web Developer&quot;  
            },
            {
             Key = &quot;PhoneNumber&quot;,
             Value = &quot;2165551212&quot;  
            }
         ],
         DateCreated = now(),
         Email = &quot;danvega@awesomeemail.com&quot;,
         GlobalStatus = 1,
         LastModified = now(),
         ListStatus = 2
      }
   };

   _http = new Http(url=&quot;http://api7.publicaster.com/Rest/ListCount.svc/&quot;,method=&quot;GET&quot;);
   _http.setUsername(&quot;myusername&quot;);
   _http.setPassword(&quot;mypassword&quot;);

   result = _http.send().getPrefix();

   writeDump(result);

&lt;/cfscript&gt;
&lt;/textarea&gt;

However when I run this example I get an immediate 401.
&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://www.danvega.org/blog/images/401_restws.png&quot;  width=&quot;625&quot;/&gt;&lt;/p&gt;

&lt;p&gt;If you &lt;a href=&quot;http://api7.publicaster.com/restdocs/Default.aspx&quot; target=&quot;_blank&quot;&gt;take a look at the docs&lt;/a&gt; it states the following

&lt;blockquote&gt;Authentication occurs through the HTTP Authorization header. Every call must have this header with the value in the following format: &lt;strong&gt;AccountID:Password&lt;/strong&gt;&lt;/blockquote&gt;
I am guessing that during basic authentication ColdFusion passes the username:password in this format but I am just not seeing it in any of the headers so I am not sure what is going on. I also tried to manually set the header using cfhttpparam with the same result. What am I missing here? 
&lt;/p&gt; 
				</description>
				
				<category>ColdFusion</category>
				
				<pubDate>Wed, 29 Feb 2012 08:28:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2012/2/29/Help-with-calling-a-rest-webservice</guid>
				
				
			</item>
			
			<item>
				<title>ColdFusion Position here in North East Ohio</title>
				<link>http://www.danvega.org/blog/2011/12/1/ColdFusion-Position-here-in-North-East-Ohio</link>
				<description>
				
				&lt;p&gt;A position opened up at a company that I used to work for. The position description is below and if you have any questions about the company please feel free to ask.&lt;/p&gt;

&lt;p&gt;&lt;blockquote&gt;The successful candidate will be an experienced ColdFusion programmer skilled in new application development and in supporting existing ColdFusion applications.  The selected candidate will work directly with clients gaining an understanding of their needs, translating those needs into functional requirements, documenting said requirements, and building ColdFusion applications that meet the identified needs. 

Four years of work experience designing, building, and administering strategic or high volume ColdFusion web applications for diverse audiences is preferred.  Must be experienced with standard web technologies (HTML, CSS, and JavaScript) and have experience in using AJAX and jQuery.  
 
Must have solid experience in designing database tables and efficient SQL queries.  Must possess strong verbal and written communication skills and have the ability to communicate effectively with both technical staff and non-technical personnel.  Qualified candidates should be self-motivated, capable of working independently and in a collaborative environment.

Salary and benefits will be commensurate with candidate&apos;s qualifications ranging between $50,000 and $80,000.  Screening of applicants will begin immediately and will continue until the position is filled. To apply online, please email jobs@letternine.net.&lt;/blockquote&gt;&lt;/p&gt; 
				</description>
				
				<category>ColdFusion</category>
				
				<pubDate>Thu, 01 Dec 2011 08:34:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2011/12/1/ColdFusion-Position-here-in-North-East-Ohio</guid>
				
				
			</item>
			
			<item>
				<title>Getting the public IP address of a visitor</title>
				<link>http://www.danvega.org/blog/2011/11/11/Getting-the-public-IP-address-of-a-visitor</link>
				<description>
				
				&lt;p&gt;I know this may seem like a pretty easy question but I have yet to find the answer. I am working on a project at work where we have 2 sets of data and only certain visitors can see certain data. We have 1 set of data that can only be shown to users visiting from the United States and the other from anyone outside of the US. &lt;/p&gt;

&lt;p&gt;I have &lt;a href=&quot;http://www.danvega.org/blog/2011/10/5/Quova-GEO-Location-ColdFusion-Example&quot; target=&quot;_blank&quot;&gt;already found a way&lt;/a&gt; to get country data based on the visitors ip address. The real trick here is provided the service with the users IP address. I know your probably thinking to yourself that is easy, but I am having trouble over here. If you use web server variable cgi.remote_addr you will get the correct address &lt;strong&gt;most&lt;/strong&gt; of the time. In my case though many of our internal visitors are under the umbrella of our proxy server. This means that when I use cgi.remote_addr it actually retuns an internal address. &lt;/p&gt;

&lt;p&gt;My question to all of my smart readers is, What are my options. I have the backing of my server admin so he can help me out in anyway I need but this is new territory for me. Any guidance you can provide is much appreciated. &lt;/p&gt; 
				</description>
				
				<category>Web Development</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Fri, 11 Nov 2011 08:09:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2011/11/11/Getting-the-public-IP-address-of-a-visitor</guid>
				
				
			</item>
			
			<item>
				<title>Getting started with Mura CMS</title>
				<link>http://www.danvega.org/blog/2011/11/8/Getting-started-with-Mura-CMS</link>
				<description>
				
				&lt;p&gt;it really has never been easier to get started with &lt;a href=&quot;http://www.getmura.com/&quot; target=&quot;_blank&quot;&gt;Mura CMS&lt;/a&gt;. In fact I am going to show you how to get started today without ever visiting the Mura website or setting up a database &amp; datasource.&lt;/p&gt;

&lt;p&gt;To get started using my method you need to be running ColdFusion Builder. This is because we are going to look at a cool extension for Builder called &lt;a href=&quot;http://muratools.com/&quot; target=&quot;_blank&quot;&gt;Mura Tools&lt;/a&gt;. This extension allows you to download the latest version of Mura right into your project. The plugin also offers options for creating and building Mura plugins. To get started &lt;a href=&quot;http://wiki.slantsoft.com/display/MT/Installing+Mura+Tools+for+Eclipse&quot; target=&quot;_blank&quot;&gt;follow the instructions&lt;/a&gt; for installing Mura Tools using their update site. When you have it installed simply right click on a project and select Mura CMS --&gt; New Mura Install. When the dialog box comes up simply hit finish and the latest version of Mura will be installed, how easy was that? &lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://www.danvega.org/blog/images/mura_tools2.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Next you need to navigate to the project, in my case I have a project on my local machine called muratest so I simply went to http://localhost/muratest. When Mura loads up for the first time you will see a page like the one below. Now it use to be that you had to create a datasource + database and enter that information here but now you no longer have to do that. If you select auto create and enter your admin api password Mura can auto create the database + datasource for you. In the example I created I had the lastest version of Mura installed, a datasource + database created for me and the Mura install finished all under a minute. Now that is impressive! &lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://www.danvega.org/blog/images/mura_install.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You have no excuses now. It is about time you give Mura a test drive and see for yourself why it is the best ColdFusion based CMS around. Actually its just an awesome CMS regarding what language it is built on. I have a ton of clients and coworkers who absolutely love the platform. Now go manage some content ;D&lt;/p&gt; 
				</description>
				
				<category>Mura CMS</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Tue, 08 Nov 2011 21:45:36 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2011/11/8/Getting-started-with-Mura-CMS</guid>
				
				
			</item>
			
			<item>
				<title>Node.js and you</title>
				<link>http://www.danvega.org/blog/2011/11/8/Nodejs-and-you</link>
				<description>
				
				&lt;p&gt;Node.js is the hottest thing the tech world has had to talk about this year. In case you didn&apos;t know, Node.js is a server platform for application development that makes building high-availability APIs and real-time applications really simple. And the best news is that you code for it with JavaScript. In this session, learn what Node.js is and what it means to use a nonblocking infrastructure. We&apos;ll talk about why JavaScript is well suited to this kind of environment, and then we&apos;ll show how to leverage Node.js to build applications for the browser, mobile, and beyond.&lt;/p&gt;

&lt;p align=&quot;center&quot;&gt;&lt;iframe title=&quot;AdobeTV Video Player&quot; width=&quot;480&quot; height=&quot;296&quot; src=&quot;http://tv.adobe.com/embed/803/11242/&quot; frameborder=&quot;0&quot; allowfullscreen scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;&lt;/p&gt; 
				</description>
				
				<category>TV Tuesday</category>
				
				<pubDate>Tue, 08 Nov 2011 16:23:00 -0500</pubDate>
				<guid>http://www.danvega.org/blog/2011/11/8/Nodejs-and-you</guid>
				
				
			</item>
			</channel></rss>
