<?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>Create Blog &#187; Uncategorized</title>
	<atom:link href="http://create.tpsitulsa.com/blog/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://create.tpsitulsa.com/blog</link>
	<description>the create framework blog</description>
	<lastBuildDate>Sat, 30 Jan 2010 20:08:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>SproutCore Animation: SC.Animatable</title>
		<link>http://create.tpsitulsa.com/blog/2009/12/21/sc-animatable/</link>
		<comments>http://create.tpsitulsa.com/blog/2009/12/21/sc-animatable/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 04:52:34 +0000</pubDate>
		<dc:creator>Alex Iskander</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://create.tpsitulsa.com/blog/?p=284</guid>
		<description><![CDATA[In real life, things don&#8217;t just suddenly disappear from one place and appear in another. This isn&#8217;t Harry Potter1. We can&#8217;t apparate. But chances are, you know that, and don&#8217;t need to be convinced of the wonder of animation. So, instead, I will tell you about the beginnings of SproutCore&#8217;s support for animation. SproutCore&#8217;s animation [...]]]></description>
			<content:encoded><![CDATA[<p>In real life, things don&#8217;t just suddenly disappear from one place and appear in another. This isn&#8217;t Harry Potter<sup id="fnref:hp"><a href="#fn:hp" rel="footnote">1</a></sup>. We can&#8217;t apparate.</p>

<p>But chances are, you know that, and don&#8217;t need to be convinced of the wonder of animation. So, instead, I will tell you about the beginnings of SproutCore&#8217;s support for animation.</p>

<p>SproutCore&#8217;s animation support currently takes the form of a mixin for views: SC.Animatable. Here are some of the features:</p>

<ul>
<li><strong>Relatively fast.</strong> It can animate 1000 or so views with reasonable performance on a fast machine.
Oddly, the biggest performance hurdle may now be the rendering engine (unless you are on 
IE—the slow script speed will kill you first).</li>
<li><strong>Uses CSS transitions where possible.</strong> Oddly, CSS transitions do not appear to be significantly faster<sup id="fnref:performance"><a href="#fn:performance" rel="footnote">2</a></sup> than
JavaScript transitions (again, indicating the rendering engine could now be the bottleneck).</li>
<li><strong>Support for Layout.</strong> This almost goes without saying, as what animation framework would be worth anything if it didn&#8217;t 
allow you to animate the position of views?</li>
<li><strong>Support for Opacity.</strong> So you can fade things in and out.</li>
<li><strong>Support for display:none.</strong> You can add transitions to the display property, and they will simply be ignored (display gets applied immediately)
<em>except</em> in the special case of display:none, which will only apply after the specified duration. See <a href="#displaynone">display:none notes</a></li>
<li><strong><a href="http://create.tpsitulsa.com/blog/2009/12/10/sc-animate-timing/">Support for Timing Curves</a>.</strong> You can specify curves to adjust the speed of the animation, and have them work in both JavaScript transitions and CSS transitions, or optionally, CSS transitions only.</li>
</ul>

<h3>Animating with SC.Animatable</h3>

<p>It is quite simple. Here are the steps:</p>

<ul>
<li>Add &#8220;sproutcore/animation&#8221; to the required frameworks array in your Buildfile (in quotes and all).</li>
<li>Mix in SC.Animatable to your view.</li>
<li>Add transitions.</li>
<li>Change layout, opacity, or display.</li>
</ul>

<p>So, how about some code? First, let&#8217;s take a look at a Buildfile:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># The Contacts application Buildfile</span>
config <span style="color:#ff3333; font-weight:bold;">:contacts</span>, <span style="color:#ff3333; font-weight:bold;">:required</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:sproutcore</span>, :<span style="color:#996600;">&quot;sproutcore/animation&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:forms</span>, <span style="color:#ff3333; font-weight:bold;">:pomona</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>


<p>Now, how about a view?</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">myView<span style="color: #339933;">:</span> SC.<span style="color: #660066;">View</span>.<span style="color: #660066;">design</span><span style="color: #009900;">&#40;</span>SC.<span style="color: #660066;">Animatable</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// mix it in</span>
  transitions<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// and add transitions</span>
    left<span style="color: #339933;">:</span> .25<span style="color: #339933;">,</span>
    top<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>duration<span style="color: #339933;">:</span> .25<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    width<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> duration<span style="color: #339933;">:</span> .25<span style="color: #339933;">,</span> timing<span style="color: #339933;">:</span> SC.<span style="color: #660066;">Animatable</span>.<span style="color: #660066;">TRANSITION_EASE_IN_OUT</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// with timing curve</span>
    height<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> duration<span style="color: #339933;">:</span> .5<span style="color: #339933;">,</span> timing<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.58</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// with custom timing curve</span>
    opacity<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> duration<span style="color: #339933;">:</span> .5<span style="color: #339933;">,</span> timing<span style="color: #339933;">:</span> SC.<span style="color: #660066;">Animatable</span>.<span style="color: #660066;">TRANSITION_CSS_EASE_IN_OUT</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// CSS-transition-only timing function (JavaScript gets linear)</span>
    display<span style="color: #339933;">:</span> .75 <span style="color: #006600; font-style: italic;">// a bit longer than opacity </span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>


<p>And finally, to animate!</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">myView.<span style="color: #660066;">adjust</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;left&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">250</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myView.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;layout&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>left<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">,</span> top<span style="color: #339933;">:</span> <span style="color: #CC0000;">300</span><span style="color: #339933;">,</span> width<span style="color: #339933;">:</span> <span style="color: #CC0000;">250</span><span style="color: #339933;">,</span> height<span style="color: #339933;">:</span> <span style="color: #CC0000;">340</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// style manipulation: a feature of SC.Animatable</span>
myView.<span style="color: #660066;">adjust</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;opacity&quot;</span><span style="color: #339933;">,</span> .5<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myView.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;style&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>opacity<span style="color: #339933;">:</span> .7<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myView.<span style="color: #660066;">adjust</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;display&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// applies after .75 seconds</span>
myView.<span style="color: #660066;">adjust</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;display&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;block&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// applies immediately</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// disable animation temporarily to change something directly</span>
myView.<span style="color: #660066;">disableAnimation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myView.<span style="color: #660066;">adjust</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;opacity&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">updateStyle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// makes invisible and applies immediately.</span>
myView.<span style="color: #660066;">enableAnimation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myView.<span style="color: #660066;">adjust</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;opacity&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// fades in to visibility (applying lazily).</span></pre></div></div>


<p>Pretty simple!</p>

<h3 id="displaynone">display:none notes</h3>

<p>When animating the display: none property, you should add a bit of extra time to its transition.</p>

<p>If everything was animated using JavaScript, there would be no issue. However, because SC.Animatable takes advantage of CSS transitions where possible, and CSS transitions don&#8217;t necessarily begin immediately, if you don&#8217;t add extra time to display&#8217;s transition it could set display:none before the other transitions end (in effect, cutting them short). In the most usual case—an opacity transition—the view will start to fade out and then suddenly disappear. Again, the easiest way to fix this is by simply adding a bit of time to the transition for the display property.</p>

<h3>The Problem with Callbacks</h3>

<p>Currently, SC.Animatable does not have callbacks for animation completion. In fact, unless the view is being animated using JavaScript (non-WebKit browsers and Firefox earlier than 3.6, I believe), it is even impossible to tell if a view <em>is</em> animating.</p>

<p>For JavaScript-based transitions, this should not be a terribly difficult feature to add <em>in general</em>; there is a question of, since animations are started and stopped automatically instead of explicitly by the developer, how those callbacks would be set: should it be one per property? One per the whole view?</p>

<p>For CSS transitions, however, this is trickier. There is an event fired in WebKit&#8217;s implementation, but I am unable to find any documentation on Mozilla&#8217;s support for it (or, for that matter, lack thereof).</p>

<p>Even if support was present, it may or may not be tricky to reconcile that with the actual animation library: what if one transition ends, but a new one starts immediately after? Will the event fire after the new one begins, tricking others into thinking it has already fired? It may be more reliable to &#8220;guesstimate,&#8221; and just set a timer for a callback to go off somewhere shortly after the target time (much like the way the &#8220;display&#8221; transition is implemented).</p>

<p><a href="http://create.tpsitulsa.com/static/contacts/"><img src="http://create.tpsitulsa.com/blog/wp-content/uploads/2009/12/Screen-shot-2009-12-21-at-10.53.52-PM-300x206.png" alt="" title="Contacts Demo App" width="300" height="206" class="alignleft size-medium wp-image-312" /></a></p>

<h3>Demo</h3>

<p>It is not &#8220;officially&#8221; released by any means—it still needs fixes, including at least one animation-related one—but a fancy demo of the animation (used in FormView, another project I am working on) <a href="http://create.tpsitulsa.com/static/contacts/">can be found here</a>.</p>

<p>The code is all online too <a href="http://github.com/ialexi/Contacts/">at GitHub.</a> I am slowly making it into a full sample app for SproutCore that demonstrates animation, FormView, and Comet—and hopefully multiple back-ends (I&#8217;m working on a wacky Python one right now, and I&#8217;d like to make a node.js-based one eventually, too).</p>

<div style="clear:both"></div>

<div class="footnotes">
<hr />
<ol>

<li id="fn:hp">
<p>I had to slip in some HP reference.<sup id="fnref:footnotes"><a href="#fn:footnotes" rel="footnote">3</a></sup>&#160;<a href="#fnref:hp" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:performance">
<p>It is tricky to tell, because I cannot measure the FPS of transitions objectively. Actually, the JavaScript transitions looked <em>faster</em> than the CSS transitions.&#160;<a href="#fnref:performance" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:footnotes">
<p>I love footnotes too much. In some papers, I have filled almost half the page with footnotes. The thing about footnotes is that they allow you to add extra information (sometimes a lot of extra information) while not badly interrupting the flow of the original piece.&#160;<a href="#fnref:footnotes" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://create.tpsitulsa.com/blog/2009/12/21/sc-animatable/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SproutCore, Todos, Django, and Comet in &lt; 100 Lines of Code</title>
		<link>http://create.tpsitulsa.com/blog/2009/12/11/sc-todos-django-comet/</link>
		<comments>http://create.tpsitulsa.com/blog/2009/12/11/sc-todos-django-comet/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 16:55:07 +0000</pubDate>
		<dc:creator>Alex Iskander</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://create.tpsitulsa.com/blog/?p=266</guid>
		<description><![CDATA[This is a continuation of the Django Todos Back-End Tutorial that adds Comet using Roots. Warning: This is not tested by anyone other than me at the moment, and might prove somewhat bumpy. Feedback is very welcome! Here is a high-level introduction of how Roots works is available here. Very little needs to be done [...]]]></description>
			<content:encoded><![CDATA[<p>This is a continuation of the <a href="https://sproutcore.pbworks.com/Todos+06-Building+with+Django">Django Todos Back-End Tutorial</a> that adds Comet using <a href="http://github.com/ialexi/dobby">Roots</a>.</p>

<p><strong>Warning: This is not tested by anyone other than me at the moment, and might prove somewhat bumpy. Feedback is very welcome!</strong></p>

<p>Here is a high-level introduction of how Roots works <a href="http://create.tpsitulsa.com/blog/2009/12/07/roots-deliver-nutrients/">is available here.</a></p>

<p>Very little needs to be done to add Comet. There are three main steps on the server side:</p>

<ol>
    <li>Get Roots and Cornelius.</li>
    <li>Add views to allow clients to subscribe/connect to events.</li>
    <li>Trigger events.</li>
</ol>

<p>On the client side, there are also three major steps:</p>

<ol>
    <li>Get+set up Pomona.</li>
    <li>Subscribe to events.</li>
    <li>Receive events.</li>
</ol>

<h3>First Step</h3>

<p>You will need at least three terminal windows—one for each server. You might as well open them first.</p>

<p>You will have three directories to work out of:</p>

<ul>
    <li>Roots (or Dobby)—not much to do here :)</li>
    <li>SproutCore Project</li>
    <li>Django Project</li>
</ul>

<p>Tip: if you want to be able to open only one TextMate window (or whatever IDE you use), you can place the Django project (and, even, Roots) in a subdirectory of your SproutCore project.</p>

<h3>Server-Side</h3>

<h4>Getting Roots and Cornelius</h4>

<p>First, let&#8217;s get Roots. In the Roots terminal, navigate to the folder you&#8217;d like to keep it, and:</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ git clone git://github.com/ialexi/dobby.git</pre></div></div>


<p>And now, you can start it (assuming you have the prerequisites):</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ cd dobby
$ python dobby.py
Instating Dolores High Inquisitor of Hogwarts</pre></div></div>


<p>There may be some deprecation warnings due to issues with Twisted, but they don&#8217;t cause problems. (Roots should be ported to node.js soon, and <em>node.js</em> doesn&#8217;t have these issues).</p>

<p>Now, get Cornelius. In the Django terminal, navigate to your Django project directory. Then run:</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ git clone git://github.com/ialexi/cornelius.git</pre></div></div>


<p>Next, you need to add Cornelius to your Django project as an application (making it really easy to import). To do this, edit settings.py and add &#8220;cornelius&#8221; in the INSTALLED_APPS setting:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">	<span style="color: #483d8b;">'django.contrib.auth'</span>,
	<span style="color: #483d8b;">'django.contrib.contenttypes'</span>,
	<span style="color: #483d8b;">'django.contrib.sessions'</span>,
	<span style="color: #483d8b;">'django.contrib.sites'</span>,
	<span style="color: #483d8b;">'todos'</span>,
	<span style="color: #483d8b;">'cornelius'</span> <span style="color: #808080; font-style: italic;"># &lt;- SEE! :D</span></pre></div></div>


<h4>Making Views to Make Connections</h4>

<p>We can&#8217;t trust the client. As such, we do not allow the client to connect itself to any path it wants. Instead, it has to go through our Django web app. Ironically, since we&#8217;re just doing a simple application, we <em>are</em> in fact, going to allow the client to connect to whatever it wants (I&#8217;ll show how to change this, though).</p>

<p>First, you need an updated urls.py:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">conf</span>.<span style="color: black;">urls</span>.<span style="color: black;">defaults</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
&nbsp;
urlpatterns = patterns<span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>,
	<span style="color: #808080; font-style: italic;"># You don't have to do it this way, but in this example, we match</span>
	<span style="color: #808080; font-style: italic;"># optional ending slashes.</span>
	<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^tasks/?$'</span>, <span style="color: #483d8b;">&quot;todos.views.tasks&quot;</span><span style="color: black;">&#41;</span>,
	<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^task/(?P&lt;taskid&gt;[0-9]+)$'</span>, <span style="color: #483d8b;">&quot;todos.views.task&quot;</span><span style="color: black;">&#41;</span>,
&nbsp;
	<span style="color: #808080; font-style: italic;"># See here:</span>
	<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^tasks/connect/(?P&lt;uid&gt;[^<span style="color: #000099; font-weight: bold;">\s</span>]+)$'</span>, <span style="color: #483d8b;">&quot;todos.views.connect&quot;</span><span style="color: black;">&#41;</span>,
	<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^tasks/disconnect/(?P&lt;uid&gt;[^<span style="color: #000099; font-weight: bold;">\s</span>]+)$'</span>, <span style="color: #483d8b;">&quot;todos.views.disconnect&quot;</span><span style="color: black;">&#41;</span>
<span style="color: black;">&#41;</span></pre></div></div>


<p>This makes tasks/connect/(CLIENT_ID) call our &#8220;connect&#8221; view, and tasks/disconnect/(CLIENT_ID) call our &#8220;disconnect&#8221; view.</p>

<p>Now, for the views themselves:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Import cornelius's Dudley</span>
<span style="color: #ff7700;font-weight:bold;">from</span> cornelius <span style="color: #ff7700;font-weight:bold;">import</span> dudley
&nbsp;
<span style="color: #808080; font-style: italic;"># Connect</span>
<span style="color: #ff7700;font-weight:bold;">def</span> connect<span style="color: black;">&#40;</span>request, uid<span style="color: black;">&#41;</span>:
	paths = json.<span style="color: black;">loads</span><span style="color: black;">&#40;</span>request.<span style="color: black;">raw_post_data</span><span style="color: black;">&#41;</span>  <span style="color: #808080; font-style: italic;"># Pomona sends the list of paths to connect to in a JSON array.</span>
	<span style="color: #808080; font-style: italic;"># note: paths is just a plain list of strings; you can loop through them and filter for security.</span>
	dudley.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>uid, paths<span style="color: black;">&#41;</span>  <span style="color: #808080; font-style: italic;"># Dudley takes a client id and a list of paths. That's it.</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> disconnect<span style="color: black;">&#40;</span>request, uid<span style="color: black;">&#41;</span>:
	paths = json.<span style="color: black;">loads</span><span style="color: black;">&#40;</span>request.<span style="color: black;">raw_post_data</span><span style="color: black;">&#41;</span>
	<span style="color: #808080; font-style: italic;"># note: ditto regarding paths being a list of strings.</span>
	dudley.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>uid, paths<span style="color: black;">&#41;</span></pre></div></div>


<h4>Triggering Events</h4>

<p>Django has nice post-save and post-delete events we can use to trigger events (&#8220;updates&#8221; in Roots-speak).</p>

<p>Here&#8217;s how we use them:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Comet alerters</span>
<span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">db</span>.<span style="color: black;">models</span>.<span style="color: black;">signals</span> <span style="color: #ff7700;font-weight:bold;">import</span> post_save, post_delete
<span style="color: #ff7700;font-weight:bold;">def</span> task_saved<span style="color: black;">&#40;</span>sender, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">try</span>:
		instance = kwargs<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;instance&quot;</span><span style="color: black;">&#93;</span>
		dudley.<span style="color: black;">update</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;tasks&quot;</span>, json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span>task_to_raw<span style="color: black;">&#40;</span>instance<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">except</span>:
		<span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> task_destroyed<span style="color: black;">&#40;</span>sender, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">try</span>:
		instance = kwargs<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;instance&quot;</span><span style="color: black;">&#93;</span>
		data = task_to_raw<span style="color: black;">&#40;</span>instance<span style="color: black;">&#41;</span>
		data<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;DELETE&quot;</span><span style="color: black;">&#93;</span> = <span style="color: #008000;">True</span>
		dudley.<span style="color: black;">update</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;tasks&quot;</span>, json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">except</span>:
		<span style="color: #ff7700;font-weight:bold;">pass</span>
post_save.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>task_saved, sender=Task<span style="color: black;">&#41;</span>
post_delete.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>task_destroyed, sender=Task<span style="color: black;">&#41;</span></pre></div></div>


<p>Note how we once again use task_to_raw.</p>

<p><strong>And now, the server-side is done!</strong></p>

<p>Of course, start it with:</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ python manage.py runserver</pre></div></div>


<h3>Client Side</h3>

<h4>Getting and Setting Up Pomona</h4>

<p>In your SproutCore terminal, navigate to your SproutCore project. Then, get Pomona and put it in the &#8220;frameworks&#8221; folder:
<pre>$ git clone git://github.com/ialexi/pomona.git frameworks/pomona</pre></p>

<p>Next, just like you add the project in Django, you need to add the framework to your SproutCore project. To accomplish this, you edit the &#8220;config&#8221; line of &#8220;Buildfile&#8221; to look like this:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">config <span style="color:#ff3333; font-weight:bold;">:all</span>, <span style="color:#ff3333; font-weight:bold;">:required</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:sproutcore</span>, <span style="color:#ff3333; font-weight:bold;">:pomona</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>


<p>You changed it from the solitary :sproutcore, to the array [:sproutcore, :pomona].</p>

<p>Next, you need to proxy Roots&#8217; long-polling server. Just add this line at the end of Buildfile after the other two proxy lines:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">proxy <span style="color:#996600;">&quot;/comet/&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:to</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;localhost:8008&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:url</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;/&quot;</span></pre></div></div>


<h4>Subscribing to Events</h4>

<p>There are two things that have to happen to subscribe to events: create and configure an instance of the long-poller, and call connect().</p>

<p>The easiest place to do this is in an init function in our data source. Just place this code in the DataSource definition (preferably at the top).</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  init<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// DataSource has no init right now, but what if it adds one?</span>
    <span style="color: #006600; font-style: italic;">// so, call super function first.</span>
    sc_super<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
    <span style="color: #006600; font-style: italic;">// needs proxy /comet/ to dobby</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">firenze</span> <span style="color: #339933;">=</span> Pomona.<span style="color: #660066;">Firenze</span>.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>    <span style="color: #006600; font-style: italic;">// Firenze is the name of the long-poll system.</span>
      connectUrl<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;/tasks/connect/%@&quot;</span><span style="color: #339933;">,</span>        <span style="color: #006600; font-style: italic;">// %@ is replaced with the client id</span>
      disconnectUrl<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;/tasks/disconnect/%@&quot;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// tell it to call this.taskReceived when a message is received on path &quot;tasks&quot;</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">firenze</span>.<span style="color: #660066;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;tasks&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;taskReceived&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span></pre></div></div>


<p>The connectUrl/disconnectUrl parameters tell Pomona what URLs to send connect and disconnect requests to. All it does is send a JSON array of path (event) names in a JSON array). It will automatically re-send these messages if the connection with the long-polling server is interrupted and a new connection (with a new id) is created.</p>

<p>All that&#8217;s left now is to receive messages!</p>

<h4>Receiving Messages</h4>

<p>Receiving messages is simple: we just implement the &#8220;taskReceived&#8221; function we told it about earlier.</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  taskReceived<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>path<span style="color: #339933;">,</span> message<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>message.<span style="color: #660066;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">// the first time, we receive &quot;&quot; to confirm connection</span>
    <span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> JSON.<span style="color: #660066;">parse</span><span style="color: #009900;">&#40;</span>message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   <span style="color: #006600; font-style: italic;">// we sent a JSON-encoded message from Python</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>data.<span style="color: #000066; font-weight: bold;">DELETE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// We set DELETE if the record needed deleting</span>
      Todos.<span style="color: #660066;">store</span>.<span style="color: #660066;">pushDestroy</span><span style="color: #009900;">&#40;</span>Todos.<span style="color: #660066;">Task</span><span style="color: #339933;">,</span> data.<span style="color: #660066;">guid</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// otherwise, we should just re-load that record.</span>
      Todos.<span style="color: #660066;">store</span>.<span style="color: #660066;">loadRecords</span><span style="color: #009900;">&#40;</span>Todos.<span style="color: #660066;">Task</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>data<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> 
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span></pre></div></div>


<h3>That&#8217;s All!</h3>

<p>Start sc-server, open two browsers, both pointing at <a href="http://localhost:4020/todos">http://localhost:4020/todos</a>, and hopefully, you&#8217;ll have Comet.</p>

<p>There may be some bumps—if anyone is willing to test and offer feedback, please do so!</p>

<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://create.tpsitulsa.com/blog/2009/12/11/sc-todos-django-comet/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SproutCore Animation Mixin Timing Curves (and BUG FIXES!!!)</title>
		<link>http://create.tpsitulsa.com/blog/2009/12/10/sc-animate-timing/</link>
		<comments>http://create.tpsitulsa.com/blog/2009/12/10/sc-animate-timing/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 01:08:15 +0000</pubDate>
		<dc:creator>Alex Iskander</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://create.tpsitulsa.com/blog/?p=258</guid>
		<description><![CDATA[First, the comparatively boring but very good news: several bugs which made CSS transitions not always work too well have been fixed! There were a lot of little errors—including a really odd one in Safari that caused transitions to be ignored if they were initiated too soon after a style.display change—that were causing some rather [...]]]></description>
			<content:encoded><![CDATA[<p>First, the comparatively boring but very good news: several bugs which made CSS transitions not always work too well have been fixed! There were a lot of little errors—including a <em>really</em> odd one in Safari that caused transitions to be ignored if they were initiated too soon after a style.display change—that were causing some rather annoying issues, and they have now been resolved.</p>

<p>Now, the comparatively exciting:
<strong>The <a href="http://github.com/ialexi/animate/">SproutCore Animation mixin</a> now supports timing curves!
</strong></p>

<p>There are two ways to set the timing curve to use: globally and locally. The global timing curve (null by default) is used if there is no local timing curve—in essence, the global timing curve is the default timing curve (in fact, it is named defaultTimingFunction).</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">aView<span style="color: #339933;">:</span> SC.<span style="color: #660066;">LabelView</span>.<span style="color: #660066;">design</span><span style="color: #009900;">&#40;</span>Animate.<span style="color: #660066;">Animatable</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    transitions<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
        left<span style="color: #339933;">:</span> .25<span style="color: #339933;">,</span>
        top<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>duration<span style="color: #339933;">:</span> .25<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        width<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> duration<span style="color: #339933;">:</span> .25<span style="color: #339933;">,</span> timing<span style="color: #339933;">:</span> Animate.<span style="color: #660066;">TIMING_EASE_IN_OUT</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// with timing curve</span>
        height<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> duration<span style="color: #339933;">:</span> .5<span style="color: #339933;">,</span> timing<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.58</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// with custom timing curve</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>


<p>Timing curves are cubic beziér curves, as used in <a href="http://www.w3.org/TR/2009/WD-css3-transitions-20091201/">CSS Transitions</a>. They can be used as CSS-only, or, if you are willing to take a bit of a JavaScript performance hit, in both CSS and JavaScript. In fact, the JavaScript variety&#8217;s code is based on <a href="http://trac.webkit.org/browser/trunk/WebCore/platform/graphics/UnitBezier.h">WebKit&#8217;s actual code</a> for handling cubic beziér curves.</p>

<p>The pre-defined timing curves are identical to the CSS timing functions:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// CSS-only</span>
TRANSITION_NONE<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;linear&quot;</span><span style="color: #339933;">,</span>
TRANSITION_CSS_EASE<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;ease&quot;</span><span style="color: #339933;">,</span>
TRANSITION_CSS_EASE_IN<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;ease-in&quot;</span><span style="color: #339933;">,</span>
TRANSITION_CSS_EASE_OUT<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;ease-out&quot;</span><span style="color: #339933;">,</span>
TRANSITION_CSS_EASE_OUT<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;ease-in-out&quot;</span><span style="color: #339933;">,</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// JavaScript-enabled</span>
TRANSITION_EASE<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0.25</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.25</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
TRANSITION_LINEAR<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0.0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
TRANSITION_EASE_IN<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0.42</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
TRANSITION_EASE_OUT<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.58</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
TRANSITION_EASE_IN_OUT<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0.42</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.58</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.0</span><span style="color: #009900;">&#93;</span></pre></div></div>


<p>The implementation is somewhat simple; if the timing function is a string, it is set directly into the transition-timing-function CSS property—and JavaScript animations ignore it (and thus work linearly). Otherwise, a cubic-bezier() is inserted into the CSS, <em>and</em> the JavaScript implementation is set up.</p>

<p>The calculations for the cubic beziér curves involve loops, and must be calculated <em>every</em> frame—they have a significant potential to slow things down (it may be wise to have a pre-calculated option as well at some point to help alleviate this). As such, you may not want to use the JavaScript variety <em>unless</em> you are animating relatively few elements.</p>

<p>I don&#8217;t know if anyone is using the Animate mixin (aside from me) but if anyone is, I hope they enjoy this new feature!</p>
]]></content:encoded>
			<wfw:commentRss>http://create.tpsitulsa.com/blog/2009/12/10/sc-animate-timing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Type Trees</title>
		<link>http://create.tpsitulsa.com/blog/2009/03/28/type-trees/</link>
		<comments>http://create.tpsitulsa.com/blog/2009/03/28/type-trees/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 20:14:46 +0000</pubDate>
		<dc:creator>Alex Iskander</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://create.tpsitulsa.com/blog/?p=102</guid>
		<description><![CDATA[The Script Engine in the Create Framework was built so that existing class hierarchies could be wrapped very easily. There is a somewhat deep class hierarchy in the framework, and as such, something that handled inheritance easily and transparently was required. In many cases, there were arrays of base classes. In C++, handling these is [...]]]></description>
			<content:encoded><![CDATA[<p>The Script Engine in the Create Framework was built so that existing class hierarchies could be wrapped very easily. There is a somewhat deep class hierarchy in the framework, and as such, something that handled inheritance easily and transparently was required.</p>

<p>In many cases, there were arrays of base classes. In C++, handling these is relatively simple: you either treat them <em>as</em> base classes, or you dynamic_cast, etc. The same thing applied with functions accepting pointers to base classes as arguments: you have to either treat it as a base class, or test by converting. I considered using this approach; it would be quite easy to implement, and would be very high-performance. In fact, there are a couple of objects which are still wrapped for scripting using this approach, with <em>isWhatever</em> and <em>whateverValue</em> members.</p>

<p>I eventually decided against using this principle, however. The reason is simple: I am wrapping C++ objects for JavaScript. To C++, I want everything to look and act like C++. To JavaScript, however, I don&#8217;t want things to act like C++ — I want them to act like JavaScript.</p>

<p><span id="more-102"></span></p>

<p>There is no such thing as a base class in JavaScript. An object is either of a specific type, or it isn&#8217;t. (This is a simplification; prototype inheritance allows something like a base class, but the point still stands).</p>

<p>So, when I pass a pointer to a Base to JavaScript, that actually refers to a Derived, JavaScript should know, and should wrap the object with a wrapper for the derived class (if one exists).</p>

<p>Things got tricky very quickly.</p>

<p>I started by creating a type map between types, which were determined using <em>typeid</em> and RTTI, and the wrappers associated with the types. This worked, except when passing JavaScript an object of a type not specifically placed in the map. I only made JavaScript aware of the types implemented in JavaScript, which meant that types derived from these types were not handled automatically.</p>

<p>The solution was a bit tricky, but works: in addition to keeping a type map for caching, I now also keep a type tree. If the cache misses*, the type tree, which stores the types hierarchically, is used to determine the correct type.</p>

<p>Each type in the tree has its own collection of sub-types. Each time a type is searched for, each of the sub-types are checked to see if the type is one of them (through dynamic_cast). Is this slow? Of course. But this performance penalty <em>only</em> occurs the first time any type is used*. After that, it is cached in the type map.</p>

<p>What does this allow me to do? I can wrap an object like so:</p>


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #666666;">//make a new point</span>
<span style="color: #666666;">//but instead of making a Point, make a point of type MySpecialPointType.</span>
<span style="color: #666666;">//JavaScript has never heard of this type, but since it has heard of Point, the base</span>
<span style="color: #666666;">//class for my special point type, things will work.</span>
Point <span style="color: #000040;">*</span>point2 <span style="color: #000080;">=</span><span style="color: #0000dd;">new</span> MySpecialPointType<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">//wrap the point for scripting</span>
<span style="color: #666666;">//automatically wraps it as if it was a Point.</span>
SObject object <span style="color: #000080;">=</span> $<span style="color: #008000;">&#40;</span>myPoint<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">//get a function from script</span>
SFunction jsFunction <span style="color: #000080;">=</span> context<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>get<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;myFunction&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>functionValue<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">//prepare an arguments array</span>
SArguments arguments<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">//pass our wrapped point as the first argument</span>
arguments.<span style="color: #007788;">push</span><span style="color: #008000;">&#40;</span>object<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">//call the function, using object as &quot;this&quot; and the first argument</span>
jsFunction<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>call<span style="color: #008000;">&#40;</span>object, arguments<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>


<p><strong>*</strong> A small snag, at this point, is that the cache does not work. Every time I enable it, it appears invalid entries get entered into the cache. I have not yet had time to debug thoroughly, so for now, it has a minor performance penalty every time an object is created.</p>
]]></content:encoded>
			<wfw:commentRss>http://create.tpsitulsa.com/blog/2009/03/28/type-trees/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welcome!</title>
		<link>http://create.tpsitulsa.com/blog/2009/01/28/welcome/</link>
		<comments>http://create.tpsitulsa.com/blog/2009/01/28/welcome/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 03:45:45 +0000</pubDate>
		<dc:creator>Alex Iskander</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://create.tpsitulsa.com/blog/?p=27</guid>
		<description><![CDATA[It is, I believe, customary to have a welcome post. Please consider this humble little post to be your welcome. If you find it unsatisfactory, just pretend something satisfactory is here. Or look at the first real post. Thank you.]]></description>
			<content:encoded><![CDATA[<p>It is, I believe, customary to have a welcome post. Please consider this humble little post to be your welcome. If you find it unsatisfactory, just pretend something satisfactory is here. Or look at the first real post.</p>

<p>Thank you.</p>
]]></content:encoded>
			<wfw:commentRss>http://create.tpsitulsa.com/blog/2009/01/28/welcome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

