<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Mohammed Buttu &#187; Open Source</title>
	<atom:link href="http://mbuttu.wordpress.com/category/Open-Source/feed/" rel="self" type="application/rss+xml" />
	<link>http://mbuttu.wordpress.com</link>
	<description></description>
	<lastBuildDate>Fri, 20 Apr 2012 09:28:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mbuttu.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Mohammed Buttu &#187; Open Source</title>
		<link>http://mbuttu.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mbuttu.wordpress.com/osd.xml" title="Mohammed Buttu" />
	<atom:link rel='hub' href='http://mbuttu.wordpress.com/?pushpress=hub'/>
		<item>
		<title>DPS911: Looking Back</title>
		<link>http://mbuttu.wordpress.com/2012/04/20/dps911-looking-back/</link>
		<comments>http://mbuttu.wordpress.com/2012/04/20/dps911-looking-back/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 09:28:10 +0000</pubDate>
		<dc:creator>mbuttu</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">https://mbuttu.wordpress.com/?p=633</guid>
		<description><![CDATA[Blog Posts During the semester, I did work on three projects: Butter, Popcorn Maker FCP, and TestSwarm for iOS. The following links lead to each blog post I wrote this semester. January Popcorn Maker &#8211; Bug 157 Popcorn Maker &#8211; &#8230; <a href="http://mbuttu.wordpress.com/2012/04/20/dps911-looking-back/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=633&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Blog Posts</h2>
<p>During the semester, I did work on three projects: Butter, Popcorn Maker FCP, and TestSwarm for iOS. The following links lead to each blog post I wrote this semester.</p>
<h3>January</h3>
<ul>
<li><a href="http://mbuttu.wordpress.com/2012/01/20/popcorn-maker-bug-157/">Popcorn Maker &#8211; Bug 157</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/01/25/popcorn-maker-bug-67/">Popcorn Maker &#8211; Bug 67</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/01/26/dps911-release-1/">DPS911 Release 1</a></li>
</ul>
<h3>February</h3>
<ul>
<li><a href="http://mbuttu.wordpress.com/2012/02/06/getting-choctop-to-work/">Getting ChocTop to Work</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/02/09/popcorn-maker-bugs-256-257-and-281/">Popcorn Maker Bugs 256, 257, and 281</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/02/09/dps911-release-2/">DPS911 Release 2</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/02/28/dps911-release-3/">DPS911 Release 3</a></li>
</ul>
<h3>March</h3>
<ul>
<li><a href="http://mbuttu.wordpress.com/2012/03/10/butter-bugs-256-and-290/">Butter: Bugs 256 and 390</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/03/12/butter-bug-434-status/">Butter: Bug 434 Status</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/03/12/butter-bug-459/">Butter: Bug 459</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/03/12/testswarm-for-popcorn-on-ios/">TestSwarm for Popcorn on iOS</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/03/12/dps911-release-4/">DPS911 Release 4</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/03/20/butter-bugs-434-458-and-493/">Butter: Bugs  434, 458, and 493</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/03/25/butter-bug-463-the-undo-manager/">Butter: Bug 463, the Undo Manager</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/03/25/dps911-release-5/">DPS911 Release 5</a></li>
</ul>
<h3>April</h3>
<ul>
<li><a href="http://mbuttu.wordpress.com/2012/04/18/dps911-release-6/">DPS911 Release 6</a></li>
<li><a href="http://mbuttu.wordpress.com/2012/04/20/dps911-release-7/">DPS911 Release 7</a></li>
</ul>
<h2>Lessons Learned</h2>
<h3>Lesson 1: It&#8217;s Not Just About Code</h3>
<p>The first lesson I learned was that although code is important, it&#8217;s also equally important to be online. Using social media to talk about the work being done and increasing awareness in the community is key to the growth of the project.</p>
<p>It&#8217;s also important for the project to have a good structure that is easy to follow. People will be more likely to contribute to code that they can understand.</p>
<h3>Second Lesson: Consistency</h3>
<p>Working on an open source project requires consistency. Code often changes so quickly that what was working today will likely be broken tomorrow. It&#8217;s also important to always blog and use Twitter, IRC, and the other forms of communication used in different projects.</p>
<h3>Third Lesson: Plan and Execute</h3>
<p>Ideas are good, but planning and execution is more important. When there is an idea that people are unsure of, or one that may cause many changes, breaking it down into smaller chunks and iterating on it can quickly reveal how viable it is.</p>
<h3>Fourth Lesson: Organization</h3>
<p>Being able to track what needs to be done, the state of each task, and who is doing what is extremely important. This is where Lighthouse and GitHub come in. Lighthouse not only keeps everything organized, but we can look at how long, on average, tickets take to complete, how long reviews take, and how often bugs delay estimated completion times. All of these details can help the planning of the project in the future: better estimates, and a better a idea of what has worked and what hasn&#8217;t.</p>
<h2>Reflections</h2>
<p>I am very glad that I was able to take this course and work on Butter, Popcorn Maker FCP, and TestSwarm for iOS. I learned how valuable blogging and communicating with the community is. I blogged and tweeted much more in these past four months than I ever have, and I plan to do more. Making more use of Lighthouse and GitHub this semester also gave me good insight into tools that I can use in future projects that I create. Although this course has come to an end, I still plan to do the work needed in order to land the UndoManager in Butter.</p>
<p>This experience has been great; every programming student should take <a target="_blank" href="http://vocamus.net/dave/">Dave Humphrey</a>&#8216;s open source classes.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mbuttu.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mbuttu.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mbuttu.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mbuttu.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mbuttu.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mbuttu.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mbuttu.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mbuttu.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mbuttu.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mbuttu.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mbuttu.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mbuttu.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mbuttu.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mbuttu.wordpress.com/633/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=633&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mbuttu.wordpress.com/2012/04/20/dps911-looking-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/614957b007f68acabea91fd754168815?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mbuttu</media:title>
		</media:content>
	</item>
		<item>
		<title>DPS911 Release 7</title>
		<link>http://mbuttu.wordpress.com/2012/04/20/dps911-release-7/</link>
		<comments>http://mbuttu.wordpress.com/2012/04/20/dps911-release-7/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 06:56:54 +0000</pubDate>
		<dc:creator>mbuttu</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">https://mbuttu.wordpress.com/?p=630</guid>
		<description><![CDATA[I have been working on adding commands to Butter, which is making use of the UndoManager discussed earlier. I talked more about it in the blog post, &#8220;DPS911 Release 6&#8243;, stating that the following items still need to be completed &#8230; <a href="http://mbuttu.wordpress.com/2012/04/20/dps911-release-7/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=630&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been working on adding commands to Butter, which is making use of the <a href="http://mbuttu.wordpress.com/2012/03/25/butter-bug-463-the-undo-manager/">UndoManager</a> discussed earlier. I talked more about it in the blog post, <a href="http://mbuttu.wordpress.com/2012/04/18/dps911-release-6/">&#8220;DPS911 Release 6&#8243;</a>, stating that the following items still need to be completed</p>
<ul>
<li>testing</li>
<li>putting the code in the right place</li>
<li>adding more commands</li>
<li>adding shortcuts to command objects</li>
</ul>
<p>I have now added 9 tests that make sure that the UndoManager is working correctly. I have also moved the code from <em>butter-main.js</em>, which is now just called <em>main.js</em>, to a new file named <em>src/core/commands.js</em>. For now, all of the commands and convenience functions are in this file. I have added more command objects, and now Butter can undo and redo the following</p>
<ul>
<li>adding track events</li>
<li>removing track events</li>
<li>adding tracks</li>
<li>removing tracks</li>
<li>changing the media url</li>
</ul>
<p>All of the commits are <a target="_blank" href="https://github.com/mozilla/butter/pull/119/commits">here</a>, and the diff is <a target="_blank" href="https://github.com/mozilla/butter/pull/119/files">here</a>. This is definitely my biggest patch that I have submitted to Butter, which is, so far, 399 additions and 21 deletions. There is still work that needs to be done. For the new code introduced to work cleanly, I still need to create a diagram of how all of this will work. Before I can do that, though, I need a diagram of Butter&#8217;s current design. Once the diagram is complete, everyone can see from a high level how objects interact with each other, and we can develop a workflow of what needs to be done when a new command needs to be created.</p>
<p>Implementing undo and redo for adding and removing a track was interesting, because when I deleted the first track and then undid the change, it was added as the last track. The problem ended up being an ordering issue, and I had to change a bit of code in a few areas. In the <em>addTrack</em> function in <em>src/core/media.js</em>, I added another argument, named <em>order</em>. If <em>order</em> is passed in, then that is the value that is set on the track. To actually make the the ordering work, I changed the code in <em>src/timeline/track-container.js</em> and <em>src/timeline/trackhandles.js</em> to use the <em>insertBefore</em> function rather than <em>append</em> on the container element. For example, <em>src/core/trackhandles.js</em> has the following code:</p>
<pre>
_listElement.insertBefore( trackDiv, _listElement.children[ e.data.order ] );
</pre>
</p>
<p>While testing out the undoing and redoing of adding/removing track events, I noticed a bug. The command object that is responsible for adding a track event was creating a new track event every time it was told to execute. This caused some weird behaviour, which took some digging to find. The fix was simply to create a new track event based on the one that was previously created instead of always creating a fresh one.</p>
<p>There is not enough time for this to be 100% complete before the semester, especially since I need to wait for a diagram to be created, and the new code still needs to go through review. However, I do plan on finishing this, because I would like to see it land in Butter, so that users can work on their projects knowing that they can undo and redo their changes.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mbuttu.wordpress.com/630/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mbuttu.wordpress.com/630/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mbuttu.wordpress.com/630/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mbuttu.wordpress.com/630/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mbuttu.wordpress.com/630/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mbuttu.wordpress.com/630/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mbuttu.wordpress.com/630/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mbuttu.wordpress.com/630/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mbuttu.wordpress.com/630/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mbuttu.wordpress.com/630/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mbuttu.wordpress.com/630/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mbuttu.wordpress.com/630/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mbuttu.wordpress.com/630/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mbuttu.wordpress.com/630/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=630&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mbuttu.wordpress.com/2012/04/20/dps911-release-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/614957b007f68acabea91fd754168815?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mbuttu</media:title>
		</media:content>
	</item>
		<item>
		<title>DPS911 Release 6</title>
		<link>http://mbuttu.wordpress.com/2012/04/18/dps911-release-6/</link>
		<comments>http://mbuttu.wordpress.com/2012/04/18/dps911-release-6/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 22:56:49 +0000</pubDate>
		<dc:creator>mbuttu</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">https://mbuttu.wordpress.com/?p=627</guid>
		<description><![CDATA[The work for DPS911&#8242;s 6th release was already complete, I am just writing about it now. Release 6 was focused on implementing the command pattern and the undo manager, as discussed in bug 463. I wrote about the progress made &#8230; <a href="http://mbuttu.wordpress.com/2012/04/18/dps911-release-6/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=627&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The work for DPS911&#8242;s 6th release was already complete, I am just writing about it now. Release 6 was focused on implementing the command pattern and the undo manager, as discussed in <a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733/tickets/463-implement-undoredo-backend#ticket-463-3">bug 463</a>.</p>
<p>I wrote about the progress made in <a href="http://mbuttu.wordpress.com/2012/03/25/dps911-release-5/">my last release</a> in the blog post, <a href="http://mbuttu.wordpress.com/2012/03/25/butter-bug-463-the-undo-manager/">&#8220;Butter: Bug 463, the Undo Manager&#8221;</a>.</p>
<p>Because this release was focused on architecture, I spent all of my time presenting and discussing the pattern being used, and the possible changes that need to be made. I was also active on <a target="_blank" href="https://github.com/mbuttu/butter/commit/3d6dd405f92e410470e4129fb1974e63c31dbc2f">GitHub</a> and <a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733/tickets/463-implement-undoredo-backend#ticket-463-3">LightHouse</a>, answering questions and concerns.</p>
<p>As a group, we went through code examples, what the pattern looks like when implemented in Butter, and how this will fit in with Butter&#8217;s current architecture. Although there was not much code added this release, there was a lot of discussion so that everyone is on the same page and understands the changes being made.</p>
<p>I also slightly changed the code, and submitted it in the <a target="_blank" href="https://github.com/mozilla/butter/pull/119/files">pull request</a>. The new commit introduced a <em>makeCommand</em> factory function, which must be called every time a new command is created. This factory function will automatically register the command with the <em>UndoManager</em>, and returns the command object to the caller, but without the <em>undo</em> function. Not returning the <em>undo</em> function as part of the command object to the caller is to ensure that undoing is only done through the <em>UndoManager</em>.</p>
<p>To summarize, to add a track event to Butter, and have undo and redo automatically done, the code within Butter would call <em>butter.addTrackEvent</em>. Behind the scenes, <em>addTrackEvent</em> will use a command and be registered with the <em>UndoManager</em>. If a button on the UI wants to add a track event, it will simply call <em>execute</em> on the command created by <em>addTrackEventCommand</em>. The key point here is that whether the command is being called from the UI or from Butter, there is only point of entry for the code.</p>
<p>In order to make everything more clear, a diagram needs to be created. I will be creating one as soon as I have a diagram of how Butter currently works. Additionally, the following items still need to be completed before this code lands in Butter</p>
<ul>
<li>testing</li>
<li>putting the code in the right place</li>
<li>adding more commands</li>
<li>adding shortcuts to command objects</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mbuttu.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mbuttu.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mbuttu.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mbuttu.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mbuttu.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mbuttu.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mbuttu.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mbuttu.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mbuttu.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mbuttu.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mbuttu.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mbuttu.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mbuttu.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mbuttu.wordpress.com/627/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=627&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mbuttu.wordpress.com/2012/04/18/dps911-release-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/614957b007f68acabea91fd754168815?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mbuttu</media:title>
		</media:content>
	</item>
		<item>
		<title>DPS911 Release 5</title>
		<link>http://mbuttu.wordpress.com/2012/03/25/dps911-release-5/</link>
		<comments>http://mbuttu.wordpress.com/2012/03/25/dps911-release-5/#comments</comments>
		<pubDate>Sun, 25 Mar 2012 20:30:25 +0000</pubDate>
		<dc:creator>mbuttu</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">https://mbuttu.wordpress.com/?p=622</guid>
		<description><![CDATA[This release I worked on four bugs in Butter: Bug 434: Let users move track events together. Bug 458: Put the code that validates the times entered for track event updates in a better place. Bug 493: Focus the track &#8230; <a href="http://mbuttu.wordpress.com/2012/03/25/dps911-release-5/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=622&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This release I worked on four bugs in Butter:</p>
<ul>
<li><a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733-butter/tickets/434-let-users-move-track-events-together">Bug 434</a>: Let users move track events together.</li>
<li><a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733-butter/tickets/458-protect-from-invalid-times-in-trackevents">Bug 458</a>: Put the code that validates the times entered for track event updates in a better place.</li>
<li><a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733-butter/tickets/493-if-a-track-event-is-double-clicked-and-the-editor-is-already-opened-focus-the-editor">Bug 493</a>: Focus the track event editor if a track event is doubled clicked and the editor is already open and in the background.</li>
<li><a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733/tickets/463-implement-undoredo-backend#ticket-463-3">Bug 463</a>: Implement undo/redo backend.</li>
</ul>
<p>I wrote about bug 434, 458, and 493 in <a href="http://mbuttu.wordpress.com/2012/03/20/butter-bugs-434-458-and-493/">this post</a>. I wrote about bug 463 in another post, <a href="https://mbuttu.wordpress.com/2012/03/25/butter-bug-463-the-undo-manager/">here</a>.</p>
<p>Bug 434 is still a work in progress. Bobby already started working on implementing our own drag and drop code in <em>src/util/dragndrop.js</em>.</p>
<p>Bug 458 is in review, but I need to fix a problem with my solution. The problem is that when a user hits tab after editing one of the fields, the editor will close. However, there is <a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733/tickets/274-users-should-be-able-to-open-other-events-from-within-editor-screen">another bug</a> which is open that will allow users to edit another track event from the track event editor. This means the editor should not close automatically on its own, and thus I am going to suggest leaving the closing of the editor up to the user.</p>
<p>Bug 493 is staged; I ran into this bug while working on bug 458.</p>
<p>Bug 463 is up on GitHub now in order to get feedback so I can put the code in the proper place and adjust the design as necessary.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mbuttu.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mbuttu.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mbuttu.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mbuttu.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mbuttu.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mbuttu.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mbuttu.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mbuttu.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mbuttu.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mbuttu.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mbuttu.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mbuttu.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mbuttu.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mbuttu.wordpress.com/622/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=622&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mbuttu.wordpress.com/2012/03/25/dps911-release-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/614957b007f68acabea91fd754168815?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mbuttu</media:title>
		</media:content>
	</item>
		<item>
		<title>Butter: Bug 463, the Undo Manager</title>
		<link>http://mbuttu.wordpress.com/2012/03/25/butter-bug-463-the-undo-manager/</link>
		<comments>http://mbuttu.wordpress.com/2012/03/25/butter-bug-463-the-undo-manager/#comments</comments>
		<pubDate>Sun, 25 Mar 2012 19:28:37 +0000</pubDate>
		<dc:creator>mbuttu</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">https://mbuttu.wordpress.com/?p=614</guid>
		<description><![CDATA[Bug 463 is about implementing an undo/redo backend in Butter using the command pattern. The progress of what&#8217;s completed so far is here. Currently Control-z is undo, and control-shift-z is redo. Only track events that are added can be undone &#8230; <a href="http://mbuttu.wordpress.com/2012/03/25/butter-bug-463-the-undo-manager/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=614&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733/tickets/463-implement-undoredo-backend#ticket-463-3">Bug 463</a> is about implementing an undo/redo backend in Butter using the <a target="_blank" href="http://en.wikipedia.org/wiki/Command_pattern">command pattern</a>. The progress of what&#8217;s completed so far is <a target="_blank" href="https://github.com/mbuttu/butter/tree/t463">here</a>.</p>
<p>Currently</p>
<ul>
<li>Control-z is undo, and control-shift-z is redo.</li>
<li>Only track events that are added can be undone and redone.</li>
</ul>
<p>In <em>src/timeline/media.js</em>, adding a track event, before the <em>UndoManager</em> was implemented looked like this:</p>
<pre>
      var trackEvent = track.addTrackEvent({
        popcornOptions: {
          start: start,
          end: start + 1,
          target: defaultTarget.elementID
        },
        type: type
      });
</pre>
<p>With the <em>UndoManager</em> in place, it now looks like this:</p>
<pre>
      var trackEvent = butter.addTrackEvent({
        track: track,
        type: type,
        popcornOptions: {
          start: start,
          end: start + 1,
          target: defaultTarget.elementID
        }
      });
</pre>
<p>It remains largely the same, except that behind the scenes, <em>butter.addTrackEvent</em> creates the command object and registers it with the <em>UndoManager</em>. After this is done, control-z can be used to undo, and contol-shift-z can be used to redo the action. The commands are placed on an undo and redo stack as appropriate, and currently there are no restrictions on how many commands can be undone/redone.</p>
<p>Having the <em>UndoManager</em> in place will provide Butter with many benefits. Some of them are</p>
<ul>
<li>Creating macro commands.</li>
<li>A simplified user interface: The UI only needs to know to call the command&#8217;s <em>execute</em> function.</li>
<li>Loosely coupled design.</li>
</ul>
<p>I will be getting feedback and fixing the design in the coming weeks, and we will, piece by piece, change all undoable actions in Butter to make use of the commands and undo manager.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mbuttu.wordpress.com/614/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mbuttu.wordpress.com/614/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mbuttu.wordpress.com/614/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mbuttu.wordpress.com/614/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mbuttu.wordpress.com/614/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mbuttu.wordpress.com/614/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mbuttu.wordpress.com/614/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mbuttu.wordpress.com/614/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mbuttu.wordpress.com/614/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mbuttu.wordpress.com/614/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mbuttu.wordpress.com/614/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mbuttu.wordpress.com/614/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mbuttu.wordpress.com/614/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mbuttu.wordpress.com/614/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=614&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mbuttu.wordpress.com/2012/03/25/butter-bug-463-the-undo-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/614957b007f68acabea91fd754168815?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mbuttu</media:title>
		</media:content>
	</item>
		<item>
		<title>Butter: Bugs 434, 458, and 493</title>
		<link>http://mbuttu.wordpress.com/2012/03/20/butter-bugs-434-458-and-493/</link>
		<comments>http://mbuttu.wordpress.com/2012/03/20/butter-bugs-434-458-and-493/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 22:57:09 +0000</pubDate>
		<dc:creator>mbuttu</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">https://mbuttu.wordpress.com/?p=605</guid>
		<description><![CDATA[Bug 434 Bug 434 is allowing users to drag multiple track events together. I talked about the problems I ran in into in this post. Since then, I got the multiple events dragging using an external plugin. For now, the &#8230; <a href="http://mbuttu.wordpress.com/2012/03/20/butter-bugs-434-458-and-493/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=605&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Bug 434</h2>
<p><a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733-butter/tickets/434-let-users-move-track-events-together">Bug 434</a> is allowing users to drag multiple track events together. I talked about the problems I ran in into in <a href="http://mbuttu.wordpress.com/2012/03/12/butter-bug-434-status/">this post</a>. Since then, I got the multiple events dragging using an <a target="_blank" href="http://threedubmedia.com/code/event/drag">external plugin</a>. For now, the code is <a target="_blank" href="https://github.com/mbuttu/butter/commit/9c14837ff694708fd6b74abae6a87ee71a07336f">here</a>. It doesn&#8217;t completely replace the behaviour provided by jQuery&#8217;s draggable plugin, though. There is no scrolling, and it cannot yet drop to other tracks. On Lighthouse I have asked if we should be creating our own draggable and droppable code for Butter, since we do not want to add more external dependencies.</p>
<p>In Butter, shift-clicking a track event adds it to the group of selected track events. In the code, we need to determine, after a user clicks on a track event, whether the intended action is to drag, or to deselect all but the currently selected track event. To solve this, I kept track of the amount of time between the <em>mousedown</em> and <em>mouseup</em> event on the trackevent. If the <em>mouseup</em> occurs between 100 and 300 milliseconds after the <em>mousedown</em> event, which is an arbitrary length of time I chose after a little bit of testing, then I assume that the user intended to deselect all but the currently selected elements. Otherwise, I assume the user wanted to drag. The code for that looks like this:</p>
<pre>
    function onTrackEventMouseDown( e ){
      var start = +new Date();
      e.originalEvent.target.addEventListener( "mouseup", function(){
        var trackEvent = e.trackEvent,
            corn = trackEvent.popcornOptions,
            originalEvent = e.originalEvent,
            end = +new Date(),
            timeElapsed = end - start;

        if ( timeElapsed &gt;= 100 &amp;&amp; timeElapsed  1 ){
            trackEvent.selected = false;
          }
          else {
            trackEvent.selected = true;
            if( !originalEvent.shiftKey ){
              for( var t in _tracks ){
                if( _tracks.hasOwnProperty( t ) ){
                  _tracks[ t ].deselectEvents( trackEvent );
                } //if
              } //for
              _selectedEvents = [ trackEvent ];
            }
            else {
              _selectedEvents.push( trackEvent );
            } //if
          } //if
        }
    });
</pre>
</p>
<p>For the actual dragging, I used the following code, which uses a little bit of arithmetic to determine how far each selected track event is allowed to move:</p>
<pre>
    function dragInit( e, dd ) {
      var selectedEvents = $( "div[selected=true]" ),
          leftPositions = [],
          lowestLeft,
          p = $.event.special.drag.callback.prototype;

      for ( var idx = 0; idx &lt; selectedEvents.length; idx++ )  {
        leftPositions.push( $( selectedEvents[ idx ] ).position().left );
      }

      p.lowestLeft = Math.min.apply( Math, leftPositions );

      return selectedEvents;
    }

    function dragStart( e, dd ) {
      var container = $( _element.parentNode.parentNode );
      dd.limit = container.position();
      dd.limit.left = dd.limit.left + $( this ).position().left - dd.lowestLeft;
      dd.limit.bottom = dd.limit.top + container.outerHeight() - $( this ).outerHeight();
      dd.limit.right = dd.limit.left + container.outerWidth() - $( this ).outerWidth();
    }

    function drag( e, dd ) {
      $( this ).css({
        top: Math.min( dd.limit.bottom, Math.max( dd.limit.top, dd.deltaY ) ),
        left: Math.min( dd.limit.right, Math.max( dd.limit.left, dd.offsetX ) )
      });
    }

    var handles;
    this.activate = function(){
      if( !handles ) {
        $( _element ).css({
          zIndex: 9001
        })
        .drag( &quot;init&quot;, dragInit )
        .drag( &quot;start&quot;, dragStart )
        .drag( &quot;end&quot;, movedCallback )
        .drag( drag, { relative: true } )
        .resizable({
          autoHide: false, 
          containment: &quot;parent&quot;, 
          handles: &quot;e, w&quot;, 
          scroll: false,
          stop: movedCallback
        });

        handles = _element.querySelectorAll( &quot;.ui-resizable-handle&quot; );
        function toggleHandles( state ){
          handles[ 0 ].style.visibility = state ? &quot;visible&quot; : &quot;hidden&quot;;
          handles[ 1 ].style.visibility = state ? &quot;visible&quot; : &quot;hidden&quot;;
        } //toggleHandles
        _element.addEventListener( &quot;mouseover&quot;, function( e ){
          toggleHandles( true );
        }, false );
        _element.addEventListener( &quot;mouseout&quot;, function( e ){
          toggleHandles( false );
        }, false );
        toggleHandles( false );

      } //if

    }; //activate
</pre>
</p>
<h2>Bug 458</h2>
<p><a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733-butter/tickets/458-protect-from-invalid-times-in-trackevents">Bug 458</a> is putting the code that validates the times entered for track event updates in a better place. Before, this code was only in the editor, which means that if a track event was altered programatically, the validation would be bypassed. I moved the validation from <em>src/editor/editor.js</em> to <em>src/core/trackevent.js</em>; all track event updates have to hit the <em>update</em> method in <em>src/core/trackevent.js</em>, so it is a good place to put the validation (for now, until MVC is implemented).</p>
<p>As discussed with <a target="_blank" href="http://vocamus.net/dave/">Davide Humphrey</a>, I also made a few optimizations to the code. Namely, I changed calls such as <em>Number( popcornData.start )</em> to <em>+popcornData.start</em>, and <em>isNan( popcornData.start )</em> to <em>popcornData.start != popcornData.start</em> (there is, or at least, was, a bug in <em>isNan</em>).</p>
<p>I also changed the logic that decides whether or not to close the editor. Before, there was a boolean variable passed in that would make this decision. I removed this, and just made it so that the editor only closes when the <em>trackeventupdate</em> event is received (because that only fires if the track event was successfully updated). This also gives authors of future editors more control of when to keep the editor open, and when to close it.</p>
<p>The pull request is <a target="_blank" href="https://github.com/mozilla/butter/pull/97">here</a>.</p>
<h2>Bug 493</h2>
<p>I filed <a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733-butter/tickets/493-if-a-track-event-is-double-clicked-and-the-editor-is-already-opened-focus-the-editor">bug 493</a> when I was working on bug 458. If the track event was double clicked and the editor was already open, but behind the main browser&#8217;s window, then the editor did not come to the front. It stayed hidden in the background, which makes it seems like the double click didn&#8217;t work. I changed it so that the track event editor&#8217;s window comes to focus if it already open; the pull request for that is <a target="_blank" href="https://github.com/mozilla/butter/pull/98">here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mbuttu.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mbuttu.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mbuttu.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mbuttu.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mbuttu.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mbuttu.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mbuttu.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mbuttu.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mbuttu.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mbuttu.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mbuttu.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mbuttu.wordpress.com/605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mbuttu.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mbuttu.wordpress.com/605/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=605&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mbuttu.wordpress.com/2012/03/20/butter-bugs-434-458-and-493/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/614957b007f68acabea91fd754168815?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mbuttu</media:title>
		</media:content>
	</item>
		<item>
		<title>DPS911 Release 4</title>
		<link>http://mbuttu.wordpress.com/2012/03/12/dps911-release-4/</link>
		<comments>http://mbuttu.wordpress.com/2012/03/12/dps911-release-4/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 20:46:50 +0000</pubDate>
		<dc:creator>mbuttu</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">https://mbuttu.wordpress.com/?p=590</guid>
		<description><![CDATA[This release, I did work on Butter and TestSwarm for Popcorn on iOS. The first two bugs are from Butter, bugs 256 and 390. As explained in the post, I did the work needed for the two tickets, but the &#8230; <a href="http://mbuttu.wordpress.com/2012/03/12/dps911-release-4/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=590&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This release, I did work on Butter and TestSwarm for Popcorn on iOS.</p>
<p>The first two bugs are from Butter, <a href="http://mbuttu.wordpress.com/2012/03/10/butter-bugs-256-and-290/">bugs 256 and 390</a>. As explained in the post, I did the work needed for the two tickets, but the code that was actually staged came from <a target="_blank" href="http://blog.robothaus.org/">Bobby</a>, who used the work from tickets 256 and 390, and merged it with <a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733/tickets/313">bug 313</a>, and I did the peer review.</p>
<p>I also worked on <a href="http://mbuttu.wordpress.com/2012/03/12/butter-bug-434-status/">bug 434</a>, which ended up being a lot more work than I expected. Even though I have some code working, this bug will need a lot more put into it before it&#8217;s done. Since the jQuery UI draggable plugin will no longer be used, a lot of functionality that used to come for free now has to be implemented by us. Before getting too far with my solution, <a target="_blank" href="http://dseifried.wordpress.com/">David Seifried</a> told me that I should talk to <a target="_blank" href="http://blog.robothaus.org/">Bobby</a>, since he talked about writing our own drag-and-drop functionality in order to reduce the dependencies in Butter.</p>
<p>In addition, I fixed up <a href="http://mbuttu.wordpress.com/2012/03/12/butter-bug-459/">bug 459</a>. Even though it was easy, I hope that having a more meaningful and readable error message will add to the user experience.</p>
<p>Finally, I worked on getting <a href="http://mbuttu.wordpress.com/2012/03/12/testswarm-for-popcorn-on-ios/">TestSwarm for Popcorn on iOS</a> to work. Now <a target="_blank" href="http://dseifried.wordpress.com/2012/01/11/setting-up-test-swarm/">TestSwarm</a> can run <a target="_blank" href="http://popcornjs.org/">Popcorn</a> tests on the iOS simulator and the physical device!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mbuttu.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mbuttu.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mbuttu.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mbuttu.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mbuttu.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mbuttu.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mbuttu.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mbuttu.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mbuttu.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mbuttu.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mbuttu.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mbuttu.wordpress.com/590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mbuttu.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mbuttu.wordpress.com/590/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=590&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mbuttu.wordpress.com/2012/03/12/dps911-release-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/614957b007f68acabea91fd754168815?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mbuttu</media:title>
		</media:content>
	</item>
		<item>
		<title>TestSwarm for Popcorn on iOS</title>
		<link>http://mbuttu.wordpress.com/2012/03/12/testswarm-for-popcorn-on-ios/</link>
		<comments>http://mbuttu.wordpress.com/2012/03/12/testswarm-for-popcorn-on-ios/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 20:13:28 +0000</pubDate>
		<dc:creator>mbuttu</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">https://mbuttu.wordpress.com/?p=578</guid>
		<description><![CDATA[Today, David Seifried and I worked on getting TestSwarm to run the Popcorn unit tests on the iOS simulator. Previously, the simulator kept saying that there were no jobs to run. After some digging and trying different things out, Dave &#8230; <a href="http://mbuttu.wordpress.com/2012/03/12/testswarm-for-popcorn-on-ios/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=578&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today, <a target="_blank" href="http://dseifried.wordpress.com/">David Seifried</a> and I worked on getting <a target="_blank" href="http://dseifried.wordpress.com/2012/01/11/setting-up-test-swarm/">TestSwarm</a> to run the <a target="_blank" href="http://popcornjs.org/">Popcorn</a> unit tests on the iOS simulator. Previously, the simulator kept saying that there were no jobs to run. After some digging and trying different things out, Dave figured out what the problem was. The simulator is now able to run the tests when a job is pushed up to it! This is very good.</p>
<p>The reason we need to create our own custom app is because Safari requires user action in order for media playback to occur. This doesn&#8217;t work for the purposes of automated testing. When first thinking about this problem, I initially thought that I was going to need to inject JavaScript into the WebView that would eventually lead to the Objective-C triggering the video to play. But, the fix for this actually ended up being simple, and I found it when I wrote an older post, <a href="http://mbuttu.wordpress.com/2012/02/28/dps911-release-3/">DPS911 Release 3</a>. As stated in that post, the <a target="_blank" href="https://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/">UIWebView</a> class has a <em>mediaPlaybackRequiresUserAction</em> property that I can set to no, which will let videos play automatically.</p>
<p>The code for that is:</p>
<pre>
[[self theWebView] setMediaPlaybackRequiresUserAction:NO];
</pre>
</p>
<p>And it works! Just one line. Now TestSwarm can run Popcorn tests on iOS using the simulator and the physical device!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mbuttu.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mbuttu.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mbuttu.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mbuttu.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mbuttu.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mbuttu.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mbuttu.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mbuttu.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mbuttu.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mbuttu.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mbuttu.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mbuttu.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mbuttu.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mbuttu.wordpress.com/578/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=578&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mbuttu.wordpress.com/2012/03/12/testswarm-for-popcorn-on-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/614957b007f68acabea91fd754168815?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mbuttu</media:title>
		</media:content>
	</item>
		<item>
		<title>Butter: Bug 459</title>
		<link>http://mbuttu.wordpress.com/2012/03/12/butter-bug-459/</link>
		<comments>http://mbuttu.wordpress.com/2012/03/12/butter-bug-459/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 16:00:30 +0000</pubDate>
		<dc:creator>mbuttu</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">https://mbuttu.wordpress.com/?p=568</guid>
		<description><![CDATA[In my post, Butter: Bugs 256 and 290, I said that there was a problem with one of the tickets that I reviewed, and that bug 459 was filed to deal with it. This bug involves fixing the error message &#8230; <a href="http://mbuttu.wordpress.com/2012/03/12/butter-bug-459/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=568&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my post, <a href="https://mbuttu.wordpress.com/2012/03/10/butter-bugs-256-and-290/">Butter: Bugs 256 and 290</a>, I said that there was a problem with one of the tickets that I reviewed, and that <a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733-butter/tickets/459-fix-the-error-message-given-for-invalid-start-and-end-times-for-track-events#ticket-459-4">bug 459</a> was filed to deal with it. This bug involves fixing the error message given to the user. Although this is simple, I find it very important to display meaningful, consistent messages to the user. It adds to the user experience.</p>
<p>Before, when an invalid start or end time for a track event was entered, the error message displayed was: </p>
<p><i>You&#8217;ve entered an invalid start or end time. Please verify that they are both greater than 0, the end time is equal to or less than the media&#8217;s duration, and that the start time is less than the end time.</i></p>
<p>I have changed it to </p>
<p>You have entered an invalid in or out time. Please verify that<br />
<i>
<ul>
<li>Both in and out times are greater than 0.</li>
<li>The out time is equal to, or less than the media&#8217;s duration (duration of the media, in seconds, displayed here).</li>
<li>The in time is less than the out time.</li>
</ul>
<p></i>
</p>
<p>Three things to note are:</p>
<ul>
<li>The error message now refers to start and end times as in and out times, since that is how it is displayed to the user in the editor.</li>
<li>The media&#8217;s duration is displayed in the error message.</li>
<li>The error message is now displayed as a bulleted list for readability.</li>
</ul>
<p>The pull request for this patch is <a target="_blank" href="https://github.com/mozilla/butter/pull/88">here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mbuttu.wordpress.com/568/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mbuttu.wordpress.com/568/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mbuttu.wordpress.com/568/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mbuttu.wordpress.com/568/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mbuttu.wordpress.com/568/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mbuttu.wordpress.com/568/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mbuttu.wordpress.com/568/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mbuttu.wordpress.com/568/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mbuttu.wordpress.com/568/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mbuttu.wordpress.com/568/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mbuttu.wordpress.com/568/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mbuttu.wordpress.com/568/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mbuttu.wordpress.com/568/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mbuttu.wordpress.com/568/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=568&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mbuttu.wordpress.com/2012/03/12/butter-bug-459/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/614957b007f68acabea91fd754168815?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mbuttu</media:title>
		</media:content>
	</item>
		<item>
		<title>Butter: Bug 434 Status</title>
		<link>http://mbuttu.wordpress.com/2012/03/12/butter-bug-434-status/</link>
		<comments>http://mbuttu.wordpress.com/2012/03/12/butter-bug-434-status/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 04:03:19 +0000</pubDate>
		<dc:creator>mbuttu</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">https://mbuttu.wordpress.com/?p=555</guid>
		<description><![CDATA[For the past couple of days, I have been working on bug 434 in Butter, which is to allow users to move multiple track events at the same time. This is definitely not as straightforward as it seems. Initially, I &#8230; <a href="http://mbuttu.wordpress.com/2012/03/12/butter-bug-434-status/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=555&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For the past couple of days, I have been working on <a target="_blank" href="https://webmademovies.lighthouseapp.com/projects/65733/tickets/434-let-users-move-track-events-together">bug 434</a> in Butter, which is to allow users to move multiple track events at the same time. This is definitely not as straightforward as it seems.</p>
<p>Initially, I was thinking that since the dragging behaviour already exists in the track event, I could just have a loop that goes through all of the selected track events, and trigger the dragging behaviour on each one. After trying various things in the code, I realized that making this trigger happen wasn&#8217;t obvious.</p>
<p>I started doing some searches, and ended up reading <a target="_blank" href="http://stackoverflow.com/questions/793559/grouping-draggable-objects-with-jquery-ui-draggable">this post on StackOverflow</a>. I implemented something similar to the selected answer, which is to implement the helper function in jQuery&#8217;s draggable to return all of the elements to be dragged appended to one container. The suggestion in the post was this:</p>
<pre>
$('#dragSource li').draggable({
  helper: function(){
    var selected = $('#dragSource input:checked').parents('li');
    if (selected.length === 0) {
      selected = $(this);
    }
    var container = $('<div />').attr('id', 'draggingContainer');
    container.append(selected.clone());
    return container; 
  }
});
</pre>
<p>This person also put up a <a target="_blank" href="http://jsbin.com/awagi">demo on JSBin</a>, and it seemed like this is exactly what I wanted. But, after trying it in Butter, it ended up having unsuitable behaviour. Everything that was appended to the div appeared on top of each other, and that means that the track events were losing their place when they were being dragged. I could have done some styling with the container div so that the track events would keep their position, but this seemed like a hack that wouldn&#8217;t work.</p>
<p>Moving on, I found <a target="_blank" href="https://groups.google.com/group/jquery-ui/msg/d7fff548bc2ad24c">this post</a> on the jQuery UI Google Group, which says to capture the mousedown event on the container, and then from there trigger the even on the draggables, which should start the dragging operations on all of the events. The code for that looks like this:</p>
<pre>
$(".draggable").draggable();

$("#container").mousedown(function(e) {
    $(".draggable").trigger(e);
});
&#8203;</pre>
<p>This works for the first draggable element in the HTML, but not for the rest. There is also an error thrown in the console (I deleted much of error here because it&#8217;s too long):</p>
<pre>
jQuery.event.dispatch
jQuery.event.add.elemData.handle.eventHandle
jQuery.event.trigger
jQuery.fn.extend.trigger
jQuery.extend.each
jQuery.fn.jQuery.each
jQuery.fn.extend.trigger
(anonymous function)
jQuery.event.dispatch
jQuery.event.add.elemData.handle.eventHandle
jQuery.event.trigger
jQuery.fn.extend.trigger
jQuery.extend.eachjquery-1.7.1.js:658

.....

jQuery.event.trigger
jQuery.fn.extend.trigger
jQuery.extend.each
jQuery.fn.jQuery.each
jQuery.fn.extend.trigger
(anonymous function)
</pre>
<p>Changing the code up a bit would just give me another error, saying that there is too much recursion. So I tried to do this:</p>
<pre>
$(".draggable").draggable();

$("#container").mousedown(function(e) {
    $(".draggable").trigger(e);
});

$(".draggable").mousedown(function(e) {
    e.stopPropagation();
});
</pre>
<p>This does not throw an error, but again there is the issue that the dragging operation only works on the first draggable in the HTML.</p>
<p>Similarly, I found <a target="_blank" href="http://bugs.jqueryui.com/ticket/3876">this bug filed in jQuery</a> three years ago. It suggested writing the code like this:</p>
<pre>
$('#draggable').one('mousedown', function(e) {
    $("#draggable").draggable().trigger(e);
});
</pre>
<p>This didn&#8217;t work either, since the mousedown event was only captured once.</p>
<p>I then found <a target="_blank" href="http://forum.jquery.com/topic/fire-events-to-simulate-drag-n-drop">another discussion on the jQuery forum</a>, where rdworth mentions that jQuery uses the simulate plugin, and linked to examples of how it&#8217;s used in the jQuery unit tests. This looked like it was a bit overboard for what we&#8217;re trying to do, so I needed to find something else.</p>
<p>I was trying to stay away from introducing another external plugin to Butter, but it seems that I need to. I found <a target="_blank" href="http://www.myphpetc.com/2009/11/jquery-ui-multiple-draggable-plugin.html">this multidraggable jQuery UI plugin</a>. I tried it out, and it works, but the one problem is that it doesn&#8217;t let the developer choose which elements are to be dragged. The way the elements are selected to be dragged is done within the plugin itself, using a control-click. This is an issue because Butter has it&#8217;s own way of deciding which track events are selected.</p>
<p>Finally, I found another plugin by ThreeDubMedia, which provides both <a target="_blank" href="http://threedubmedia.com/code/event/drag">drag</a> and <a target="_blank" href="http://threedubmedia.com/code/event/drop">drop</a> plugins. These plugins are set up to give the developer a lot of control, which is good for our case. I now have some code that moves multiple track events, but now that the jQuery UI draggable plugin is not being used, other areas need to be rewritten. For example, the scrolling feature that&#8217;s available automatically with the jQuery UI draggable plugin doesn&#8217;t seem to exist in the plugin provided by ThreeDubMedia, which means code for that has to be created.</p>
<p>So far, this is what I have:</p>
<pre>
function drag ( ev, dd ) {
    $( this ).css({
        top: dd.offsetY,
        left: dd.offsetX
    });
}

$( _element ).css({
    zIndex: 9001
});
$( _element ).drag( "init", function() {
    return $( "div[selected=true]" );
}).drag( "end", movedCallback ).drag(drag, {
    relative: true
}).resizable({ 
    autoHide: false, 
    containment: "parent", 
    handles: "e, w", 
    scroll: false,
    stop: movedCallback
});
</pre>
<p>Oh, and I also found an accidental global variable, <em>_selectedEvents</em>, in <em>src/timeline/media.js</em>. I will also fix that in the patch I submit.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mbuttu.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mbuttu.wordpress.com/555/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mbuttu.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mbuttu.wordpress.com/555/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mbuttu.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mbuttu.wordpress.com/555/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mbuttu.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mbuttu.wordpress.com/555/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mbuttu.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mbuttu.wordpress.com/555/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mbuttu.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mbuttu.wordpress.com/555/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mbuttu.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mbuttu.wordpress.com/555/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mbuttu.wordpress.com&#038;blog=22767246&#038;post=555&#038;subd=mbuttu&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mbuttu.wordpress.com/2012/03/12/butter-bug-434-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/614957b007f68acabea91fd754168815?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mbuttu</media:title>
		</media:content>
	</item>
	</channel>
</rss>
