<?xml version="1.0" encoding="UTF-8"?>
<entries type="array">
  <entry>
    <category-id type="integer">1</category-id>
    <content>&lt;p&gt;Here I will summarize some quick points about using the WCF Rest Starter Kit P2 to consume REST services. If you are not familiar with it, here is a good article from msdn: &lt;a href="http://msdn.microsoft.com/en-us/library/ee391967.aspx"&gt;http://msdn.microsoft.com/en-us/library/ee391967.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
// quick code example .net accessing shopify api
private orders InitialOrderSync(string appURL, string apiKey, string pwd)
		{
// note here we can use http or https
			HttpClient client = new HttpClient("https://" + appURL);
// set optional credentials
			client.TransportSettings.Credentials = new NetworkCredential(apiKey, pwd);
			// the uri of the REST path to get, can also pass in parameters 
			HttpResponseMessage message = client.Get("admin/orders.xml");
			message.EnsureStatusIsSuccessful(); // make sure all ok
                        // serialize into object
			orders shopifyOrders = message.Content.ReadAsXmlSerializable&lt;orders&gt;();
			return shopifyOrders;
		}
&lt;/pre&gt;
&lt;p&gt;
You may be wondering how did I build the orders object based on the xml. This is very easy. Just copy the xml you will be serializing from start to finish, go into Visual Studio that has wcf rest kit installed, add a new Class, and go menu Edit -&gt; Paste as XML Types. That's it.
&lt;/p&gt;
&lt;p&gt;
As far as using requirements, add references to your project to all 3 binaries in the WCF REST kit installation directory folder.&lt;br /&gt; in your code you'll need these guys for above to work:&lt;br/&gt;&lt;br/&gt;
using System.Xml.Serialization;
using System.Xml;
using System.Runtime.Serialization;
using Microsoft.Http;
using Microsoft.ServiceModel;
using System.Net;
&lt;/p&gt;</content>
    <created-at type="datetime">2010-03-05T16:13:29-08:00</created-at>
    <id type="integer">66</id>
    <title>WCF REST Starter Kit Consumer quick example</title>
    <updated-at type="datetime">2010-03-05T16:19:56-08:00</updated-at>
  </entry>
  <entry>
    <category-id type="integer">5</category-id>
    <content>&lt;p&gt;After some research looking for a good jquery password strength meter, I found one that I liked, looked good, and was easy to use. It is also a jquery plugin, which makes it easier to implement.&lt;/p&gt;
&lt;p&gt;
Here is the link: &lt;a href="http://mypocket-technologies.com/jquery/password_strength/"&gt;SelectBox Password Strength Plugin&lt;/a&gt;
&lt;/p&gt;</content>
    <created-at type="datetime">2010-02-25T21:10:21-08:00</created-at>
    <id type="integer">65</id>
    <title>JQuery Password Strength</title>
    <updated-at type="datetime">2010-02-25T21:10:21-08:00</updated-at>
  </entry>
  <entry>
    <category-id type="integer">1</category-id>
    <content>&lt;p&gt;Here is an example of having page properties that hold their value in viewstate so that when the same screen posts back but in a different mode, ie. multistep processes, you can still hold the value.
Also note we put the value into a local variable as well, because the viewstate will only be set after the postback, so therefore if you tried to access the property in the same request, you won't get a null back.
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
public partial class WizardSignup : System.Web.UI.Page
	{
public int? PhysicalDockId
		{
			get
			{
				if (ViewState["PhysicalDockId"] == null &amp;&amp; _physicalDockId == null)
					return null;
				else
				{
					return _physicalDockId ?? (int)ViewState["PhysicalDockId"];
				}
			}
			set
			{
				ViewState["PhysicalDockId"] = (_physicalDockId = value);
			}
		}
		private int? _physicalDockId = null;
}
&lt;/pre&gt;</content>
    <created-at type="datetime">2010-02-25T11:55:03-08:00</created-at>
    <id type="integer">64</id>
    <title>Page Properties with Viewstate done right</title>
    <updated-at type="datetime">2010-02-25T11:56:41-08:00</updated-at>
  </entry>
  <entry>
    <category-id type="integer">6</category-id>
    <content>&lt;p&gt;Some of the Telerik controls offer a Culture property setting. Here is a list of what these can be set to. &lt;/p&gt;
