<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Derik Whittaker : Featured, Development</title><link>http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/Development/default.aspx</link><description>Tags: Featured, Development</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>Simple extension methods to help with Asserting values</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2008/04/10/simple-extension-methods-to-help-with-asserting-values.aspx</link><pubDate>Thu, 10 Apr 2008 12:49:43 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:40019</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=40019</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=40019</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2008/04/10/simple-extension-methods-to-help-with-asserting-values.aspx#comments</comments><description>&lt;p&gt;In the past I have written about the &lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/06/08/fail-fast-principle.aspx"&gt;Fail Fast&lt;/a&gt; principle.&amp;#160; This is a principle I try to live my development life by.&amp;#160; I would rather explicitly check for possible failure points then have a runtime error crop up.&amp;#160; In the past when writing these failure check we have had to resort to a few &amp;#39;cavemanish&amp;#39; techniques.&amp;#160; But with the inception of Extension Methods (&lt;a href="http://msdn2.microsoft.com/en-us/library/bb383977.aspx"&gt;here&lt;/a&gt; or &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx"&gt;here&lt;/a&gt;) we can actually create something that is pretty simple as well as elegant.&lt;/p&gt;  &lt;p&gt;Lets take a look at a few examples where we are NOT using extension methods to accomplish our failure checking.&lt;/p&gt;  &lt;pre class="c-sharp" name="code"&gt;public bool SomeMethod( string key )  
{  
	// In this case the key cannot be null or empty  
	if ( key.length == 0 ) { throw new ArgumentOutOfRangeException( &amp;quot;key&amp;quot;, &amp;quot;Some Message Goes here&amp;quot; ); }
} &lt;/pre&gt;

&lt;p&gt;The code above works, it is pretty simple and will get the job done.&amp;#160; But to be honest, having this sprinkled all over your code is kinda ugly.&lt;/p&gt;

&lt;pre class="c-sharp" name="code"&gt;public bool SomeMethod( SomeObject obj, Int32 someInt )  
{  
	// In this case the object cannot be null  
     	Assert.IsNotNull( obj, &amp;quot;Some Object&amp;quot; );  
  
	// In this case the int must be greater then 1  
     	Assert.IsTrue( someInt &amp;gt; 1, &amp;quot;Some Int not correct&amp;quot; );  
} &lt;/pre&gt;

&lt;p&gt;This code works as well and is more concise the the previous example.&amp;#160; However, this code is still less readable then the example below.&lt;/p&gt;

&lt;p&gt;Now, lets take a look at the same thing, but using Extension Methods&lt;/p&gt;

&lt;pre class="c-sharp" name="code"&gt;public bool SomeMethod( SomeObject obj, strnig someString )  
{  
	// In this case the object cannot be null  
	obj.AssertNonNull(); 
  
	// In this case the cannot be null or empty
	someString.AssertNotNullOrEmpty();	
} &lt;/pre&gt;

&lt;p&gt;Here is the code for the actual extension methods assert&lt;/p&gt;

&lt;pre class="c-sharp" name="code"&gt;public static void AssertNonNull( this T value )
{
	// Do our null check here.
	if ( value == null ) 
	{ 
		// Could even use reflection to gather info such as calling method, method exception was
		//	found in, etc.
		throw new ArgumentNullException( &amp;quot;Some message here&amp;quot; );
	}
}&lt;/pre&gt;

&lt;p&gt;The assert above using the extension method to me is the most elegant.&amp;#160; It is easy to read (very important) and very concise.&amp;#160; &lt;/p&gt;

&lt;p&gt;Keep in mind, all the examples above do the exact same thing, but they do in varying levels of elegance.&amp;#160; I would argue that the usage of extension methods here makes the code cleaner and easier to read.&lt;/p&gt;

&lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=40019" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/.Net/default.aspx">.Net</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>Subclassing for Success</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/11/02/subclassing-for-success.aspx</link><pubDate>Fri, 02 Nov 2007 12:36:58 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38781</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38781</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38781</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/11/02/subclassing-for-success.aspx#comments</comments><description>&lt;p&gt;As someone how has been designing and developing WinForms based applications for the past 7+ years, I have learned that subclassing UI controls is a must.&amp;nbsp; You may be thinking, why would I want to subclass a text box?&amp;nbsp; Or a combo box?&amp;nbsp; The answer is simple, the better future proof your app.&amp;nbsp; &lt;/p&gt; &lt;p&gt;How many times have you been into the development cycle of your application and you found out that you needed/wanted to extend the text box that is being used.&amp;nbsp; By extend I am not necessary talking about adding functionality to it, but do something like having the control highlight the entire contents of the control&amp;nbsp;when the&amp;nbsp;it receives focus.&lt;/p&gt; &lt;p&gt;If you don&amp;#39;t have your controls subclassed, extending your control will be a pain in your ass.&amp;nbsp; Sure you could find EVERY use of the control and add the needed&amp;nbsp;code.&amp;nbsp; Or you could find and replace your control later with the subclassed control, but both of these suck.&lt;/p&gt; &lt;p&gt;When I start a new WinForms (same concept should work for Browser based as well) application, I will immediately add a Controls namespace and simply add my subclassed controls.&amp;nbsp; In many cases I never extend the control, but knowing that I can do so allows me to make better decisions later on.&amp;nbsp; &lt;/p&gt; &lt;p&gt;One example of where this has helped me in the past was on a project where about 6 months into development, the business owners decided that would like the UI controls (text box, check box, combo box, etc) to change background color when the control receives focus and then change back when it loses focus.&amp;nbsp; Because I had everything subclassed i was able to implement this request in a very short time frame and did not even have to open up a single form.&amp;nbsp; Had I not subclasses the controls I would have either pushed back heavily or it would have taken me much longer to implement this change.&lt;/p&gt; &lt;p&gt;Another good use is for things like data grids.&amp;nbsp; Whether you are using the out of the box data grid, or some third party grid like Infragistics or Janus, subclassing can save you a ton.&amp;nbsp; How many times have you developed an application where you wanted a standard look and feel for your grids.&amp;nbsp; Say every other line is gray, and there are no selection column.&amp;nbsp; If the control is not subclassed you are asking each developer to remember to make the look and feel customizations.&amp;nbsp; But, if it is subclassed, simply add the control to the form and you are done.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38781" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>Using Anonymous Delegates to handle Async Web Service Calls</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/15/using-anonymous-delegates-to-handle-async-web-service-calls.aspx</link><pubDate>Mon, 15 Oct 2007 13:27:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38679</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38679</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38679</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/15/using-anonymous-delegates-to-handle-async-web-service-calls.aspx#comments</comments><description>
&lt;p&gt;I just thought I would share a little trick I used today to back in Async web 
service calls into existing code using anonymous delegates. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here was my problem:&lt;br /&gt;&lt;/strong&gt;I have a library that makes use of 
an existing web service that I do not control (so I cannot change/up the timeout on this).&amp;nbsp; I have been using this code now 
for a few weeks with no issues, however late last week I noticed that I was 
experiencing timeouts when making certain requests via the service.&amp;nbsp; My original 
code was making use of the synchronous methods on the web service.&amp;nbsp; In order to 
get around the time out issue I wanted to make the calls asynchronous, but I did 
not want to have to put in a ton of time or effort to retrofit my code.&amp;nbsp; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here is my solution:&lt;/strong&gt;&lt;br /&gt;Create an anonymous delegate to 
handle my Async call and move on.&lt;/p&gt;

&lt;p&gt;Here is my original code&lt;/p&gt;

&lt;p&gt;
&lt;textarea class="xml:nogutter" name="code" rows="7" cols="100"&gt;XmlNode results = listService.GetListItems( param1, param2, param3, param4, param5, param6, param7 );

....
Do something here
....
&lt;/textarea&gt;
&lt;/p&gt;

&lt;p&gt;Here is the new code using the delegates&lt;/p&gt;

&lt;p&gt;
&lt;textarea class="xml:nogutter" name="code" rows="15" cols="100"&gt;asyncResults = null;
asyncReturned = false;

// Wire up the async callback with our delegate
listService.GetListItemsCompleted += delegate( object sender, GetListItemsCompletedEventArgs e ) { 
asyncResults = e.Result;                                                                                                                 asyncReturned = true; 
};

listService.GetListItemsAsync( param1, param2, param3, param4, param5, param6, param7 )

// hack, but works....:(
while( !asyncReturned )
{
   System.Threading.Thread.Sleep(1000);
}

....
Do something here
....
&lt;/textarea&gt;
&lt;/p&gt;

