<?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>Chris Fattarsi</title>
	<atom:link href="http://chrisfattarsi.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrisfattarsi.com</link>
	<description>//TODO: tagline</description>
	<lastBuildDate>Wed, 16 Jan 2013 04:17:40 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.7.1</generator>
	<item>
		<title>Flashcards update &#8211; multiple collections</title>
		<link>http://chrisfattarsi.com/2011/12/flashcards-update-multiple-collections/</link>
		<comments>http://chrisfattarsi.com/2011/12/flashcards-update-multiple-collections/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 11:29:24 +0000</pubDate>
		<dc:creator><![CDATA[chris]]></dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[flashcards]]></category>

		<guid isPermaLink="false">http://chrisfattarsi.com/?p=133</guid>
		<description><![CDATA[I just pushed a new update to the Chrome web store for my flashcard app. Now you can create multiple collections of cards to study different subjects. Create a separate deck for each subject you want to study. You can &#8230; <a href="http://chrisfattarsi.com/2011/12/flashcards-update-multiple-collections/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I just pushed a new update to the <a href="https://chrome.google.com/webstore/detail/adgakpcekaedlfopplbbmbbknppkpjgp">Chrome web store</a> for my flashcard app.</p>
<p><a href="http://chrisfattarsi.com/wp-content/uploads/2011/12/fc.png"><img src="http://chrisfattarsi.com/wp-content/uploads/2011/12/fc.png" alt="" title="flashcards" width="233" height="142" class="aligncenter size-full wp-image-134" /></a></p>
<p>Now you can create multiple collections of cards to study different subjects. Create a separate deck for each subject you want to study. You can manage the collections from the options menu.</p>
<p><a href="http://chrisfattarsi.com/wp-content/uploads/2011/12/fc2.png"><img src="http://chrisfattarsi.com/wp-content/uploads/2011/12/fc2.png" alt="" title="fc2" width="640" height="400" class="aligncenter size-full wp-image-135" /></a></p>
<p><a href="http://chrisfattarsi.com/wp-content/uploads/2011/12/option-menu.png"><img src="http://chrisfattarsi.com/wp-content/uploads/2011/12/option-menu.png" alt="" title="option-menu" width="1280" height="800" class="aligncenter size-full wp-image-136" /></a></p>
<p>If you have already been using flashcards to study the update will put all of your previous cards into a collection called &#8216;default&#8217;, from there you can rename to anything you like.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisfattarsi.com/2011/12/flashcards-update-multiple-collections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The last 1%</title>
		<link>http://chrisfattarsi.com/2011/11/the-last-1/</link>
		<comments>http://chrisfattarsi.com/2011/11/the-last-1/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 21:05:23 +0000</pubDate>
		<dc:creator><![CDATA[chris]]></dc:creator>
				<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://chrisfattarsi.com/?p=130</guid>
		<description><![CDATA[Lately, I have been trying to take some of my part-time projects and clean them up into nice, releasable apps. The part I struggle with the most is the finishing touches that is needed to bring it home, the icing &#8230; <a href="http://chrisfattarsi.com/2011/11/the-last-1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Lately, I have been trying to take some of my part-time projects and clean them up into nice, releasable apps. The part I struggle with the most is the finishing touches that is needed to bring it home, the icing on the cake.</p>
<p><a href="http://chrisfattarsi.com/wp-content/uploads/2011/11/asymptote.png"><img src="http://chrisfattarsi.com/wp-content/uploads/2011/11/asymptote.png" alt="" title="asymptote" width="400" height="200" class="aligncenter size-full wp-image-132" /></a></p>
<h2>It typically goes like this</h2>
<p>I get an idea for an app that I want to build. I get excited, plan it out, code it up, go through a couple of revisions and then&#8230; it starts to plateau. I get the feeling like, &#8220;Yeah, it&#8217;s pretty much done&#8221; but it seems no matter how much I work at it, it just stays 99% complete.</p>
<h2>Why?</h2>
<ul>
<li>The honey moon is over. The initial excitement of the project fades down a bit.</li>
<li>The cool things I wanted to do in the project are done first, leaving only the meh parts for the end.</li>
<li>Features keep piling up. I keep adding features rather than polish up and push out a finished version.</li>
<li>The code gets more complex later in the project.</li>
<li>The last remaining details add up. May seem like small changes but as I continue to work at it, I keep finding more to do. Maybe it was more than 1% after all.</li>
</ul>
<h2>Can you relate?</h2>
]]></content:encoded>
			<wfw:commentRss>http://chrisfattarsi.com/2011/11/the-last-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips for being a productive developer while traveling</title>
		<link>http://chrisfattarsi.com/2011/11/tips-for-being-a-productive-developer-while-traveling/</link>
		<comments>http://chrisfattarsi.com/2011/11/tips-for-being-a-productive-developer-while-traveling/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 09:00:52 +0000</pubDate>
		<dc:creator><![CDATA[chris]]></dc:creator>
				<category><![CDATA[travel]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://chrisfattarsi.com/?p=121</guid>
		<description><![CDATA[Now that I have been traveling for the last 6 months I have picked up some tips for staying productive while on the road. Carry a notebook &#8211; Not your laptop, but an actual paper notebook. There are many waiting &#8230; <a href="http://chrisfattarsi.com/2011/11/tips-for-being-a-productive-developer-while-traveling/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Now that I have been traveling for the last 6 months I have picked up some tips for staying productive while on the road.</p>
<ol>
<li><strong>Carry a notebook</strong> &#8211; Not your laptop, but an actual paper notebook. There are many waiting moments while traveling. Waiting in line, for a bus, at the airport, for food, etc. Having a notebook handy is perfect for putting down notes and ideas when things come to mind. Capture all those &#8216;aha!&#8217; moments.</li>
<li><strong>Create a todo list</strong> &#8211; Since most tasks I need/want to get done require me to be on the computer I like to plan out goals before my next working section. That way when you sit down for some work you can get going right away. Also, when you are on the road you can go over your todo list and refactor it, optimize it to make best use of your working time.</li>
<li><strong>Seek out WIFI</strong> &#8211; In south america this could be difficult at times. Many places advertise WIFI but don&#8217;t actually have it in the room, or have it strong enough to be usable. I would keep my iPod touch handy when looking at rooms or cafes to verify I could get a good signal.</li>
<li><strong>Have something to test on the road</strong> &#8211; For my <a href="/flashcards">HTML5 flashcard app</a> I would target to have something ready for me to use when I was on the road. Since the app worked offline, I would make sure to load the latest version on my iPod touch before heading out. On long bus rides or flying I would use the app and note features I want to add or change and test it to death looking for bugs or ways to break it.</li>
<li><strong>Get plenty of rest</strong> &#8211; For some reason, on long travel days, even though most of the time can be spent sitting, is tiring. Trying to work while on the road seems to tire me faster than normal. Sometimes, rather than trying to be productive your time might be better spent simply getting rest and relaxing until you can get to a proper setup.</li>
</ol>
<p>What are some things you do to be productive while traveling?</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisfattarsi.com/2011/11/tips-for-being-a-productive-developer-while-traveling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objects that draw themselves</title>
		<link>http://chrisfattarsi.com/2011/10/objects-that-draw-themselves/</link>
		<comments>http://chrisfattarsi.com/2011/10/objects-that-draw-themselves/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 16:12:36 +0000</pubDate>
		<dc:creator><![CDATA[chris]]></dc:creator>
				<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://chrisfattarsi.com/?p=117</guid>
		<description><![CDATA[I am starting out another HTML5 app called DayTrader. It is my first attempt using the canvas tag. It is a simple game to buy and sell stocks to make as much as you can. I will do another post &#8230; <a href="http://chrisfattarsi.com/2011/10/objects-that-draw-themselves/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I am starting out another HTML5 app called DayTrader. It is my first attempt using the canvas tag. It is a simple game to buy and sell stocks to make as much as you can. I will do another post when its ready and post everything on <a href="https://github.com/fattarsi">github</a>.</p>
<p>For DayTrader, I am doing a different approach than I did with the <a href="http://chrisfattarsi.com/2011/09/flashcard-app-in-html5/">Flashcard</a> app.</p>
<p>The flashcard app I tried to be as MVC as possible:</p>
<p><a href="http://chrisfattarsi.com/wp-content/uploads/2011/10/flashcard-design.png"><img src="http://chrisfattarsi.com/wp-content/uploads/2011/10/flashcard-design.png" alt="" title="flashcard-design" width="458" height="147" class="aligncenter size-full wp-image-118" /></a></p>
<p>All the HTML was put into index.html, even without any JS it looks like the flashcard app. All of the events in index.html call methods in controller.js. From there, controller.js modifies instances and updates the view in index.html. The controller here is the glue between the HTML and the objects. The objects here know nothing about what the HTML looks like or how to update it, controller does all of that.</p>
<p>DayTrader on the other-hand has a very simple index.html file. In fact, index.html doesn&#8217;t &#8220;know&#8221; anything about the DayTrader app. </p>
<p><a href="http://chrisfattarsi.com/wp-content/uploads/2011/10/daytrader-design.png"><img src="http://chrisfattarsi.com/wp-content/uploads/2011/10/daytrader-design.png" alt="" title="daytrader-design" width="471" height="214" class="aligncenter size-full wp-image-119" /></a></p>
<p>In this case, controller.js is replaced with a simple init function to create object instances with an id reference of where to put itself. The main object (a Market) creates all of it&#8217;s HTML dynamically in the container it was initialized with.</p>
<p>Cons with this approach</p>
<ul>
<li>Breaks MVC and cuts out the &#8216;C&#8217;.</li>
<li>Harder to test the layout since all HTML is dynamic</li>
</ul>
<p>Pros</p>
<ul>
<li>Easier to embed on a page, just initialize and tell where to put itself, objects do the rest</li>
<li>Easier to make multiple instances. With the flashcard app, if I wanted multiple instances on one page (for some reason) I would need to duplicate the HTML in index.html and update the controller to be aware. But this way the objects bring their own HTML.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisfattarsi.com/2011/10/objects-that-draw-themselves/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google JS-test framework..</title>
		<link>http://chrisfattarsi.com/2011/10/testing-the-google-js-test-framework-it-passed/</link>
		<comments>http://chrisfattarsi.com/2011/10/testing-the-google-js-test-framework-it-passed/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 15:50:14 +0000</pubDate>
		<dc:creator><![CDATA[chris]]></dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://chrisfattarsi.com/?p=116</guid>
		<description><![CDATA[I decided to touch up my HTML5 flashcards app. The app started out with me just playing around with HTML5 localStorage but as it was getting a bit more complex I decided to rewrite some parts in object oriented fashion. &#8230; <a href="http://chrisfattarsi.com/2011/10/testing-the-google-js-test-framework-it-passed/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I decided to touch up my <a href="http://chrisfattarsi.com/2011/09/flashcard-app-in-html5/">HTML5 flashcards app</a>. The app started out with me just playing around with HTML5 localStorage but as it was getting a bit more complex I decided to rewrite some parts in object oriented fashion. Also, I just saw on the <a href="http://googletesting.blogspot.com/2011/10/google-js-test-now-in-open-source.html">Google Test Blog</a> that the <a href="http://code.google.com/p/google-js-test/">Google JS Test framework</a> was open sourced so I decided to give it a dance.</p>
<p>Install gjstest &#8211; easy.</p>
<p>Wrote the Card and Deck class while writing simple test cases in parallel.<br />
These are just snippets, view all the source at <a href="https://github.com/fattarsi/flashcards">github</a>.</p>
<pre>
/*
 * card.js
 * Defines a Card class to represent a flashcard
 */


// Card constructor
function Card(opts) {
    if (opts == undefined) { opts = {} };
    this.key = (opts.key) ? opts.key : makeKey();
    //set attrs if key is in localStorage
    if (localStorage[this.key]) {
        var c = JSON.parse(localStorage[this.key]);
        this.phrase1 = c.phrase1;
        this.phrase2 = c.phrase2;
        this.points = c.points;
        return;
    }
    
    this.phrase1 = (opts.phrase1) ? opts.phrase1 : '';
    this.phrase2 = (opts.phrase2) ? opts.phrase2 : '';
    this.points = (opts.points) ? opts.points : 0;
}
</pre>
<pre>
/*
 * deck.js
 * Defines a Deck class to represent a deck of flashcards. A deck holds references to
 * Card objects and viewing states
 */

//deck constructor
function Deck(key) {
    this.key = key;
    var d = (localStorage[key]) ? JSON.parse(localStorage[key]) : {} ;
    //this.index = (d.index) ? d.index : 0;
    this.index = 0;
    //master_set contains all cards in order that they were added
    this.master_set = (d.master_set) ? d.master_set : new Array();
    //this.cards = (d.cards) ? d.cards : new Array();
    //cards is the current ordering based on mutation options (random, low/high)
    this.cards = this.master_set.slice();
    this.mode_low = false;
    this.mode_high = false;
    this.mode_random = (d.mode_random) ? d.mode_random : false;
    this.mode_reverse = (d.mode_reverse) ? d.mode_reverse : false;
    
    this.processOptions();
}
</pre>
<p>Started off simple, just to sanity check my objects.</p>
<pre>
 function CardTest() {}
 registerTestSuite(CardTest);
 
 CardTest.prototype.InitCard = function() {
  var card = new Card();
  //Assert new card fields are empty
  expectNe('', card.key);
  expectEq('', card.phrase1);
  expectEq('',card.phrase2);
  expectEq(0, card.points);
  
  //Init with key
  var card = new Card({'key':'abcd'});
  expectEq('abcd', card.key);
  expectEq('', card.phrase1);
  expectEq('',card.phrase2);
  expectEq(0, card.points);
 }
</pre>
<pre>
 function DeckTest() {}
 registerTestSuite(DeckTest);
 
 DeckTest.prototype.InitDeck = function() {
  var deck = new Deck('new-deck');
  expectEq(0, deck.length());
  expectFalse(deck.mode_random);
  expectFalse(deck.mode_reverse);

 }
</pre>
<p>Some more complex scenarios:</p>
<pre>
 DeckTest.prototype.EdgeCases = function () {
    //return current card of empty deck
    var deck = new Deck('test-deck');
    var card = deck.current();
    expectEq(0, deck.length());
    expectEq(null, card);
    
    //delete from an empty deck
    deck.deleteCard();
    expectEq(0, deck.length());
 }
</pre>
<p>Then fix and repeat.</p>
<p>The JS-test framework is handy. One issue I came across was using the localStorage, although Chrome recognizes the localStorage mechanism, gjstest did not. Since localStorage has a very simple API I was able to fake it by defining a global and adding a removeItem method:</p>
<pre>
 var localStorage = new Object();
 localStorage.removeItem = function (key) {
    delete this[key];
 }
</pre>
<p>Not sure what I would do if I was using SQL storage, I might have to be more clever. </p>
]]></content:encoded>
			<wfw:commentRss>http://chrisfattarsi.com/2011/10/testing-the-google-js-test-framework-it-passed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Travel expense stats</title>
		<link>http://chrisfattarsi.com/2011/10/travel-expense-stats/</link>
		<comments>http://chrisfattarsi.com/2011/10/travel-expense-stats/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 18:09:49 +0000</pubDate>
		<dc:creator><![CDATA[chris]]></dc:creator>
				<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http:/?p=1</guid>
		<description><![CDATA[For the last 5 months during my travels in South America I have recorded every expense. From hostels to cab rides to buying candy on the street, I record it in Gnucash. It has been draining at times to keep &#8230; <a href="http://chrisfattarsi.com/2011/10/travel-expense-stats/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>For the last 5 months during my travels in South America I have recorded every expense. From hostels to cab rides to buying candy on the street, I record it in Gnucash. It has been draining at times to keep up with this but I find it interesting to make random graphs and charts, like this:</p>
<div style="float:left">
<h2>Spending per day in Colombia</h2>
<p><a href="http://chrisfattarsi.com/wp-content/uploads/2011/08/colombia-by-day.gif"><img src="http://chrisfattarsi.com/wp-content/uploads/2011/08/colombia-by-day-150x150.gif" alt="" title="Colombia spending by day" width="150" height="150" class="size-thumbnail wp-image-59" /></a></div>
<div style="float:right">
<h2>Total expenses by category</h2>
<p><a href="http://chrisfattarsi.com/wp-content/uploads/2011/08/rtw-pie.gif"><img src="http://chrisfattarsi.com/wp-content/uploads/2011/08/rtw-pie-150x150.gif" alt="" title="RTW pie chart" width="150" height="150" class="aligncenter size-thumbnail wp-image-61" /></a></div>
<div style="clear:both"></div>
<h2>Since Gnucash stores all of the data in a sqlite database, I can also query it for random stats to see how much we have spent on:</h2>
<ul>
<li>Twix: $16.26</li>
<li>Starbucks: $46.55</li>
<li>Laundry: $24.36</li>
<li>Dinner: $670.11</li>
<li>Buses: $857.69</li>
<li>Cabs: $107.73</li>
<li>Beer: $76.58</li>
</ul>
<p>Or even just silly things like the number of transactions that contain the letter &#8216;a&#8217;: <strong>608</strong></p>
<p>After exploring the database schema that Gnucash uses I found that the main tables I needed to look at for stats like this were the <strong>accounts</strong>, <strong>splits</strong>, and <strong>transactions</strong>.</p>
<p>Most stats that I got above were calculated using a query similar to:</p>
<div style="background-color:#ddd;padding:3px;"><code>select sum(s.value_num) from accounts a, splits s, transactions t where t.guid=s.tx_guid and s.account_guid=a.guid and a.guid='b2548da9122135502dcb36ed8ba6c393' and t.description like '%twix%';</code></div>
</p>
<p>Where <strong>%twix%</strong> searches for transactions that have &#8216;twix&#8217; anywhere in the description.</p>
<p>And &#8216;<strong>b2548da9122135502dcb36ed8ba6c393</strong>&#8216; is the unique id (guid) of the account that I am searching.</p>
<p>Now I wish I had stats for how much time I have spent on this&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisfattarsi.com/2011/10/travel-expense-stats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flashcard app in html5</title>
		<link>http://chrisfattarsi.com/2011/09/flashcard-app-in-html5/</link>
		<comments>http://chrisfattarsi.com/2011/09/flashcard-app-in-html5/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 22:20:03 +0000</pubDate>
		<dc:creator><![CDATA[chris]]></dc:creator>
				<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://chrisfattarsi.com/?p=43</guid>
		<description><![CDATA[Yesterday I made a flashcard app that is intended to help with my Spanish studies (and an excuse to play with html5 too). It is a simple app that features: Add / Edit / Delete flashcards through the frontend Uses &#8230; <a href="http://chrisfattarsi.com/2011/09/flashcard-app-in-html5/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Yesterday I made a <a href="http://fattarsi.com/m/html5/flashcards/">flashcard app</a> that is intended to help with my Spanish studies (and an excuse to play with html5 too). It is a simple app that features:</p>
<ul>
<li>Add / Edit / Delete flashcards through the frontend</li>
<li>Uses localStorage to store all of your cards</li>
<li>Works offline</li>
<li>Separate css for iphone or small screens</li>
<li>Detects iphone screen orientation and updates style</li>
<li>Point feature for each card to track which cards you need to work more on</li>
<li>Randomize feature to study cards in a different order</li>
</ul>
<p><a href="http://fattarsi.com/flashcards/"><img src="http://chrisfattarsi.com/wp-content/uploads/2011/09/flashcards-300x155.png" alt="" title="flashcards" width="300" height="155" class="aligncenter size-medium wp-image-45" /></a></p>
<p>Try it out: <a href="http://fattarsi.com/flashcards/">Flashcards</a></p>
<p>The source is posted on <a href="https://github.com/fattarsi/flashcards">GitHub</a>:<br />
<code>git clone git://github.com/fattarsi/flashcards.git</code></p>
]]></content:encoded>
			<wfw:commentRss>http://chrisfattarsi.com/2011/09/flashcard-app-in-html5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
