<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>On the Vampire Schedule Again</title>
	<atom:link href="http://ifwdev.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ifwdev.wordpress.com</link>
	<description>(Web) Design &#38; Development</description>
	<lastBuildDate>Thu, 20 Nov 2008 14:33:54 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='ifwdev.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/cdda0ae34392abd7cc35a91e6d7e1987?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>On the Vampire Schedule Again</title>
		<link>http://ifwdev.wordpress.com</link>
	</image>
			<item>
		<title>Get WeekDays in a Month (C# 3.0)</title>
		<link>http://ifwdev.wordpress.com/2008/11/20/get-weekdays-in-a-month-c-30/</link>
		<comments>http://ifwdev.wordpress.com/2008/11/20/get-weekdays-in-a-month-c-30/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 14:33:54 +0000</pubDate>
		<dc:creator>ifwdev</dc:creator>
				<category><![CDATA[.NET 3.5]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C# 3.0]]></category>
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://ifwdev.wordpress.com/?p=8</guid>
		<description><![CDATA[var weekends = new DayOfWeek[] { DayOfWeek.Saturday, DayOfWeek.Sunday };
 
DateTime calendarMonth = DateTime.Parse(&#8220;10/1/2008&#8243;);
 
int totalDays = DateTime.DaysInMonth(DateTime.Now.Year, calendarMonth.Month);
 
IEnumerable&#60;int&#62; businessDays = Enumerable.Range(1, totalDays)
 .Where(d =&#62; 
 !weekends.Contains(new DateTime(DateTime.Now.Year, calendarMonth.Month, d).DayOfWeek)
 )
;
 
//loop through businessDays or get a count&#8230;
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=8&subd=ifwdev&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>var weekends = new DayOfWeek[] { DayOfWeek.Saturday, DayOfWeek.Sunday };</p>
<p> </p>
<p>DateTime calendarMonth = DateTime.Parse(&#8220;10/1/2008&#8243;);</p>
<p> </p>
<p>int totalDays = DateTime.DaysInMonth(DateTime.Now.Year, calendarMonth.Month);</p>
<p> </p>
<p>IEnumerable&lt;int&gt; businessDays = Enumerable.Range(1, totalDays)</p>
<p><span> </span>.Where(d =&gt; </p>
<p><span> </span>!weekends.Contains(new DateTime(DateTime.Now.Year, calendarMonth.Month, d).DayOfWeek)</p>
<p><span> </span>)</p>
<p>;</p>
<p> </p>
<p>//loop through businessDays or get a count&#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifwdev.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifwdev.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifwdev.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifwdev.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifwdev.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifwdev.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifwdev.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifwdev.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifwdev.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifwdev.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=8&subd=ifwdev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifwdev.wordpress.com/2008/11/20/get-weekdays-in-a-month-c-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ce67211b878f619ceb7ddc151c4fcae?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ifwdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Safari Windows Beta</title>
		<link>http://ifwdev.wordpress.com/2007/06/16/safari-windows-beta/</link>
		<comments>http://ifwdev.wordpress.com/2007/06/16/safari-windows-beta/#comments</comments>
		<pubDate>Sat, 16 Jun 2007 11:20:34 +0000</pubDate>
		<dc:creator>ifwdev</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ifwdev.wordpress.com/2007/06/16/safari-windows-beta/</guid>
		<description><![CDATA[If you haven&#8217;t checked it out yet already, I highly suggest downloading the Safari 3 Public Beta.  Obviously this makes testing easier (especially when you don&#8217;t have a Mac to test on).  It&#8217;s also blazingly fast.  I have noticed a significant speed difference when loading pages compared to IE7 or Firefox (especially with extra plugins) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=7&subd=ifwdev&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you haven&#8217;t checked it out yet already, I highly suggest downloading the <a href="http://www.apple.com/safari/download/">Safari 3 Public Beta</a>.  Obviously this makes testing easier (especially when you don&#8217;t have a Mac to test on).  It&#8217;s also blazingly fast.  I have noticed a significant speed difference when loading pages compared to IE7 or Firefox (especially with extra plugins) or Opera.  The font rendering is a direct emulation of OS X, which is definitely strange at first.  For larger fonts its great, but ClearType looks superior (to me at least) for smaller sizes&#8230;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifwdev.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifwdev.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifwdev.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifwdev.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifwdev.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifwdev.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifwdev.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifwdev.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifwdev.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifwdev.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifwdev.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifwdev.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=7&subd=ifwdev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifwdev.wordpress.com/2007/06/16/safari-windows-beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ce67211b878f619ceb7ddc151c4fcae?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ifwdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Ajax.NET Professional with Mootools (part 2)</title>
		<link>http://ifwdev.wordpress.com/2007/06/07/ajaxnet-professional-with-mootools-part-2/</link>
		<comments>http://ifwdev.wordpress.com/2007/06/07/ajaxnet-professional-with-mootools-part-2/#comments</comments>
		<pubDate>Thu, 07 Jun 2007 23:22:01 +0000</pubDate>
		<dc:creator>ifwdev</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mootools]]></category>

		<guid isPermaLink="false">http://ifwdev.wordpress.com/2007/06/07/ajaxnet-professional-with-mootools-part-2/</guid>
		<description><![CDATA[This is an update to my original post.&#160; That version was a preliminary attempt and should not be used in production.
The MootoolsTypeJavaScriptProvider is a compatibility layer between AjaxPro and Mootools&#8230;
The provider now supports most of the native AjaxPro javascript functionality.&#160; The idea is to maintain as much compatibility as possible with the original AjaxPro javascript [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=6&subd=ifwdev&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>This is an update to my </em><a href="http://ifwdev.wordpress.com/2007/06/01/hello-world/"><em>original post</em></a><em>.&nbsp; That version was a preliminary attempt and should not be used in production.</em></p>
<p><strong><em>The</em> <font face="consolas">MootoolsTypeJavaScriptProvider</font> <em>is a compatibility layer between </em><a href="http://ajaxpro.info"><em>AjaxPro</em></a><em> and </em><a href="http://www.mootools.net"><em>Mootools</em></a><em>&#8230;</em></strong></p>
<p>The provider now supports most of the native AjaxPro javascript functionality.&nbsp; The idea is to maintain as much compatibility as possible with the original AjaxPro javascript library to eliminate the need for changes to existing code.</p>
<p><a href="http://creativestandards.com/blog/files/Ifw.AjaxNet-1.6.zip">Download Version 1.6 Binaries</a><br /><a href="http://creativestandards.com/blog/files/Ifw.AjaxNet-1.6-Source.zip">Download Source Project</a></p>
<p>Tested on Internet Explorer 6&nbsp;&amp; 7, Firefox 1.5 &amp; 2.0, Opera 9.</p>
<p><strong><br />Working AjaxPro javascript&nbsp;options:</strong></p>
<ul>
<li><font color="#656565">Fully compatible method signature for invoking calls from script: <em>MyServerClass.Method(&lt;arguments&#8230;&gt;, callback, context, onError);</em></font>
<li><font color="#656565">Synchronous requests (no change in syntax)</font>
<li><font color="#656565">Compatible with most Global AjaxPro options &amp; event handlers:</font>
<ul>
<li><font color="#656565">AjaxPro.onLoading</font>
<li><font color="#656565"><font color="#656565">AjaxPro.</font>onError</font>
<li><font color="#656565"><font color="#656565">AjaxPro.</font>onTimeout</font>
<li><font color="#656565"><font color="#656565">AjaxPro.</font>onStateChanged</font>
<li><font color="#656565"><font color="#656565">AjaxPro.</font>timeoutPeriod</font></li>
</ul>
</li>
</ul>
<p><strong>Not working:</strong></p>
<ul>
<li><font color="#656565"><font color="#656565"><strong>Support for any IE version less than 6</strong> (this is a requirement for Mootools in general)</font></font>
<li><font color="#656565">Tokens (they are implemented on the client, but when you set AjaxPro to RenderJsonCompliant, it stops emitting/checking&nbsp;the token data required.&nbsp; An modified build of AjaxPro is required to fix this)</font>
<li><font color="#656565">AjaxPro.cryptProvider</font>
<li><font color="#656565">AjaxPro.queue (see below)</font>
<li><font color="#656565">Using IFrames instead of XmlHttpRequest</font></li>
</ul>
<p><font color="#656565"><strong><br />Additions / Breaking Changes from default AjaxPro javascript lib:</strong></font></p>
<ul>
<li><font color="#656565">AjaxPro.toJSON simply references Mootools Json.toString.&nbsp; The resulting JSON string may be different.</font>
<li><font color="#656565">AjaxPro.queue does not work, however you can toggle request queuing by using the AjaxPro.queueRequests flag I&#8217;ve added (defaults to true).&nbsp; This is just a wrapper for Mootools autoCancel property which handles the actual request queue.</font>
<li><font color="#656565">Aborting asynchronous requests uses different syntax.&nbsp; To abort a request,&nbsp;use the&nbsp;following:<br /></font>
<div class="wlWriterSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;overflow:auto;">
<div><span style="color:#0000FF;">var</span><span style="color:#000000;"> req </span><span style="color:#000000;">=</span><span style="color:#000000;"> MyServerClass.Method(...);
req.cancel();</span></div>
</pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p><font color="#656565"></p>
<p>This is using the native cancel function&nbsp;from the Mootools XHR class.</font></li>
</ul>
<p><strong>Usage</strong></p>
<ul>
<li>Copy the <strong><font face="Consolas">mootools-core.js</font></strong> file into your project
<li>Reference the <font face="consolas">Ifw.AjaxNet.dll</font> assembly in your project
<li>Adjust the AjaxPro&nbsp;<font face="consolas"><strong>web.config</strong></font> options in <font face="consolas"><strong>ajaxNet/ajaxSettings</strong></font>:</li>
</ul>
<div class="wlWriterSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;overflow:none;font-family:Consolas;font-size:11.25px;">
<div><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">scriptReplacements</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">file </span><span style="color:#FF0000;">name</span><span style="color:#0000FF;">=&quot;core&quot;</span><span style="color:#FF0000;"> path</span><span style="color:#0000FF;">=&quot;~/res/js/ajaxpro/mootools-core.js&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">file </span><span style="color:#FF0000;">name</span><span style="color:#0000FF;">=&quot;prototype&quot;</span><span style="color:#FF0000;"> path</span><span style="color:#0000FF;">=&quot;&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">file </span><span style="color:#FF0000;">name</span><span style="color:#0000FF;">=&quot;converter&quot;</span><span style="color:#FF0000;"> path</span><span style="color:#0000FF;">=&quot;&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">scriptReplacements</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">

</span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">providers</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">typeJavaScriptProvider </span><span style="color:#FF0000;">type</span><span style="color:#0000FF;">=&quot;Ifw.AjaxNet.MootoolsTypeJavaScriptProvider, Ifw.AjaxNet&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">providers</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">

</span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">oldStyle</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">renderJsonCompliant</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">renderDateTimeAsString</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">oldStyle</span><span style="color:#0000FF;">&gt;</span></div>
</pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifwdev.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifwdev.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifwdev.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifwdev.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifwdev.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifwdev.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifwdev.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifwdev.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifwdev.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifwdev.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifwdev.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifwdev.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=6&subd=ifwdev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifwdev.wordpress.com/2007/06/07/ajaxnet-professional-with-mootools-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ce67211b878f619ceb7ddc151c4fcae?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ifwdev</media:title>
		</media:content>
	</item>
		<item>
		<title>More AjaxPro Serialization Problems with NHibernate Entities</title>
		<link>http://ifwdev.wordpress.com/2007/06/03/ajaxpro-serialization-problems-with-nhibernate-entities/</link>
		<comments>http://ifwdev.wordpress.com/2007/06/03/ajaxpro-serialization-problems-with-nhibernate-entities/#comments</comments>
		<pubDate>Sun, 03 Jun 2007 14:10:36 +0000</pubDate>
		<dc:creator>ifwdev</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Castle ActiveRecord]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://ifwdev.wordpress.com/2007/06/03/ajaxpro-serialization-problems-with-nhibernate-entities/</guid>
		<description><![CDATA[Edit: It seems that disabling lazy loading with NHibernate/ActiveRecord will keep properties from being overridden (and therefore AjaxPro will still see the base property AjaxNonSerializable attributes).&#160; This can still have a negative effect on performance and I would like to fix the actual cause, but at least I can use this solution in the interim.
In [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=5&subd=ifwdev&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Edit: </strong><em>It seems that disabling lazy loading with NHibernate/ActiveRecord will keep properties from being overridden (and therefore AjaxPro will still see the base property <strong>AjaxNonSerializable</strong> attributes).&nbsp; This can still have a negative effect on performance and I would like to fix the actual cause, but at least I can use this solution in the interim.</em></p>
<p>In my <a title="AjaxPro + NHibernate = Crash" href="http://ifwdev.wordpress.com/2007/06/01/ajaxpro-nhibernate-crash/">previous post</a>, I mentioned how the bidirectional object references that manage parent-child relationships for a domain model intended for use with <a href="http://www.hibernate.org/343.html">NHibernate</a> causes <a href="http://ajaxpro.info">AjaxPro&#8217;s</a> JSON serializer to crash with an infinite loop.&nbsp; The answer to this was to mark the &#8220;parent&#8221; properties of all child objects with an <strong>[AjaxNonSerializable]</strong> attribute.&nbsp; In my initial tests, this worked great.&nbsp; However, when actually using NHibernate to retrieve objects from the database, I&#8217;m back to my original crashing problem.</p>
<p>The crash is occurring because of how NHibernate creates new instances of objects from the database.&nbsp; It is actually inheriting from your base object and returning an instance of that instead.&nbsp; So instead of getting a <em><strong>Blog</strong></em> object, you are getting an instance of the <strong>B<em>log_NHibernate_proxy</em></strong> class which derives from&nbsp;<em><strong>Blog</strong></em>&nbsp;(that is not the actual naming convention, but illustrates the point).</p>
<p>The <strong>[AjaxNonSerializable]</strong> attribute doesn&#8217;t affect derived types, only the type you actually mark with it.&nbsp; This creates a problem, since the NHibernate proxy types are generated at runtime via reflection.&nbsp; There is no way that I know of to tell NHibernate to copy over attributes from the base class.&nbsp; There is no way to tell AjaxPro to check base types for the attributes either.</p>
<p>I hope I am wrong about this.&nbsp; Here is a simple test case to show that the AjaxPro serialization attributes only affect the defined type:</p>
</p>
<div class="wlWriterSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;overflow:auto;font-family:Consolas;font-size:11.25px;">
<div><span style="color:#0000FF;">using</span><span style="color:#000000;"> System;
</span><span style="color:#0000FF;">using</span><span style="color:#000000;"> System.Text;
</span><span style="color:#0000FF;">using</span><span style="color:#000000;"> AjaxPro;
</span><span style="color:#0000FF;">using</span><span style="color:#000000;"> NUnit.Framework;

</span><span style="color:#0000FF;">namespace</span><span style="color:#000000;"> Ifw.Cgd.Tests.AjaxPro
{
    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> Foo
    {
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">virtual</span><span style="color:#000000;"> </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> Name
        {
            </span><span style="color:#0000FF;">get</span><span style="color:#000000;"> { </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> _test; }
            </span><span style="color:#0000FF;">set</span><span style="color:#000000;"> { _test </span><span style="color:#000000;">=</span><span style="color:#000000;"> value; }
        }

        [AjaxNonSerializable]
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">virtual</span><span style="color:#000000;"> </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> Name2
        {
            </span><span style="color:#0000FF;">get</span><span style="color:#000000;"> { </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> _test2; }
            </span><span style="color:#0000FF;">set</span><span style="color:#000000;"> { _test2 </span><span style="color:#000000;">=</span><span style="color:#000000;"> value; }
        }

        </span><span style="color:#0000FF;">private</span><span style="color:#000000;"> </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> _test </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;&quot;</span><span style="color:#000000;">;
        </span><span style="color:#0000FF;">private</span><span style="color:#000000;"> </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> _test2 </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;&quot;</span><span style="color:#000000;">;
    }

    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> Bar : Foo
    {
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">override</span><span style="color:#000000;"> </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> Name2
        {
            </span><span style="color:#0000FF;">get</span><span style="color:#000000;"> { </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">overriden</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">; }
            </span><span style="color:#0000FF;">set</span><span style="color:#000000;"> { </span><span style="color:#0000FF;">base</span><span style="color:#000000;">.Name2 </span><span style="color:#000000;">=</span><span style="color:#000000;"> value; }
        }

        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">virtual</span><span style="color:#000000;"> </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> Name3
        {
            </span><span style="color:#0000FF;">get</span><span style="color:#000000;"> { </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> _test3; }
            </span><span style="color:#0000FF;">set</span><span style="color:#000000;"> { _test3 </span><span style="color:#000000;">=</span><span style="color:#000000;"> value; }
        }
        </span><span style="color:#0000FF;">private</span><span style="color:#000000;"> </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> _test3 </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;&quot;</span><span style="color:#000000;">;
    }

    [TestFixture]
    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> AjaxProJsonTests
    {
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> ajaxSerialize(</span><span style="color:#0000FF;">object</span><span style="color:#000000;"> o)
        {
            StringBuilder sb </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> StringBuilder();
            JavaScriptSerializer.Serialize(o, sb);
            </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> sb.ToString();
        }

        [Test]
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> CanSerializeBaseObject()
        {
            Foo x </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> Foo();
            x.Name </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">test</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">;
            x.Name2 </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">test2</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">; </span><span style="color:#008000;">//</span><span style="color:#008000;">should be ignored by AjaxPro</span><span style="color:#008000;">
</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> js </span><span style="color:#000000;">=</span><span style="color:#000000;"> ajaxSerialize(x);
            Console.WriteLine(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Foo JSON: </span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">+</span><span style="color:#000000;"> js);

            Foo abc </span><span style="color:#000000;">=</span><span style="color:#000000;"> JavaScriptDeserializer.DeserializeFromJson</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">Foo</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">(js);

            Assert.AreEqual(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">test</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, abc.Name, </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Foo.Name not set properly</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
            Assert.AreNotEqual(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">test2</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, abc.Name2, </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Foo.Name2 should not be serialized</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
        }

        [Test]
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> CanSerializeInheritedObject()
        {
            Bar x </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> Bar();
            x.Name </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">test</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">;
            x.Name2 </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">test2</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">; </span><span style="color:#008000;">//</span><span style="color:#008000;">should be ignored by AjaxPro</span><span style="color:#008000;">
</span><span style="color:#000000;">            x.Name3 </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">test3</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">;

            </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> js </span><span style="color:#000000;">=</span><span style="color:#000000;"> ajaxSerialize(x);
            Console.WriteLine(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Bar JSON: </span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">+</span><span style="color:#000000;"> js);

            Bar abc </span><span style="color:#000000;">=</span><span style="color:#000000;"> JavaScriptDeserializer.DeserializeFromJson</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">Bar</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">(js);

            Assert.AreEqual(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">test</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, abc.Name, </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Foo.Name not set properly</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
            Assert.AreEqual(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">test3</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, abc.Name3, </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Foo.Name3 not set properly</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
            Assert.AreNotEqual(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">test2</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, abc.Name2, </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Foo.Name2 should not be serialized</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
        }
    }
}</span></div>
</pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</p>
<p>Here is the output:</p>
<p>Foo JSON: {&#8220;Name&#8221;:&#8221;test&#8221;}<br />Bar JSON: {&#8220;Name2&#8243;:&#8221;overriden&#8221;,&#8221;Name3&#8243;:&#8221;test3&#8243;,&#8221;Name&#8221;:&#8221;test&#8221;} </p>
<p>If anyone knows a way around this, I would LOVE to hear it.&nbsp; Thanks.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifwdev.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifwdev.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifwdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifwdev.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifwdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifwdev.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifwdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifwdev.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifwdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifwdev.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifwdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifwdev.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=5&subd=ifwdev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifwdev.wordpress.com/2007/06/03/ajaxpro-serialization-problems-with-nhibernate-entities/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ce67211b878f619ceb7ddc151c4fcae?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ifwdev</media:title>
		</media:content>
	</item>
		<item>
		<title>AjaxPro + NHibernate = Crash</title>
		<link>http://ifwdev.wordpress.com/2007/06/01/ajaxpro-nhibernate-crash/</link>
		<comments>http://ifwdev.wordpress.com/2007/06/01/ajaxpro-nhibernate-crash/#comments</comments>
		<pubDate>Fri, 01 Jun 2007 11:23:41 +0000</pubDate>
		<dc:creator>ifwdev</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Castle ActiveRecord]]></category>
		<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://ifwdev.wordpress.com/2007/06/01/ajaxpro-nhibernate-crash/</guid>
		<description><![CDATA[The Problem
I&#8217;m currently using Castle ActiveRecord (which builds on NHibernate) for a web project.  One problem I was having was pretty annoying when trying to access NHibernate-generated entities as JavaScript objects via Ajax.NET Professional.  ASP.NET would hang for a while and then crash completely with the dreaded &#8220;Application Unavailable&#8221; error from IIS (or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=4&subd=ifwdev&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>The Problem</strong></p>
<p>I&#8217;m currently using <a href="http://castleproject.org/activerecord/">Castle ActiveRecord</a> (which builds on <a href="http://www.hibernate.org/">NHibernate</a>) for a web project.  One problem I was having was pretty annoying when trying to access NHibernate-generated entities as JavaScript objects via <a href="http://ajaxpro.info/">Ajax.NET Professional</a>.  ASP.NET would hang for a while and then crash completely with the dreaded &#8220;Application Unavailable&#8221; error from IIS (or something like that).</p>
<p>With no error messages or stack trace, I immediately blamed the NHibernate proxy objects as the reason why this was happening.  On this assumption, I started considering what would be involved to use <a href="http://www.martinfowler.com/eaaCatalog/dataTransferObject.html">DTOs</a> instead of the actual domain objects.  These would be simpler and hopefully, serializable.  After going down that path and getting frustrated by the added effort required to make that solution work, I decided to come back to the AjaxPro serialization issue and see if I could figure out what the problem was.</p>
<p><strong>The Cause</strong></p>
<p>After writing some serialization tests using manually created instances of my domain models (not proxies that were generated from the NHibernate repository), I found that I had the same problem.  Great, I thought, my class hierarchy is just too complex for the serializer to handle&#8230;</p>
<p>Actually, after considering what is happening in the JSON conversion process, it started to make sense.  When using ActiveRecord (or NHibernate) you need bidirectional references with any collections (or else you lose a lot of functionality).  So the <em><strong>Post</strong></em> object needs to have a <em><strong>Blog</strong></em> property referencing its parent object (which has a collection of <em><strong>Posts</strong></em> as well).  <strong>Hence the reason for the crash: an infinite loop.</strong></p>
<p><strong>The Solution</strong></p>
<p>Any circular references in your class relationships need to be excluded from serialization by marking those properties with <strong>[AjaxPro.AjaxNonSerializable]</strong> (in this case, the <em><strong>Blog</strong></em> property of the <em><strong>Post</strong></em> object).  If you are a DDD purist, you may not like the idea of tacking attributes all over your domain model, but I already bit that bullet when going with ActiveRecord over pure NHibernate anyway.</p>
<p>Keep in mind that if you are passing JavaScript proxy objects back to the server for deserialization, you will need to reconnect the parent-child associations or NHibernate won&#8217;t be able to save them correctly.  It is a little work, but much less than using DTOs with a ton of duplicated properties.</p>
<p>Example:</p>
<p class="wlWriterSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="overflow:auto;background-color:White;"><span style="color:#000000;">    </span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System;
    </span><span style="color:#0000ff;">using</span><span style="color:#000000;"> System.Collections;

    </span><span style="color:#0000ff;">using</span><span style="color:#000000;"> Castle.ActiveRecord;

    [ActiveRecord]
    </span><span style="color:#0000ff;">public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">class</span><span style="color:#000000;"> Blog : ActiveRecordBase
    {
        ...

        </span><span style="color:#0000ff;">private</span><span style="color:#000000;"> IList posts </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">new</span><span style="color:#000000;"> ArrayList();

        ...
        [HasMany(</span><span style="color:#0000ff;">typeof</span><span style="color:#000000;">(Post), Inverse</span><span style="color:#000000;">=</span><span style="color:#0000ff;">true</span><span style="color:#000000;">)]
        </span><span style="color:#0000ff;">public</span><span style="color:#000000;"> IList Posts
        {
            </span><span style="color:#0000ff;">get</span><span style="color:#000000;"> { </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> posts; }
            </span><span style="color:#0000ff;">set</span><span style="color:#000000;"> { posts </span><span style="color:#000000;">=</span><span style="color:#000000;"> value; }
        }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>The <em><strong>Post</strong></em> class:</p>
<p class="wlWriterSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="overflow:auto;background-color:White;"><span style="color:#000000;">    [ActiveRecord]
    </span><span style="color:#0000ff;">public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">class</span><span style="color:#000000;"> Post : ActiveRecordBase
    {
        ...

        </span><span style="color:#0000ff;">private</span><span style="color:#000000;"> Blog blog;

        ...
        [AjaxPro.AjaxNonSerializable]
        [BelongsTo(</span><span style="color:#000000;">"</span><span style="color:#000000;">BlogId</span><span style="color:#000000;">"</span><span style="color:#000000;">)]
        </span><span style="color:#0000ff;">public</span><span style="color:#000000;"> Blog Blog
        {
            </span><span style="color:#0000ff;">get</span><span style="color:#000000;"> { </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> blog; }
            </span><span style="color:#0000ff;">set</span><span style="color:#000000;"> { blog </span><span style="color:#000000;">=</span><span style="color:#000000;"> value; }
        }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></p>
<p>I think that it would be helpful if AjaxPro would check for these kinds of things and throw an Exception instead of just crashing, but the rest of it works quite well so I won&#8217;t complain too much there.  It would also be nice if you didn&#8217;t have to wire up bidirectional associations to make NHibernate work.  I suppose we have to work with the tools we are given though&#8230;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifwdev.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifwdev.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifwdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifwdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifwdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifwdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifwdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifwdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifwdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifwdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifwdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifwdev.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=4&subd=ifwdev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifwdev.wordpress.com/2007/06/01/ajaxpro-nhibernate-crash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ce67211b878f619ceb7ddc151c4fcae?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ifwdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Ajax.NET Professional with Mootools</title>
		<link>http://ifwdev.wordpress.com/2007/06/01/hello-world/</link>
		<comments>http://ifwdev.wordpress.com/2007/06/01/hello-world/#comments</comments>
		<pubDate>Fri, 01 Jun 2007 04:31:07 +0000</pubDate>
		<dc:creator>ifwdev</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Edit: Do not use this.&#160; See the updated post here.
Edit: I posted this pretty quickly without trying to pass back serialized types from the client to AjaxPro. Mootools Json.Remote prepends &#8220;json=&#8221; to the JSON string and AjaxPro&#8217;s deserializer doesn&#8217;t like that. To work around it, I have created Json.AjaxPro which removes this:&#160; 


Json.AjaxPro = XHR.extend({

 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=1&subd=ifwdev&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong><font size="3"><em>Edit: Do not use this.&nbsp; See the <a href="http://ifwdev.wordpress.com/2007/06/07/ajaxnet-professional-with-mootools-part-2/">updated post here</a>.</em></font></strong>
<p><strong>Edit: I posted this pretty quickly without trying to pass back serialized types from the client to AjaxPro. Mootools Json.Remote prepends &#8220;json=&#8221; to the JSON string and AjaxPro&#8217;s deserializer doesn&#8217;t like that. To work around it, I have created Json.AjaxPro which removes this:</strong>&nbsp; </p>
<div class="wlWriterSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;overflow:auto;font-family:Consolas;font-size:11.25px;">
<div><span style="color:#000000;">Json.AjaxPro </span><span style="color:#000000;">=</span><span style="color:#000000;"> XHR.extend({

    initialize: </span><span style="color:#0000FF;">function</span><span style="color:#000000;">(url, options){
        </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.url </span><span style="color:#000000;">=</span><span style="color:#000000;"> url;
        </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.addEvent(</span><span style="color:#000000;">'</span><span style="color:#000000;">onSuccess</span><span style="color:#000000;">'</span><span style="color:#000000;">, </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.onComplete);
        </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.parent(options);
        </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.setHeader(</span><span style="color:#000000;">'</span><span style="color:#000000;">X-Request</span><span style="color:#000000;">'</span><span style="color:#000000;">, </span><span style="color:#000000;">'</span><span style="color:#000000;">JSON</span><span style="color:#000000;">'</span><span style="color:#000000;">);
    },

    send: </span><span style="color:#0000FF;">function</span><span style="color:#000000;">(obj){
        </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.parent(</span><span style="color:#0000FF;">this</span><span style="color:#000000;">.url, Json.toString(obj));
    },

    onComplete: </span><span style="color:#0000FF;">function</span><span style="color:#000000;">(){
        </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.fireEvent(</span><span style="color:#000000;">'</span><span style="color:#000000;">onComplete</span><span style="color:#000000;">'</span><span style="color:#000000;">, Json.evaluate(</span><span style="color:#0000FF;">this</span><span style="color:#000000;">.response.text, </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.options.secure));
    }

});</span></div>
</pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p><strong>See also updated assembly and source code below<br /></strong></p>
<p>I have been meaning to start a blog for a while, if only so I can Google my own thoughts later on&#8230; I have been using the <a title="AJAX.NET Professional by Michael Schwarz" href="http://ajaxpro.info">Ajax.NET library</a> for JSON-RPC with ASP.NET for the last couple of years on various projects. It has always been the easiest way to get an AJAX app going quickly for me. In order to allow easier use with third party libraries like <a href="http://www.mootools.net">Mootools</a>, the latest <a href="http://www.codeplex.com/AjaxPro/Release/ProjectReleases.aspx">AjaxPro beta release</a> adds the ability to alter JSON output to be strictly JSON-compliant (string date formatting mostly) and allows using a custom <strong>TypeJavaScriptProvider </strong>which renders the client script proxies for your server calls. It also adds the <strong>jQueryTypeJavaScriptProvider </strong>which <a href="http://docs.jquery.com/Tutorials:Using_AjaxPro">generates jQuery-compatible proxy functions</a>, eliminating the need to include the default AjaxPro &#8220;core&#8221;, &#8220;prototype core&#8221; and &#8220;converter&#8221; files. In addition to saving bandwidth, this eliminates potential conflicts with other libraries. Since Mootools already has XHR and JSON handling in the form of <a href="http://docs.mootools.net/Remote/Json-Remote.js">JSON.Remote</a>, I took a look a the AjaxPro source to see if I could implement a Mootools provider. It is still a little rough and not every native feature of AjaxPro&#8217;s lib is implemented, but it will work for most cases I think. It supports callback, context and onerror arguments (no changes are required to existing javascript code). Tokens and the global AjaxPro.onError aren&#8217;t working yet, but I will take a look at it when I have more time. If anyone wants to improve on it, that would be helpful. To use this, <a title="Ifw.AjaxNet.zip" href="http://www.creativestandards.com/blog/files/ifw.ajaxnet.zip">download and reference this assembly</a>. You will need the appropriate <strong>ajaxNet/ajaxSettings</strong> in your <strong>web.config</strong>&nbsp; </p>
<div class="wlWriterSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;overflow:auto;font-family:Consolas;font-size:11.25px;">
<div><span style="color:#000000;">            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">scriptReplacements</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
                </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">file </span><span style="color:#FF0000;">name</span><span style="color:#0000FF;">=&quot;core&quot;</span><span style="color:#FF0000;"> path</span><span style="color:#0000FF;">=&quot;&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
                </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">file </span><span style="color:#FF0000;">name</span><span style="color:#0000FF;">=&quot;prototype&quot;</span><span style="color:#FF0000;"> path</span><span style="color:#0000FF;">=&quot;&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
                </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">file </span><span style="color:#FF0000;">name</span><span style="color:#0000FF;">=&quot;converter&quot;</span><span style="color:#FF0000;"> path</span><span style="color:#0000FF;">=&quot;&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">scriptReplacements</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">

            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">providers</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
                </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">typeJavaScriptProvider </span><span style="color:#FF0000;">type</span><span style="color:#0000FF;">=&quot;Ifw.AjaxNet.MootoolsTypeJavaScriptProvider, Ifw.AjaxNet&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">providers</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">

            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">oldStyle</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
                </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">renderJsonCompliant</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
                </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">renderDateTimeAsString</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">oldStyle</span><span style="color:#0000FF;">&gt;</span></div>
</pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>Here is the <a title="MootoolsTypeJavaScriptProvider Source" href="http://www.creativestandards.com/blog/files/Ifw.AjaxNet-Source.zip">VS2005 Project</a> and a quick look at the (simple) source:&nbsp;&nbsp; </p>
<div class="wlWriterSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;overflow:auto;font-family:Consolas;font-size:11.25px;">
<div><span style="color:#0000FF;">using</span><span style="color:#000000;"> System;
</span><span style="color:#0000FF;">using</span><span style="color:#000000;"> System.Reflection;
</span><span style="color:#0000FF;">using</span><span style="color:#000000;"> System.Text;
</span><span style="color:#0000FF;">using</span><span style="color:#000000;"> AjaxPro;

</span><span style="color:#0000FF;">namespace</span><span style="color:#000000;"> Ifw.AjaxNet
{
    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> MootoolsTypeJavaScriptProvider : TypeJavaScriptProvider
    {
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> MootoolsTypeJavaScriptProvider(Type type, </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> url, StringBuilder sb) : </span><span style="color:#0000FF;">base</span><span style="color:#000000;">(type, url, sb) {}

        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">override</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> RenderClassBegin()
        {
            </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> clientNS </span><span style="color:#000000;">=</span><span style="color:#000000;"> GetClientNamespace();

            sb.Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">\r\n</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">).Append(clientNS).Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">_class = new Class({\r\n</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
            sb.Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">AjaxUrl : '</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">+</span><span style="color:#000000;"> m_URL </span><span style="color:#000000;">+</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">',\r\n</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
        }

        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">override</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> RenderClassEnd()
        {
            </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> clientNS </span><span style="color:#000000;">=</span><span style="color:#000000;"> GetClientNamespace();

            sb.Append(</span><span style="color:#000000;">@&quot;</span><span style="color:#000000;">AjaxProCB : function(response, onsuccess, context, onfailure)
{
    var o = null;
    eval(&quot;&quot;o = &quot;&quot; + response + &quot;&quot;;&quot;&quot;);
    if(o != null) {
        if(typeof o.value != &quot;&quot;undefined&quot;&quot; &amp;&amp; typeof onsuccess == &quot;&quot;function&quot;&quot;) {
            o.context = context;
            onsuccess(o);
            return;
        } else if(typeof o.error != &quot;&quot;undefined&quot;&quot; &amp;&amp; typeof onfailure == &quot;&quot;function&quot;&quot;) {
            onfailure(o.error);
            return;
        }
    }
    if(typeof onfailure == &quot;&quot;function&quot;&quot;) {
        onfailure({&quot;&quot;Message&quot;&quot;:&quot;&quot;Failed.&quot;&quot;});
    }
}
});

</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);

            sb.Append(clientNS).Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> = new </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">).Append(clientNS).Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">_class();\r\n\r\n</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
        }

        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">override</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> RenderMethods(MethodInfo[] methods)
        {
            </span><span style="color:#0000FF;">for</span><span style="color:#000000;"> (</span><span style="color:#0000FF;">int</span><span style="color:#000000;"> i </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">0</span><span style="color:#000000;">; i </span><span style="color:#000000;">&lt;</span><span style="color:#000000;"> methods.Length; i</span><span style="color:#000000;">++</span><span style="color:#000000;">)
            {
                MethodInfo method </span><span style="color:#000000;">=</span><span style="color:#000000;"> methods[i];
                </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> methodName </span><span style="color:#000000;">=</span><span style="color:#000000;"> GetClientMethodName(method);
                ParameterInfo[] pi </span><span style="color:#000000;">=</span><span style="color:#000000;"> method.GetParameters();

                sb.Append(methodName);
                sb.Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> : function(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);

                </span><span style="color:#0000FF;">for</span><span style="color:#000000;"> (</span><span style="color:#0000FF;">int</span><span style="color:#000000;"> p </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">0</span><span style="color:#000000;">; p </span><span style="color:#000000;">&lt;</span><span style="color:#000000;"> pi.Length; p</span><span style="color:#000000;">++</span><span style="color:#000000;">)
                {
                    sb.Append(pi[p].Name);
                    sb.Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
                }

                sb.Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">onsuccess, context, onfailure)\r\n{</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
                sb.Append(</span><span style="color:#000000;">@&quot;</span><span style="color:#000000;">
    return new Json.AjaxPro(this.AjaxUrl,
    {
        headers: {&quot;&quot;X-AjaxPro-Method&quot;&quot;:&quot;&quot;</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">+</span><span style="color:#000000;"> methodName </span><span style="color:#000000;">+</span><span style="color:#000000;"> </span><span style="color:#000000;">@&quot;</span><span style="color:#000000;">&quot;&quot;},
        onSuccess: function(response)
        {
            </span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">+</span><span style="color:#000000;"> GetClientNamespace() </span><span style="color:#000000;">+</span><span style="color:#000000;"> </span><span style="color:#000000;">@&quot;</span><span style="color:#000000;">.AjaxProCB(response, onsuccess, context, onfailure);
        }
    }).send({</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);

                </span><span style="color:#0000FF;">for</span><span style="color:#000000;"> (</span><span style="color:#0000FF;">int</span><span style="color:#000000;"> p </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">0</span><span style="color:#000000;">; p </span><span style="color:#000000;">&lt;</span><span style="color:#000000;"> pi.Length; p</span><span style="color:#000000;">++</span><span style="color:#000000;">)
                {
                    sb.Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">\&quot;</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
                    sb.Append(pi[p].Name);
                    sb.Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">\&quot;:</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
                    sb.Append(pi[p].Name);

                    </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (p </span><span style="color:#000000;">&lt;</span><span style="color:#000000;"> pi.Length </span><span style="color:#000000;">-</span><span style="color:#000000;"> </span><span style="color:#000000;">1</span><span style="color:#000000;">)
                        sb.Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
                }

                sb.Append(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">});\r\n},\r\n</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);

                </span><span style="color:#008000;">//</span><span style="color:#008000;">TODO: Implement support for AjaxPro Tokens</span><span style="color:#008000;">
</span><span style="color:#000000;">                </span><span style="color:#008000;">/*</span><span style="color:#008000;">
                string AjaxToken = @&quot;beforeSend: function(xhr) {
            if(typeof AjaxPro !== 'undefined' &amp;&amp; AjaxPro.token !== null)
                xhr.setHeader(&quot;&quot;X-AjaxPro-Token&quot;&quot;, AjaxPro.token);}&quot;;
                 </span><span style="color:#008000;">*/</span><span style="color:#000000;">
            }
        }
    }
}
</span></div>
</pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>Here is an example of a Mootools proxy class generated with 2 server-side functions: </p>
<div class="wlWriterSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;overflow:auto;font-family:Consolas;font-size:11.25px;">
<div><span style="color:#0000FF;">if</span><span style="color:#000000;">(</span><span style="color:#0000FF;">typeof</span><span style="color:#000000;"> Ifw </span><span style="color:#000000;">==</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">undefined</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">) Ifw</span><span style="color:#000000;">=</span><span style="color:#000000;">{};
</span><span style="color:#0000FF;">if</span><span style="color:#000000;">(</span><span style="color:#0000FF;">typeof</span><span style="color:#000000;"> Ifw.Cgd </span><span style="color:#000000;">==</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">undefined</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">) Ifw.Cgd</span><span style="color:#000000;">=</span><span style="color:#000000;">{};
</span><span style="color:#0000FF;">if</span><span style="color:#000000;">(</span><span style="color:#0000FF;">typeof</span><span style="color:#000000;"> Ifw.Cgd.Video </span><span style="color:#000000;">==</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">undefined</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">) Ifw.Cgd.Video</span><span style="color:#000000;">=</span><span style="color:#000000;">{};

Ifw.Cgd.Video.ProjectManager_class </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> Class({
AjaxUrl : </span><span style="color:#000000;">'</span><span style="color:#000000;">/ajaxpro/Ifw.Cgd.Video.ProjectManager,App_Code.lonzioom.ashx</span><span style="color:#000000;">'</span><span style="color:#000000;">,
LoadProjects : </span><span style="color:#0000FF;">function</span><span style="color:#000000;">(onsuccess, context, onfailure)
{
    </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> Json.AjaxPro(</span><span style="color:#0000FF;">this</span><span style="color:#000000;">.AjaxUrl,
    {
        headers: {</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">X-AjaxPro-Method</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">:</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">LoadProjects</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">},
        onSuccess: </span><span style="color:#0000FF;">function</span><span style="color:#000000;">(response)
        {
            Ifw.Cgd.Video.ProjectManager.AjaxProCB(response, onsuccess, context, onfailure);
        }
    }).send({});
},
SaveProject : </span><span style="color:#0000FF;">function</span><span style="color:#000000;">(dto, onsuccess, context, onfailure)
{
    </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> Json.AjaxPro(</span><span style="color:#0000FF;">this</span><span style="color:#000000;">.AjaxUrl,
    {
        headers: {</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">X-AjaxPro-Method</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">:</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">SaveProject</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">},
        onSuccess: </span><span style="color:#0000FF;">function</span><span style="color:#000000;">(response)
        {
            Ifw.Cgd.Video.ProjectManager.AjaxProCB(response, onsuccess, context, onfailure);
        }
    }).send({</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">dto</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">:dto});
}
AjaxProCB : </span><span style="color:#0000FF;">function</span><span style="color:#000000;">(response, onsuccess, context, onfailure)
{
    </span><span style="color:#0000FF;">var</span><span style="color:#000000;"> o </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">null</span><span style="color:#000000;">;
    eval(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">o = </span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">+</span><span style="color:#000000;"> response </span><span style="color:#000000;">+</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">;</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
    </span><span style="color:#0000FF;">if</span><span style="color:#000000;">(o </span><span style="color:#000000;">!=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">null</span><span style="color:#000000;">) {
        </span><span style="color:#0000FF;">if</span><span style="color:#000000;">(</span><span style="color:#0000FF;">typeof</span><span style="color:#000000;"> o.value </span><span style="color:#000000;">!=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">undefined</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;&amp;</span><span style="color:#000000;"> </span><span style="color:#0000FF;">typeof</span><span style="color:#000000;"> onsuccess </span><span style="color:#000000;">==</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">function</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">) {
            o.context </span><span style="color:#000000;">=</span><span style="color:#000000;"> context;
            onsuccess(o);
            </span><span style="color:#0000FF;">return</span><span style="color:#000000;">;
        } </span><span style="color:#0000FF;">else</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">(</span><span style="color:#0000FF;">typeof</span><span style="color:#000000;"> o.error </span><span style="color:#000000;">!=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">undefined</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;&amp;</span><span style="color:#000000;"> </span><span style="color:#0000FF;">typeof</span><span style="color:#000000;"> onfailure </span><span style="color:#000000;">==</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">function</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">) {
            onfailure(o.error);
            </span><span style="color:#0000FF;">return</span><span style="color:#000000;">;
        }
    }
    </span><span style="color:#0000FF;">if</span><span style="color:#000000;">(</span><span style="color:#0000FF;">typeof</span><span style="color:#000000;"> onfailure </span><span style="color:#000000;">==</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">function</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">) {
        onfailure({</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Message</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">:</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Failed.</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">});
    }
}
});

Ifw.Cgd.Video.ProjectManager </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> Ifw.Cgd.Video.ProjectManager_class();</span></div>
</pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>That should do it&#8230; Hopefully someone finds this useful.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ifwdev.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ifwdev.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ifwdev.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ifwdev.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ifwdev.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ifwdev.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ifwdev.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ifwdev.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ifwdev.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ifwdev.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ifwdev.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ifwdev.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ifwdev.wordpress.com&blog=1180835&post=1&subd=ifwdev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ifwdev.wordpress.com/2007/06/01/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ce67211b878f619ceb7ddc151c4fcae?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ifwdev</media:title>
		</media:content>
	</item>
	</channel>
</rss>