&lt;p&gt;As you can see, this code is not &amp;#39;slick&amp;#39; and &amp;#39;cool&amp;#39; but it does do the job.&amp;nbsp; By tweaking this code I was able to not have to re-write any other outside logic to handle the new async way of making this call.&lt;/p&gt;&lt;p&gt;Till next time,&amp;nbsp;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38679" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/.Net/default.aspx">.Net</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/HowTo/default.aspx">HowTo</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>Why I believe IN and WRITE unit tests</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/01/why-i-believe-in-and-write-unit-tests.aspx</link><pubDate>Tue, 02 Oct 2007 00:27:25 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38554</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38554</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38554</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/01/why-i-believe-in-and-write-unit-tests.aspx#comments</comments><description>&lt;p&gt;In my last post I think I struck a cord with some people in my post &amp;#39;Unit tests taking too much time&amp;#39;.&amp;nbsp; My intent was NOT to sound like an elitist Agilist or any else of that nature.&amp;nbsp; My intent was simply to put a post out there about the misperception (in my opinion) about how writing unit tests take too much time.&lt;/p&gt; &lt;p&gt;I thought I would put my &amp;#39;retort&amp;#39; on why I believe in&amp;nbsp;and write unit tests.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows&amp;nbsp;ME to write better code&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I believe that when&amp;nbsp;I truly follow TDD practices&amp;nbsp;my code comes out simpler.&amp;nbsp; I have also found, that my code tends to follow&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/YAGNI" target="_blank"&gt;YAGNI&lt;/a&gt;&amp;nbsp;more so then when I don&amp;#39;t follow TDD practices.&lt;/p&gt; &lt;p&gt;Here is an example from my past experience.&amp;nbsp; On a prior project I needed to build a &amp;#39;search engine&amp;#39; into our app (this was not an actual search engine, more like a hunt path engine).&amp;nbsp; When I first started out writing code I started out by creating all these classes and logic that I thought I would need.&amp;nbsp; After about 3-4 hours of coding I was dead in the water.&amp;nbsp; I was not able to solve my problem in a simple manner and I was frustrated.&amp;nbsp; I decided to take a step back and start over.&amp;nbsp; &lt;/p&gt; &lt;p&gt;This time though I&amp;nbsp;started out by writing test to mimic what I actually needed.&amp;nbsp; I continued to follow the principles of &lt;a href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank"&gt;TDD&lt;/a&gt; (btw, TDD is more then just about writing tests), within an hour or so I had my solution pretty much good to go.&amp;nbsp; All those classes and methods I THOUGHT I would need I did NOT.&amp;nbsp; I was able to scrap about 50% of the code/classes that I thought I needed.&amp;nbsp; And guess what, now I have a test suit to test my new code.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows ME to find more bugs during the development process&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;It has been my experience that I find more bugs while writing tests.&amp;nbsp; This is due to the fact that I not only follow TDD, but I also do my best to implement the &lt;a href="http://en.wikipedia.org/wiki/Fail-fast" target="_blank"&gt;Fail Fast Principle&lt;/a&gt;.&amp;nbsp; When I am writing my tests I have the ability to create tests that easily walk though the different pathways of my code (I attempt to hit 100% code coverage as well).&amp;nbsp; If I were not writing tests I would have to do this via the application, and&amp;nbsp;this is much more painful and it less likely that I would actually do it.&lt;/p&gt; &lt;p&gt;By writing my tests and testing my code during the development process I know that I have reduced my bug count significantly.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Makes ME feel more comfortable making changes&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This is the beauty of TDD, I am not afraid to make any critical changes to my code because I KNOW that I have tests to verify if I screwed anything up.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Have you ever run across some code that &amp;#39;you were scared&amp;#39; to change?&amp;nbsp; If you had tests for that code I bet you would a WHOLE LOT LESS scared to make any changes.&amp;nbsp; I know that I am.&lt;/p&gt; &lt;p&gt;A case in point for this is as follows.&amp;nbsp; On a prior project a consultant I was working with needed to make changes to some &amp;#39;smelly&amp;#39; logic.&amp;nbsp; This just happened to be a week or so before a scheduled release.&amp;nbsp; Beacuse he had NO confidence that the changes he would make would NOT break the application, he convinced the business to NOT make the changes. &amp;nbsp;I bet you a dollar that had there been unit tests he would have been much more willing to make the changes.&amp;nbsp; In this case the fact of NOT having tests may have caused the business to lose out on features it needed.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Improves MY code&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Because following TDD practices&amp;nbsp;forces you to write your failing code before your passing code,&amp;nbsp;I tend to implement my intent much cleaner and simpler.&amp;nbsp; I also know that because I am writing tests along the way my code is solid.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows ME to better convey intent&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I know that tests are not a&amp;nbsp;substitution for&amp;nbsp;quality comments that convey intent, but they sure are the next best thing.&amp;nbsp; It is really nice to be able to point someone towards a suite of tests to &amp;#39;demo&amp;#39; how to use a component.&lt;/p&gt; &lt;p&gt;A case in point for this is as follows.&amp;nbsp; A few weeks ago at work I wrote an API to allow the querying of some data via our imaging system at work.&amp;nbsp; Turns out that an outside party needed to use this API for integration into on of our 3rd party applications.&amp;nbsp; When he came to me asking for &amp;#39;how do I use this&amp;#39;, I simply emailed him my suite of tests.&amp;nbsp; In this suite I had pretty much any conceivable use for the API.&amp;nbsp; To date the vendor has not asked me how to implement the API.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows MY tests to be automated and rerunable&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This is a nice side effect of having tests.&amp;nbsp; Because we use&amp;nbsp;both NUnit and CruiseControl I can run my tests on every check in.&amp;nbsp; This is cool because now I (and the team) know if changes&amp;nbsp;I made&amp;nbsp;breaks some other part of the system.&amp;nbsp; I would rather know now then before QA hits it.&amp;nbsp; &lt;/p&gt; &lt;p&gt;The above are simply my opinion, if you don&amp;#39;t share the same opinions, let me know.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38554" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>Updating List Information in SharePoint via Web Services</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/09/19/updating-list-information-in-sharepoint-via-web-services.aspx</link><pubDate>Wed, 19 Sep 2007 12:49:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38442</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>28</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38442</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38442</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/09/19/updating-list-information-in-sharepoint-via-web-services.aspx#comments</comments><description>
&lt;p&gt;In my continued learning on SharePoint and how to manipulate the data stored in SharePoint I thought I would post on how to perform updates on existing data inside a document library.&lt;/p&gt;
 
