<?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>AriasAmp</title>
	<atom:link href="http://www.ariasamp.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ariasamp.net</link>
	<description>Brent Arias chanting about software development...</description>
	<lastBuildDate>Mon, 23 Apr 2012 10:35:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>A New Adventure in The Great Recession</title>
		<link>http://www.ariasamp.net/2012/03/a-new-adventure-in-the-great-recession/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-new-adventure-in-the-great-recession</link>
		<comments>http://www.ariasamp.net/2012/03/a-new-adventure-in-the-great-recession/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 09:22:44 +0000</pubDate>
		<dc:creator>Brent Arias</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.ariasamp.net/?p=257</guid>
		<description><![CDATA[The Gig is Up! So far I&#8217;ve spent half my career consulting, and half as a permanent employee. As I look back I can&#8217;t help notice how I&#8217;ve faired better as a consultant. The Great Recession led me into FTE, as I felt a permanent position would provide better security. However, I eventually woke up [...]]]></description>
			<content:encoded><![CDATA[<h3>The Gig is Up!</h3>
<p>So far I&#8217;ve spent half my career consulting, and half as a permanent employee. As I look back I can&#8217;t help notice how I&#8217;ve faired better as a consultant.</p>
<p>The Great Recession led me into FTE, as I felt a permanent position would provide better security. However, I eventually woke up and realized that full-time work had continued to be no safer than contracting, and often was much less rewarding. This is what has inspired my transition back into consulting, despite the continued recession.</p>
<p>So I&#8217;ve begun a new adventure. It goes like this: American Express bought a company called Serve Enterprise (SE). Contrary to the Amex IT strategy, Serve is Microsoft stack. Amex wanted to ensure the success of their new investment, and so they had Microsoft consulting brought on board to provide guidance. In turn Microsoft had provided some of its own staff, as well as 3rd party consultants. This is where I step in.</p>
<p>Thus I&#8217;ve joined the Amex/MS platform software architecture group, where I provide guidance on ASP.NET MVC3 and devops. I&#8217;m travelling 100% between Phoenix, my home, and St. Petersburg Florida (with an occasional trip to Manhatten). I take non-stop flights both ways, on Sunday evening and Thursday evening.</p>
<p>The work and the team are fantastic. I couldn&#8217;t have hoped for better.</p>
<h3>Maximizing Return</h3>
<p>In a corp-to-corp engagement like this, it is typical for consultants to add $25/hour to the overall hourly rate to cover the three major expenses of air-fare, lodging, and auto-rental.  Of course it is a shame to see that money spent that way, and I was determined to do something about it.  To put this in rocket-science terms, I keep the money I don&#8217;t spend.</p>
<p>Part of my adventure has been exploring my cost-savings options.  Other than purchasing air-fare 3 weeks out, there is nothing I can do to reduce that cost.  That leaves lodging and auto-rental.  The hotel used by some of the other consultants is $180/night, and even if they obtain the American Express corporate rate at $120/night for four nights a week, it still means about $2000/month.   Worse than this, I have recently taken on a new self-imposed diet that requires I greatly reduce eating out;  I can&#8217;t prepare meals in a hotel room.</p>
<p>My next stop was to consider Extended Stay hotels.  I found the best deal in the St. Petersburg area (Clearwater to be precise).  At $300/week it was at a sweet spot for quality and price.  Unfortunately it is 10 miles from the downtown office where I work, which means I&#8217;m footing a $200 to $260 rental car each week.</p>
<p>I then decided to be more creative.  I looked into being a room-mate in a home or condo.  My first stop was roommate.com.  It is a great web site, and I didn&#8217;t mind the modest subscription fee.  However, what I foud is that far too few home-owners know about roommate.com.  Rather, craigslist was a firehose of opportunity.  More than half of the offerings included furnishings (bed, dresser, etc.).  In a single evening I located three condo owners all in walking distance to both my work and groceries.  All three had pictures showing a beautiful residence.</p>
<p>This was my ticket.  As a roomie, I&#8217;ve reduced my monthly lodging and auto expenses from about $2500/month down to $700/month.</p>
<p>If you are reading this and are thinking of doing the same thing, my advice is to seek a place to be a room-mate after you have already started your new engagement.  This means you should start your engagement living at an Extended Stay hotel.  Assume you will need to stay there for about two weeks.  When you search craigslist for rooming opportunities, hold out for best!  There is no need to stay in a home that feels wrong, or is distant from your work place.  There are fresh postings on craiglist each day; It will take you very little time to find something awesome!  If you do room somewhere that is not in walking distance of work, at least be sure it has walking-access to suitable public transit.</p>
<h3>Keeping It Fresh</h3>
<p>Life is what happens while you make other plans.  This is one reason I so welcome all this change in my life.  I&#8217;m travelling to new places, having new experiences, and meeting new people.  To the reader, my suggestion is not to wait-out the Great Recession.  Make your move now, to live your life now.  You won&#8217;t regret it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ariasamp.net/2012/03/a-new-adventure-in-the-great-recession/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Orchard CMS Screencasts!!!</title>
		<link>http://www.ariasamp.net/2012/03/new-orchard-cms-screencast/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=new-orchard-cms-screencast</link>
		<comments>http://www.ariasamp.net/2012/03/new-orchard-cms-screencast/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 05:41:24 +0000</pubDate>
		<dc:creator>Brent Arias</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Orchard CMS]]></category>

		<guid isPermaLink="false">http://www.ariasamp.net/?p=230</guid>
		<description><![CDATA[I&#8217;ve finally completed my screen-cast &#8220;jump start&#8221; demonstration of the Orchard CMS. The four part series can be viewed on youtube: Orchard CMS Jump Start Part 1 Orchard CMS Jump Start Part 2 Orchard CMS Jump Start Part 3 Orchard CMS Jump Start Part 4 I made these videos for two reasons. First, it is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally completed my screen-cast &#8220;jump start&#8221; demonstration of the Orchard CMS.  The four part series can be viewed on youtube:</p>
<ul type="disc">
<li><a href="http://www.youtube.com/watch?v=vFC0pmmxdzM">Orchard CMS Jump Start Part 1</a></li>
<li><a href="http://www.youtube.com/watch?v=IvGXCUpvbr4">Orchard CMS Jump Start Part 2</a></li>
<li><a href="http://www.youtube.com/watch?v=3ZyY_W6KUQc">Orchard CMS Jump Start Part 3</a></li>
<li><a href="http://www.youtube.com/watch?v=IOQ3Llu9Rcc">Orchard CMS Jump Start Part 4</a></li>
</ul>
<p>I made these videos for two reasons.  First, it is somewhat a sales-pitch for the work place.   You know, try to get your employer hooked!  Second, I wanted to give back to the community; I saw a need for a mid-level overview for technical types new to Orchard.  After watching these videos, the uninitiated should quickly be able to understand most any subsequent documentation they encounter.</p>
<p>Speaking of which, I want to take this time to indicate what I think are the best pieces of documentation available for Orchard.  Obviously the <a href="http://docs.orchardproject.net/">Orchard site official documentation</a> is a primary place to get started.  However, for technical types, there are two other sources that I can&#8217;t recommend highly enough:</p>
<ul type="disc">
<li><a href="http://msdn.microsoft.com/en-us/magazine/hh708754.aspx">Orchard Extensibility</a>: An MSDN article that      introduces the modular architecture of Orchard.  Particularly useful if you already have      an ASP.NET MVC background.</li>
<li><a href="http://skywalkersoftwaredevelopment.net/blog/writing-an-orchard-webshop-module-from-scratch-part-1">Writing an Orchard Webshop      Module from Scratch</a>: This incredible 15 part series is an absolute must read.  Perhaps the best way to become an      Orchard developer over-night.</li>
</ul>
<p>After watching my screencasts, be sure to immerse yourself in the above links.  And speaking of my screencasts&#8230;</p>
<h3>The Good, the Bad, and the Funny.</h3>
<p><strong>Funny</strong>: Sometime after I made the material for part 1, I noticed that my demo restaurant &#8220;Cowboy Ciao,&#8221; was misspelled.  It is a real restaurant, which I highly recommend, in downtown Scottsdale.  But the demo incorrectly captured its name as &#8220;Cowbory Ciao.&#8221;  I keep picturing Jackie Chan helping me with pronunciation.  I quietly fixed this typo in the later videos.  Adding insult to injury, I stated in the video that it is in downtown Phoenix, rather than Scottsdale.  I hope I don&#8217;t get sued for being geographically challenged.</p>
<p><strong>Bad</strong>: My videos are based on Orchard 1.3.10, and I released them precisely when Orchard 1.4.0 was released.  DOH!   The good news is that I don&#8217;t believe 1.4.0 changed anything about what I had demonstrated in the videos.</p>
<p><strong>Good</strong>: Another coincidence.  I demonstrated how to use rule-tokens in the context of comments notification, and at the same time Bertrand blogged <a href="http://weblogs.asp.net/bleroy/archive/2012/03/01/my-orchard-comment-notification-rule.aspx">comment related tokens</a> in greater depth.  A nice one-two punch.</p>
<p><strong>Good</strong>: While I was making the demo for comment notification rules, I <a href="http://orchard.codeplex.com/discussions/346778">found a bug</a> which the Orchard team dispatched effortlessly.  Orchard 1.4.0 was given the fix just before its release date, and I think 1.3.10 may have been given it as well.</p>
<p>Ok, enough talk.  Get thee to youtube, watch my videos, and get to know Orchard!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ariasamp.net/2012/03/new-orchard-cms-screencast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>setAttribute Bug</title>
		<link>http://www.ariasamp.net/2012/02/setattribute-bug/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setattribute-bug</link>
		<comments>http://www.ariasamp.net/2012/02/setattribute-bug/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 15:09:30 +0000</pubDate>
		<dc:creator>Brent Arias</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.ariasamp.net/?p=235</guid>
		<description><![CDATA[The book &#8220;Javascript: The Definitive Guide&#8221; says &#8220;these methods (getAttribute and setAttribute) use standard attribute names, even when those names are reserved words in JavaScript&#8221; (6th edition, p 376).  But as it turns out, this is incorrect where IE7 is concerned. To demonstrate this, consider the code below. If you can access &#8220;compatibility mode&#8221; of IE, [...]]]></description>
			<content:encoded><![CDATA[<p>The book &#8220;Javascript: The Definitive Guide&#8221; says &#8220;these methods (getAttribute and setAttribute) use standard attribute names, even when those names are reserved words in JavaScript&#8221; (6th edition, p 376).  But as it turns out, this is incorrect where IE7 is concerned.</p>
<p>To demonstrate this, consider the code below.  If you can access &#8220;compatibility mode&#8221; of IE, notice that the &#8220;one two three&#8221; result stacks horizontally in IE with compatibility mode off, but stacks vertically in IE with compatibility on (e.g. imitating IE 7).</p>
<p><iframe style="width: 100%; height: 200px; border: 1px solid; padding-bottom: 3px;" src="http://jsfiddle.net/Mystagogue/EkERc/1/embedded/" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
<p>To work around this issue, without requiring jquery, simply replace the setAttribute call with a direct assignment to the predefined &#8220;className&#8221; attribute.</p>
<p>You can try this solution by editing the code above (hit the plus symbol in the top right corner).  Just uncomment the &#8220;className&#8221; assignment line, and comment the setAttribute line.  Then toggle compatibility mode again &#8211; the horizontal format then becomes consistent!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ariasamp.net/2012/02/setattribute-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Acquitting setInterval</title>
		<link>http://www.ariasamp.net/2012/02/acquitting-setinterval/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=acquitting-setinterval</link>
		<comments>http://www.ariasamp.net/2012/02/acquitting-setinterval/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 00:15:56 +0000</pubDate>
		<dc:creator>Brent Arias</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.ariasamp.net/?p=218</guid>
		<description><![CDATA[A co-worker spotted me using setInterval in my Javascript, and sent a link explaining why to avoid setInterval.  In summary, the reasons: If the termination token is lost, it is not possible to stop the repeated invocation. Multiple setInterval configurations, if you have them, are difficult to debug. My co-worker added a third reason: re-entrancy [...]]]></description>
			<content:encoded><![CDATA[<p>A co-worker spotted me using setInterval in my Javascript, and sent a link explaining why to <a href="http://weblogs.asp.net/bleroy/archive/2009/05/14/setinterval-is-moderately-evil.aspx">avoid setInterval</a>.  In summary, the reasons:</p>
<ul type="disc">
<li>If the termination token is      lost, it is not possible to stop the repeated invocation.</li>
<li>Multiple setInterval      configurations, if you have them, are difficult to debug.</li>
</ul>
<p>My co-worker added a third reason: re-entrancy issues.  &#8220;What happens,&#8221; he asks &#8220;if the callback does not complete before the next appointed interval?&#8221;</p>
<p>What is being suggested by these arguments, is that I should use a &#8220;self-renewing&#8221;  setTimeout instead of setInterval.</p>
<p>Well, I disagree with the rationale.  Answering the objections in reverse order…</p>
<p>The Javascript execution environment in the browser is single-threaded.  Both setTimeout and setInterval are implemented as events placed on an event loop.  Thus there is no re-entrancy issue to worry about.</p>
<p>Otherwise, I believe the remaining &#8220;manageability&#8221; objections are handled simply by encapsulating setInterval code within an object.  Below is an example of a count-down clock, where setInterval can&#8217;t lose its termination token, and can be stopped or started as needed.</p>
<pre class="crayon-plain-tag"><code>&quot;use strict&quot;;

function CountDown(TargetID, TargetDate, DisplayFormat, FinishMessage, CountActive) {
    if (!(this instanceof CountDown))
        return new CountDown(); 
    this.TargetID = TargetID || &quot;cntdwn&quot;;
    this.CountStepper = -1;
    this.CountActive = CountActive || true;
    this.FinishMessage = FinishMessage || &quot;It is finally here!&quot;;
    this.TargetDate = TargetDate || &quot;12/31/2020 5:00 AM&quot;;
    this.DisplayFormat = DisplayFormat || &quot;%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.&quot;;
    this.LeadingZero = true;
}

CountDown.prototype = {
    constructor: CountDown,

    start: function () {
        var SetTimeOutPeriod = (Math.abs(this.CountStepper) - 1) * 1000 + 990;

        var dthen = new Date(this.TargetDate);
        var dnow = new Date();
        var ddiff = 0;
        if (this.CountStepper &gt; 0) {
            ddiff = dnow - dthen;
        } else {
            ddiff = dthen - dnow;
        }
        this.gsecs = Math.floor(ddiff / 1000);

        var me = this;
        this.Terminate = setInterval(function () { me.countBack() }, SetTimeOutPeriod);
    },

    stop: function () {
        setInterval(this.Terminate, 0);
    },

    countBack: function () {
        this.gsecs += this.CountStepper;
        var secs = this.gsecs;
        if (secs &lt; 0) {
            document.getElementById(this.TargetID).innerHTML = this.FinishMessage;
            clearInterval(this.Terminate);
            return;
        }
        var format = this.DisplayFormat.replace(/%%D%%/g, this.calcAge(secs, 86400, 100000));
        format = format.replace(/%%H%%/g, this.calcAge(secs, 3600, 24));
        format = format.replace(/%%M%%/g, this.calcAge(secs, 60, 60));
        format = format.replace(/%%S%%/g, this.calcAge(secs, 1, 60));

        document.getElementById(this.TargetID).innerHTML = format;
    },

    calcAge: function (secs, num1, num2) {
        var s = ((Math.floor(secs / num1)) % num2).toString();
        if (this.LeadingZero &amp;&amp; s.length &lt; 2) {
            s = &quot;0&quot; + s;
        }
        return &quot;&lt;b&gt;&quot; + s + &quot;&lt;/b&gt;&quot;;
    }
}</code></pre><p>As seen in the object literal assignment to the prototype of CountDown, the termination token is wrapped behind start() and stop() methods.  And within start(), an interesting bit of indirection is used to establish the setInterval callback:</p>
<pre class="crayon-plain-tag"><code>var me = this;
        this.Terminate = setInterval(function () { me.countBack() }, SetTimeOutPeriod);</code></pre>
<p>This looks funny simply because we need a parameter, the &#8216;this&#8217; reference, to be passed to the countBack callback.  Unfortunately, the setInterval call can&#8217;t take explicit parameters in IE8 or earlier, so the parameters must either be fed into a string or represented with a closure.  The string solution is, generally, a very bad idea.  The closure approach requires an anonymous function, which will hold the &#8216;this&#8217; value.  Even so, &#8216;this&#8217; can&#8217;t be captured by a closure the way one might expect; &#8216;this&#8217; always represents the caller.  So the code above cheats by feeding the temp variable &#8216;me&#8217; to the anonymous function.</p>
<p>All is well that is encapsulated well!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ariasamp.net/2012/02/acquitting-setinterval/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

