Just another site

Monthly Archives: January 2014

I want to know more about Window Identity Foundation today.  I’ve found lots of videos available online.  My favorite one is this:


Following the Cloudera Hadoop Course

Since I’ve last hit a road block last time I’ve tried to follow the Hadoop – a Definitive Guide book, I have not done much with it.  My time were spent working on learning developing iOS apps for iPad.  Today I went back to the Cloudera site and found a very nice course on the subject.  I like the format and it explains everything very clearly and with illustration, kind of like the Kahn Academy for Hadoop.  🙂  I’ve went through 2 classes tonight.!/c-ud617/l-308873796/m-416359060

Practice Java Tonight

Tonight I forced myself to sit down and practice Java programming for 3 hours.  For me, the best way to learn is through hands-on experience.  I wrote a package that parses a text file, sort and count occurrence of each word.  i’ve found out that Java String.split method and the C# version of the same behave differently.  The former takes a regular expression and the latter takes a array of string that contains the splitting characters, or an array of splitting characters.  The C# RegRx.Split behaves like the Java split.

Trying to Complie Hadoop Sample Code with Eclipse

I am having trouble building and running the sample code from Hadoop – The Definitive Guide.  The problem is that I am not familiar with how to set the CLASSPATH for the Java compiler.  Found this webcast from Cloudera:

So, I’ve created a project and add the downloaded sample code.  Then I click on the Properties of the project:


Click on “Add External Jars…”

Browse to /user/lib/hadoop/lib and select all the jar files


Add more jar files…


After that, all the jar files show up in my project folder, making it really cluttered.


At this point I gave up and call it a night.

The next night, after being able to compile the WordCount example from Cloudera in command line, it gave me an idea – what if I add the hadoop_mapreduce library in this project as well?  Turned out it works.  The ~ signs under the import statement initially stayed, then disappeared.  Oh, I also need to switch to J2SE-1.5 JRE library.  Eclipse asked me if I want to switch so I am guessing the sample code is using the old JRE calls. Now, all I’ve left is the warning about Job() is deprecated.

Job job = new Job();

At this point, I am going to table it and learn from Cloudera or some other places such as Horton Works.

In doing my research, I’ve found out that you can use Eclipse to run Hadoop code in its IDE.  This posting: let you download the Eclipse Hadoop plug-in, or build your own plug in.  I think I am going to try it and test it out with WordCount sample code.

Compiling Cloudera WordCount Hadoop Sample Code

Since I’ve been having trouble building the sample code from the Hadoop – The Definitive Guide, using Eclipse.  I thought I’d go back to the Cloudera site and built it’s sample code, following the instruction from here:

However, since the version of Hadoop has changed, I am using Hadoop 2.0.0-cdh4.5.0, the ClassPath is different, too.  When I try compiling

$ mkdir wordcount_classes
$ javac -cp <classpath> -d wordcount_classes
where <classpath> is:/usr/lib/hadoop/*:/usr/lib/hadoop/client-0.20/* 

I get errors: package org.apache.hadoop.mapred does not exist
import org.apache.hadoop.mapred.*;
^ cannot find symbol
symbol : class MapReduceBase
location: class org.myorg.WordCount
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {

Obviously, we need more jar file to be included in the ClassPath.  After checking with the installed directories, this works:

javac -cp /usr/lib/hadoop/*:/usr/lib/hadoop-mapreduce/* -d wordcount_classes

After that, I can create the jar file, run the application, and exam the results, just like what’s in the instruction.

How to set the “From” attribute for a PhoneCall entity using Dynamics CRM 2013 SDK

In working on my Incident Management POC, I’ve found that I need to set the phone call’s “From” attribute to a contact programatically and I had some trouble finding out how to do that.  The following is the definition of the “PhoneCall.From” property in C#:

public System.Collections.Generic.IEnumerable<UIM.ActivityParty> From

I search online for code samples and couldn’t find one.  This is what works for me to set the “From” attribute for a PhoneCall entity with phonecallId, with a contactId, after a lot of try/error:

var myPhoneCall = myContext.PhoneCallSet.Where(p=>p.Id == phonecallId).Single();

ActivityParty actvityParty = new ActivityParty()
ActivityId = new EntityReference(PhoneCall.EntityLogicalName, phonecallId),
PartyId = new EntityReference(Contact.EntityLogicalName, contactId)
myPhoneCall.Id = phonecallId;
myPhoneCall.From = new List<UIM.ActivityParty>() { actvityParty };

Trying to build a help desk service using Dyanmics CRM 2013

The past week I’ve been consumed by my work around Microsoft Dynamics CRM 2013. Everybody was still on vacation and I stepped up to do develop the POC. My hope is to learn something and get my developer’s mojo back.

I did get a lot better at writing code, especially Linq, since that’s how I access the entities from CRM SDK.

The routing scenario in the POC is like this:

  • A customer calls the help desk. He/she dials the support hotline and punches in the selection to answer the questions asked by the IVR system path. The selections eventually lead the call to a queue.
  • The system creates a phonecall record in the CRM and a case record. The phonecall’s regading object is set to the case. Based on the info collected through IVR, the system knows this much about the case:
    • support language
    • type of service request (questions, complaints, or other types)
    • country of support
    • product family
    • other attributes…
  • These selections create a “property bag” around the case. We can use it to match the preset “property bag” for the queues in CRM. If there is a match, the case gets assigned to the queue.
  • An agent belongs to a team. The team has its own property bag. When the team’s property bag matches that of a queue, the agents in the team gets to see the queue and all the open items in the queue are up for grab by the agents.

I am not sure how a case gets routed in the out-of-box implementation of Dynamics CRM but so far I know:

  • A queue contains queuedItems.
  • a queuedItems has a n:1 relationship to any entity that’s queue-enabled: Appointment, Campaignactivity, CampaignResponse, Email, Fax, Incident, Letter, PhoneCall, RecurringAppointmentMaster, ServiceAppointment and Task.
  • The assigning of Incident (case) to Queue needs to be based on some kind of logic but I am not finding OOB support from the CRM front-end. I’ve built my own phonecall simulator to do the property bag matching logic like above but would like to learn if there’s way to do this without coding.

Other than the above, I’ve also explored using the Subject entity in CRM to representing the hierarchical reason for user’s call. So, I have the top-level subject called “Reason for Contact” that has children of major reasons for calling. Each of the child reason can have more detailed classification in its own branch. It looks good in the CRM UI. However, if I am using the same Subject entity for something else, like representing my product taxonomy, I want to have a way to configure the branch for the Incident form so that “Reason for Contact” will only show the branch under “Reason for Contact” record and not the product tree. I wish I know how to do this.