# Wednesday, July 8, 2009

I have been using Microsoft “Oslo” for some time and have been pretty excited about the ability to model an application and store it in the repository. Other developers have also gotten very excited about the ability to create domain specific languages (DSLs). DSLs are cool, because if you build a DSL on top of your application, you can abstract away some of the hard to understand stuff. You can also put in a layer on top of your standard communication (DALs, web services, etc.) For example, let’s say you work at Expedia and you want to give your providers (the airlines) a way to enter flight data to your site. You will most likely have a data entry screen with lots of boxes and drop downs. An alternative of course is a Web Service as well as a CSV text import. But another alternative is to provide a DSL, so if someone wants to go in and make a quick change, they can type:

Delta flight 280 on Friday’s new price is $780.

Then using Oslo, you can transform this to an M Value format:

Flights

{

{Carrier=”Delta”, Flight=280, DepartDate=”July 10, 2009”, Price=780}

}

This is one area where you can use Oslo with .NET today-you can call the M DSL DLLs from .NET and perform the transformation in C# or VB. The problem is that the M Value format is difficult to work with in .NET; parsing the M values can be a challenge.

Mehfuz Hossain over at Telerik built a LINQ Extender available on codeplex. Building on top that, Telerik has released a LINQ to M implementation. It is pretty easy to use. After you download it and set a reference to it in your application, you then use standard LINQ statements against M Values.

For example, let’s say that your application has some M values that looks like this:

   1:   {                
   2:           {Id=1,Name=""Stephen Forte"",Age=37},
   3:           {Id=2,Name=""Mehfuz Hossain"",Age=29},
   4:           {Id=3,Name=""Vassil Terziev"",Age=31},
   5:           {Id=4,Name=""Nadia Terziev"",Age=27},
   6:           {Id=5,Name=""Chris Sells"",Age=37},
   7:           {Id=6,Name=""Todd Anglin"",Age=27},
   8:           {Id=7,Name=""Joel Semeniuk"",Age=37},
   9:           {Id=8,Name=""Richard Campbell"",Age=42},
  10:           {Id=9,Name=""Kathleen Gurbisz"",Age=31}
  11:   }

 

You could have gotten this M code from the results of a DSL or some other process. For our purpose, we will just put it into a constant and query against it:

 

const string MGraphCode = @"

            {

               

                {Id=1,Name=""Stephen Forte"",Age=37},

                {Id=2,Name=""Mehfuz Hossain"",Age=29},

                {Id=3,Name=""Vassil Terziev"",Age=31},

                {Id=4,Name=""Nadia Terziev"",Age=27},

                {Id=5,Name=""Chris Sells"",Age=37},

                {Id=6,Name=""Todd Anglin"",Age=27},

                {Id=7,Name=""Joel Semeniuk"",Age=37},

                {Id=8,Name=""Richard Campbell"",Age=42},

                {Id=9,Name=""Kathleen Gurbisz"",Age=31}

            }";

Now you need to load the M code into a QueryContext object so you can work with it in LINQ:

   1:  var personM = QueryContext.Instance.Load(MGraphCode);

There is not a ton you can do with it just yet, but you can bind it to an ASP.NET data grid:

   1:  GridView1.DataSource = personM;
   2:  GridView1.DataBind();

This alone will save you some time, but if you want to do typed queries and have the cool IntelliSense experience, you have to strongly type your LINQ statement. To do this, create a class that has the same shape as your M data, so we will create a Person class:

   1:  public class Person
   2:  {
   3:  public int Id { get; set; }
   4:  public string Name { get; set; }
   5:  public int Age { get; set; }
   6:  }

 

Now it gets fun. Let’s create a simple LINQ statement that will query just the 37 year old people not named Joel Semeniuk:

   1:  var persons = QueryContext.Instance.Load<Person>(MGraphCode);
   2:   
   3:  var result = from person in persons
   4:                where person.Age == 37 && person.Name != "Joel Semeniuk"
   5:                orderby person.Name ascending
   6:                select person;

