Sunday, June 6, 2010

Microsoft Certification in SharePoint 2010

Recently, I am surfing on Internet to look for the news of Microsoft Certification in SharePoint 2010. Although Microsoft haven’t publish the Certification Path yet, but we still can get the clue from Microsoft Learning.

Here is the diagram I create based on my understanding from Microsoft Learning as below,

SP2010-CertificationPath

Figure – MS Certification SharePoint 2010

 

Microsoft said “This preparation guide is subject to change at any time without prior notice and at the sole discretion of Microsoft.” But I think that’s the pretty much the same.

Here are the links as below if you are interested in.

MCTS

Microsoft SharePoint 2010, Application Development

Microsoft SharePoint 2010, Configuring

MCITP

Microsoft SharePoint 2010, Administrator

MCPD

Designing and Developing Microsoft SharePoint 2010 Applications

MCM

Microsoft Certified Master

MCA

Microsoft Certified Architect

 

If you have any opinion, please don’t hesitate to leave comments.

Tuesday, June 1, 2010

Lessons from Scrum

I have just been through the worst Sprint Review Meeting (Scrum). We didn’t communicated with Product Owner very well and the demonstration is terrible. However, it is a good learning process and I want to summarize about what I have learned.

Scrum is all about transparency and communication. The first reason we failed this sprint is we failed to communicate with client. We did something we thought was awesome stuff which didn’t get approved from client before we started. So we gave a big “surprise” to client in the sprint review meeting. So, instead of showing all the User Stories to PO in the sprint review meeting, we need to keep the PO posted during the sprint. Let him/her have a general idea regarding what we are doing to avoid misunderstanding and surprise in sprint review meeting. I suggest if we have one week sprint, we need give PO an update every day. If two weeks sprint, give PO an update every two days etc.

Also, Paul gave me a good example about how to demonstrate a User Story in an efficient way. First,use a few short sentences to quickly show what we missed (the reason of creating this user story) and what we have done to fix these issues for the User Story. The most important point is people prefer to see the demo, to see have the code runs instead of listening someone keep talking all the time, so we need to be general in describing the User Story and focus on demonstration. Also when you show the demo, please don’t hesitate to tell everyone what are you doing now.

Any comments are welcome.

Sunday, March 14, 2010

LINQ To Entities in WinForm and Better Practice

There is a homework for week 2 UTS Short Course about LINQ To Entities. As a tutor, I find it is interesting and I never use LINQ before, so I spent sometime to do the homework in advance. Here is the homework mock-up and criteria,

















Figure: Mock-Up


Criteria:
On Search Button click, try to use some LINQ  magic to return employees that match that filter
  • Firstname match OR Lastname match
  • Filter on phone number as well
  • Try to filter on birth date if the text in the textbox is a date or the user writes "1979"
  • Try to implement filters like:  “Gfader 1979” returns all people with name Gfader and birthdate year 1979 

I use VS 2010 RC in this solution:














"Form1.cs" is my original version which is messy coding. After I took the advice from Peter about using Regex and reusable Iqueryable object, I create the "BetterPracticeForm.cs". So you can download the solution file if you interested to make a comparison.

In "BetterPracticeForm.cs", when search button fires, It will call the Text Parsing method (using Regex) :

//Format: BirthDate e.g. 22/12/1948
Regex birthDateRegex = new Regex(@"([1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d$");

//Format: Phone Number e.g. (206) 555-9857 PS: Space is optional
Regex phoneNumRegex = new Regex(@"\(\d+\)\s?\d+[-]\d+$");

//Format: BirthYear e.g. 1959
Regex birthYearRegex = new Regex(@"(19|20)\d\d$");