&lt;p&gt;When performing an update on data inside of SharePoint there are a few steps that need to happen to make your journey a successful one.&lt;/p&gt;
 
&lt;p&gt;Steps overview&lt;/p&gt;
 
&lt;ol&gt; 
&lt;li&gt;Connect to the correct web service  &lt;/li&gt;

&lt;li&gt;Know the correct document site (sub site) and document library you want to use  &lt;/li&gt;

&lt;li&gt;Get the ID/Version for the Site/Library combination  &lt;/li&gt;

&lt;li&gt;Know the data you want update, along with build the correct CAML statement  &lt;/li&gt;

&lt;li&gt;Perform the update via the web service&lt;/li&gt;
&lt;/ol&gt;
 
&lt;p&gt;&lt;b&gt;Connecting to the correct web service.&lt;br /&gt;&lt;/b&gt;When performing an update you will want to connect to the Lists.asmx server.&amp;nbsp; You can get information about the web service &lt;a href="http://msdn2.microsoft.com/en-us/library/lists.aspx" target="_blank"&gt;here&lt;/a&gt;&amp;nbsp;or if you have downloaded the latest &lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/08/28/new-sharepoint-2007-sdk-released.aspx" target="_blank"&gt;SDK&lt;/a&gt;&amp;nbsp;you can find information about the service inside there.&lt;/p&gt;
 
&lt;p&gt;&lt;textarea class="xml:nogutter" name="code" rows="7" cols="100"&gt;Lists returnService = new Lists();  
System.Net.ICredentials credential = new System.Net.NetworkCredential(&amp;quot;usernamehere&amp;quot;, &amp;quot;passwordhere&amp;quot;, &amp;quot;domain here&amp;quot;); 
returnService.Credentials = credential;                          
returnService.Url = string.Format(&amp;quot;{0}/{1}&amp;quot;, baseURL, ListsWSName); 
&lt;/textarea&gt; &lt;br /&gt;&lt;br /&gt;In the code above&amp;nbsp;I am simply creating the service and providing it with the correct network credentials.&amp;nbsp; It&amp;nbsp;may be&amp;nbsp;possible for you to use System.Net.CredentialCache.DefaultCredentials in place of providing actual network credentials&lt;/p&gt;
 
&lt;p&gt;&lt;b&gt;Knowing the correct document site/document library&lt;br /&gt;&lt;/b&gt;Any time you do anything with the SharePoint web service you will need to know the sub-site and document library.&amp;nbsp; This is because all the web services are isolated to a given sub-site and there are multiple locations for the service.&amp;nbsp; This is also why in the code above I provide the baseURL to connect to.&amp;nbsp; This URL is formatted as this &lt;br /&gt;string.Format( &amp;quot;{0}/{1}/{2}&amp;quot;, siteURL, DocumentSiteName,&amp;nbsp;&amp;quot;_vti_bin&amp;quot; )&lt;/p&gt;
 
&lt;p&gt;&lt;b&gt;Get the ID/Version for the Site/Library&lt;/b&gt;&lt;br /&gt;I found that in order to perform the update i needed to get the correct version/id for the given library that contains the data to be updated.&amp;nbsp; This information will be used during the actual update.&lt;/p&gt;
 
&lt;p&gt;&lt;b&gt;Build the CAML statement&lt;br /&gt;&lt;/b&gt;To perform pretty much any action via the web services you will have to build a correct CAML statement.&amp;nbsp; You can get information on CAML &lt;a href="http://msdn2.microsoft.com/en-us/library/ms462365.aspx." target="_blank"&gt;here&lt;/a&gt; or check your SDK for info as well.&lt;/p&gt;
 
&lt;p&gt;&lt;textarea class="xml:nogutter" name="code" rows="5" cols="100"&gt;// Simple CAML for performing an update 
&amp;lt;Method ID=&amp;#39;1&amp;#39; Cmd=&amp;#39;Update&amp;#39;&amp;gt; 	
&amp;lt;Field Name=&amp;#39;ID&amp;#39;&amp;gt;RowIndexVersion (default to 1)&amp;lt;/Field&amp;gt; 	

&amp;lt;Field Name=&amp;#39;FieldNameGoesHere&amp;#39;&amp;gt;New Value goes here&amp;lt;/Field&amp;gt; 
&amp;lt;/Method&amp;gt;
&lt;/textarea&gt; &lt;/p&gt;
 
&lt;p&gt;The CAML above is a very simple one.&amp;nbsp; This will update one field within a single row of data.&amp;nbsp; If you want to perform multiple updates you can do this, check your documentation for more information how.&lt;/p&gt;
 
&lt;p&gt;&lt;b&gt;Perform the actual update&lt;br /&gt;&lt;/b&gt;Time to perform the actual update for the data.&amp;nbsp; &lt;/p&gt;
 
&lt;p&gt;&lt;textarea class="xml:nogutter" name="code" rows="20" cols="100"&gt; 
// Create the List.asmx object
Lists listService = // Do something here to build the list (see above code)

// Get the information about the given list ID/Version
XmlNode listResponse = listService.GetList( documentLibraryName );

string listID = listResponse.Attributes[&amp;quot;ID&amp;quot;].Value;          // Provides the GUID id for the actual list
string listVersion = listResponse.Attributes[&amp;quot;Version&amp;quot;].Value;  // Provides the version number for the actual ist

// Build the CAML statement
string updateCAML = // Do something to build the actual statement (see above code)

// Build the XMLdocument object that contains the update request
XmlDocument xmlDoc = new XmlDocument();
XmlElement elBatch = xmlDoc.CreateElement( &amp;quot;Batch&amp;quot; );

elBatch.SetAttribute( &amp;quot;OnError&amp;quot;, &amp;quot;Continue&amp;quot; );
elBatch.SetAttribute( &amp;quot;ListVersion&amp;quot;, listVersion );

elBatch.InnerXml = updateCAML;

XmlNode ndReturn = listService.UpdateListItems( listID, elBatch );

// If the ndReturn object has no errors in the Inner/Outer XML then your update was successful.

&lt;/textarea&gt; &lt;br /&gt;&lt;/p&gt;
 
&lt;p&gt;There you have it, a quick and dirty way to perform data updates via the Lists.asmx web&amp;nbsp;service in SharePoint.&lt;/p&gt;
 
