<?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/"
	>

<channel>
	<title>The other point is....</title>
	<atom:link href="http://theotherpointis.com/dititus-blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://theotherpointis.com/dititus-blog</link>
	<description>Thoughts about SharePoint and Agile</description>
	<pubDate>Fri, 06 Aug 2010 10:41:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Disabling workflow associations through the SharePoint API</title>
		<link>http://theotherpointis.com/dititus-blog/?p=109</link>
		<comments>http://theotherpointis.com/dititus-blog/?p=109#comments</comments>
		<pubDate>Fri, 06 Aug 2010 10:27:55 +0000</pubDate>
		<dc:creator>James Fisk</dc:creator>
		
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://theotherpointis.com/dititus-blog/?p=109</guid>
		<description><![CDATA[
Recently I was tasked with migrating data from a DB into SharePoint.&#160; Now, the sites that’ll be migrating to have a lot of workflows, and the one requirement was that they needed to be disabled before migration and re-enabled afterwards.&#160; Now we knew how to disable them through the browser and SharePoint designer, but we [...]]]></description>
			<content:encoded><![CDATA[</p>
<p>Recently I was tasked with migrating data from a DB into SharePoint.&#160; Now, the sites that’ll be migrating to have a lot of workflows, and the one requirement was that they needed to be disabled before migration and re-enabled afterwards.&#160; Now we knew how to disable them through the browser and SharePoint designer, but we needed to disable them through the API.&#160; So after a bit of digging around I found that each <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.aspx" target="_blank">SPList</a> object in the site has a collection of <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowassociation.aspx">SPWorkflowAssociation</a> objects.</p>
</p>
<p>Below is code that enables and disable work flow associations, however, i discovered when i tried to use the foreach on the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowassociation.aspx">SPWorkflowAssociation</a> updating the association causes an error saying you cannot enumerate over this collection because it has been changed.&#160; To get round this I used a normal for loop.</p>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span><span class="kwrd">using</span> System;</pre>
<pre><span class="lnum">   2:  </span><span class="kwrd">using</span> System.Collections.Generic;</pre>
<pre class="alt"><span class="lnum">   3:  </span><span class="kwrd">using</span> System.Linq;</pre>
<pre><span class="lnum">   4:  </span><span class="kwrd">using</span> System.Text;</pre>
<pre class="alt"><span class="lnum">   5:  </span><span class="kwrd">using</span> Microsoft.SharePoint;</pre>
<pre><span class="lnum">   6:  </span><span class="kwrd">using</span> Microsoft.SharePoint.Workflow;</pre>
<pre class="alt"><span class="lnum">   7:  </span>&#160;</pre>
<pre><span class="lnum">   8:  </span>&#160;</pre>
<pre class="alt"><span class="lnum">   9:  </span><span class="kwrd">namespace</span> TestWorkFlow</pre>
<pre><span class="lnum">  10:  </span>{</pre>
<pre class="alt"><span class="lnum">  11:  </span>    <span class="kwrd">public</span> <span class="kwrd">class</span> Program</pre>
<pre><span class="lnum">  12:  </span>    {</pre>
<pre class="alt"><span class="lnum">  13:  </span>        <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args)</pre>
<pre><span class="lnum">  14:  </span>        {</pre>
<pre class="alt"><span class="lnum">  15:  </span>            <span class="kwrd">using</span> (SPSite site = <span class="kwrd">new</span> SPSite(<span class="str">&quot;&lt;URL of Site&gt;&quot;</span>))</pre>
<pre><span class="lnum">  16:  </span>            {</pre>
<pre class="alt"><span class="lnum">  17:  </span>                <span class="kwrd">using</span> (SPWeb web = site.RootWeb)</pre>
<pre><span class="lnum">  18:  </span>                {</pre>
<pre class="alt"><span class="lnum">  19:  </span>                    SPList withWorkFlowsList = web.Lists[<span class="str">&quot;&lt;List name with work flows&gt;&quot;</span>];</pre>
<pre><span class="lnum">  20:  </span>                    <span class="kwrd">if</span> (withWorkFlowsList != <span class="kwrd">null</span>)</pre>
<pre class="alt"><span class="lnum">  21:  </span>                    {</pre>
<pre><span class="lnum">  22:  </span>                        SetWorkFlowsEnabledStatus(withWorkFlowsList, <span class="kwrd">false</span>);</pre>
<pre class="alt"><span class="lnum">  23:  </span>                        <span class="rem">// do Stuff</span></pre>
<pre><span class="lnum">  24:  </span>&#160;</pre>
<pre class="alt"><span class="lnum">  25:  </span>                        SetWorkFlowsEnabledStatus(withWorkFlowsList, <span class="kwrd">true</span>);</pre>
<pre><span class="lnum">  26:  </span>                    }</pre>
<pre class="alt"><span class="lnum">  27:  </span>                }</pre>
<pre><span class="lnum">  28:  </span>            }</pre>
<pre class="alt"><span class="lnum">  29:  </span>        }</pre>
<pre><span class="lnum">  30:  </span>&#160;</pre>
<pre class="alt"><span class="lnum">  31:  </span>        <span class="kwrd">private</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SetWorkFlowsEnabledStatus(SPList withWorkFlowsList, <span class="kwrd">bool</span> status)</pre>
<pre><span class="lnum">  32:  </span>        {</pre>
<pre class="alt"><span class="lnum">  33:  </span>            SPWorkflowAssociation spWorkflowAssociation;</pre>
<pre><span class="lnum">  34:  </span>            <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; withWorkFlowsList.WorkflowAssociations.Count ; i++)</pre>
<pre class="alt"><span class="lnum">  35:  </span>            {</pre>
<pre><span class="lnum">  36:  </span>                spWorkflowAssociation = withWorkFlowsList.WorkflowAssociations[i];</pre>
<pre class="alt"><span class="lnum">  37:  </span>                spWorkflowAssociation.Enabled = status;</pre>
<pre><span class="lnum">  38:  </span>                withWorkFlowsList.UpdateWorkflowAssociation(spWorkflowAssociation);</pre>
<pre class="alt"><span class="lnum">  39:  </span>            }</pre>
<pre><span class="lnum">  40:  </span>        }</pre>
<pre class="alt"><span class="lnum">  41:  </span>    }</pre>
<pre><span class="lnum">  42:  </span>}</pre>
</div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
]]></content:encoded>
			<wfw:commentRss>http://theotherpointis.com/dititus-blog/?feed=rss2&amp;p=109</wfw:commentRss>
		</item>
		<item>
		<title>Getting Development Storage in Azure to use SQLServer instead of SQLExpress</title>
		<link>http://theotherpointis.com/dititus-blog/?p=108</link>
		<comments>http://theotherpointis.com/dititus-blog/?p=108#comments</comments>
		<pubDate>Fri, 30 Jul 2010 08:50:30 +0000</pubDate>
		<dc:creator>James Fisk</dc:creator>
		
		<category><![CDATA[azure]]></category>

		<guid isPermaLink="false">http://theotherpointis.com/dititus-blog/?p=108</guid>
		<description><![CDATA[I’ve recently been playing with Azure, when you install the development SDK for Azure it installs the development app fabric for you, so that you can develop against a virtual Azure.
After rebuilding my dev rig and, if you’re like me, you don’t always want SQLExpress installed on your system, and instead you prefer SQLServer in [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve recently been playing with Azure, when you install the development SDK for Azure it installs the development app fabric for you, so that you can develop against a virtual Azure.</p>
<p>After rebuilding my dev rig and, if you’re like me, you don’t always want SQLExpress installed on your system, and instead you prefer SQLServer in some sort of guise instead.&#160; However, when I tried to install the Azure SDK it refused to install the development storage.&#160; It was complaining that it could not find an instance of SQLExpress, but I already had SQLServer installed and didn’t want to install SQLExpress.&#160; </p>
<p>However, the error dialog did give me an alternative by informing me that I can run a command DSInit to choose where the development storage is to be stored.</p>
<p>To understand DSInit read <a href="http://msdn.microsoft.com/en-us/library/dd179457.aspx">MSDN Help file</a>.</p>
<p> This tool also allows you reinitialise the storage, great of you want to run integration tests, a continuous integration environment.   </p>
]]></content:encoded>
			<wfw:commentRss>http://theotherpointis.com/dititus-blog/?feed=rss2&amp;p=108</wfw:commentRss>
		</item>
		<item>
		<title>Using ReSharper to adjust namespaces across multiple files</title>
		<link>http://theotherpointis.com/dititus-blog/?p=106</link>
		<comments>http://theotherpointis.com/dititus-blog/?p=106#comments</comments>
		<pubDate>Thu, 15 Jul 2010 20:05:49 +0000</pubDate>
		<dc:creator>James Fisk</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://theotherpointis.com/dititus-blog/?p=106</guid>
		<description><![CDATA[
I’m currently working on a project that has a large amount of files and projects, as you can imagine managing all those files and projects can get a little unwieldy.&#160; We as a team realised this, and decided to take some time out in order to reduce the amount of projects.
Now one of the tasks [...]]]></description>
			<content:encoded><![CDATA[<p>
<p>I’m currently working on a project that has a large amount of files and projects, as you can imagine managing all those files and projects can get a little unwieldy.&#160; We as a team realised this, and decided to take some time out in order to reduce the amount of projects.</p>
<p>Now one of the tasks I was asked to do was to merge a number of the core projects into one project, this involved moving around 50+ files into the project that we were merging into.&#160; So, with my task assigned to me I gallantly completed the task by simply moving the required files into the project, and hey presto job done.&#160; Or was it?</p>
<p>As you may know that good development practice in .NET requires the developer to ensure that the namespace follows the directory structure from project root down to the file. Now moving the files was ok, but the job was half done, the namespaces did not match the dir structure of the files new location.&#160; Ok I thought, I’ll just update the namespaces, but there was a lot of files 50+ files.&#160; Ok I could just use find and replace, but that means I could screw it up because it requires my intervention.</p>
<p>
<p>What I needed was a addin that detects the incorrectly specified namespaces in the files, then when you have confirmed that you wish the files to be corrected, it’ll not only update the namespaces, and as a bonus it’ll update all the references, usings and clean up the code as well.&#160; Funny enough there is such an addin, and it’s called (drum role) <a href="http://www.jetbrains.com/resharper/" target="_blank">Resharper</a>.</p>
<p>
<p>What you can do is select the offending files in the solution, either by right clicking on the selected files, or by right clicking on a project or solution folder in the solution, and then by selecting the menu item Refactor-&gt;Adjust Namespaces, you’ll then be presented with a wizard detailing the files that have been detected, clicking next will start the process.&#160; After a while all the files and references will be updated, leaving you to save all the files afterwards (by default the wizards opens the files it has changed).</p>
<p>Now, this is just the tip of the iceberg regarding Resharper, it is a very powerful addin, not cheap, but well worth it in helping to speed up development, I recommend that you download the trial and give it a go, it supports VS 2008, VS 2010 and also VS 2003 as well.</p>
</p></p>
]]></content:encoded>
			<wfw:commentRss>http://theotherpointis.com/dititus-blog/?feed=rss2&amp;p=106</wfw:commentRss>
		</item>
		<item>
		<title>Getting around the 260 chars path limit in Windows</title>
		<link>http://theotherpointis.com/dititus-blog/?p=101</link>
		<comments>http://theotherpointis.com/dititus-blog/?p=101#comments</comments>
		<pubDate>Wed, 10 Feb 2010 21:41:54 +0000</pubDate>
		<dc:creator>James Fisk</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://theotherpointis.com/dititus-blog/?p=101</guid>
		<description><![CDATA[Just recently I&#8217;ve been creating projects in Visual Studio 2010 for SharePoint 2010.&#160; My projects where getting very deep in the filesystem, where the upshot of this is that the file path was getting very long.&#160; To my dismay if you try and deploy a SharePoint solution that contains very long paths (&#62;260 char) it [...]]]></description>
			<content:encoded><![CDATA[<p>Just recently I&#8217;ve been creating projects in Visual Studio 2010 for SharePoint 2010.&#160; My projects where getting very deep in the filesystem, where the upshot of this is that the file path was getting very long.&#160; To my dismay if you try and deploy a SharePoint solution that contains very long paths (&gt;260 char) it fails.&#160; Now in this day of age, that is not good.&#160; </p>
</p>
<p>Now i’ve been reading around and found that the limit is imposed by the WIN32 API, however, I know that NTFS supports file path lengths of 32K. Now that is one hell of a difference.&#160; When we hit this 260 char limit our first reaction is to shorten the file path somehow, but it does not seem right.&#160; Further reading finally led me to a way to get windows to allow file paths upto 32K.</p>
<p>To get windows to allow for path up to 32K you simply prepend the file path with <a href="file://\\?\">\\?\</a> and away you go.</p>
<p> Ie copy <a href="file://\\?\c:\&lt;Very">\\?\c:\&lt;Very</a> long path&gt; <a href="file://\\?\d:\&lt;Very">\\?\d:\&lt;Very</a> long path&gt;
</p>
<p>Now the thing is you can use it in your windows apps to support 32K path lengths and hey presto, a windows app that supports 32K.</p>
<p>
<p>Update :-</p>
<p>I found this snippet</p>
<blockquote><p> The &quot;\\?\&quot; prefix can also be used with paths constructed according to the universal naming convention (UNC). To specify such a path using UNC, use the &quot;\\?\UNC\&quot; prefix. For example, &quot;\\?\UNC\server\share&quot;, where &quot;server&quot; is the name of the computer and &quot;share&quot; is the name of the shared folder. These prefixes are not used as part of the path itself. They indicate that the path should be passed to the system with minimal modification, which means that you cannot use forward slashes to represent path separators, or a period to represent the current directory, or double dots to represent the parent directory. Because you cannot use the &quot;\\?\&quot; prefix with a relative path, relative paths are always limited to a total of MAX_PATH characters.</p></blockquote>
<p> This was extracted from the <a href="http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx" target="_blank">MSDN</a>.</p>
<p>So use it with caution.</p>
]]></content:encoded>
			<wfw:commentRss>http://theotherpointis.com/dititus-blog/?feed=rss2&amp;p=101</wfw:commentRss>
		</item>
		<item>
		<title>Windows 7 God Mode</title>
		<link>http://theotherpointis.com/dititus-blog/?p=97</link>
		<comments>http://theotherpointis.com/dititus-blog/?p=97#comments</comments>
		<pubDate>Wed, 06 Jan 2010 20:12:15 +0000</pubDate>
		<dc:creator>James Fisk</dc:creator>
		
		<category><![CDATA[Fun stuff]]></category>

		<guid isPermaLink="false">http://theotherpointis.com/dititus-blog/?p=97</guid>
		<description><![CDATA[Just found this nugget out, apparently you make windows 7 very customisable simply by doing the following :-



Create a new folder in c:\windows


Rename that folder to GodMode.{ED7BA470-8E54-465E-825C-99712043E01C} 

Now double click on the new god mode folder and have fun. 

]]></description>
			<content:encoded><![CDATA[<p>Just found this nugget out, apparently you make windows 7 very customisable simply by doing the following :-</p>
</p>
<ul>
<li>
<p>Create a new folder in c:\windows</p>
</li>
<li>
<p>Rename that folder to GodMode.{ED7BA470-8E54-465E-825C-99712043E01C} </p>
</li>
<li>Now double click on the new god mode folder and have fun. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://theotherpointis.com/dititus-blog/?feed=rss2&amp;p=97</wfw:commentRss>
		</item>
		<item>
		<title>Using Typemock VS2010 Beta 2</title>
		<link>http://theotherpointis.com/dititus-blog/?p=86</link>
		<comments>http://theotherpointis.com/dititus-blog/?p=86#comments</comments>
		<pubDate>Wed, 06 Jan 2010 10:59:05 +0000</pubDate>
		<dc:creator>James Fisk</dc:creator>
		
		<category><![CDATA[SharePoint]]></category>

		<category><![CDATA[typemock]]></category>

		<guid isPermaLink="false">http://theotherpointis.com/dititus-blog/?p=86</guid>
		<description><![CDATA[After installing TypeMock with VS2010 Beta 2 I found there was no integration in VS2010.&#160; This means that when you run your unit tests in your integrated unit test runner TypeMock would not kick in.
To workaround this use TMockRunner.exe with nunit as an external command like this :-
&#34;c:\Program Files\Typemock\Isolator\5.4\TMockRunner.exe&#34; &#34;c:\Program Files (x86)\NUnit 2.5.3\bin\net-2.0\nunit-console.exe” &#34;c:\Projects\Aberdovey2010\spikes\UnitTesting\Sample.Tests\bin\Debug\Sample.Tests.dll&#34;
You will [...]]]></description>
			<content:encoded><![CDATA[<p>After installing TypeMock with VS2010 Beta 2 I found there was no integration in VS2010.&#160; This means that when you run your unit tests in your integrated unit test runner TypeMock would not kick in.</p>
<p>To workaround this use TMockRunner.exe with nunit as an external command like this :-</p>
<p>&quot;c:\Program Files\Typemock\Isolator\5.4\TMockRunner.exe&quot; &quot;c:\Program Files (x86)\NUnit 2.5.3\bin\net-2.0\nunit-console.exe” &quot;c:\Projects\Aberdovey2010\spikes\UnitTesting\Sample.Tests\bin\Debug\Sample.Tests.dll&quot;</p>
<p>You will need to change the paths for your environment.</p>
<p>As mentioned this will need to executed outside the outside Visual Studio from batch file, or you could add the command as an external tool.</p>
<p>To do this got to menu Tools-&gt;Externel Tools…</p>
<p>This will bring up the following dialog box :-</p>
<p> <a href="http://theotherpointis.com/dititus-blog/wp-content/uploads/2010/01/externeltools.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="externeltools" border="0" alt="externeltools" src="http://theotherpointis.com/dititus-blog/wp-content/uploads/2010/01/externeltools-thumb.png" width="383" height="378" /></a>
<p>Enter the title, location of the command, in this case TMockRunner.exe, and the arguments which should be, &lt;nunit install path&gt;nunit-console.exe &lt;full path to TEST assembly&gt;.&#160; Don’t forget to check the ‘User Output to window’ check box, which means all output from this command will go to the output window, simples.&#160; Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://theotherpointis.com/dititus-blog/?feed=rss2&amp;p=86</wfw:commentRss>
		</item>
		<item>
		<title>Mixing JQuery, SP2010 Client OM with the sand pit</title>
		<link>http://theotherpointis.com/dititus-blog/?p=31</link>
		<comments>http://theotherpointis.com/dititus-blog/?p=31#comments</comments>
		<pubDate>Sat, 26 Dec 2009 18:21:50 +0000</pubDate>
		<dc:creator>James Fisk</dc:creator>
		
		<category><![CDATA[JQuery]]></category>

		<category><![CDATA[SandBox]]></category>

		<category><![CDATA[SharePoint]]></category>

		<category><![CDATA[research]]></category>

		<category><![CDATA[sp2010 javascript jquery]]></category>

		<guid isPermaLink="false">http://theotherpointis.com/dititus-blog/?p=31</guid>
		<description><![CDATA[On a recent project we had set a requirement for the solution to run as a SharePoint 2010 Sandboxed solution,&#160; and needed to provide a much richer UI experience, so we decided to use JQuery and Client OM.
This presented me with few challenges, what helped was a deep dive into SharePoint 2010 with the first [...]]]></description>
			<content:encoded><![CDATA[<p>On a recent project we had set a requirement for the solution to run as a SharePoint 2010 Sandboxed solution,&#160; and needed to provide a much richer UI experience, so we decided to use JQuery and Client OM.</p>
<p>This presented me with few challenges, what helped was a deep dive into SharePoint 2010 with the first ever Combined Knowledge 2010 beta training course with Todd Bleeker and Gary Yeoman.&#160; Because I follow agile practices, I spiked this, what I mean by this is that a spike is a term used for researching a way of doing something, so that the team can estimate the story that requires this approach.&#160; After I completed my spike we were in a much better place to estimate the story, this post is my journey in trying to understand this problem.</p>
<p>Here is the <a title="code" href="http://theotherpointis.com/dititus-blog/?attachment_id=70">code </a>that this post discusses, please bear in mind that this is not production code.</p>
<p>First of all i set up myself with a VMWare image of SharePoint 2010 running on Windows Server 2008 SP2.&#160; I used these <a title="Setting up a development SP2010 machine" href="http://msdn.microsoft.com/en-us/library/ee554869%28office.14%29.aspx" target="_blank">Instructions</a> from Microsoft.</p>
<p>Once i got myself setup I then researched how I would go about making this happen. After googling for what seemed like and eternity I stumbled across this <a title="Load javascript files once and only once from a web part." href="http://www.lightningtools.com/blog/archive/2009/12/06/add-javascript-files-once-to-a-page---sharepoint-sandbox.aspx" target="_blank">post</a> from Lighting Tools, which enabled me to load javascript in a sandboxed solution.</p>
</p>
<p>So I set to work. I created a blank SharePoint 2010 project in Visual Studio 2010 and added a web part, don&#8217;t go for the visual web part they are not compatible with sandboxed solutions.</p>
<blockquote>
<p> Don’t create a Visual Web Part in sandboxed solution as they are not compatible, mainly because visual web parts need physical files on the file system.</p></blockquote>
<p>You then add this snippet of code to the web part cs file, as detailed in the post I mentioned earlier.</p>
<div style="overflow: auto" class="csharpcode">
<div class="csharpcode">
<pre><span class="lnum">   1:  </span>        <span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> RenderContents(HtmlTextWriter writer)</pre>
<pre><span class="lnum">   2:  </span>        {</pre>
<pre><span class="lnum">   3:  </span>            <span class="kwrd">string</span> url = SPContext.Current.Site.RootWeb.Url;</pre>
<pre><span class="lnum">   4:  </span>            writer.Write(<span class="str">&quot;&lt;script language='javascript' type='text/javascript' src='&quot;</span> + url + <span class="str">&quot;/SiteAssets/Assets/Start.js'&gt;&lt;/script&gt;&quot;</span>);</pre>
<pre><span class="lnum">   5:  </span>            writer.Write(<span class="str">&quot;&lt;script language='javascript' type='text/javascript'&gt;Sys.loadScripts('&quot;</span> + url + <span class="str">&quot;/SiteAssets/Assets/jquery-1.3.2.min.js');&lt;/script&gt;&quot;</span>);</pre>
<pre><span class="lnum">   6:  </span>            writer.Write(<span class="str">&quot;&lt;script language='javascript' type='text/javascript'&gt;Sys.loadScripts('&quot;</span> + url + <span class="str">&quot;/SiteAssets/Assets/jquery-ui-1.7.2.custom.min.js');&lt;/script&gt;&quot;</span>);</pre>
<pre><span class="lnum">   7:  </span>            writer.Write(<span class="str">&quot;&lt;script language='javascript' type='text/javascript'&gt;Sys.loadScripts('&quot;</span> + url + <span class="str">&quot;/SiteAssets/Assets/SandBox.js');&lt;/script&gt;&quot;</span>);</pre>
<pre><span class="lnum">   8:  </span>        }</pre>
</p></div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</div>
<p>Notice the use of SPContext.Current.Site.RootWeb.Url, this is to ensure that the script always loaded from the root web, regardless of where the webpart running from.</p>
<p>This code is loading a javascript file (Start.js) that is from Microsoft’s AJAX library.&#160; This loads all the required functionality, such as the Sys namespace.&#160; I could have used the ‘Sys.require’ to load the required JQuery, but I wanted tight control over that instead.</p>
<p>Next the real magic happens, using the Sys.loadScripts function you ensure that one, and only one copy of the script you have selected is being loaded.&#160; Notice that the script are being loaded from a folder called /SiteAssets/Assets.&#160; This is a container in SharePoint that stores the script into the content database, very important if you want to use a Sandboxed solution.</p>
<p>Next I created a normal sitepage in SharePoint, which I used to load the web part and javascript.&#160; Once the site page was created I used SharePoint Designer 2010 to get hold of the contents of the page, it was easier that way because I’m lazy at typing, but you can use whatever method you want.</p>
<p>Remember the SiteAssets/Assets folder in the web part that loads the jquery and other javascript files.&#160; For this to work you need to create a module called ‘Assets’ and added all the required files for the module.&#160; Don’t forget to add the ‘URL’ attribute to the Elements.xml file to ensure the files get rendered from the correct location.</p>
<p><a href="http://theotherpointis.com/dititus-blog/wp-content/uploads/2009/12/siteassets.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="siteassets" border="0" alt="siteassets" src="http://theotherpointis.com/dititus-blog/wp-content/uploads/2009/12/siteassets-thumb.png" width="644" height="179" /></a></p>
<p>Now, I created another module, this time it is for the deployment of the sitepage that will contain the javascript loading web part, and your html that the javascript will interact with.&#160; In my case it was to mimic a white board that SCRUM teams use.&#160; In this UI you can drag and drop the story boxes from one swim lane to another.&#160; Dropping the story into a swim lane would update the stories&#8217; status, this being ‘Not Started’, ‘In Progress’, ‘Verify’ or ‘Done’.&#160; The story status is stored in a SharePoint list.</p>
<p>Each swim lane is a div, which i had to mark as droppable by using jquery UI plugin.</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span>    $(<span class="str">&quot;#notStarted&quot;</span>).droppable({</pre>
<pre><span class="lnum">   2:  </span>        drop: <span class="kwrd">function</span> (<span class="kwrd">event</span>, ui) {</pre>
<pre><span class="lnum">   3:  </span>            updateStoryStatus(<span class="str">'notStarted'</span>, ui.draggable);</pre>
<pre><span class="lnum">   4:  </span>        }</pre>
<pre><span class="lnum">   5:  </span>    });</pre>
</div>
<p>These 6 lines does quite a lot.&#160; I’m selecting a div with the ID ‘notStarted’, you use the ‘#’ notation to depict an ID.&#160; Then I enable the div to become droppable,that is to accept any draggable item.&#160; Droppable can handle upto five events, these being ‘<a href="http://docs.jquery.com/#event-activate">activate</a>’, ‘<a href="http://docs.jquery.com/#event-deactivate">deactivate</a>’, ‘<a href="http://docs.jquery.com/#event-over">over</a>’, ‘<a href="http://docs.jquery.com/#event-out">out</a>’, ‘<a href="http://docs.jquery.com/#event-drop">drop</a>’.&#160; For this I just concentrated on the event drop. When the event fires it uses an anonymous function, which then passes control over to another function that updates the stories’ status.&#160; The first parameter is obviously the status I want to set the dropped story, the second parameter is the object that was dropped, this is supplied by this rather curios syntax ‘ui.draggable’.&#160; This happens in the initialisation stage.</p>
<h1>Initialisation stage</h1>
<p>In the SandBox.js file I have all the custom code.&#160; This code handles the loading of all the stories from the story list on SP2010 and updated story status based on where the stories are dropped.</p>
<p>Now, one of the very first functions i call is the following :-</p>
<pre class="csharpcode">ExecuteOrDelayUntilScriptLoaded(start, <span class="str">&quot;sp.js&quot;</span>);</pre>
<p>This line is very important, the reason why is that in order to use Client OM in javascript, you need the JS file ‘sp.js’.&#160; This JS framework allows me to load current SP context and start to query and update the SharePoint Lists and so forth.&#160; It is a limited framework that can only talk back to the SP server farm from whence sp.js is loaded from.&#160; This is for obvious security reasons.&#160; You might be wondering what the function ExecuteOrDelayUntilScriptLoaded is for.&#160; This function is used to ensure the that the function ‘start’ (starting point of my app) is only called when the file ‘sp.js’ is loaded, if not, then it can’t be guaranteed when the client om framework is loaded.&#160; Incidentally, the function ExecuteOrDelayUntilScriptLoaded should not be in a function, you want it to be called as soon as the ‘sandbox.js’ is loaded.</p>
<p>In order for the ExecuteOrDelayUntilScriptLoaded function to work you need to load the JS file this function is in the ‘init.js’, that is part of the ‘sp.js’.&#160; For the ‘sp.js’ to be loaded you need to include it into the ASPX page, like so :-</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span><span class="kwrd">&lt;</span><span class="html">script</span> <span class="attr">type</span><span class="kwrd">=&quot;text/javascript&quot;</span><span class="kwrd">&gt;</span></pre>
<pre><span class="lnum">   2:  </span>        &lt;SharePoint:ScriptLink language=<span class="str">&quot;javascript&quot;</span> name=<span class="str">&quot;sp.js&quot;</span> LoadAfterUI=<span class="str">&quot;true&quot;</span> runat=<span class="str">&quot;server&quot;</span>/&gt;</pre>
<pre><span class="lnum">   3:  </span><span class="kwrd">&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span></pre>
</div>
<p>When the ‘Start’ function is called all the swim lanes are set as droppable, then the stories are loaded.</p>
<h1>Loading the stories</h1>
<p>This is where client OM really comes in to it’s own.&#160; Knowing I now have ‘sp.js’ loaded and ready I can start using client om.&#160; The first thing I had to do is load the context :-</p>
<pre class="csharpcode">context = <span class="kwrd">new</span> SP.ClientContext.get_current();</pre>
<p>Now I have the equivalent to SPContext on the client side, now to load the story status list :-</p>
<div class="csharpcode">
<pre class="csharpcode">    <span class="kwrd">this</span>.site = context.get_web();

    context.load(<span class="kwrd">this</span>.site);

    lists = site.get_lists();
    displayAStory(lists.getByTitle(<span class="str">'StoryStatus'</span>));</pre>
</div>
<p>Here I grab the current web, load that into the main context, retrieve all the lists, then retrieve the list called story status passing it to a function load displays all the stories and places them into the correct swim lane.</p>
<h1>Display the stories</h1>
<p>Once the correct list has been loaded all that remains is to load all the list items :-</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span><span class="kwrd">function</span> displayAStory(currentItem) {</pre>
<pre><span class="lnum">   2:  </span>    <span class="kwrd">var</span> camlQuery = generateCAMLQuery(<span class="str">'&lt;View&gt;&lt;/View&gt;'</span>);</pre>
<pre><span class="lnum">   3:  </span>    <span class="kwrd">this</span>.listItems = currentItem.getItems(camlQuery);</pre>
<pre><span class="lnum">   4:  </span>    context.load(listItems);</pre>
<pre><span class="lnum">   5:  </span>&#160;</pre>
<pre><span class="lnum">   6:  </span>    context.executeQueryAsync(</pre>
<pre><span class="lnum">   7:  </span>        Function.createDelegate(<span class="kwrd">this</span>, <span class="kwrd">this</span>.onQuerySucceeded),</pre>
<pre><span class="lnum">   8:  </span>        Function.createDelegate(<span class="kwrd">this</span>, <span class="kwrd">this</span>.onFail));</pre>
<pre><span class="lnum">   9:  </span>}</pre>
</div>
<p>First I needed to generate a CAMLQuery to put against the story list.&#160; The list items are then filtered against the CAML query, load that list into the context, finally execute the loading of story list asynchronously.&#160; With executeQueryAsync you supply two functions, the first one is called when the execute command was successful, the second is called when the command fails.</p>
<h1>Successful ASync command</h1>
<p>After the command has been executed and it was success, this function is called as a delegate by the&#160; executeQueryAsync method mentioned earlier :-</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span><span class="kwrd">function</span> onQuerySucceeded(sender, args) {</pre>
<pre><span class="lnum">   2:  </span>    <span class="kwrd">var</span> itemCount = listItems.get_count();</pre>
<pre><span class="lnum">   3:  </span>    <span class="kwrd">for</span> (i = 0; i &lt; itemCount; i++) {</pre>
<pre><span class="lnum">   4:  </span>        <span class="kwrd">var</span> item = listItems.itemAt(i);</pre>
<pre><span class="lnum">   5:  </span>        <span class="kwrd">if</span> (item.get_item(<span class="str">'Status'</span>) == <span class="str">&quot;Not Started&quot;</span>) {</pre>
<pre><span class="lnum">   6:  </span>            $(<span class="str">&quot;#notStarted&quot;</span>).append(generateStoryDivHTML(item));</pre>
<pre><span class="lnum">   7:  </span>        }</pre>
<pre><span class="lnum">   8:  </span>        <span class="kwrd">if</span> (item.get_item(<span class="str">'Status'</span>) == <span class="str">&quot;In Progress&quot;</span>) {</pre>
<pre><span class="lnum">   9:  </span>            $(<span class="str">&quot;#inprogress&quot;</span>).append(generateStoryDivHTML(item));</pre>
<pre><span class="lnum">  10:  </span>        }</pre>
<pre><span class="lnum">  11:  </span>        <span class="kwrd">if</span> (item.get_item(<span class="str">'Status'</span>) == <span class="str">&quot;Verify&quot;</span>) {</pre>
<pre><span class="lnum">  12:  </span>            $(<span class="str">&quot;#verify&quot;</span>).append(generateStoryDivHTML(item));</pre>
<pre><span class="lnum">  13:  </span>        }</pre>
<pre><span class="lnum">  14:  </span>        <span class="kwrd">if</span> (item.get_item(<span class="str">'Status'</span>) == <span class="str">&quot;Done&quot;</span>) {</pre>
<pre><span class="lnum">  15:  </span>            $(<span class="str">&quot;#done&quot;</span>).append(generateStoryDivHTML(item));</pre>
<pre><span class="lnum">  16:  </span>        }</pre>
<pre><span class="lnum">  17:  </span>    }</pre>
<pre><span class="lnum">  18:  </span>    $(<span class="str">&quot;.story&quot;</span>).draggable({cursor:<span class="str">'crosshair'</span>});</pre>
<pre><span class="lnum">  19:  </span>}</pre>
</div>
<p>Here I simply loop over all the items in the list, looking at the status of the current story and placing it into the corresponding swim lane.&#160; The story is generated by creating a div.</p>
<h1>Generating a Story box</h1>
<p>To generate a story box I simply generate a DIV on fly inserting the story name.</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span><span class="kwrd">function</span> generateStoryDivHTML(item) {</pre>
<pre><span class="lnum">   2:  </span>    <span class="kwrd">return</span> <span class="str">&quot;&lt;div class='story'&gt;&lt;span id='StoryTitle'&gt;&quot;</span> +</pre>
<pre><span class="lnum">   3:  </span>            item.get_item(<span class="str">'Title'</span>) +</pre>
<pre><span class="lnum">   4:  </span>            <span class="str">&quot;&lt;/span&gt;&lt;input type='hidden' id='itemId' value='&quot;</span> +</pre>
<pre><span class="lnum">   5:  </span>            item.get_id() +</pre>
<pre><span class="lnum">   6:  </span>            <span class="str">&quot;' &lt;/div&gt;&quot;</span>;</pre>
<pre><span class="lnum">   7:  </span>}</pre>
</div>
<p>The story id is also added, but as a hidden field, this is used when the app wants to know which story should be updated after it has been dropped.</p>
<h1>Update story status</h1>
<p>In order to update the story I had to store the story ID in each story div, so that when the ui.draggable object is supplied I can grab the story id from a hidden input field here is the code that does that :-</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span><span class="kwrd">function</span> updateStoryItem(storyElement, newStatus) {</pre>
<pre><span class="lnum">   2:  </span>    <span class="kwrd">var</span> storyId = storyElement.find(<span class="str">'#itemId'</span>).attr(<span class="str">'value'</span>);</pre>
<pre><span class="lnum">   3:  </span>    <span class="kwrd">var</span> itemToUpdate = listItems.getById(storyId);</pre>
<pre><span class="lnum">   4:  </span>    itemToUpdate.set_item(<span class="str">'Status'</span>, newStatus);</pre>
<pre><span class="lnum">   5:  </span>    itemToUpdate.update();</pre>
<pre><span class="lnum">   6:  </span>    context.load(itemToUpdate);</pre>
<pre><span class="lnum">   7:  </span>    context.executeQueryAsync(updateStoryStatusSucceed, onFail)</pre>
<pre><span class="lnum">   8:  </span>}</pre>
</div>
<p>In here I grab the story id from the hidden field and then use it to grab the list item by it’s id.&#160; Then I take the ‘newStatus’ and update the item by column ‘Status’ with the ‘newStatus’.&#160; All that remains is to update the list, then load it into the current context and execute Async on the context in order to&#160; persist the changes.</p>
<h1>Final thoughts</h1>
<p>I know this has been a whirl wind overview of using jquery, client om in a sandboxed solution, and no doubt there might be a better way of achieving the same thing, but I&#8217;m still learning.&#160; Using AJAX based web apps is now easier in SP2010 with Client OM.</p>
<p>Speed might be an issue I have not done any performance testing on this, so that might raise a few issues.&#160; On the whole I hope this will help in some way to understand Client OM with Javascript.</p>
]]></content:encoded>
			<wfw:commentRss>http://theotherpointis.com/dititus-blog/?feed=rss2&amp;p=31</wfw:commentRss>
		</item>
		<item>
		<title>21Apps and thee</title>
		<link>http://theotherpointis.com/dititus-blog/?p=28</link>
		<comments>http://theotherpointis.com/dititus-blog/?p=28#comments</comments>
		<pubDate>Fri, 20 Nov 2009 11:10:56 +0000</pubDate>
		<dc:creator>James Fisk</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[21apps]]></category>

		<guid isPermaLink="false">http://theotherpointis.com/dititus-blog/?p=28</guid>
		<description><![CDATA[As you&#8217;ll no doubt be aware that i&#8217;ve joined forces with Andrew Woodward at 21Apps (www.21apps.com).  I&#8217;ve worked with Andy for about two years, on and off on various projects, and found him to be passionate about Agile (SCRUM/XP) and since we share the same views and vision it seemed the logicial step to [...]]]></description>
			<content:encoded><![CDATA[<p>As you&#8217;ll no doubt be aware that i&#8217;ve joined forces with Andrew Woodward at 21Apps (www.21apps.com).  I&#8217;ve worked with Andy for about two years, on and off on various projects, and found him to be passionate about Agile (SCRUM/XP) and since we share the same views and vision it seemed the logicial step to join forces and help others enjoy the benefits of Agile.</p>
<p>Sorry for the short, hopefully this blog will be updated on a regular basis.  Ta Ta for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://theotherpointis.com/dititus-blog/?feed=rss2&amp;p=28</wfw:commentRss>
		</item>
		<item>
		<title>Scribing in planning games</title>
		<link>http://theotherpointis.com/dititus-blog/?p=21</link>
		<comments>http://theotherpointis.com/dititus-blog/?p=21#comments</comments>
		<pubDate>Tue, 19 May 2009 11:01:00 +0000</pubDate>
		<dc:creator>James Fisk</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dititus.com/dititus-blog/?p=21</guid>
		<description><![CDATA[In our planning games we&#8217;re using the tried and tested approach of post it notes and white boards.  However, we found that when we were writing the tasks out the team members were writing the tasks in silence, which meant knowledge sharing was not really taking place and the team members were really estimating on [...]]]></description>
			<content:encoded><![CDATA[<p>In our planning games we&#8217;re using the tried and tested approach of post it notes and white boards.  However, we found that when we were writing the tasks out the team members were writing the tasks in silence, which meant knowledge sharing was not really taking place and the team members were really estimating on a task they had little or no say in.  Which meant that sometimes, when we got into the iteration, one or more tasks didn&#8217;t seem to really fulfil the story and we were having to do extra work, at best, or, at worst, dump the story altogether.</p>
<p>So, a solution was needed.  What the team did was come up with a scribing system.  It&#8217;s quite simple, these are always the best ideas, a member of the team scribes (writes onto the whiteboard).</p>
<p>What happens is that a team member is chosen to scribe.  That person writes down verbatim what the TEAM thinks will be the appropriate task(s) to deliver the story.  The scribe does not guess the tasks, they do not make suggests, they are merely dictated to by the team.  Once all the tasks are written then the team transfer the tasks onto post it notes and estimates.</p>
<p>We found that scribing forced the team to think about the tasks more, it also allowed the team to enter into a lively debate about the required task(s), thus spreading knowledge.  Another added bonus scribing has is that things that may have been missed, were not, because whole team is writing the task collectively.</p>
<p>Try it, it&#8217;s nice.  A word of warning though, we found that scribing on all stories we found that it&#8217;s causes the planning game to drag on a bit.  So we only scribed on stories that appeared to be complicated, but to be honest that&#8217;s just us, try it for yourself and see how it helps then adjust accordingly.</p>
<p>One further note, is that the teams that use web based story and task tools, ie <a href="http://www.versionone.com/FreeAgilePMSoftware/index.asp?c-1=&amp;gr-versionone&amp;v-002&amp;gclid=CJ_I6fuTyJoCFUpM5QodIj5v2w">Version One</a>, <a href="http://www.xplanner.org/">XP Planner</a>, etc, maybe already be doing this.  ie one person sits at the keyboard whilst the other team members tell the person what to type, so if your team are doing that then you are already benefiting from the scribing approach.</p>
<p>Happy scribing.</p>
]]></content:encoded>
			<wfw:commentRss>http://theotherpointis.com/dititus-blog/?feed=rss2&amp;p=21</wfw:commentRss>
		</item>
		<item>
		<title>Planning poker cards</title>
		<link>http://theotherpointis.com/dititus-blog/?p=12</link>
		<comments>http://theotherpointis.com/dititus-blog/?p=12#comments</comments>
		<pubDate>Tue, 12 May 2009 09:29:28 +0000</pubDate>
		<dc:creator>James Fisk</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dititus.com/dititus-blog/?p=12</guid>
		<description><![CDATA[Where I&#8217;m currently working we were finding that our planning games were becoming a bit strained.  We found that when we came to estimating our stories we found that the estimates were a bit varied.
Now, we all know that if the estimations are very different in a planning game you stop to discuss why there [...]]]></description>
			<content:encoded><![CDATA[<p>Where I&#8217;m currently working we were finding that our planning games were becoming a bit strained.  We found that when we came to estimating our stories we found that the estimates were a bit varied.</p>
<p>Now, we all know that if the estimations are very different in a planning game you stop to discuss why there are differences in the estimations.  Once the reasoning why the estimations has been discussed, the team can then re-estimate with new knowledge and hopefully things should be more or less the same, if not repeat.</p>
<p>That was OK after a while, but what I mean by varied people were giving funny estimations like 12.5, 4.7 so on and so forth, and no matter now draconian we tried to make the estimation process these silly little estimations kept on cropping up, which slowed the estimation process down and just generally frustrated people.</p>
<p>What we needed was a predefined set of numbers that we can all use, where we can quickly show what our estimation is.</p>
<p>After a bit of searching I found the <a href="http://store.mountaingoatsoftware.com/">planning poker cards</a> from <a href="http://www.mountaingoatsoftware.com/">Mountain Goat Software</a>.</p>
<p>How you use them is quite interesting, each developer has a pack.  In the pack consists of the following cards :-</p>
<ul>
<li>? = I&#8217;m not playing</li>
<li>0</li>
<li>1/2</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>5</li>
<li>8</li>
<li>13</li>
<li>20</li>
<li>40</li>
<li>100</li>
<li>∞ = Greater than 100</li>
</ul>
<p>When it comes to estimating the developers all hold up the cards at the same time, if they are mostly all the same the team goes with that estimation, however, if they are varied then the team quickly discuss the variances then re-estimate.</p>
<p>If the developer has no clue about the task the team is estimating they hold up the ? card, if however, they think this story is too huge they show the ∞ card, this is probably an indication that the story is one hell of an epic and really needs to be broken down.  The numbering scale also helps to stop people giving silly estimates of small increments.</p>
<p>When you read around <a href="http://store.mountaingoatsoftware.com/pages/planning-poker-in-detail">how to use the planning poker game cards</a>, you&#8217;ll see that they are used mainly estimating stories, but we also use them for estimating the tasks as well, with great effect.</p>
<p>This may seem a bit unprofessional, but our team have found that it helps to speed up the planning games greatly.  Firstly by introducing a strict numbering system, so we don&#8217;t get the x.something nonsense, and introducing an element of fun, and as we all know that time goes by much quicker when you are having fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://theotherpointis.com/dititus-blog/?feed=rss2&amp;p=12</wfw:commentRss>
		</item>
	</channel>
</rss>