Here is the checking if the SearchValue match Regex:

            bool noNameAndBirthYearflag = true;
            bool phoneNumFound = false;
            string phoneNumString = string.Empty;
            if (phoneNumRegex.IsMatch(searchValue))
            {
                phoneNumFound = true;
                phoneNumString = searchValue;
                noNameAndBirthYearflag  = false;
            }

            bool birthDateFound = false;
            string birthDateString = string.Empty;
            if(birthDateRegex.IsMatch(searchValue))
            {
                birthDateFound = true;
                birthDateString = searchValue;
                noNameAndBirthYearflag = false;
            }

            int tmepYear;
            int year = 0;
            bool yearFound = false;
            string[] inputKeywords = searchValue.Split();
            string nameString = string.Empty;

            if(noNameAndBirthYearflag)
            {
                foreach (var inputKeyword in inputKeywords)
                {

                    if (int.TryParse(inputKeyword, out tmepYear))
                    {
                        // number found!
                        if (birthYearRegex.IsMatch(tmepYear.ToString()))
                        {
                            // is a valid year
                            yearFound = true;
                            year = tmepYear;
                        }
                    }
                    else
                    {
                            nameString = inputKeyword;
                    }
                }
            }

 Here is the code of LINQ:

            using (NorthwindEntities data = new NorthwindEntities())
            {
                       var dq = data.Employees.Select(employee => new
                       {
                           employee.FirstName,
                           employee.LastName,
                           employee.Title,
                           employee.BirthDate,
                           employee.HomePhone
                       });

                if(noNameAndBirthYearflag )
                {
                    // Filter on year
                    if (yearFound)
                    {
                        dq = from employee in dq
                             where employee.BirthDate.Value.Year == year
                             select (new
                             {
                                 employee.FirstName,
                                 employee.LastName,
                                 employee.Title,
                                 employee.BirthDate,
                                 employee.HomePhone
                             });
                    }

                    // Filter on firstname lastname
                    if (string.IsNullOrEmpty(nameString) == false)
                    {
                        dq = dq.Where(employee=>(employee.FirstName.Contains(nameString) || employee.LastName.Contains(nameString))).Select(employee => (new
                        {
                            employee.FirstName,
                            employee.LastName,
                            employee.Title,
                            employee.BirthDate,
                            employee.HomePhone
                        }));
                    }
                }
                else
                {
                    // Filter phone number
                    if (phoneNumFound)
                    {
                        dq = from employee in dq
                             where employee.HomePhone == phoneNumString
                             select (new
                             {
                                 employee.FirstName,
                                 employee.LastName,
                                 employee.Title,
                                 employee.BirthDate,
                                 employee.HomePhone
                             });
                    }

                    // Filter birth date
                    if (birthDateFound)
                    {
                        DateTime dt = DateTime.Parse(birthDateString);
                        dq = from employee in dq
                             where
                                 employee.BirthDate.Value.Year == dt.Year && employee.BirthDate.Value.Month == dt.Month &&
                                 employee.BirthDate.Value.Day == dt.Day
                             select (new
                             {
                                 employee.FirstName,
                                 employee.LastName,
                                 employee.Title,
                                 employee.BirthDate,
                                 employee.HomePhone
                             });
                    }
                }
                dataGridViewResult.DataSource = dq;











Figure - Search Phone Number











Figure - Search Birth Date












Figure - Search FirstName Or LastName












Figure - Search Name and Birth Year











Figure - Search Birth Year


Here is the link for code downloading and link for Regex reference.
Also, here is the link from SSW about why we choose LINQ To Entities over LINQ To SQL.

Thanks for Peter giving me advice.

If you think here is any problems in my entry, please leave comments. I really appreciate it.

    Monday, March 1, 2010

    Using ListBox instead of ScrollViewer in Silverlight

    If you are thinking about scrolling image or text in silverlight, ScrollViewer might be the first thing to pop up in head. However, it is not always works.

    In my scenario, there is an auction-related project. It basically use silverlight to create UI similarly as below,


    The left Viewer is the connection and biding information. The right one is the DataGrid displaying the latest price for each items.


    In .xaml file, I was using ScrollViewer,
     <ScrollViewer Margin="25,0,-7,8" x:Name="connectViewer">
                    <TextBlock x:Name="lblMessages" Margin="1" TextWrapping="Wrap" Height="860" FontSize="8"></TextBlock>
                </ScrollViewer>

               
    In code behind,
    lblMessages.Text += message + Environment.NewLine;

    The problem is there is a limitation in the length of TextBlock. Because there are so many biding information which reach the limit of TextBlock, the new coming biding info won't be displayed in ScrollViewer.


    Solution:
    Use ListBox DataTemplate intead.

    Code in .xaml
     <ListBox x:Name="listBoxConnectInfo" Margin="25,0,-7,8">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" TextAlignment="Left" />
                        </DataTemplate>
                    </ListBox.ItemTemplate>
     </ListBox>

    In code behind,
    listBoxConnectInfo.Items.Add(message);

    So for every each time, it adds a TextBlock into ListBox and bind the message to the Text property.The more important thing is, it is scrollable as well.


    Hope that helps -:).
    Please don't hesitate to leave comments if you have better idea.

    Friday, February 26, 2010

    Resharper 4.5 issue with SilverLight RIA Service in VS 2008

    Recently, I dive in a little bit the RIA Service in SilverLight 3 following Tim Heuer's great video which available here
    http://silverlight.net/learn/videos/all/net-ria-services-intro/.



    I followed the video to create the ADO.NET Entity Data Model and Domain Service Class. Everything works just fine until


    The AdvDomainContext cannot be found. The reason is RIA service use Generated_Code to share code between Server and silverlight which technically exclude from project.


    So any code references Generated_Code in silverlight can not be resolved by Resharper.


    Solution:
    1. Show all file in VS 2008





















    2. Include Generated_Code into project






















    Then, Resharper can pick up the class now.
    By the way, it might pop up warning when you dubug the project


    Just go will the "continue".

    It works now :-)

    Saturday, February 20, 2010

    Hello world

    "Hello world" is the most common print out if you are familiar with programming. It is also appropriate for my first post title.

    The reason I become a blogger is I want to share my roadblocks and the ways to solve
    them in work, rather than only Google or Bing it up without participating and making contribution in Microsoft community.

    I will focus on MS technologies, especially ASP.NET, C#, SilverLight and SQL Server. I will post my findings in work and other areas I'm interested in besides work.

    All the comments are welcome......