Wednesday, April 18, 2012

If everyone decides to throw their moral out of the window, won’t we all be certified idiots?

The first year I worked as a developer, I passed my first two Microsoft certifications. I studied for months, reading the Self-paced training kit books from cover to cover and doing the exercises over and over again. I spent a lot of time studying and and I was nervous as hell. I was fresh out of university and I wanted to show my employer that I could get a great score.

Did I get a great score? Yes, on one of them, but the other one I barely passed. I was proud of myself, damn proud! That was until I got the question: “Which brain-dump did you use?”. Say what? I didn’t know what a brain-dump was, but soon enough the person asking me the question explained it to me. I was shocked, he had assumed I cheated on my certifications! A while later I realized that he hadn’t made this assumption on the basis of “the unlikely event” of me passing the certifications, he made them because “everyone uses brain-dumps”. That shocked me even more. If everyone decides to throw their moral out of the window, won’t we all be certified idiots? If we all could call ourselves “Queen of England”, wouldn’t the title lose its value?

Yes, it would. And this is exactly what has happened with the Microsoft certifications. NetworkWorld did an analysis in 2008 where they found that Microsoft was the Most Braindumped Certification Vendor. And all this despite Microsofts strict exam policy stating that a candidate may be banned if he/she is “Using unauthorized material in attempting to satisfy certification requirements (this includes using "brain-dump" material and/or unauthorized publication of exam questions with or without answers)” (Source:

But who’s responsibility is it to make sure the candidates are not using brain dumps?

It’s my responsibility
I will never throw my moral out of the window and become a certified idiot. I respect myself and my job too much to resort to brain-dumps. I expect my colleagues and fellow developers to do the same.

It’s my employers responsibility
My employer should be critical to the score I present them with. If I am able to complete four certifications in a month, all with a 100% score, I expect to be questioned.

It’s the customers responsibility
The customer should be critical to the number of certified developers their supplier presents to them. Unfortunately some companies encourage their employees to use brain-dumps, it apparently saves them time and money.

It’s Microsofts responsibility
Microsoft should continue to sue the brain-dump vendors, but this will probably not be sufficient enough. They should also continue to do statistical analysis of the certifications so that the cheaters can be identified and banned. Last, but not least: They need to keep their certifications up to speed, constantly improving them and making them more difficult to spread.

If you’re interested in some more blog posts about this topic, I’d recommend having a look at these:

Tuesday, April 17, 2012

Trying out the SocialCast REST API

Lately, I’ve been integrating an EPiServer site with SocialCast, a social network for businesses. I thought I’d share some code on how I chose to do this.

SocialCast has quite an extensive REST API which allows the developer to retrieve pretty much all the information needed. In this blog post I’ll show you how to retrieve the most recent status updates and how to post a new message to SocialCast.

The data from SocialCast can either be retrieved as JSON or XML, I’ve chosen JSON for these examples. 
2) I’ve used in these examples. In order to click on the links I’ve supplied further down you need to be logged into the demo site (username and password is supplied next to login box).

First, let’s create a class called WebRequester which I’ve made internal as I only want it to be accessible from within the same assembly. This class contains two methods, the first being GetRequestInJson which creates a WebRequest towards SocialCast and returns the response. The second method is a generic method called DeserializeResponse which uses a JavaScriptSerializer to deserialize the HttpWebResponse to an object.

1: internal static class WebRequester

2: {

3:    public static HttpWebResponse GetRequestinJson(string url, string username, string password, string method)

4:    {

5:       try

6:       {

7:          var webRequest = WebRequest.Create(url) as HttpWebRequest;

8:          if (webRequest != null)

9:          {

10:            webRequest.Credentials = new NetworkCredential(username, password);

11:            webRequest.Method = method;

12:            webRequest.ServicePoint.Expect100Continue = false;

13:            webRequest.Timeout = 20000;

14:            webRequest.ContentType = "application/json";

15:            return (HttpWebResponse)webRequest.GetResponse();

16:         }

17:      }

18:      catch (Exception e)

19:      {

20:          // Implement your own error handling (logging etc.)

21:      }

22:      return null;

23:    }


25:    public static T DeserealizeResponse<T>(HttpWebResponse httpWebResponse) where T : new()

26:    {

27:       try

28:       {

29:          Stream responseStream = httpWebResponse.GetResponseStream();

30:          if (responseStream != null)

31:          {

32:             string responseBody;

33:             using (StreamReader sr = new StreamReader(responseStream))

34:             {

35:                responseBody = sr.ReadToEnd();

36:             }

37:             JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

38:             return jsSerializer.Deserialize<T>(responseBody);

39:          }

40:       }

41:       catch (Exception e)

42:       {

43:          // Implement your own error handling (logging etc.)

44:       }

45:       return new T();

46:    }

47: }

Creating the SocialCast class

Next we’ll create a class called SocialCast which will contain one method called GetMostRecentStatusUpdates and another one called PostMessage. Both these methods use the WebRequester class we created above in order to execute the web requests and deserialize the web response.

1: public static class SocialCast

2: {

3:    public static MessageCollection GetMostRecentStatusUpdates()

4:    {

5:       HttpWebResponse httpWebResponse = WebRequester.GetRequestinJson("",

6: "", "demo", "GET");

7:       if (httpWebResponse != null)

8:          return WebRequester.DeserealizeResponse<MessageCollection>(httpWebResponse);

9:       return new MessageCollection();

10:    }


12:    public static bool PostMessage(string message)

13:    {

14:        string postUrl = string.Format("[body]={0}", message);

15:       HttpWebResponse httpWebResponse = WebRequester.GetRequestinJson(postUrl,

16: "", "demo", "POST");

17:       if (httpWebResponse != null && httpWebResponse.StatusCode == HttpStatusCode.Created)

18:          return true;

19:       return false;

20:    }

21: }

Yes, I am aware of the fact that the code above contains the username and password to the demo site, but I don’t consider that a problem as SocialCast themselves have made it public on

So let’s go through the GetMostRecentStatusUpdates method. The URL and the querystring parameters supplied to the WebRequester is explained here: After the WebRequest is executed and the response is returned, the response is deserialized to a MessageCollection object. The MessageCollection class contains the information we need from SocialCast and it has to match the structure of the JSON response. So the MessageCollection class could for example look like this:

1: public class MessageCollection

2: {

3:     public Message[] messages { get; set; }

4: }


6: public class Message

7: {

8:     public User user { get; set; }

9:     public string body { get; set; }

10:    public string created_at { get; set; }

11:    public string likes_count { get; set; }

12:    public string url { get; set; }

13: }


15: public class User

16: {

17:    public string name { get; set; }

18:    public string url { get; set; }

19: }

As you can see the MessageCollection simply contains an array of Message objects, and this structure matches the structure of the JSON response seen here:

Using the SocialCast class

1: MessageCollection messagesCollection = SocialCast.GetMostRecentStatusUpdates();


3: bool success = SocialCast.PostMessage("This is a test message which I'm posting to SocialCast");

That’s it :)