This will return just Chris and Stephen. You can see that we are using the standard LINQ statements FROM, WHERE, ORDERBY, and SELECT. (Hey wait a minute, aren’t those SQL operators, but I digress…. )

Let’s do some aggregation, this query will aggregate a list all of the ages and count how many people are that age, but we will exclude from our query any age that only has one person:

   1:  //Using a Group By and SUM
   2:   var result1 = from person in persons
   3:                 group person by person.Age into g                         
   4:                 where g.Count() > 1
   5:                 orderby g.Count() descending
   6:                 select new { Age = g.Key, Count = g.Count() };

Your results will look like this:

 

Age

Count

37

3

31

2

27

2

Lastly, just for the true geeks, here is how to use a LAMBDA expression:

   1:  GridView3.DataSource = QueryContext.Instance.Load<Person>(MGraphCode)
   2:                         .Where(p => p.Name == "Mehfuz Hossain");
   3:  GridView3.DataBind();

 

Mehfuz and I are pretty excited about this. There are some limitations; the M Values that you pass in has to be shaped without a name as you can see above. (Don’t worry we will change that later on.) But what you can do so far is pretty darn cool. Enjoy and drop a comment to me or Mehfuz about what you want to see in the next release.

Download it here.

posted on Wednesday, July 8, 2009 11:31:05 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Tuesday, July 7, 2009

Thursday, July 16, 2009
Project Stonehenge for .NET

Subject: 
You must register at https://www.clicktoattend.com/invitation.aspx?code=139381 in order to be admitted to the building and attend.
Project Stonehenge is an open source project created to build reference applications that demonstrate the use of WS-* Standards in real-world project implementations. Project Stonehenge is sponsored by the Apache Software Foundation, a leader in the Open Source community. Project Stonehenge’s flagship application the StockTrader Application currently has interoperable layers in .NET, PHP (unmanaged-C), and JAVA.
This session will provide an overview of the WS-* standards, a history of Apache Stonehenge and the StockTrader application, an demo of the StockTrader web services interoperability, and walk-thru of the StockTrader .NET WCF code and configuration.

Speaker: 
Ben Dewey, twentysix New York
Ben Dewey is a Senior Software Developer at twentysix New York and is a committer for the Apache Incubator StoneHenge project. He has over 10 years of web development experience and has recently worked on projects using WebServices, REST, WCF, jQuery, Silverlight, and WPF. Ben strives to create connected system with well defined roles without sacrificing the richness of the user experience.

Date: 
Thursday, July 16, 2009

Time: 
Reception 6:00 PM , Program 6:15 PM

Location:  
Microsoft , 1290 Avenue of the Americas (the AXA building - bet. 51st/52nd Sts.) , 6th floor

Directions:
B/D/F/V to 47th-50th Sts./Rockefeller Ctr
1 to 50th St./Bway
N/R/W to 49th St./7th Ave.

posted on Tuesday, July 7, 2009 7:48:33 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Monday, July 6, 2009

Last week I did the Agile Estimation session at the NYC Agile Firestarter. Thanks to Alex Hung for taking the video and posting it!

Some back story: all the presenters were trying to out do each other in making up words. :)

Agile Estimation from Alex Hung on Vimeo.

posted on Monday, July 6, 2009 9:05:04 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Thursday, June 25, 2009

I have been to Nepal several times and trekked to the Everest Base camp twice. Since 2003, I have used a sherpa, Ngima, who totally rocks. Here is a photo of him on top of Mt. Everest:

DSC01433

While trekking to Everest base camp last year, Ngima invited me to come visit him at his home village Chyangba. I wanted to eat his mother’s cooking (dal bhat!) and visit the school children in his village. (They can help me improve my soccer skills.)

One thing led to another and it turns out that his Uncle, Pemba, is in the States and is working to build a school, library, and bring running water to the village. They are leading a trip this September that will raise money for the library via a US based charity called Elevation Education. We will be going to Chyangba with Ngima, Pemba, and Elevation Education on September 25th, to both raise money and do physical labor in the town. (Yes think of me giving up the laptop for a week and chopping wood and building a library.)

You can donate here. Please do.