&lt;a href="http://www1.cs.columbia.edu/~lok/csharp/refdocs/System.Globalization/types/CultureInfo.html"&gt;System.Globalization Cultures list&lt;/a&gt;
&lt;p&gt;This is useful for example in the RadDatePicker control, to be able to change the date format string, ie. using european standards that use the day-month-year order. You would set the Culture property to "en-GB" for example to achieve this.&lt;/p&gt;
&lt;p&gt;Telerik controls that use this:
RadCalendar  	CultureInfo&lt;br/&gt;
RadDatePicker 	Culture&lt;br/&gt;
RadTimePicker 	Culture&lt;br/&gt;
RadDateTimePicker Culture&lt;br/&gt;
&lt;/p&gt;</content>
    <created-at type="datetime">2010-02-19T15:02:41-08:00</created-at>
    <id type="integer">63</id>
    <title>Globalization Culture Property list</title>
    <updated-at type="datetime">2010-02-19T15:03:36-08:00</updated-at>
  </entry>
  <entry>
    <category-id type="integer">1</category-id>
    <content>&lt;p&gt;Here is a basic example of a custom exception that can have the message property assigned to.&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
public class PresentationException : Exception, ISerializable
	{
		public override string Message
		{
			get
			{
				return _message;
			}
		}
		private string _message;

		public PresentationException()
		{

		}
		public PresentationException(string message)
		{
			_message = message;
		}
		public PresentationException(string message, Exception inner)
		{
			_message = message;
		}

		// This constructor is needed for serialization.
		protected PresentationException(SerializationInfo info, StreamingContext context)
		{
		}
	}
&lt;/pre&gt;</content>
    <created-at type="datetime">2010-02-18T16:06:22-08:00</created-at>
    <id type="integer">62</id>
    <title>Custom Exception that processes Message</title>
    <updated-at type="datetime">2010-02-18T16:07:06-08:00</updated-at>
  </entry>
  <entry>
    <category-id type="integer">1</category-id>
    <content>&lt;p&gt;Sometimes we want to show a custom message in a page's validation summary depending on something that happens in our business object, ie. catch an exception and display the message to the user.&lt;/p&gt;
&lt;p&gt;First, be sure your ValidationSummary is in a Panel control. You can add the following presentation helper somewhere in your project. Basically we pass in the message we want to be displayed, ie the Exception.Message and this function will return a custom validator that we add to the Panel that contains the validation summary.&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
public static class PresentationHelper
	{
		public static CustomValidator BuildCustomValidator(string message)
		{
			CustomValidator CustomValidatorCtrl = new CustomValidator();
			CustomValidatorCtrl.IsValid = false;
			CustomValidatorCtrl.ErrorMessage = message;
			CustomValidatorCtrl.Display = ValidatorDisplay.None;
			return CustomValidatorCtrl;
		}
	}
&lt;/pre&gt;

&lt;p&gt;Here is an example of usage in a Page codebehind:&lt;/p&gt;

&lt;pre name="code" class="csharp"&gt;
protected void ButtonCreate_Click(object sender, EventArgs e)
{
     try
     {
          MyBusinessObject.DoSomething(...);
     }
     catch(Exceptions.PresentationException exc)
     {
          PanelCreate.Controls.Add(PresentationHelper.BuildCustomValidator(exc.Message));
     }
}
&lt;/pre&gt;</content>
    <created-at type="datetime">2010-02-18T15:53:11-08:00</created-at>
    <id type="integer">61</id>
    <title>Validation Summary Custom Message</title>
    <updated-at type="datetime">2010-02-18T15:57:12-08:00</updated-at>
  </entry>
</entries>
