<?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>Karoshi Ethos &#187; jon</title>
	<atom:link href="http://karoshiethos.com/author/jon/feed/" rel="self" type="application/rss+xml" />
	<link>http://karoshiethos.com</link>
	<description>Navigating the treacherous waters of interactive technology</description>
	<lastBuildDate>Fri, 11 May 2012 20:46:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Hacking Code Assist in Aptana 3 (JavaScript)</title>
		<link>http://karoshiethos.com/2012/05/11/hacking-code-assist-in-aptana-3-javascript/</link>
		<comments>http://karoshiethos.com/2012/05/11/hacking-code-assist-in-aptana-3-javascript/#comments</comments>
		<pubDate>Fri, 11 May 2012 20:35:32 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Things that are broken]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=636</guid>
		<description><![CDATA[I wanted to share some quick notes on how to get JavaScript code assist "working" under the latest version of Aptana Studio. Note: As far as I can tell, this feature is very buggy, and as such, YMMV. There are three features that I find particularly desirable: Jump-to-definition: A Command-Click opens the file to the [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to share some quick notes on how to get JavaScript code assist "working" under the latest version of Aptana Studio.</p>
<p><emphasis>Note: As far as I can tell, this feature is very buggy, and as such, YMMV.</emphasis></p>
<p>There are three features that I find particularly desirable:</p>
<ul  style="clear: both">
<li>Jump-to-definition: A Command-Click opens the file to the location where the highlighted function (etc) is defined. Probably the most important / useful.</li>
<li>Code-completion: a drop-down of possible entries appears as you type / upon pressing Control-Space.</li>
<li>Code-hints: Class constructor and method signatures appear as you type / upon mouse hover, displaying helpful information about method signatures & parameters.</li>
</ul>
<p>Sounds pretty awesome, huh? Too bad it doesn't work as advertised. Let's talk about <a href="http://karoshiethos.com/category/things-that-are-broken/" title="Things That Are Broken">what's busted</a>.</p>
<ul>
<li>
The SDocGen tool only seems to catch classes that are defined globally, so if you're organizing your functions (as you should) into requirejs define calls (for instance), your comments won't get picked up.
</li>
<li>
Using a @return tag inside a constructor function will seem to work ok, but it tramples the class's method definitions, so I avoid it in that context. The same @return tag inside method functions doesn't seem to have this issue.
</li>
<li>
The opening documentation tag is "/**" (Note: that's 2 asterisks). The closing documentation tag is "*/". Nothing else seems to work.
</li>
<li>
I've seen code hints (eg for google maps) that seemed to work using the object-literal syntax. I never got this to work. Lucky for me, I don't define my classes that way.
</li>
</ul>
<p>That first bullet is nearly impossible to work around, and I eventually quit trying. Instead, I hacked around it by appending the following structure to the <strong>bottom</strong> of my file:</p>
<pre>
if (false)
{
  MyClass = function (xyz)
  {
    /**
      Documentation here
      @param {String} xyz This text appears as a hint while you enter the xyz parameter
    */
  }

  MyClass.prototype.method = function ()
  {
    /**
      Method documentation here
      @return {Number}
    */
  }
}
</pre>
<p>Unfortunately, that means repeating yourself a bit, but everything seems to work. The "if (false)" pattern keeps this code from executing at runtime, but SDocGen will pick up your comments for documentation. When you Command-click (I'm on OS X) a class or method name in your code, it will jump to the <emphasis>first</emphasis> occurrence in the definition file, ie the correct one. Provided you're defining one class per file, you shouldn't have any collisions. </p>
<p>I discovered that a limited set of HTML tags are supported. I've had success with UL/LI, STRONG, EMPHASIS, BR,  TABLE/TR/TD. I was even able to get a simple style-sheet to work, but that was nearly useless. The only thing that worked reliably was colors, and it was necessary to omit the '#' from my hexadecimal colors. HTML did <emphasis>not</emphasis> work for method-parameter pop-up help. I'll probably avoid this feature for now.</p>
<p><a href="https://github.com/aptana/sdocgen/" title="SDocGen on Github" target="_blank">SDocGen is available on github</a>; maybe someone can fix it? </p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2012/05/11/hacking-code-assist-in-aptana-3-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HTML5 Portfolio Project &#8211; Part 4</title>
		<link>http://karoshiethos.com/2012/05/03/html5-portfolio-project-part-4/</link>
		<comments>http://karoshiethos.com/2012/05/03/html5-portfolio-project-part-4/#comments</comments>
		<pubDate>Thu, 03 May 2012 14:59:20 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=616</guid>
		<description><![CDATA[I'm structuring the project folder like this: /portfolio /deploy /css /img /icons /link.png /video.png /pic.png /js /framework /lib /jquery.js /background.png /index.html /contact /thumb.png /bio_contact.html /projects /project1 /thumb.png /video.html /description.html /project2 /thumb.png /video.html /description.html /src /project1 /video /notes If your information architecture is tight, you'll likely see echoes of your file hierarchy in your data hierarchy [...]]]></description>
			<content:encoded><![CDATA[<p>I'm structuring the project folder like this:</p>
<pre class="syntax brush-sh" style="clear:both;">
/portfolio
  /deploy
    /css
    /img
      /icons
        /link.png
        /video.png
        /pic.png
    /js
      /framework
      /lib
        /jquery.js 

    /background.png
    /index.html

    /contact
      /thumb.png
      /bio_contact.html
    /projects
      /project1
        /thumb.png
        /video.html
        /description.html
      /project2
        /thumb.png
        /video.html
        /description.html

  /src
    /project1
      /video

  /notes
</pre>
<p>If your information architecture is tight, you'll likely see echoes of your file hierarchy in your data hierarchy and echoes from both in your code's object hierarchy. Guess that means we're going to need some code then.</p>
<h2>Stay Tuned:</h2>
<p>In the next installment, we're going to spend a little time playing with jQuery-based animation so that we're comfortable with it before trying to integrate the effect into the site itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2012/05/03/html5-portfolio-project-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 Portfolio Project &#8211; Part 3</title>
		<link>http://karoshiethos.com/2012/05/03/html5-portfolio-project-part-3/</link>
		<comments>http://karoshiethos.com/2012/05/03/html5-portfolio-project-part-3/#comments</comments>
		<pubDate>Thu, 03 May 2012 14:51:58 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=613</guid>
		<description><![CDATA[Don Your Project Manager Hat A week with no updates?! ... And things are about to get more busy, not less. Plus, upon reviewing the project plan, I noticed an omission: there's no specific line item for the mask transition. It seemed so obvious, I neglected to capture it in the schedule. I'm adding 3 [...]]]></description>
			<content:encoded><![CDATA[<h2>Don Your Project Manager Hat</h2>
<p>A week with no updates?! ... And things are about to get <i>more</i> busy, not less.</p>
<p>Plus, upon reviewing the project plan, I noticed an omission: there's no specific line item for the mask transition. It seemed so obvious, I neglected to capture it in the schedule. I'm adding 3 hours to account for it (new total: 44 hrs).</p>
<h2>Ok, To Work Then</h2>
<p>Last time, I talked a bit about the data model. Since then, I've thought of some improvements. Just because the Flash version worked a certain way doesn't mean I shouldn't re-evaluate my assumptions.</p>
<p>First, the home screen ought to be treated as a node. It has a url and graphical content, just like the portfolio pieces. It's button-ness behaves a little differently, and it's sized larger, but we should be able to abstract away the differences. In theory, it would be nice to allow unlimited node nesting. This would allow projects to have sub-projects (for example) and enable a lot more organizational flexibility, extending the useful lifetime of the site. We'll see if we can squeeze it in. (<a href="http://lmgtfy.com/?q=YAGNI" title="YAGNI">Google: YAGNI</a>)</p>
<pre class="syntax brush-js">
[
  {
    &quot;url&quot;         : &quot;/&quot;,
    &quot;title&quot;       : &quot;shovemedia portfolio 2012&quot;,
    &quot;content&quot;     : &quot;homepage.html&quot;,
    &quot;sections&quot;     : [
          {
            &quot;url&quot;         : &quot;contact&quot;,
            &quot;client&quot;      : &quot;Email:&lt;br /&gt;jon@shovemedia.com&quot;,
            &quot;title&quot;       : &quot;contact info&quot;,
            &quot;date&quot;        : &quot;01/01/2011&quot;,
            &quot;role&quot;        : &quot;developer&quot;,
            &quot;link&quot;        : &quot;mailto:jon@shovemedia.com?subject=New Business&quot;,
            &quot;thumbnail&quot;   : &quot;thumbnails/email.jpg&quot;,
            &quot;content&quot;     : &quot;contact.html&quot;
          },
          {
            &quot;url&quot;         : &quot;3D&quot;,
            &quot;client&quot;      : &quot;Photobiz&quot;,
            &quot;title&quot;       : &quot;3D Templates&quot;,
            &quot;date&quot;        : &quot;01/01/2011&quot;,
            &quot;role&quot;        : &quot;developer&quot;,
            &quot;link&quot;        : &quot;http://photobiz.com&quot;,
            &quot;thumbnail&quot;   : &quot;thumbnails/3d-templates.jpg&quot;,
            &quot;sections&quot;        : [
                    {
                      &quot;url&quot;     : &quot;video&quot;,
                      &quot;title&quot;   : &quot;watch!&quot;,
                      &quot;icon&quot;    : &quot;video&quot;,
                      &quot;content&quot; : &quot;papervision/videoPlayer.html&quot;
                    },
                    {
                      &quot;url&quot;     : &quot;image1&quot;,
                      &quot;title&quot;   : &quot;Image 1&quot;,
                      &quot;icon&quot;    : &quot;pic&quot;,
                      &quot;content&quot; : &quot;papervision/image1.jpg&quot;
                    },
                    {
                      &quot;url&quot;     : &quot;description&quot;,
                      &quot;icon&quot;    : &quot;description&quot;,
                      &quot;content&quot; : &quot;papervision/description.html&quot;,
                    }
                  ]
          }
        ]
  }
]
</pre>
<p>Don't get lost in the braces. Deeper nesting is a necessary evil, I think. Otherwise, I'm going to end up with redundant references to "link" all the flattened elements.</p>
<p>I've also changed some of my naming conventions. Each nodes stores its child nodes in an Array called "sections".</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2012/05/03/html5-portfolio-project-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 Portfolio Project &#8211; Part 2</title>
		<link>http://karoshiethos.com/2012/04/24/html5-portfolio-project-part-2/</link>
		<comments>http://karoshiethos.com/2012/04/24/html5-portfolio-project-part-2/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 01:30:23 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=593</guid>
		<description><![CDATA[Jump to Part 1 here. Today, we're going to define the data format for our portfolio. Back in 2005, XML was the last data format we were ever going to need, so that's what I used. It must have been second-to-last, because today, everyone seems to prefer JSON. I'm more than happy to commiserate about [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://karoshiethos.com/2012/04/23/html5_portfolio_p1/" title="HTML5 Portfolio Project - Part 1">Jump to Part 1 here.</a></p>
<p>Today, we're going to define the data format for our portfolio. Back in 2005, XML was the last data format we were ever going to need, so that's what I used. It must have been second-to-last, because today, everyone seems to prefer JSON. I'm more than happy to commiserate about the pros and cons over beers sometime, but I've moved on. We're doing this in JSON. Afterall, the portfolio is going to be driven by JavaScript; I doubt much justification is warranted.</p>
<h2>Don Your Information Architect Hat</h2>
<p>A portfolio is a list of projects. Each project has a bunch of properties like a title and a URL. Each project will also have some media (like pictures and/or video) and a brief, text-based description.</p>
<p>Here's what I came up with originally:</p>
<ul>
<li>client - eg. Microsoft</li>
<li>title - eg. Micro-site</li>
<li>description - eg. "Lorem ipsum..."</li>
<li>date - eg. January 2011</li>
<li>role - eg. developer</li>
<li>link - eg. http://microsoft.com/someMicroSite
<li>thumbnail - eg. thumbnails/3d-templates.jpg</li>
<li>media - eg. microsite/image1.jpg, microsite/image2.jpg, microsite/image3.jpg, microsite/video.mov</li>
</ul>
<p>All fairly straight-forward, I hope.</p>
<p>I did over-simplify the items in the media section. In order to make this work, we need to know a little more than just what URL has the media.</p>
<ul>
<li>title - eg. Image 1</li>
<li>icon type - eg. pic / video</li>
<li>content - eg. microsite/image1.jpg</li>
</ul>
<p>Turning all of this into JSON should be easy. First, double-check to make sure our names make sense and are consistent. ... Then, we need to decide whether it makes sense to encode items with more than one value as an Array or as an Object (hash). There are two spots in this project where this comes into play. One should be obvious. Can you spot the second?</p>
<ol>
<li>The list of projects</li>
<li>The list of media belonging to each project</li>
</ol>
<p>Above all else, it pays to be consistent. The two items above are similar enough that, whether we choose to store them in an Array or an Object, we'll probably want to use the same approach for both.</p>
<h3>Array is Best</h3>
<p>You'll want to use an Array when you have a list of things and their order matters. We want to display projects in a specific order, so let's use an Array. That was easy! Wait...</p>
<h3>No, Object is Best</h3>
<p>You want to use an Object when you have a list of things and the order doesn't necessarily matter, and each item can be identified by some sort of unique key. An Array (a type of Object afterall) often does this automatically. It uses numeric keys.</p>
<p>Come to think of it, each of our projects will be accessible via a unique URL. And, hey, the media items will have URLs as well. But wait, we didn't show "url" anywhere in our list of properties. Where should it go? If I use an Object to store my list items, I could use the URL fragment as the key, or I could go back to the Array (preserving the order of my list) and add a "url" property to each item...</p>
<h3>Just Pick One Already</h3>
<p>Hopefully you're starting to see that there's no one right way to do this. I want to be able to control the order of my items, but I also need to access each item by a unique key (its URL). Here's a sample of what I think my data will look like (so far).</p>
<pre class="syntax brush-js">
[
  {
    &quot;url&quot;         : &quot;contact&quot;,
    &quot;client&quot;      : &quot;Email:&lt;br /&gt;jon@shovemedia.com&quot;,
    &quot;title&quot;       : &quot;contact info&quot;,
    &quot;description&quot; : &quot;content/contact.html&quot;,
    &quot;date&quot;        : &quot;01/01/2011&quot;,
    &quot;role&quot;        : &quot;developer&quot;,
    &quot;link&quot;        : &quot;mailto:jon@shovemedia.com?subject=New Business&quot;,
    &quot;thumbnail&quot;   : &quot;thumbnails/email.jpg&quot;,
    &quot;pics&quot;        : []
  },
  {
    &quot;url&quot;         : &quot;3D&quot;,
    &quot;client&quot;      : &quot;Photobiz&quot;,
    &quot;title&quot;       : &quot;3D Templates&quot;,
    &quot;description&quot; : &quot;content/3d.html&quot;,
    &quot;date&quot;        : &quot;01/01/2011&quot;,
    &quot;role&quot;        : &quot;developer&quot;,
    &quot;link&quot;        : &quot;http://photobiz.com&quot;,
    &quot;thumbnail&quot;   : &quot;thumbnails/3d-templates.jpg&quot;,
    &quot;pics&quot;        : [
            {
              &quot;url&quot;     : &quot;video&quot;,
              &quot;title&quot;   : &quot;watch!&quot;,
              &quot;icon&quot;    : &quot;video&quot;,
              &quot;content&quot; : &quot;papervision/videoPlayer.html&quot;
            },
            {
              &quot;url&quot;     : &quot;image1&quot;,
              &quot;title&quot;   : &quot;Image 1&quot;,
              &quot;icon&quot;    : &quot;pic&quot;,
              &quot;content&quot; : &quot;papervision/image1.jpg&quot;
            }
          ]
  }
]
</pre>
<p>Most of this is identical to the XML format I've been using. I've introduced one small change for the "description" field. Rather than trying to embed HTML within a JSON document (and spending a tutorial or three to explain it), I'm going to place that in an external document and load it on request. That's "lazy initialization" for the initiated.</p>
<h2>Stay Tuned:</h2>
<p>In the next episode, we'll decide how best to organize everything into folders at the file system level. If you take a close look at the JSON above, you'll should be able to spot a hint or two in some of the example values that contain file paths.</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2012/04/24/html5-portfolio-project-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 Portfolio Project &#8211; Part 1</title>
		<link>http://karoshiethos.com/2012/04/23/html5_portfolio_p1/</link>
		<comments>http://karoshiethos.com/2012/04/23/html5_portfolio_p1/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 17:12:50 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=587</guid>
		<description><![CDATA[Introduction I built a Flash-based portfolio back in 2005. It was itself a nice example of the kind of work that kept new projects coming: back-button &#038; bookmarking support, raw content visible to Google &#038; non-Flash browsers, Google Analytics tracking, easily updatable via an XML file, etc. All at a time when most people believed [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>I built <a href="http://shovemedia.com/2006portfolio" target="_blank">a Flash-based portfolio</a> back in 2005. It was itself a nice example of the kind of work that kept new projects coming: back-button & bookmarking support, raw content visible to Google & non-Flash browsers, Google Analytics tracking, easily updatable via an XML file, etc. All at a time when most people believed it couldn't be done. For better or worse, it's functional enough that it <a href="http://shovemedia.com/2012portfolio" target="_blank">still drives my portfolio today</a>. </p>
<p>In the seven years since, browsers have done a great deal to catch up. Canvas, web fonts, and CSS enhancements have expanded the possibilities so that I'm confident I can rebuild the whole thing in HTML5. I still get compliments on the minimalist design, and I think I'd get even more if it worked on iPads and iPhones. <img src='http://karoshiethos.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>This move is long overdue, and I've decided, not only does it make sense to open source the final template, but there's value in letting you follow my <em>process</em>. I <em>will</em> make mistakes, but I'll probably learn something from them, and in turn, so might you.</p>
<h2>The Plan</h2>
<p>We won't be doing any coding today. Instead, I'll start where all projects ought to start: with a plan. The numbers in parenthesis represent the estimated number of hours required.</p>
<ul>
<li>(1) Project Plan</li>
<li>(1) Define JSON format</li>
<li>(1) Assemble project file structure</li>
<li>(4) Scale transition</li>
<li>(4) Navigation</li>
<li>(4) Canvas-based Tooltip</li>
<li>(6) Text in circle</li>
<li>(3) Media Player (video)</li>
<li>(2) Background gradient effect</li>
<li>(4) Preloader animation</li>
<li>(1) CSS / media queries</li>
<li>(1) Google Analytics integration</li>
<li>(1) Fonts (Typekit?)</li>
<li>(8) Bug Fixes</li>
</ul>
<p><strong>Total: 41 hours</strong></p>
<p>These estimates don't include the time required to write up the accompanying blog-posts or answer your questions. That's probably another 15-20 hours. In addition, I usually multiply my initial estimate by two to account for the Murphy-factor. Also, I've got three other projects right now, and this isn't the most important, so it's going to take a lot longer than a week. Let's schedule launch for June 1st, that <a href="http://www.quotationspage.com/quote/723.html" title="Douglas Adams Quote" target="_blank">sounds nice, doesn't it</a>?</p>
<h2>Stay Tuned:</h2>
<p>In the next episode, we'll define a JSON format for each project in our portfolio and start thinking about how those will get transformed in to richer JavaScript structures and HTML elements.</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2012/04/23/html5_portfolio_p1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Automatic Value-Object Mediation with JS Signals</title>
		<link>http://karoshiethos.com/2012/03/03/automatic-value-object-mediation-with-js-signals/</link>
		<comments>http://karoshiethos.com/2012/03/03/automatic-value-object-mediation-with-js-signals/#comments</comments>
		<pubDate>Sat, 03 Mar 2012 05:16:15 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=570</guid>
		<description><![CDATA[Just a little something I cooked up tonight after a few beers with Lee: ModelMediator = function (model) { &#160;&#160;this.__onChanged__ = new Dictionary(); &#160;&#160;for (var key in model) &#160;&#160;{ &#160;&#160;&#160;&#160;this.__defineSetter__(key, function (arg) { this.set(model, key, arg) }); &#160;&#160;&#160;&#160;this.__defineGetter__(key, function () { this.get(model, key) }); &#160;&#160;&#160;&#160;this.__onChanged__.set(key, new signals.Signal()); &#160;&#160;} } ModelMediator.prototype.get = function (model, key) { [...]]]></description>
			<content:encoded><![CDATA[<p>Just a little something I cooked up tonight after a few beers with Lee: </p>
<pre style="clear: both" class="code">
ModelMediator = function (model) {
&nbsp;&nbsp;this.__onChanged__ = new Dictionary();

&nbsp;&nbsp;for (var key in model)
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;this.__defineSetter__(key, function (arg) { this.set(model, key, arg) });
&nbsp;&nbsp;&nbsp;&nbsp;this.__defineGetter__(key, function () { this.get(model, key) });
&nbsp;&nbsp;&nbsp;&nbsp;this.__onChanged__.set(key, new signals.Signal());
&nbsp;&nbsp;}
}

ModelMediator.prototype.get = function (model, key)
{
&nbsp;&nbsp;return model[key]
}

ModelMediator.prototype.set = function (model, key, value)
{
&nbsp;&nbsp;model[key] = value;
&nbsp;&nbsp;this.__onChanged__.get(key).dispatch({model:model, key:key, value:value});
}
</pre>
<p><a href="http://karoshiethos.com/2012/03/03/dictionary-class-javascript-js/">Dictionary class here</a></p>
<p>Downloading and understanding JS Signals is left as an exercise for the reader.</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2012/03/03/automatic-value-object-mediation-with-js-signals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dictionary Class (JavaScript / JS)</title>
		<link>http://karoshiethos.com/2012/03/03/dictionary-class-javascript-js/</link>
		<comments>http://karoshiethos.com/2012/03/03/dictionary-class-javascript-js/#comments</comments>
		<pubDate>Sat, 03 Mar 2012 05:09:01 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=578</guid>
		<description><![CDATA[I sorely miss the Dictionary class from AS3, but wasn't excited by what my Googles led to and figured I'd learn more by rolling my own. JavaScript Arrays can be used as a hash, but only with String or Numeric keys. This class lets you use any Object. A function, an Array, a class ... [...]]]></description>
			<content:encoded><![CDATA[<p>I sorely miss the Dictionary class from AS3, but wasn't excited by what my Googles led to and figured I'd learn more by rolling my own.</p>
<p>JavaScript Arrays can be used as a hash, but only with String or Numeric keys. This class lets you use any Object. A function, an Array, a class ... anything. It could be faster, among other possible improvements, but this implementation has been coming in handy all over.</p>
<pre style="clear: both;">Dictionary = function ()
{
  this.keys = [];
  this.values = [];
}

Dictionary.prototype.get = function (key)
{
  var index = this.keys.indexOf(key);
  if (index != -1)
  {
    return this.values[index];
  }
}

Dictionary.prototype.set = function (key, value)
{
  var index = this.keys.indexOf(key);
  if (index == -1)
  {
    this.keys.push(key);
    index = this.keys.length - 1;
  }

  this.values[index] = value;
}

Dictionary.prototype.remove = function (key)
{
  var index = this.keys.indexOf(key);
  if (index == -1)
  {
      return undefined;
  }

  var value = this.values[index];

  delete(this.values[index]);
  delete(this.keys[index]);

  return value;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2012/03/03/dictionary-class-javascript-js/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Removing Trace and Logging Statements for Production</title>
		<link>http://karoshiethos.com/2010/11/06/removing-trace-and-logging-statements-for-production/</link>
		<comments>http://karoshiethos.com/2010/11/06/removing-trace-and-logging-statements-for-production/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 16:07:58 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=557</guid>
		<description><![CDATA[I'm saving these recipes here so I can bookmark, and I'm sure someone else will find them useful. I decided to convert calls to trace or my logging framework to use conditional compilation so that they won't be included when I do a production build, but are included when I do a debug build. The [...]]]></description>
			<content:encoded><![CDATA[<p>I'm saving these recipes here so I can bookmark, and I'm sure someone else will find them useful.</p>
<p>I decided to convert calls to trace or my logging framework to use conditional compilation so that they <em>won't</em> be included when I do a production build, but <em>are</em> included when I do a debug build.</p>
<p>The Flex compiler supports this by allowing you to set a variable at compile-time, eg:</p>
<pre>-define=CONFIG::debug,true</pre>
<p>In your code, simply wrap the code to be conditionally compiled in curly braces, prepended with this variable, eg:</p>
<pre>CONFIG::Debug
{
	trace( 'Debug' );
}</pre>
<p>I spent some time writing a regular expression that finds trace statements, and wraps them in this block. In plain English, start at the beginning of the line, match zero or more whitespace, the word "trace", zero or more whitespace, an open parenthesis, the rest of the line.</p>
<p>Search for: ^([ \t]*)(trace[ \t]*\(.*)$<br />
Replace with: $1CONFIG::debug { $2 }</p>
<p>FDT's internal parser doesn't like the conditional compilation syntax, so we need to change our replacement text slightly to wrap that part in markers instructing it to ignore them.</p>
<p>Search for: ^([ \t]*)(trace[ \t]*\(.*)$<br />
Replace with: $1/*FDT_IGNORE*/ CONFIG::debug /*FDT_IGNORE*/ { $2 }</p>
<p>The same recipe for any call to logger, eg: logger.debug, logger.info, logger.warn, etc.</p>
<p>Search for: ^([ \t]*)(logger\..*)$<br />
Replace with: $1/*FDT_IGNORE*/ CONFIG::debug /*FDT_IGNORE*/ { $2 }</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2010/11/06/removing-trace-and-logging-statements-for-production/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Masking TLF (Text Layout Framework)</title>
		<link>http://karoshiethos.com/2010/06/09/masking-tlf-text-layout-framework/</link>
		<comments>http://karoshiethos.com/2010/06/09/masking-tlf-text-layout-framework/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 17:01:56 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=532</guid>
		<description><![CDATA[Just a quick note to point out a bug (?) I found today while working with the ActionScript 3 Text Layout Framework. I wanted to add a mask to the Sprite container I'd passed to my TLF ContainerController. Whatever it is that happened wasn't correct: there was masking occurring, but the shape I was using [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick note to point out a bug (?) I found today while working with the ActionScript 3 Text Layout Framework.</p>
<p>I wanted to add a mask to the Sprite container I'd passed to my TLF ContainerController. Whatever it is that happened wasn't correct: there was masking occurring, but the shape I was using as a mask was (incorrectly) visible on the stage. Rolling over my buttons caused redraw of stage regions, and my TLF text in those areas would go from invisible to incorrectly masked.</p>
<p>After trying several things, I pulled an old-school trick out of my bag: nest the Sprite I was passing as a container to the ContainerController in another holder Sprite, and apply the mask to the holder instead. From there, everything worked as expected.</p>
<p>Note: I further tracked this down to be caused by the ContainerController being created smaller than the text stuffed inside. Only then do I have problems with masking. YMMV.</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2010/06/09/masking-tlf-text-layout-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FDT/Eclipse Ant Configuration – Same JRE as Workspace (Update!)</title>
		<link>http://karoshiethos.com/2010/04/29/fdteclipse-ant-configuration-%e2%80%93-same-jre-as-workspace-update/</link>
		<comments>http://karoshiethos.com/2010/04/29/fdteclipse-ant-configuration-%e2%80%93-same-jre-as-workspace-update/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 17:12:33 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=525</guid>
		<description><![CDATA[(See the original post) I messed around with this quite a bit but was never able to get things to work exactly as I'd hoped. I even got as far as using the XmlTask Ant extensions to modify the launch file on the fly. Unfortunately, I couldn't figure out how to get Eclipse to reload [...]]]></description>
			<content:encoded><![CDATA[<h2>(See the <a href="http://karoshiethos.com/2010/01/11/fdteclipse-ant-configuration-same-jre-as-workspace/">original post</a>)</h2>
<p>I messed around with this quite a bit but was never able to get things to work <em>exactly</em> as I'd hoped. I even got as far as using the XmlTask Ant extensions to modify the launch file on the fly. Unfortunately, I couldn't figure out how to get Eclipse to reload the modified configuration without completely restarting, so that path resulted more or less in a dead end.</p>
<p>What I <em>did</em> figure out is how to make your launch configurations shareable via SVN, so that only one team member (yours truly) has to deal with builds and launch configurations. Everyone else can update from SVN and run ANT tasks without being familiar with all these grisly details.</p>
<p>The last post mentioned (with no small amount of grumbling) that you have to change the JRE setting to "Same JRE as Workspace" on every single build target you create (or rename). This is incredibly annoying. If you go to the same dialog: Run &gt;&gt; External Tools &gt;&gt; External Tools Configurations...</p>
<p>Check out the Common Tab. Here you can pull the launch file configuration into the project and out of the workspace by selecting "Shared file" instead of "Local file". This lets you share launch configurations with the rest of the team.</p>
<p>If you wish, you can create a template for new build targets. If you get the file naming convention right, you should be able to get away with defining new build targets without ever needing to visit the External Tools Configurations dialog. I've got a mixed OS X / Windows Team, so I made some modifications to Eclipse's default launch file output. In short, I removed explicit references to my OS X default JVM.</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&lt;launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType"&gt;
&lt;booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/&gt;
&lt;listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"&gt;
&lt;listEntry value="/PROJECT_NAME/build.xml"/&gt;
&lt;/listAttribute&gt;
&lt;listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"&gt;
&lt;listEntry value="1"/&gt;
&lt;/listAttribute&gt;
&lt;stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/&gt;
&lt;stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="PROJECT_NAME"/&gt;
&lt;stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/&gt;
&lt;stringAttribute key="org.eclipse.ui.externaltools.ATTR_ANT_TARGETS" value="BUILD_TARGET_NAME"/&gt;
&lt;stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/PROJECT_NAME/build.xml}"/&gt;
&lt;stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/&gt;
&lt;/launchConfiguration&gt;</pre>
<p>Note the spots where you should substitute your own PROJECT_NAME and BUILD_TARGET_NAME.</p>
<p>I tried setting the DEFAULT_VM_INSTALL to true, and it worked, but Eclipse insisted on mucking with it as soon as I visited the External Tools Configurations dialog again.</p>
<p>I'm storing my launch files in .settings and setting the filename to:<br />
PROJECT_NAME BUILD_FILE_NAME.xml [BUILD_TARGET_NAME].launch</p>
<p>Your mileage will almost certainly vary.</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2010/04/29/fdteclipse-ant-configuration-%e2%80%93-same-jre-as-workspace-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