posted on Thursday, June 25, 2009 10:49:41 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Wednesday, June 10, 2009

Thursday, June 18, 2009
An Introduction to Oslo

Subject: 
You must register at https://www.clicktoattend.com/invitation.aspx?code=138919 in order to be admitted to the building and attend.
"Oslo" is the code name for a family of new technologies that enable data-driven model based development. First we will explore the nature of model driven development and then apply the concept of model driven development to Oslo. Learn about the three major components of Oslo: the new “M” language, the “Quadrant” data visualization tool, and the Oslo repository. An M tutorial will show you how to capture all aspects of an application schematized in the Oslo repository and use Oslo directly to drive the execution of deployed applications. In addition to learning how to use M to model an application, we will use M to build and interact with domain specific languages (DSLs). See how Oslo interacts with Visual Studio and .NET. We will finish up with a discussion on where Oslo is going and how and when you can adopt it. (Note, there will be enough time for an enjoyable Q&A.)

Speaker: 
Stephen Forte, Telerik
Stephen Forte is the Chief Strategy Officer of Telerik, a leading vendor in .NET components. He sits on the board of several start-ups including Triton Works and is also a certified scrum master. Prior he was the Chief Technology Officer (CTO) and co-founder of Corzen, Inc, a New York based provider of online market research data for Wall Street Firms. Corzen was acquired by Wanted Technologies (TXV: WAN) in 2007. Stephen is also the Microsoft Regional Director for the NY Metro region and speaks regularly at industry conferences around the world. He has written several books on application and database development including Programming SQL Server 2008 (MS Press). Prior to Corzen, Stephen served as the CTO of Zagat Survey in New York City and also was co-founder of the New York based software consulting firm The Aurora Development Group. He currently an MVP, INETA speaker and is the co-moderator and founder of the NYC .NET Developer User Group. Stephen has an MBA from the City University of New York.

Date: 
Thursday, June 18, 2009

Time: 
Reception 6:00 PM , Program 6:15 PM

Location:  
Microsoft , 1290 Avenue of the Americas (the AXA building - bet. 51st/52nd Sts.) , 6th floor

Directions:
B/D/F/V to 47th-50th Sts./Rockefeller Ctr
1 to 50th St./Bway
N/R/W to 49th St./7th Ave.

posted on Wednesday, June 10, 2009 6:34:23 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Wednesday, June 3, 2009

Are you just starting out with Agile, XP or Scrum and need to get up to speed? Or do you know a thing or two about Agile but want to learn the basics so you can implement it in your organization? Then this Firestarter is for you. We’ll take you from 0 to 60 in 8 hours. Bring a laptop with Visual Studio 2008 Express edition or better for an all day hands on seminar led by some of the NY area’s Agile practitioners.

When: Saturday June 27th

Where:

Kaye Scholer LLP
425 Park Avenue
New York, NY 10022

Time: Registration and welcome 8:30am

Cost: $8 (to cover the pizza and materials)

To Register: http://agilefirestarter2009.eventbrite.com

Agenda:

• Registration and Welcome

• Intro to Agile (Steve Bohlen)

• Agile Estimation (Steve Forte)

• Test Driven Development (Steve Bohlen)

• Pizza!

• Continuous Integration (Alex Hung)

• Refactoring (Mark Pollack)

• Dependency Injection (Mark Pollack)

• Retrospective Erik Stepp

• Wrap up

Register today, space is limited! More info is here: http://www.agilefirestarter.net

posted on Wednesday, June 3, 2009 5:28:22 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Saturday, May 30, 2009

Here is the code from Mary and my session about building front ends to SQL Server with spending any money. It is an Access 2007 Front end that consumes the Twitter RESTful API and eventually allows the user to augment that data in Access then dump it back into a SQL Server table via a SQL TVP. Pretty cool.

posted on Saturday, May 30, 2009 7:25:49 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Thursday, May 28, 2009

Here is a recording of the Daily Scrum Q&A talk that Joel and I did at the Enterprise Development and Solutions Conference in New York City earlier this month.

posted on Thursday, May 28, 2009 10:23:06 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback