
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>merill.net</title>
	<atom:link href="http://merill.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://merill.net</link>
	<description>My utmost for His highest, my best for His glory</description>
	<lastBuildDate>Thu, 02 Feb 2012 21:02:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>LogParser &#8211; Converting IIS logs to local date and time and filtering by date range</title>
		<link>http://merill.net/2012/02/logparser-converting-iis-logs-to-local-date-and-time-and-filtering-by-date-range/</link>
		<comments>http://merill.net/2012/02/logparser-converting-iis-logs-to-local-date-and-time-and-filtering-by-date-range/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 21:02:26 +0000</pubDate>
		<dc:creator>Merill Fernando</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[logparser]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[utc]]></category>

		<guid isPermaLink="false">http://merill.net/?p=750</guid>
		<description><![CDATA[This is a note to myself to remember how to convert the UTC date/time to the local timezone. logparser &#8220;SELECT TO_TIMESTAMP(date, time) AS utc-timestamp, TO_LOCALTIME(utc-timestamp) AS local-timestamp,* FROM D:\Log\SearchServiceWrapperLogs\SearchServiceWrapperLogs\u_ex1202* WHERE local-timestamp between timestamp(&#8217;2012/02/02 00:00:00&#8242;, &#8216;yyyy/MM/dd hh:mm:ss&#8217;) and timestamp(&#8217;2012/02/03 00:00:00&#8242;, &#8216;yyyy/MM/dd hh:mm:ss&#8217;)&#8221; -recurse:-1 -o:csv >> fulllog.csv]]></description>
			<content:encoded><![CDATA[<p>This is a note to myself to remember how to convert the UTC date/time to the local timezone.</p>
<p>logparser &#8220;SELECT TO_TIMESTAMP(date, time) AS utc-timestamp, TO_LOCALTIME(utc-timestamp) AS local-timestamp,* FROM D:\Log\SearchServiceWrapperLogs\SearchServiceWrapperLogs\u_ex1202* WHERE local-timestamp between timestamp(&#8217;2012/02/02 00:00:00&#8242;, &#8216;yyyy/MM/dd hh:mm:ss&#8217;) and timestamp(&#8217;2012/02/03 00:00:00&#8242;, &#8216;yyyy/MM/dd hh:mm:ss&#8217;)&#8221; -recurse:-1 -o:csv >> fulllog.csv</p>
]]></content:encoded>
			<wfw:commentRss>http://merill.net/2012/02/logparser-converting-iis-logs-to-local-date-and-time-and-filtering-by-date-range/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixed: The target &#8220;GetCopyToOutputDirectoryContentProjectItems&#8221; does not exist in the project.</title>
		<link>http://merill.net/2012/01/fixed-the-target-getcopytooutputdirectorycontentprojectitems-does-not-exist-in-the-project/</link>
		<comments>http://merill.net/2012/01/fixed-the-target-getcopytooutputdirectorycontentprojectitems-does-not-exist-in-the-project/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 13:08:36 +0000</pubDate>
		<dc:creator>Merill Fernando</dc:creator>
				<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[windows phone]]></category>

		<guid isPermaLink="false">http://merill.net/?p=746</guid>
		<description><![CDATA[If your building a Windows Phone app and get this error then a quick fix is to download the XNA Game Studio 4.0 Refresh (40 MB) and install it. This adds the missing target. XNA Game Studio 4.0 Refresh Download page - http://www.microsoft.com/download/en/details.aspx?displaylang=en&#38;id=27599 Direct download link - http://download.microsoft.com/download/E/C/6/EC68782D-872A-4D58-A8D3-87881995CDD4/XNAGS40_setup.exe Downloading and installing this takes way less time than [...]]]></description>
			<content:encoded><![CDATA[<p>If your building a Windows Phone app and get this error then a quick fix is to download the XNA Game Studio 4.0 Refresh (40 MB) and install it.</p>
<p>This adds the missing target.</p>
<p><strong>XNA Game Studio 4.0 Refresh</strong></p>
<ul>
<li>Download page - <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=27599">http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=27599</a></li>
<li>Direct download link - <a title="http://download.microsoft.com/download/E/C/6/EC68782D-872A-4D58-A8D3-87881995CDD4/XNAGS40_setup.exe" href="http://download.microsoft.com/download/E/C/6/EC68782D-872A-4D58-A8D3-87881995CDD4/XNAGS40_setup.exe">http://download.microsoft.com/download/E/C/6/EC68782D-872A-4D58-A8D3-87881995CDD4/XNAGS40_setup.exe</a></li>
</ul>
<div>Downloading and installing this takes way less time than repairing the Windows Phone SDK (which asks for a reboot as well). Also repairing does not always solve the problem.</div>
]]></content:encoded>
			<wfw:commentRss>http://merill.net/2012/01/fixed-the-target-getcopytooutputdirectorycontentprojectitems-does-not-exist-in-the-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configure the Belkin Play Max router for SLT ADSL Broadband</title>
		<link>http://merill.net/2011/09/configure-the-belkin-play-max-router-for-slt-adsl-broadband/</link>
		<comments>http://merill.net/2011/09/configure-the-belkin-play-max-router-for-slt-adsl-broadband/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 11:57:54 +0000</pubDate>
		<dc:creator>Merill Fernando</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[router]]></category>

		<guid isPermaLink="false">http://merill.net/?p=737</guid>
		<description><![CDATA[I&#8217;m on vacation back home in Sri Lanka and became the tech support guy for the in-laws. They were using an old D-Link router which supported just 802.11b and a draft version of g. In short ancient. The house has two stories and a terrace but the wifi wouldn&#8217;t even work on all the rooms [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m on vacation back home in Sri Lanka and became the tech support guy for the in-laws. They were using an old D-Link router which supported just 802.11b and a draft version of g. In short ancient. The house has two stories and a terrace but the wifi wouldn&#8217;t even work on all the rooms on the same floor.</p>
<p>So I went to Unity plaza and checked out all the routers that are available. Unfortunately there&#8217;s not much in terms of choice. All of the available routers were the low end versions by D-Link, a few have a low-end Linksys router and some Belkin routers. You also get a handful of Asian brands of which the Unity Plaza sales guys tout the TP-Link as being the best brand, far superior to D-Link, Linksys etc.</p>
<p>I finally settled on the <a href="http://www.belkin.com/IWCatProductPage.process?Product_Id=522112">Belkin Play Max N300+300</a> which sells here for Rs. 16,500/-</p>
<p>I got home plugged it in but couldn&#8217;t get it to connect to the SLT ADSL. I spent a few hours trying various settings, calling SLT to verify the username/password all to no avail. I finally updated the router from v1.00.45 to <a href="http://en-au-support.belkin.com/app/answers/detail/a_id/4624/~/f7d4401au-play-max-wireless-modem-router---firmware-update">v1.00.46</a> and viola it worked.</p>
<p>The connectivity is really good and I don&#8217;t have any dead spots in the house.</p>
<p>Here are a few screenshots of the config page for SLT&#8217;s settings.</p>
<p><a href="http://merill.net/wp-content/uploads/2011/09/Belkin-Router-Config-PPPoE.png"><img class="alignnone size-medium wp-image-739" title="Belkin-Router-Config-PPPoE" src="http://merill.net/wp-content/uploads/2011/09/Belkin-Router-Config-PPPoE-300x216.png" alt="" width="300" height="216" /></a></p>
<p><a href="http://merill.net/wp-content/uploads/2011/09/Belkin-Router-Config-PPPoE-VPI-VCI.png"><img class="alignnone size-medium wp-image-740" title="Belkin-Router-Config-PPPoE-VPI-VCI" src="http://merill.net/wp-content/uploads/2011/09/Belkin-Router-Config-PPPoE-VPI-VCI-300x206.png" alt="" width="300" height="206" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://merill.net/2011/09/configure-the-belkin-play-max-router-for-slt-adsl-broadband/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating a mock/stub WCF web service from a WSDL</title>
		<link>http://merill.net/2011/08/generating-a-mockstub-wcf-web-service-from-a-wsdl/</link>
		<comments>http://merill.net/2011/08/generating-a-mockstub-wcf-web-service-from-a-wsdl/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 22:29:14 +0000</pubDate>
		<dc:creator>Merill Fernando</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[wcf]]></category>
		<category><![CDATA[wsdl]]></category>

		<guid isPermaLink="false">http://merill.net/?p=732</guid>
		<description><![CDATA[When working on integration projects you sometimes need to build a stub or mock service to emulate the behavior of the targeted system in your dev environment. Visual Studio&#8217;s Add Service Reference dialog provides an easy way for generating the client code based on the WSDL of the service that you are invoking. Unfortunately there [...]]]></description>
			<content:encoded><![CDATA[<p>When working on integration projects you sometimes need to build a stub or mock service to emulate the behavior of the targeted system in your dev environment.</p>
<p>Visual Studio&#8217;s Add Service Reference dialog provides an easy way for generating the client code based on the WSDL of the service that you are invoking. Unfortunately there is no such dialog to generate a server side stub / mock.</p>
<p>There are various approaches you can take here but using svcutil.exe has been the most pain-free for me. </p>
<p>Here&#8217;s an example of how to go about it:<br />
<code>svcutil /mc UserService.wsdl UserTypes.xsd</code></p>
<p>The /mc parameter generates a class file with all the data types defined in the .xsd as well as the interfaces for all the operations defined in the WSDL. It also provides you with a starter .config file that you&#8217;ll then need to tweak to define the port on which the service is going to be hosted.</p>
<p>Once you have these files create a new WCF Service Library project, add the generated class files. Then create an implementation class that implements the interfaces that is generated. To keep things simple you might want to write code for just the operations that your calling from the client side.</p>
<p>Now here&#8217;s a gotcha for those stubbing out a service generated by Oracle WebLogic. The Action (SOAP Action) attribute on the operations are sometimes the same for all the operations in the interface. WCF doesn&#8217;t support this since it doesn&#8217;t conform to the WSDL specifications. You&#8217;ll easily know that you&#8217;ve hit this issue when you get the following exception when trying to host your stubbed service.</p>
<p><code>System.InvalidOperationException: The operations xxx and yyy have the same action ().  Every operation must have a unique action value.<br />
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ActionDemuxer.Add(String action, DispatchOperationRuntime operation)<br />
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime..ctor(DispatchRuntime dispatch)<br />
   at System.ServiceModel.Dispatcher.DispatchRuntime.GetRuntimeCore()<br />
   at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpened()<br />
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)<br />
   at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)<br />
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)<br />
   at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info)<br />
</code></p>
<p>To overcome this you can create a custom Dispatch Behavior that uses an alternate algorithm to assign incoming messages to operations. The <a href="http://msdn.microsoft.com/en-us/library/aa395223.aspx">Dispatch by Body Element</a> WCF sample comes with a sample implementation that works well. </p>
<p>All you need to do is add the two class files in this zip file (it&#8217;s the same code that comes with the WCF samples) <a href='http://merill.net/wp-content/uploads/2011/08/Contracts.zip'>DispatchByBodyBehavior</a></p>
<p>Next open up the class generated by svcutil and add the DispatchByBodyBehavior attribute to the ServiceContractInterface. You should now be able to host the service in WCF without any issues.</p>
<p><code>[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples"),<br />
                            <strong>DispatchByBodyElementBehavior</strong>]<br />
public interface IDispatchedByBody<br />
{<br />
    [OperationContract(ReplyAction="*"),<br />
     DispatchBodyElement("bodyA","http://tempuri.org")]<br />
    Message OperationForBodyA(Message msg);<br />
    [OperationContract(ReplyAction = "*"),<br />
     DispatchBodyElement("bodyB", "http://tempuri.org")]<br />
    Message OperationForBodyB(Message msg);<br />
    [OperationContract(Action="*", ReplyAction="*")]<br />
    Message DefaultOperation(Message msg);<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://merill.net/2011/08/generating-a-mockstub-wcf-web-service-from-a-wsdl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ULS Viewer stops working</title>
		<link>http://merill.net/2011/04/uls-viewer-stops-working/</link>
		<comments>http://merill.net/2011/04/uls-viewer-stops-working/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 02:38:42 +0000</pubDate>
		<dc:creator>Merill Fernando</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[uls viewer]]></category>

		<guid isPermaLink="false">http://merill.net/?p=719</guid>
		<description><![CDATA[If ULS Viewer suddenly stops reading from the ULS log, the quick fix is to move all the log files to another folder. Except for the last log file which Explorer will anyway prevent you from moving. The issue is most probably because one or more files in the folder are not in the right [...]]]></description>
			<content:encoded><![CDATA[<p>If ULS Viewer suddenly stops reading from the ULS log, the quick fix is to move all the log files to another folder. Except for the last log file which Explorer will anyway prevent you from moving.</p>
<p>The issue is most probably because one or more files in the folder are not in the right format and trip up ULS Viewer. </p>
<p>Some have reported the *upgrade.log files as the culprit. Deleting them didn&#8217;t fix it for me so I just deleted all the files.</p>
<p>PS: If your a SharePoint dev and your not using the ULS Viewer from Microsoft (no not the one from CodePlex). Do yourself a favour and give it a try.<br />
<a href="http://archive.msdn.microsoft.com/ULSViewer">http://archive.msdn.microsoft.com/ULSViewer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://merill.net/2011/04/uls-viewer-stops-working/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>FBA Custom Sign In Page returns 401 Unauthorized error</title>
		<link>http://merill.net/2010/12/fba-custom-sign-in-page-returns-401-unauthorized-error/</link>
		<comments>http://merill.net/2010/12/fba-custom-sign-in-page-returns-401-unauthorized-error/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 01:14:56 +0000</pubDate>
		<dc:creator>Merill Fernando</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[claims]]></category>
		<category><![CDATA[fba]]></category>
		<category><![CDATA[sso]]></category>

		<guid isPermaLink="false">http://merill.net/?p=720</guid>
		<description><![CDATA[If you&#8217;ve built a custom sign in page in SharePoint 2010 but keep getting a 401 Unauthorized error instead of the sign in page then you&#8217;ve most probably deployed the solution package to a single web application. To resolve the issue the solution needs to be deployed to all applications and not restricted to a [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve built a custom sign in page in SharePoint 2010 but keep getting a 401 Unauthorized error instead of the sign in page then you&#8217;ve most probably deployed the solution package to a single web application.</p>
<p>To resolve the issue the solution needs to be deployed to all applications and not restricted to a single web application.</p>
<p>i.e. When calling Install-SPSolution don&#8217;t include the -WebApplication parameter.</p>
<p>Edit: Another instance when you will see the 401 Unauthorized error is when your not inheriting from the correct base page. It should not be the layoutsbasepage.</p>
<p>Another tip if you see the following error in your ULS log:<br />
<code>Request for security token failed with exception: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Object reference not set to an instance of an object. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.NullReferenceException: Object reference not set to an instance of an object.<br />
 at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.SPRequestInfo.ValidateFormsAuthProviderNames(Uri context, String membershipProvider, String roleProvider)<br />
 at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.SPRequestInfo.SetProviderNames(RequestSecurityToken request)<br />
 at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.SPRequestInfo..ctor(IClaimsIdentity identity, RequestSecurityToken request, Boolean initializeForActor)<br />
 at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.SPRequestInfo..ctor(IClaimsPrincipal principal, RequestSecurityToken request)<br />
 at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.GetTokenLifetime(Lifetime requestLifetime)<br />
 at Microsoft.IdentityModel.SecurityTokenService.SecurityTokenService.Issue(IClaimsPrincipal principal, RequestSecurityToken r...).<br />
</code></p>
<p>That means your using a name that has not been setup as an AAM. I was using http://localhost and it always kept failing. Changing the request url to the actual name of the server (in my case http://mosswfe1) fixed it.</p>
<p>Note to myself: References for creating a Custom Sign In Page<br />
<a href="http://blogs.msdn.com/b/chunliu/archive/2010/08/21/creating-a-custom-login-page-for-fba-in-sharepoint-2010.aspx">Creating a Custom Login Page for FBA in SharePoint 2010</a><br />
<a href="http://blogs.msdn.com/b/kaevans/archive/2010/07/09/creating-a-custom-login-page-for-sharepoint-2010.aspx">Creating a Custom Login Page for SharePoint 2010</a><br />
<a href="http://blogs.msdn.com/b/pranab/archive/2010/07/26/how-to-create-custom-login-form-for-sharepoint-2010-form-based-authentication.aspx">How to create custom login page for SharePoint 2010 form based authentication (FBA)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://merill.net/2010/12/fba-custom-sign-in-page-returns-401-unauthorized-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FBA Configuration Manager for SharePoint 2010</title>
		<link>http://merill.net/2010/12/fba-configuration-manager-for-sharepoint-2010/</link>
		<comments>http://merill.net/2010/12/fba-configuration-manager-for-sharepoint-2010/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 04:54:18 +0000</pubDate>
		<dc:creator>Merill Fernando</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[fba]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://merill.net/?p=713</guid>
		<description><![CDATA[Setting up forms based authentication in SharePoint 2010 requires making changes in three web.config files. This utility allows you to perform the update in a single click and was inspired by the configuration manager that Steve Peschka released. I&#8217;ve taken a different approach to Steve&#8217;s, instead of using a feature and a timer job I [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up forms based authentication in SharePoint 2010 requires making changes in three web.config files.</p>
<p>This utility allows you to perform the update in a single click and was inspired by the configuration manager that Steve Peschka <a href="http://blogs.technet.com/b/speschka/archive/2010/07/28/sharepoint-2010-forms-based-authentication-configuration-manager.aspx">released</a><code>.</code></p>
<p>I&#8217;ve taken a different approach to Steve&#8217;s, instead of using a feature and a timer job I directly update the config files in the local machine. To update the other machines in the farm you can use the included PowerShell script.</p>
<p>The utility makes a back-up of all of the web.configs before updating them. I&#8217;ve also included the sample membership and role providers that Steve provided.</p>
<p><a href="http://merill.net/wp-content/uploads/2010/12/ConfigureMembershipProvider1.png"><img class="alignnone size-full wp-image-715" title="ConfigureMembershipProvider" src="http://merill.net/wp-content/uploads/2010/12/ConfigureMembershipProvider1.png" alt="" width="695" /></a></p>
<p>The PowerShell script to perform the update uses the same engine as the UI. </p>
<p><code><br />
function global:Get-ScriptDirectory()<br />
{<br />
   $Invocation = (Get-Variable MyInvocation -Scope 1).Value<br />
   Split-Path $Invocation.MyCommand.Path<br />
}</p>
<p>$webApp = Get-SPWebApplication http://localhost:9191<br />
$settingsPath = Join-Path (Get-ScriptDirectory) "SqlMembershipConfig.xml"<br />
$settings = Get-Content $settingsPath<br />
$scriptDir = Get-ScriptDirectory<br />
$assemblyPath = Join-Path $scriptDir "FBA.dll"<br />
Add-Type -Path $assemblyPath<br />
[FBA.ConfigureMembershipProvider]::Configure($webApp, "Default", $settings)<br />
</code></p>
<p>The source code and release packages are available in CodePlex: <a href="http://fbaconfigmanager.codeplex.com/">http://fbaconfigmanager.codeplex.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://merill.net/2010/12/fba-configuration-manager-for-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Updating Extended Properties of a Database using SQL Server SMO</title>
		<link>http://merill.net/2010/06/updating-extended-properties-of-a-database-using-sql-server-smo/</link>
		<comments>http://merill.net/2010/06/updating-extended-properties-of-a-database-using-sql-server-smo/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 01:28:01 +0000</pubDate>
		<dc:creator>Merill Fernando</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[smo]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://merill.net/?p=710</guid>
		<description><![CDATA[Updating the extended properties on a database using SQL Server&#8217;s excellent Server Management Objects API is not as straightforward as setting the value and calling update. The database.Alter() method needs to be called both before and after updating the value. I had to lookup the code of El Pluto&#8216;s awesome SQL Server Extended Properties Quick [...]]]></description>
			<content:encoded><![CDATA[<p>Updating the extended properties on a database using SQL Server&#8217;s excellent <a href="http://msdn.microsoft.com/en-us/library/ms162169.aspx">Server Management Objects</a> API is not as straightforward as setting the value and calling update.</p>
<p>The database.Alter() method needs to be called both before and after updating the value. I had to lookup the code of <a href="http://blog.elpluto.com/">El Pluto</a>&#8216;s awesome <a href="http://xqued.codeplex.com/">SQL Server Extended Properties Quick Editor</a> project on CodePlex to figure this out.</p>
<div style="color: black; background: white; font-family: Consolas; font-size: 10pt;">
<pre style="margin: 0px;"><span style="color: blue;">using</span> Microsoft.SqlServer.Management.Smo;</pre>
<pre style="margin: 0px;">&nbsp;</pre>
<pre style="margin: 0px;"><span style="color: gray;">///</span><span style="color: green;"> </span><span style="color: gray;">&lt;summary&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: gray;">///</span><span style="color: green;"> Set's the extended property of a database.</span></pre>
<pre style="margin: 0px;"><span style="color: gray;">///</span><span style="color: green;"> </span><span style="color: gray;">&lt;/summary&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: gray;">///</span><span style="color: green;"> </span><span style="color: gray;">&lt;param name=&quot;serverName&quot;&gt;</span><span style="color: green;">The name of the SQL Server.</span><span style="color: gray;">&lt;/param&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: gray;">///</span><span style="color: green;"> </span><span style="color: gray;">&lt;param name=&quot;databaseName&quot;&gt;</span><span style="color: green;">The name of the database.</span><span style="color: gray;">&lt;/param&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: gray;">///</span><span style="color: green;"> </span><span style="color: gray;">&lt;param name=&quot;propertyName&quot;&gt;</span><span style="color: green;">The name of the extended property.</span><span style="color: gray;">&lt;/param&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: gray;">///</span><span style="color: green;"> </span><span style="color: gray;">&lt;param name=&quot;value&quot;&gt;</span><span style="color: green;">The value of the extended property.</span><span style="color: gray;">&lt;/param&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">private</span> <span style="color: blue;">void</span> SetExtendedProperty(<span style="color: blue;">string</span> serverName, <span style="color: blue;">string</span> </pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; databaseName, <span style="color: blue;">string</span> propertyName, <span style="color: blue;">string</span> value)</pre>
<pre style="margin: 0px;">{</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: blue;">var</span> server = <span style="color: blue;">new</span> <span style="color: #2b91af;">Server</span>(serverName);</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: blue;">var</span> database = server.Databases[databaseName];</pre>
<pre style="margin: 0px;">&nbsp;</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; database.Alter();</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> (!database.ExtendedProperties.Contains(propertyName))</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; {</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; database.ExtendedProperties.Add(</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: blue;">new</span> <span style="color: #2b91af;">ExtendedProperty</span>(database, propertyName, value));</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; }</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: blue;">else</span></pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; {</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; database.ExtendedProperties[propertyName].Value = value;</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; }</pre>
<pre style="margin: 0px;">&nbsp;&nbsp;&nbsp; database.Alter();</pre>
<pre style="margin: 0px;">}</pre>
<pre style="margin: 0px;">&nbsp;</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://merill.net/2010/06/updating-extended-properties-of-a-database-using-sql-server-smo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dynamically setting multiple activity destinations in K2 with ASP .NET</title>
		<link>http://merill.net/2010/06/dynamically-setting-multiple-activity-destinations-in-k2-with-asp-net/</link>
		<comments>http://merill.net/2010/06/dynamically-setting-multiple-activity-destinations-in-k2-with-asp-net/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 04:18:42 +0000</pubDate>
		<dc:creator>Merill Fernando</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[destinations]]></category>
		<category><![CDATA[infopath]]></category>
		<category><![CDATA[k2]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://merill.net/?p=690</guid>
		<description><![CDATA[When building a typical workflow you usually know which user or group needs to perform an activity at design time. Sometimes though the workflow needs to be more dynamic. The issue I had to resolve recently involved having to build a workflow where the end-user gets to individually pick the users who will be performing [...]]]></description>
			<content:encoded><![CDATA[<p>When building a typical workflow you usually know which user or group needs to perform an activity at design time. Sometimes though the workflow needs to be more dynamic.</p>
<p>The issue I had to resolve recently involved having to build a workflow where the end-user gets to individually pick the users who will be performing the next step. Here&#8217;s a view of  the workflow design.</p>
<p><a href="http://merill.net/wp-content/uploads/2010/06/K2-Multiple-Destination-Workflow.png"><img class="alignnone size-full wp-image-691" title="K2 Multiple=" src="http://merill.net/wp-content/uploads/2010/06/K2-Multiple-Destination-Workflow.png" alt="" width="696" height="478" /></a></p>
<p>The scenario involved an application being submitted for review. The application would go to an individual who is responsible for assigning a group of users (destination users) to review the application. The twist was that it was the individual picking users for each application, it wasn&#8217;t a fixed group or role. The screen mockup shows how they do it.</p>
<p>When the person hits the &#8216;Assign Reviewers&#8217; button the form then needs to turn up as a work list item for each of the reviewers (destination users) who get to review the application in parallel.</p>
<p>Implementing this process using K2/InfoPath is quite straightforward and is well documented in many places including this post titled &#8216;<a href="http://www.k2underground.com/blogs/fromthebench/archive/2008/05/22/activity-destination-users-based-upon-a-repeating-xml-element.aspx">Activity Destination Users based upon a Repeating XML element</a>&#8216; in a K2 underground blog.</p>
<p>It&#8217;s not well documented though for ASP.NET. The post &#8216;<a href="http://www.k2underground.com/blogs/fromthebench/archive/2009/08/18/how-to-use-a-web-service-for-destinations-in-k2-blackpoint.aspx?CommentPosted=true#commentmessage">How To: Use a web service for destinations in K2 blackpoint</a>&#8216; is close to what we want but it&#8217;s targeted at using a web service.</p>
<p>K2 let&#8217;s you set multiple destination users in one of two ways</p>
<p>1. Using a SmartObject method in a role</p>
<p>2. Using Xml as a destination set</p>
<p>Going the SmartObject route was a lot of work for my simple requirement so I chose the Xml method. The idea here is to use the list of users in the Assign Reviewers form and store them in a Process xml field. The destination set will then be configured to read the xml field and create a slot for each user.</p>
<p>FYI: See page 4 of the <a href="http://help.k2.com/en/AdvancedDestinations_Whitepaper.aspx">Advanced Destinations whitepaper</a> for a description of the two roles. &lt;rant&gt;Why the K2 KB portal needs a login is beyond me.&lt;/rant&gt;</p>
<p><strong>Step 1: Write the code to create the xml containing the list of users</strong></p>
<p>The code block below accepts a ; delimited list of domain name\username (e.g. domain\johna) and creates an XML document containing the list of users. This is then assigned to the Process Instance XML field called Reviewers.</p>
<div style="color: black; background: white; font-family: Consolas; font-size: 10pt;">
<pre style="margin: 0px;"><span style="color: blue;">private</span> <span style="color: blue;">static</span> <span style="color: blue;">void</span> AssignReviewers(<span style="color: #2b91af;">WorklistItem</span> item, <span style="color: blue;">string</span> listOfUsers)</pre>
<pre style="margin: 0px;">{</pre>
<pre style="margin: 0px;">    <span style="color: blue;">var</span> doc = <span style="color: blue;">new</span> <span style="color: #2b91af;">XmlDocument</span>();</pre>
<pre style="margin: 0px;">    <span style="color: blue;">var</span> root = doc.CreateElement(<span style="color: #a31515;">"UserList"</span>);</pre>
<pre style="margin: 0px;">    doc.AppendChild(root);</pre>
<pre style="margin: 0px;"></pre>
<pre style="margin: 0px;">    <span style="color: blue;">foreach</span> (<span style="color: blue;">string</span> user <span style="color: blue;">in</span> listOfUsers.Split(<span style="color: #a31515;">';'</span>))</pre>
<pre style="margin: 0px;">    {</pre>
<pre style="margin: 0px;">        <span style="color: blue;">var</span> userNode = doc.CreateElement(<span style="color: #a31515;">"Users"</span>);</pre>
<pre style="margin: 0px;">        userNode.InnerText = user;</pre>
<pre style="margin: 0px;">        root.AppendChild(userNode);</pre>
<pre style="margin: 0px;">    }</pre>
<pre style="margin: 0px;">    item.ProcessInstance.XmlFields[<span style="color: #a31515;">"Reviewers"</span>].Value = doc.OuterXml;</pre>
<pre style="margin: 0px;">}</pre>
</div>
<p><strong>Step 2: Create an xml schema based on the user list xml</strong></p>
<p>This proved to be the trickiest part for me. Using the xsd.exe as documented in this <a href="http://www.k2underground.com/blogs/fromthebench/archive/2009/08/18/how-to-use-a-web-service-for-destinations-in-k2-blackpoint.aspx">article</a> didn&#8217;t work.  After a lot of anguish I worked out that K2 was happy with the schema generated by InfoPath. So I opened an empty form in InfoPath and added a repeating text field (<a href="http://www.k2underground.com/blogs/fromthebench/archive/2008/05/22/activity-destination-users-based-upon-a-repeating-xml-element.aspx">screenshot</a>).</p>
<p>Next I exported the form to get to the .xsd (in InfoPath 2010 it is File -&gt; Publish -&gt; Export Source Files). Cleaning out the my: namespace and a bit of tweaking should give you the following schema definition. This definition should work fine with the xml produced by the above code block.</p>
<div style="color: black; background: white; font-family: Consolas; font-size: 10pt;">
<pre style="margin: 0px;"><span style="color: blue;">&lt;?</span><span style="color: #a31515;">xml</span><span style="color: blue;"> </span><span style="color: red;">version</span><span style="color: blue;">=</span>"<span style="color: blue;">1.0</span>"<span style="color: blue;"> </span><span style="color: red;">encoding</span><span style="color: blue;">=</span>"<span style="color: blue;">UTF-8</span>"<span style="color: blue;"> </span><span style="color: red;">standalone</span><span style="color: blue;">=</span>"<span style="color: blue;">no</span>"<span style="color: blue;">?&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">&lt;</span><span style="color: #a31515;">xsd:schema</span><span style="color: blue;"> </span><span style="color: red;">xmlns:xsd</span><span style="color: blue;">=</span>"<span style="color: blue;">http://www.w3.org/2001/XMLSchema</span>"<span style="color: blue;">&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">  &lt;</span><span style="color: #a31515;">xsd:element</span><span style="color: blue;"> </span><span style="color: red;">name</span><span style="color: blue;">=</span>"<span style="color: blue;">UserList</span>"<span style="color: blue;">&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">    &lt;</span><span style="color: #a31515;">xsd:complexType</span><span style="color: blue;">&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">      &lt;</span><span style="color: #a31515;">xsd:sequence</span><span style="color: blue;">&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">        &lt;</span><span style="color: #a31515;">xsd:element</span><span style="color: blue;"> </span><span style="color: red;">name</span><span style="color: blue;">=</span>"<span style="color: blue;">Users</span>"<span style="color: blue;"> </span><span style="color: red;">minOccurs</span><span style="color: blue;">=</span>"<span style="color: blue;">0</span>"<span style="color: blue;"> </span><span style="color: red;">maxOccurs</span><span style="color: blue;">=</span>"<span style="color: blue;">unbounded</span>"<span style="color: blue;">/&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">      &lt;/</span><span style="color: #a31515;">xsd:sequence</span><span style="color: blue;">&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">    &lt;/</span><span style="color: #a31515;">xsd:complexType</span><span style="color: blue;">&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">  &lt;/</span><span style="color: #a31515;">xsd:element</span><span style="color: blue;">&gt;</span></pre>
<pre style="margin: 0px;"><span style="color: blue;">&lt;/</span><span style="color: #a31515;">xsd:schema</span><span style="color: blue;">&gt;</span></pre>
</div>
<p><strong>Step 3: Create an xml field for the process</strong></p>
<p>Armed with the xml schema, we&#8217;re now ready to configure the workflow.</p>
<p>Fire up the K2 process designer and add the process xml field name <em>Reviewers</em> which we referred to in our code in step 1.</p>
<p>To do this open the Process General Properties window, expand the right panel. From the list select the Process/Activity Data node, expand it to select the name of your process and right-click on it to click Add.. and get to the Add XML Field.</p>
<p><img class="alignnone size-full wp-image-696" title="K2 Add Process Xml Field" src="http://merill.net/wp-content/uploads/2010/06/K2-Add-Process-Xml-Field.png" alt="" width="306" height="192" /></p>
<p>Name the field &#8216;Reviewers&#8217;.</p>
<p><img class="alignnone size-full wp-image-697" title="K2 Add Xml Field Dialog" src="http://merill.net/wp-content/uploads/2010/06/K2-Add-Xml-Field-Dialog.png" alt="" width="462" height="205" /></p>
<p>Switch to the XML Schema tab and browse to pick the xsd file created in Step 2.</p>
<p>When you hit OK you should now be able to drill down and see the Users node.</p>
<p><img class="alignnone size-full wp-image-698" title="K2 Xml Field Step" src="http://merill.net/wp-content/uploads/2010/06/K2-Xml-Field-Step.png" alt="" width="188" height="183" /></p>
<p>The key is to make sure that the node&#8217;s icon has a green overlay which flags it as a repeating node. If it&#8217;s there you should be fine. If not you need to repeat the steps above until you get the green overlay icon. Without it, the worklist item is not going to be assigned to multiple users.</p>
<p><strong>Step 4: Setup the destination to read from the xml field</strong></p>
<p>Select the activity which needs to be executed in parallel and click on the Destination Users node. Switch to the Advanced Mode if you are not already in there (select the checkbox on the first page). In the Destination Rule Options select Plan per destination -&gt;All at once. We do this to tell K2 that when it goes to multiple users they will be able to open and work on the item in parallel.</p>
<p><img class="alignnone size-full wp-image-703" title="K2 Setup Destination 1" src="http://merill.net/wp-content/uploads/2010/06/K2-Setup-Destination-1.png" alt="" width="560" height="281" /></p>
<p>Select &#8216;Create a slot for each destination&#8217;, this way each destination user get&#8217;s their own slot.</p>
<p><img class="alignnone size-full wp-image-704" title="K2 Setup Destination 2" src="http://merill.net/wp-content/uploads/2010/06/K2-Setup-Destination-2.png" alt="" width="543" height="328" /></p>
<p>Click on the Edit button to configure the Destination sets.</p>
<p><img class="alignnone size-full wp-image-705" title="K2 Setup Destination 3" src="http://merill.net/wp-content/uploads/2010/06/K2-Setup-Destination-3.png" alt="" width="532" height="198" /></p>
<p>Click on the ellipsis to open the Context Browser, drill down to the Process Xml field that we setup earlier and drag the Users repeating node (the one with the green icon) onto Name column.</p>
<p><img class="alignnone size-full wp-image-706" title="K2 Setup Destination 4" src="http://merill.net/wp-content/uploads/2010/06/K2-Setup-Destination-4.png" alt="" width="734" height="323" /></p>
<p>You should now be all set to test out your dynamic multiple destination users! Running through the workflow you will now see that the worklist item gets assigned to each of the reviewers in parallel.</p>
]]></content:encoded>
			<wfw:commentRss>http://merill.net/2010/06/dynamically-setting-multiple-activity-destinations-in-k2-with-asp-net/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Limit SQL Server memory usage on your workstation, laptop or VM</title>
		<link>http://merill.net/2010/05/limit-sql-server-memory-usage-on-your-workstation-laptop-or-vm/</link>
		<comments>http://merill.net/2010/05/limit-sql-server-memory-usage-on-your-workstation-laptop-or-vm/#comments</comments>
		<pubDate>Wed, 19 May 2010 00:51:30 +0000</pubDate>
		<dc:creator>Merill Fernando</dc:creator>
				<category><![CDATA[Service Manager]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://merill.net/?p=678</guid>
		<description><![CDATA[Here&#8217;s a neat tip I learnt over the weekend. All SQL Server instances are by default set up to use all the memory available on your workstation. This is ideal when you have SQL Server running on it&#8217;s own dedicated server, not so ideal when you have SQL Server installed on your laptop, workstation or [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a neat tip I learnt over the weekend.</p>
<p>All SQL Server instances are by default set up to use all the memory available on your workstation.</p>
<p>This is ideal when you have SQL Server running on it&#8217;s own dedicated server, not so ideal when you have SQL Server installed on your laptop, workstation or even on a SharePoint VM.</p>
<p>Here&#8217;s what <a href="http://msdn.microsoft.com/en-us/library/ms180797.aspx">MSDN says</a></p>
<blockquote><p>if SQL Server is one of several server applications running on a single computer, the system administrators may need to control the amount of memory allocated to SQL Server. In these cases, you can use the min server memory and max server memory options to control how much memory SQL Server can use.</p></blockquote>
<p>In the <a href="http://msdn.microsoft.com/en-us/library/ms178067.aspx">Server Memory Options</a> page they go on to say:</p>
<blockquote><p>When you are running multiple instances of the Database Engine, there are three approaches you can use to manage memory</p>
<ul>
<li>Use max server memory to control memory usage.</li>
<li>Use min server memory to control memory usage.</li>
<li><strong>Do nothing (not recommended).</strong></li>
</ul>
</blockquote>
<p>Which brings us to how we can set the maximum limit. Quite easy. Just connect to each SQL Server instance and set the maximum memory to a more palatable value.</p>
<p>Here&#8217;s a visual walk through to limit the maximum memory usage to 512MB for your SharePoint 2010 instance (if you installed it on Windows 7).</p>
<p>1. Start SQL Server Management Studio (or SSMS Express) and connect to your SQL Server instance (SharePoint in this case): <em>localhost\SharePoint</em></p>
<p><em> </em> <a href="http://merill.net/wp-content/uploads/2010/05/SqlServerConnectSharePoint.png"><img class="alignnone size-medium wp-image-681" title="SqlServerConnectSharePoint" src="http://merill.net/wp-content/uploads/2010/05/SqlServerConnectSharePoint-300x229.png" alt="" width="300" height="229" /></a></p>
<p>2. Right-click on the instance node and select Properties.</p>
<p><a href="http://merill.net/wp-content/uploads/2010/05/SqlServer-Properties.png"><img class="alignnone size-medium wp-image-683" title="SqlServer-Properties" src="http://merill.net/wp-content/uploads/2010/05/SqlServer-Properties-300x251.png" alt="" width="300" height="251" /></a></p>
<p>3. Click on the Memory node you&#8217;ll notice that the Maximum Server Memory is set to 2,147,483,647MB change it to a lower limit like 256 or 512MB. Click OK and your all set.</p>
<p><a href="http://merill.net/wp-content/uploads/2010/05/SqlServer-Memory.png"><img class="alignnone size-medium wp-image-682" title="SqlServer-Memory" src="http://merill.net/wp-content/uploads/2010/05/SqlServer-Memory-300x269.png" alt="" width="300" height="269" /></a></p>
<p>If you prefer SQL the same can be done with the following commands.</p>
<p><br/><em>Enable advanced options:</em></p>
<p><code>USE master </code></p>
<p><code>EXEC sp_configure 'show advanced options', 1 </code></p>
<p><code>RECONFIGURE WITH OVERRIDE</code></p>
<p><br/><em>Set the maximum amount of memory to 512 MB:</em></p>
<p><code>USE master </code></p>
<p><code>EXEC sp_configure 'max server memory (MB)', 512 </code></p>
<p><code>RECONFIGURE WITH OVERRIDE</code></p>
<p><br/><em>Display the newly set configuration:</em></p>
<p><code>USE master </code></p>
<p><code>EXEC sp_configure 'max server memory (MB)' </code></p>
<p><br/><em>Set &#8216;show advanced options&#8217; back to default:</em></p>
<p><code>USE master </code></p>
<p><code>EXEC sp_configure 'show advanced options', 0 </code></p>
<p><code>RECONFIGURE WITH OVERRIDE</code></p>
]]></content:encoded>
			<wfw:commentRss>http://merill.net/2010/05/limit-sql-server-memory-usage-on-your-workstation-laptop-or-vm/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