&lt;p&gt;Till next time,&lt;/p&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://devlicio.us/blogs/derik_whittaker/archive/2007/09/19/updating-list-information-in-sharepoint-via-web-services.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://devlicio.us/blogs/derik_whittaker/archive/2007/09/19/updating-list-information-in-sharepoint-via-web-services.aspx" alt="kick it on DotNetKicks.com" border="0" /&gt;&lt;/a&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38442" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/HowTo/default.aspx">HowTo</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>Logging Bugs: Do's and Don'ts</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/08/19/logging-bugs-the-do-s-and-don-ts.aspx</link><pubDate>Mon, 20 Aug 2007 00:40:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38244</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38244</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38244</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/08/19/logging-bugs-the-do-s-and-don-ts.aspx#comments</comments><description>&lt;p&gt;All software that is being developed WILL have bugs, sorry, but this IS a fact.&amp;nbsp; Now I know some people and&amp;nbsp;companies don&amp;#39;t like to call them glitches&amp;nbsp;in software bugs.&amp;nbsp; They would rather call them issues or defects.&amp;nbsp; For all I care we can call them &amp;#39;WizBangs&amp;#39;, just call them something and LOG THEM.&lt;/p&gt;
&lt;p&gt;However, logging &amp;#39;WizBangs&amp;#39; (ok, I will call them bugs from here on) is not as simple as it may sound.&amp;nbsp; I would like to go over some of MY Do&amp;#39;s and Don&amp;#39;ts in this post.&amp;nbsp; If you don&amp;#39;t like my list, or would like to add to it, drop me a line.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;When to log Items:&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Do&lt;/b&gt; log everything.&amp;nbsp; Just because&amp;nbsp;the bug&amp;nbsp;may seem trivial or simple or only happen &amp;#39;every now and again&amp;#39; does not mean that it should be ignored.&amp;nbsp; Even it you are not sure it is an issue, LOG IT.&amp;nbsp; Better to have close off an non-issue then fail to report a major bug in hiding&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Don&amp;#39;t&lt;/b&gt; assume that someone else is going to fix the issue.&amp;nbsp; Also, don&amp;#39;t assume this issue is too trivial or minor to report.&amp;nbsp; Wouldn&amp;#39;t it suck to find out after the application went lived that &lt;b&gt;you&lt;/b&gt; failed to report a critical bug because you thought it was not a &amp;#39;big deal&amp;#39;?&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Providing information on the log:&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Do&lt;i&gt; &lt;/i&gt;&lt;/b&gt;provide detailed information about the bug.&amp;nbsp; Save yourself the headache later and provide as much information as you possible can.&amp;nbsp; This should include, but not limited to items such as Build Version, Environment, Platform, Short Description of issue, Severity, Detailed steps to reproduce.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Don&amp;#39;t&lt;/b&gt; make provide a single sentence that says something like &amp;#39;Unable to perform XYZ in the ABC process&amp;#39;.&amp;nbsp; This type of information will provide nothing of real value to the next guy.&amp;nbsp; Sure, this would be a great line for the title of the bug.&amp;nbsp; But by no means is this enough information to fix the bug.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;What types of items to log:&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Do&lt;/b&gt; Log Everything.&amp;nbsp; Enough said&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Don&amp;#39;t&lt;/b&gt; make assumptions&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;When to log bugs:&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Do&lt;/b&gt; log them as soon as possible.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Don&amp;#39;t&lt;/b&gt; put it off.&amp;nbsp; If you dont log the bug as soon as you find it you WILL forget something about what you did to cause it.&amp;nbsp; For the sake of your fellow co-workers log it now before you forget.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The plain and simple truth about logging bugs is, it sucks!!!!&amp;nbsp; However, it is a necessary part of&amp;nbsp;most developers jobs.&amp;nbsp; If you take some time and put in a little effort, you will be rewarded with great riches.&amp;nbsp; Ok, maybe not great riches, but it will make fixing the bugs much easier.&lt;/p&gt;
&lt;p&gt;Till next time,&lt;/p&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://devlicio.us/blogs/derik_whittaker/archive/2007/08/19/logging-bugs-the-do-s-and-don-ts.aspx"&gt;&lt;img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://devlicio.us/blogs/derik_whittaker/archive/2007/08/19/logging-bugs-the-do-s-and-don-ts.aspx" border="0" /&gt;&lt;/a&gt; &lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38244" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item></channel></rss>