Robert Jan - Saturday, March 14, 2009 - 3:12 PM

Last thursday, the last PDC Report Back event was held at Logica Rotterdam. It was the third and final time I held my 'Introduction to Oslo' talk.

As promised, here you can find the audio recording, screencast and the powerpoint slide deck.

- Slide deck

- Audio recording (beware: in Dutch!)

- Screencast, see the flash movie below (beware: it's also in Dutch!)

Enjoy!

And tell me what you think of it.


Posted in: Oslo , PDC 2008  Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Robert Jan - Thursday, February 05, 2009 - 8:39 PM

Yesterday, the first of three PDC feedback evenings was held at Logica, Amstelveen.

image

 


Rutger de Vries, Rene Schrieken and myself gave talks about three different subjects; we had a great time sharing our thoughts and knowledge. First Rutger talked about Visual Studio 2010 as Cameron Skinner did on the PDC. Rene presented the .NET framework 4.0 and it’s new features and I gave a talk about Oslo.

Two more feedback evenings will be held: next week we will be in Eindhoven and in march we will visit Rotterdam. Hope to see you there!

After the last talk, I’ll share the slide deck here.


Posted in: Oslo , PDC 2008  Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Robert Jan - Friday, January 16, 2009 - 3:50 PM

Session 1: Innovations in Identity Management

Stefan Brands (who’s also Dutch) took the stage and shared with us his story. He and some colleagues joined Microsoft due to the acquisition of Credentica (http://www.credentica.com/) last year. Credentica has developed and patented their so called U-Prove technology which is a new way of doing Identity management.
UProve will become/is a so called “minimal disclosure token

DSC_5301

I was expecting a story about the new Geneva platform, so this was a nice kind of surprise to me. Stefan took us through this UProve technology and explained a bunch of its features. I invite you all to read more about this technology at http://www.credentica.com/unique_features.html and watch the introduction video http://www.credentica.com/intro_video.html.

Some of the features Stefan highlighted are:

    • Subset disclosure: Only send the requested claims from the token
    • Unlinkability /untraceability
    • Derived claims: only disclose a property of a claim (can be computed)
    • Issuer driven revocation: ex. a credit card that became invalid. The token will be blacklisted.
    • User driven revocation: ex. the token is lost
    • Verifier driven revocation: something invisible in the token van indicate that the token is blacklisted
    • Brokered disclosure: some sort of query can be send to a broker. the result will not contain the details itself; the result will just indicate that records have been found (with perhaps the record count)
    • User signed transcript: a relying party can send a subset to another relying party as an audit transcript

It’s really interesting where this is going and I expect this to be integrated in all sorts of Microsoft product stacks like for example WCF.

 

Session 2: Navigating the New World of Business

Daniel Rasmus elaborated a bit more on the well known subject : New World of Work / Business.
His story was about the different generations passing on (like the babyboomers, generationX and right now the Millennials) and how these generations all have their own characteristics and requirements related to their profession.
Daniel writes about this subject on his blog, and you can also find more on this web site: http://www.listeningtothefuture.com/

DSC_5302

He and Rob Salkowitz wrote a book called “Listening to the Future” in which they speak about methods of scenario planning to look at issues facing businesses over the next 10-12 years. The work force coming up will be of a whole different kind that most of the companies are currently ready for. So anticipating on this is a major thing!

Interesting stuff, I recommend reading this whitepaper he wrote about the New World of Work:

http://download.microsoft.com/download/0/1/2/012e8e6e-ff65-4b04-857c-1e2c991f57f4/NewWorldOfWork.pdf

 

Session 3: Building composite information worker solutions using the Microsoft Office System

Paul Stubbs talked about OBA’s:  Office Business Applications. He showed different kind of architectures to build these and also showed a tool called the OBA composer. This is a tool which allows a user to mashup his OBA sharepoint application, and then let the tool generate this app within sharepoint. Nice kind of way to abstract all sorts of sharepoint configuration details.

 

Session 4: Security

Steve Riley came along, and did a whole different kind of session. Without a powerpoint he did some sort of whiteboard session where everyone could ask questions and discuss all sorts of issues.
I really enjoyed this session. It is great to see someone speaking on a subject he knows a LOT about; and he did it in such a humorous manner that I think everybody was on the tip of his chair ( :) that’s a Dutch saying that means you’re listening very closely to the speaker, and he has grabbed your full attention).

DSC_5303

So we a great laugh at this last session of the day. Afterwards, we went directly to the busses to visit the Newcastle Golf Club for a dinner and a spectacular view.

DSC_5305

 

That latter wasn’t possible due to the fog that hung around the hill.. Pity, however the dinner and table talk were fine!


Posted in: LEAP 2009 , Architecture  Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Robert Jan - Wednesday, January 14, 2009 - 1:33 PM

Session 1:  Software + Services a.k.a Windows Azure

The first session of the day was all about Windows Azure. Yousef Khalidi took the stage and gave a nice talk about this.

DSC_5292

As I visited the PDC 2008 last year, and I also attended the Cloud Computing seminar done by David Chappel, for me there was not that much new stuff being told.

He told what Azure as a Cloud Computing platform delivers:

  • Automated Service Management
  • High availability and scalability
  • Rich developer experience (uses the common platform: .NET, VS2008)
  • Model driven service lifecycle management (manages services, not just servers)

Some characteristics of a cloud computing platform (for more on this, read my blog post and its links about the David Chappell seminar):

  • Scale out and not Scale up
  • Add and remove capacity on demand
  • Pay for what you use, as you go (based on e.x. network utilization, storage capacity or VM hours)
  • Automation is the key to reducing costs

Then, Yousef shared some ideas on the future of azure:

  • Support for unmanaged code
  • Also run legacy apps
  • support for more application types
  • more interfaces to utilize (for example for monitoring, tracking and event handling)

Session 2: Role of Architecture in the current Economic Climate

Now here was a session that I didn't quite expect, in a positive sense. Neil Leslie had us put our feet back on the ground talking about how to leverage the current economical situation to its best.
( I found his PPT right here on a public web site: http://architect-center.com/groups/saf/media/p/30.aspx)
First he talks about the Microsoft internal IT characteristics:

DSC_5296

Message here was, Microsoft does know enterprise IT and how to best centralize this. With these kind of numbers, I guess you have to :)
Leslie then took a lot of time asking and discussing what he called the ‘Ultimate Question’:

  • How do you add business value?
    The answer Leslie have have here is:
    • User Experience
    • BI

When talking to, or selling to customers make these are your unique selling points. Focus on these because right now it seems these are the most triggering aspects a customer might relate to and decide on.

  • And how do you drive out costs?
    The answer Leslie gave here is:
    • SOA and Business Process
    • Development

SOA and Business Process has everything to do with centralizing key (software) functions, reuse (not just of small software parts, but also of complete subsystems)  and optimizing business processes around this.  To reduce costs, you could also take a look at fast prototyping methodologies like Agile (Scrum, XP etc…)

To distinguish yourself, Leslie told, you have to move now! On what area? Watch this slide:

DSC_5297 

 

Session 3:  Application Architecture Guidance

Unlike the Agenda stated, not Don Smith took care of this session, but Ade Miller took the stage.
He guided through the Application Architecture Guide you can find on CodePlex.

I’ve been using this guide for a while now, and I must say I think it’s a great collection of information you’d normally see spread out in different segments within a project. It’s not that Microsoft is telling anything really new in this guide, to me the added value is the fact that it’s now all put into one great book for reference purposes.

Ade told about the different Architectural Types, Architectural frame and Architectural Styles. He also explained the different steps you can take when designing your architecture, and the quality attributes you should look at the guarantee some sort of stable, high quality deliverable.

If you are now raising your eyebrows, I’d really invite you to take a look at the book.

By the way, I really belief this kind of info should go hand in hand with a security approach. So when defining an architecture also take a look on the MSDN Security Developer Center, and especially on Threat Modeling.

 

Session 4: Office Futures

Gideon Bibliowicz took his turn to talk about the future of the Office products.
Due to an NDA we had to sign, I cant say anything about this, but as usual it will get bigger, better, more beautiful and perhaps also easier to integrate :)

Well, at least I guessed Gideon’s favorite soccer team right, ‘Holland’ won me a USB key :)

 

After the bus ride back to the hotel, we went to the Lucky Strike Lanes & Lounge across the street for some fun and beers.


Posted in: LEAP 2009 , Azure , Architecture  Tags:

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Robert Jan - Tuesday, January 13, 2009 - 10:33 PM

So here we are! LEAP 2009 @ Redmond has started!

After a steady flight we arrived perfectly on schedule in Seattle WA.

DSC_5280
Luckily, it didn't take long to get passed through customs and soon we were on a bus ride to the Hyatt Regency Hotel.

I just checked in and I have pretty much the same room (and the same nice view!) as two years ago.
After checking in and a shower, we took a walk to the mall (http://www.bellevuesquare.com/) on the other side of the street. I had some ideas of presents to buy, but finding those items seems to be a bit hard… so many shops…. I hope I have more luck on Friday, we’ll have a day off then and will visit downtown Seattle.

Expect more LEAP follow ups this week!


Posted in: LEAP 2009  Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Last Friday, David Chappell spoke at the Microsoft Innovation Center in Barneveld (NL) about Cloud Platforms in general and a lot about the Azure services platform in detail.

When talking about Cloud Computing David identifies three categories:

  1. SAAS (Software as a Service) ex. SalesForce.com  == App in the cloud
  2. Attached Services == Combine on-premises applications with cloud services
  3. Cloud Platforms

To me, the most important part of the talk was hearing his lists of advantages and disadvantages of SAAS and Cloud Platforms in general.

So what could be the pro’s and con’s of cloud computing / SAAS?
Pro’s:

  • Less financial risk
    - No large up-front investman
    - Try before buy
  • Lower costs (initially, at least)
    - No license buy (pay per usage)
    - Shift fixed buying expenses to variable operating expenses
  • Faster deployment
  • Higher Availability
  • Easier upgrades

Con’s:

  • Trust (which is a major thing; do you trust the service provider? will they protect your data?)
  • Regulatory and compliance issues
  • Customization (tailoring)
  • Integration (with on-premise applications)
  • Identity (federation)
  • Management (monitoring)
  • Support

He then further talked about the Azure services platform itself; perhaps I’ll write some more posts on this subject later on. I first like to have investigated it a bit more.
Overall, I really liked his talk. You can hear why he’s a frequently asked speaker; great job!


PS. David wrote a short introduction about Cloud Platforms; go read it here.


Posted in: Azure , Cloud Computing  Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Robert Jan - Tuesday, November 25, 2008 - 10:31 PM

To find out what LEAP is read my first blog post about LEAP 2009 or check out the LEAP web site (Dutch!)

LEAP is now also rolled out to other European countries; for my Belgian readers keep an eye on this web page; apparently it’s now fully booked but I’m sure there will be another course next year!

Master classes 3 & 4 were presented by Sasa Radosevic. I’ll write brief outlines below.

MC3 was titled : Core Infrastructure Architecture.

Due to everlasting (and expanding) pressure on IT  image
And industry trends image

 

A better approach is needed. One that:

  • Looks holistically across the infrastructure
  • Addresses underlying structure and complexity
  • Creates an integrated, uniform environment
  • Adopts IT solutions that support proven best practices
  • Prioritizes and sequences IT projects in a structured, systematic manner

That’s where Microsoft’s vision on this subject comes into place: DynamicIT which has some
Characteristics
- Unified & Virtualized
- Process-Led & Model-driven
- Service enabled
- User focused

and Goals
- Manage Complexity, Achieve Agility
- Protect Information, Control Access
- Advance the Business with IT solutions
- Amplify the impact of your users

Every organization can assess it’s IT infrastructure to identify where it’s at, and where it want to be, using the Infrastructure Optimization Maturity Model developed by Microsoft:

image

Sasa further told us where to get Architectural and design guidance, and the Microsoft products to manage virtualized infrastructures like the System Center suite. Also, an in-depth explanation of virtualization on the Microsoft platform was shown and told.

MC4 was also done by Sasa and was titled: Advancing Security

This session covered Microsoft and Security, risks and threats, core infrastructure security and identity and access control. First, we were shown a nice overview of threat evolution:

image

Often security is just seen as a technology aspect, but the process and people aspects are just as important:

image

And of course Microsoft has a optimization model for security on these three aspects:

image

Within the security development lifecycle creating the Threat Model is an important deliverable in the design phase:

image

Threat modeling is all about identifying potential threats within certain categories (STRIDE model):

image

The rest of the talk was about the products Microsoft provides to implement security at all levels:

- Edge protection with ISA or IAG
- Network transport security
- Rights Management Services
- Bitlocker drive protection
- Network Access Protection (NAP)
- Identity and Access management
- Authorization management
- Messaging security

Next week, the last session within the Netherlands will take place and it’s about the Knowledge Worker and Microsoft’s vision on this subject: The New World of Work.
After that, we’ll fly off to Redmond,  the second week of January to listen to what some people working within the lion’s den have to say :)


Posted in: LEAP 2009  Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

At the last day of the PDC, Chris Anderson and Giovanni Della-Libera showed us how to build textual DSL’s with the Oslo modeling language. I wrote a blog post about this session and in that post you can find this image:

image

Normally you would use the MG.exe compiler or the MG Build Task to compile your languages. But as the slide above indicates, the MGrammar team provided us with an in-memory version of the MG build task. So let’s try this out!

For this exercise I reuse the language and instance data I created in my blog post: My First Language in MGrammar

Module

First, I created the Module class. This class represents the  MGrammar textual DSL. It also contains the name of the parser you want to create (more on that later on in this post) and the result bytes of the compiled DSL:

   1: public class Module
   2: {
   3:     public string MGrammar { get; set; }
   4:     public string ParserName { get; set; }
   5:     public byte[] Bytes { get; set; }
   6: }

 

DynamicMGrammarCompiler

The dynamic compiler class I created can be used in two scenarios:

  1. You compile the module, cache it in your host application and reuse this module when parsing data through your DSL. Compiling a module is an expensive operation; it burns quite some CPU cycles, so reusing it seems like a good idea.
  2. You compile the module and parse your data through your DSL every single call.

The above scenarios result in three methods: CompileModule, ParseData and CompileModuleAndParseData:

   1: public class DynamicMGrammarCompiler
   2: {
   3:  
   4:     /// <summary>
   5:     /// Compile the module, and store the graph in the byte[], so the 
   6:     /// client application can cache this compiled image
   7:     /// </summary>
   8:     /// <param name="module"></param>
   9:     /// <returns></returns>
  10:     public Module CompileModule(Module module) 
  11:     {
  12:  
  13:         MGrammarCompiler compiler = new MGrammarCompiler(); 
  14:         ErrorReporter reporter = ErrorReporter.Standard;
  15:         TextReader reader = new StringReader(module.MGrammar);
  16:         FileStream fs = null;
  17:         try
  18:         {
  19:             SourceItem item = new SourceItem(module.ParserName, reader);
  20:             item.ContentType = GContentType.Mg;
  21:             SourceItem[] items = new SourceItem[] { item };
  22:             compiler.SourceItems = items;
  23:             compiler.Target = Target.Mgx;
  24:             compiler.TypeCheckActions = true;
  25:             compiler.OutFile = Path.GetTempFileName();
  26:             compiler.Execute(reporter);
  27:             //read bytes 
  28:             string filepath = Path.Combine(Path.GetDirectoryName(compiler.OutFile), Path.GetFileNameWithoutExtension(compiler.OutFile) + ".mgx");
  29:             fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);
  30:             byte[] bytes = new byte[fs.Length];
  31:             fs.Read(bytes, (int)0, (int)fs.Length);
  32:             fs.Close();
  33:             module.Bytes = bytes;
  34:         }
  35:         finally
  36:         {
  37:             if (null!=fs)
  38:             {
  39:                 fs.Close();
  40:             }
  41:             reader.Close();
  42:         }
  43:         return module; 
  44:     }
  45:  
  46:     /// <summary>
  47:     /// Parse the instancedata through the compiled image within the module
  48:     /// </summary>
  49:     /// <param name="module"></param>
  50:     /// <param name="instanceData"></param>
  51:     /// <returns></returns>
  52:     public object ParseData(Module module, string instanceData) 
  53:     {
  54:  
  55:         object result = null;
  56:         MemoryStream ms = null;
  57:         StringReader sr = new StringReader(instanceData);
  58:         try
  59:         {
  60:             ms = new MemoryStream(module.Bytes);
  61:             DynamicParser parser = MGrammarCompiler.LoadParserFromMgx(ms, module.ParserName);
  62:             if (null == parser)
  63:             {
  64:                 throw new NullReferenceException(string.Format("Language with name '{0}' not found in MGrammar image!", module.ParserName));
  65:             }
  66:             
  67:             result = parser.ParseObject(sr, ErrorReporter.Standard);
  68:         }
  69:         finally
  70:         {
  71:             if (null != ms)
  72:             {
  73:                 ms.Close();
  74:             }
  75:             sr.Close();
  76:         }
  77:         return result;
  78:     }
  79:  
  80:     /// <summary>
  81:     /// Both Compile and Parse.
  82:     /// </summary>
  83:     /// <param name="module"></param>
  84:     /// <param name="instanceData"></param>
  85:     /// <returns></returns>
  86:     public object CompileModuleAndParseData(Module module, string instanceData)
  87:     {
  88:         module = CompileModule(module);
  89:         return ParseData(module, instanceData);
  90:     }
  91: }

CompileModule creates a MGrammarCompiler instance and loads theMGrammar we want to compile in a TextReader. Then, I create a SourceItem instance which will tell the MGrammarCompiler what type of source it can expect and provides the source (textual DSL) itself.
Then, I tell the compiler that the target of the compilation should be a MGX file. I also provide a temporary file name to write the result to, and then call Execute!
The last step is opening the created file and reading its bytes and returning them within the module instance.

ParseData receives a module and some input instance data. I first read the instance data and create a stream of the module bytes. Then I create a DynamicParser using the stream and the provided ParserName. Important to know here is that the parser name should be the module name and the language name concatenated with a dot. As I’m using my RssLanguage from the inwit module, my parser name should be “inwit.RssLanguage”.
If a correct parser is created, we use it parse our instance data and create a graph. I just return this graph to the caller.

CompileModuleAndParseData just combines the above two steps in one call.

Test Application

As a test application I created a console App:

   1: class Program
   2: {
   3:     static void Main(string[] args)
   4:     {
   5:         Console.WriteLine(">>Initializing...");
   6:         string filePathMGrammar =       @"C:\Users\Robert Jan\Desktop\My Documents\Oslo\MyOslo\RssLanguage.mg";
   7:         string filePathInstanceData =   @"C:\Users\Robert Jan\Desktop\My Documents\Oslo\MyOslo\FeedsInput.m";
   8:         
   9:         string mGrammar = File.ReadAllText(filePathMGrammar);
  10:         string instanceData = File.ReadAllText(filePathInstanceData);
  11:  
  12:         inwit.Module module = new inwit.Module();
  13:         module.MGrammar = mGrammar;
  14:         module.ParserName = "inwit.RssLanguage";
  15:  
  16:         inwit.DynamicMGrammarCompiler compiler = new inwit.DynamicMGrammarCompiler();
  17:         
  18:         //first compile and cache module
  19:         Console.WriteLine(">>Step 1: compiling module");
  20:         module = compiler.CompileModule(module);
  21:  
  22:         //second reuse module, and just parse instancedata
  23:         Console.WriteLine(">>Step 2a: parsing instance data");
  24:         object graph = compiler.ParseData(module, instanceData);
  25:         Console.WriteLine(">>Step 2b: Writing result:");
  26:         inwit.Helper.WalkMGraphTree(graph);
  27:         
  28:         //third, do all in one call
  29:         Console.WriteLine(">>Step 3a: compiling module and parsing data in one call...");
  30:         graph = compiler.CompileModuleAndParseData(module, instanceData);
  31:         Console.WriteLine(">>Step 3b: Writing result:");
  32:         inwit.Helper.WalkMGraphTree(graph);
  33:  
  34:         Console.ReadLine();
  35:     }
  36: }

I’m using the Helper.WalkMGraphTree method from my previous post again to output the result graph.

The result of the console app looks like:

image


Posted in: Oslo , MGrammar  Tags:

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Robert Jan - Wednesday, November 05, 2008 - 9:23 AM

Update: Something went wrong with the code snippets; should be shown correctly now!

Now we have MGrammar mode correctly running in Intellipad, let’s try out some stuff.

Let’s create a language that understands textual representation of the title, location, URL and email address of an RSS Feed. I also want the language to skip whitespace and comments, and the email address should be validated.

So as sample instance data I wrote this:


 

   1: Title: inwit.nl
   2: Url: http://inwit.nl
   3: RssFeedUrl: http://feeds.feedburner.com/inwitnl
   4: Email: rj@vanholland.net
   5:  
   6: //this is comment
   7: /*
   8: this is also comment
   9: 
  10: */
  11:  
  12: Title: IntellipadBlog
  13: Url: http://blogs.msdn.com/intellipad
  14: RssFeedUrl: http://blogs.msdn.com/intellipad/rss.xml
  15: Email: oslo@microsoft.com

As you can see, just two instances of a Feed type with some comments and whitespacing in there.
Now, let’s write a language that swallows this data. What I in fact did was create three languages:

  • A common language with some stuff you’d want to use more often; perhaps the Email Language should be moved here also.
  • The language that understands an Email Address
  • The actual RSS language

The Common Language
This language should cover the part of understanding white spacing and comments; after having looked at the demo done at the PDC and after having looked around in the “C:\Program Files\Microsoft Oslo SDK 1.0\Samples\MGrammar\Languages” directory of  your SDK installation I came up with this:

   1: language InwitCommon
   2: {
   3:  
   4:     token Skippable = Whitespace | Comment;
   5:     
   6:     token Comment = CommentToken;
   7:     token CommentToken 
   8:         = CommentDelimited
   9:         | CommentLine;
  10:     token CommentDelimited = "/*" CommentDelimitedContent* "*/";
  11:     token CommentDelimitedContent = 
  12:         ^('*')
  13:         | '*'  ^('/');
  14:     token CommentLine = "//" CommentLineContent*;
  15:             token CommentLineContent = ^(
  16:              '\u000A' // New Line
  17:           |  '\u000D' // Carriage Return
  18:           |  '\u0085' // Next Line
  19:           |  '\u2028' // Line Separator
  20:           |  '\u2029'); // Paragraph Separator
  21:           
  22:           
  23:           
  24:    token Whitespace = WhitespaceToken+;
  25:    token WhitespaceToken = WhitespaceCharacter+;
  26:             token WhitespaceCharacter 
  27:         = '\u0009'   // Horizontal Tab
  28:         | '\u000B' // Vertical Tab
  29:         | '\u000C' // Form Feed
  30:         | '\u0020' // Space
  31:         | NewLineCharacter;
  32:         
  33:    token NewLineCharacter 
  34:         = '\u000A' // New Line
  35:         | '\u000D' // Carriage Return
  36:         | '\u0085' // Next Line
  37:         | '\u2028' // Line Separator
  38:         | '\u2029'; // Paragraph Separator
  39: }
Now, in your language you can use the Skippable token from this language to set as an interleave; this will let your language skip whitespacing and comments.

The Email Language
I wanted to have some sort of Email address validation within my language. So I came up with this:

   1: language EmailAddressLanguage
   2:     {
   3:         token EmailAddress = 
   4:         localpart
   5:         at
   6:         domainpart;
   7:            
   8:         token abzABZ = ('A'..'Z' | 'a'..'z')+;
   9:         token digits = ('0'..'9')+;
  10:         token otherChars = ('!' | '#' | '$' | '%' | '&' | "'" | '*' | '+' | '-' | '/' | '=' | '?' | '^' | '_' | '`' | '{' | '|' | '}' | '~')+; 
  11:         token allButDot = (abzABZ | digits | otherChars)+;
  12:         token all = (allButDot | dot)+;
  13:         token dot = ('.')#1;
  14:         
  15:         token localpart = 
  16:         (allButDot)+ | 
  17:         allButDot dot all* allButDot+;
  18:         
  19:         token at = "@";
  20:         
  21:         token domainpart = 
  22:         (allButDot)+ dot all* allButDot+;
  23:     }

It’s far from being perfect! It validates email addresses but in some cases doesn’t work correctly yet:
You can have an email address like “bla..bla@hotmail..com” and it will validate. I haven’t looked much deeper in it yet, because this was just a small test but if someone feels like improving this part, please do so and post a comment with your solution!

The RSS Language
Then, I wrote the RSS language itself, which looks like this:

   1: language RssLanguage
   2:     {
   3:         syntax Main = f:Feeds => f;
   4:         
   5:         syntax Feeds = Feed*;
   6:         
   7:         syntax Feed = 
   8:         "Title" ":" t:Title 
   9:         "Url" ":" u:Url
  10:         "RssFeedUrl" ":" r:RssFeedUrl
  11:         "Email" ":" e:EmailAddressLanguage.EmailAddress
  12:         =>
  13:         Feed{
  14:             Title{t},
  15:             Url{u},
  16:             RSS{r},
  17:             Email{e}
  18:             };
  19:         
  20:         @{Classification["Keyword"]} token Title = ('A'..'Z' | 'a'..'z' | '.')+;
  21:         
  22:         token Url = "http://" ('A'..'Z' | 'a'..'z' | '.' | '/')+;
  23:         
  24:         token RssFeedUrl = Url;
  25:         
  26:         
  27:         interleave WhiteSpacing = " " | "\r" | "\n";
  28:         interleave Skippable = InwitCommon.Skippable;
  29:     }

It defined that the Main is a sequence called ‘Feeds’ which contains items of the type Feed. An input Feed will consist of a Title, Url, RssFeedUrl and Email and will be shaped to a Feed with a Title, Url, RSS and Email element.
You can see that I use the EmailAddressLanguage and the InwitCommon language within this language.

Full Listing
To simplify, here is the full listing in one module:

   1: module inwit
   2: {
   3:     language RssLanguage
   4:     {
   5:         syntax Main = f:Feeds => f;
   6:         
   7:         syntax Feeds = Feed*;
   8:         
   9:         syntax Feed = 
  10:         "Title" ":" t:Title 
  11:         "Url" ":" u:Url
  12:         "RssFeedUrl" ":" r:RssFeedUrl
  13:         "Email" ":" e:EmailAddressLanguage.EmailAddress
  14:         =>
  15:         Feed{
  16:             Title{t},
  17:             Url{u},
  18:             RSS{r},
  19:             Email{e}
  20:             };
  21:         
  22:         @{Classification["Keyword"]} token Title = ('A'..'Z' | 'a'..'z' | '.')+;
  23:         
  24:         token Url = "http://" ('A'..'Z' | 'a'..'z' | '.' | '/')+;
  25:         
  26:         token RssFeedUrl = Url;
  27:         
  28:         
  29:         interleave WhiteSpacing = " " | "\r" | "\n";
  30:         interleave Skippable = InwitCommon.Skippable;
  31:     }
  32:     
  33:     language EmailAddressLanguage
  34:     {
  35:         token EmailAddress = 
  36:         localpart
  37:         at
  38:         domainpart;
  39:            
  40:         token abzABZ = ('A'..'Z' | 'a'..'z')+;
  41:         token digits = ('0'..'9')+;
  42:         token otherChars = ('!' | '#' | '$' | '%' | '&' | "'" | '*' | '+' | '-' | '/' | '=' | '?' | '^' | '_' | '`' | '{' | '|' | '}' | '~')+; 
  43:         token allButDot = (abzABZ | digits | otherChars)+;
  44:         token all = (allButDot | dot)+;
  45:         token dot = ('.')#1;
  46:         
  47:         token localpart = 
  48:         (allButDot)+ | 
  49:         allButDot dot all* allButDot+;
  50:         
  51:         token at = "@";
  52:         
  53:         token domainpart = 
  54:         (allButDot)+ dot all* allButDot+;
  55:     }
  56:     
  57:     language InwitCommon
  58:     {
  59:     
  60:         token Skippable = Whitespace | Comment;
  61:         
  62:         token Comment = CommentToken;
  63:         token CommentToken 
  64:             = CommentDelimited
  65:             | CommentLine;
  66:         token CommentDelimited = "/*" CommentDelimitedContent* "*/";
  67:         token CommentDelimitedContent = 
  68:             ^('*')
  69:             | '*'  ^('/');
  70:         token CommentLine = "//" CommentLineContent*;
  71:                 token CommentLineContent = ^(
  72:                  '\u000A' // New Line
  73:               |  '\u000D' // Carriage Return
  74:               |  '\u0085' // Next Line
  75:               |  '\u2028' // Line Separator
  76:               |  '\u2029'); // Paragraph Separator
  77:               
  78:               
  79:               
  80:        token Whitespace = WhitespaceToken+;
  81:        token WhitespaceToken = WhitespaceCharacter+;
  82:                 token WhitespaceCharacter 
  83:             = '\u0009'   // Horizontal Tab
  84:             | '\u000B' // Vertical Tab
  85:             | '\u000C' // Form Feed
  86:             | '\u0020' // Space
  87:             | NewLineCharacter;
  88:             
  89:        token NewLineCharacter 
  90:             = '\u000A' // New Line
  91:             | '\u000D' // Carriage Return
  92:             | '\u0085' // Next Line
  93:             | '\u2028' // Line Separator
  94:             | '\u2029'; // Paragraph Separator
  95:     }
  96: }

And this is what it looks like when writing it within Intellipad:

lang

 

Language Compilation

Next step, is to compile the module ‘RSSLanguage.mg’ I just created; we use the mg.exe compiler provided by the Oslo SDK to do this:

mg
We get an .MGX file out of this. When renamed to a file with a .ZIP extension, I tried to open this file but it’s password protected. Anyone knows the secret password? :)

 

Run-time Language utilization

Last but not least I’d like to use my language within the .NET runtime. Luckily, the Oslo SDK provides us some base classes to do this. I created a new C# Console Application to test test things out.
First add references to the System.Dataflow and Microsoft.M.Grammar assemblies which can be found within the Bin directory of the Oslo SDK.:

image

Then, I wrote this code:

   1: using System;
   2: using System.Collections.Generic;
   3: using System.Linq;
   4: using System.Text;
   5: using System.Dataflow; // DynamicParser, GraphBuilder
   6: using Microsoft.M.Grammar; // MGrammarCompiler
   7:  
   8: namespace ConsoleApplication
   9: {
  10:     class Program
  11:     {
  12:         static void Main(string[] args)
  13:         {
  14:             try
  15:             {
  16:                 string imageFileName = @"C:\Users\Robert Jan\Desktop\My Documents\Oslo\MyOslo\ConsoleApplication\RssLanguage.mgx";
  17:                 string inputFileName = @"C:\Users\Robert Jan\Desktop\My Documents\Oslo\MyOslo\ConsoleApplication\FeedsInput.m";
  18:                 //inwit == module name
  19:                 //RssLanguage == language name
  20:                 string parserName = "inwit.RssLanguage";
  21:                 
  22:                 DynamicParser parser = MGrammarCompiler.LoadParserFromMgx(imageFileName, parserName);
  23:  
  24:                 object output = parser.ParseObject(inputFileName, ErrorReporter.Standard);
  25:  
  26:                 Helper.WalkMGraphTree(output);
  27:  
  28:             }
  29:             catch (Exception e)
  30:             {
  31:                 Console.WriteLine(e.Message);
  32:             }
  33:             Console.ReadLine();
  34:         }
  35:     }
  36: }

First, I Create a DynamicParser instance, and provide it with the compiled language image file (the .MGX file) and with the parserName. The parser name is the name of the module and the name of the language concatenated.

I then parse the input file using the ParseObject method, and we will get the result.

I wrote a nice Helper function that walks the result tree, and outputs its contents to the Console. Feel free to use it yourself (after giving me a comment here of course :)).

   1: using System;
   2: using System.Collections.Generic;
   3: using System.Linq;
   4: using System.Text;
   5: using System.Dataflow;
   6:  
   7: namespace ConsoleApplication
   8: {
   9:     class Helper
  10:     {
  11:  
  12:         public static void WalkMGraphTree(object rootNode)
  13:         {
  14:             IGraphBuilder builder = new GraphBuilder();
  15:             WalkNode(rootNode, builder);
  16:  
  17:         }
  18:         private static void WalkNode(object node, IGraphBuilder builder)
  19:         {
  20:             if (node.GetType().Name == "SequenceNode")
  21:             {
  22:                 foreach (object sequenceElement in builder.GetSequenceElements(node))
  23:                 {
  24:                     
  25:                     WalkNode(sequenceElement, builder);
  26:                 }
  27:                 Console.WriteLine();
  28:             }
  29:             else if (node.GetType().Name == "SimpleNode")
  30:             {
  31:                 Identifier id = builder.GetLabel(node) as Identifier;
  32:                 WriteLine(id.Text,false);
  33:                 foreach (object successorElement in builder.GetSuccessors(node))
  34:                 {
  35:                     WalkNode(successorElement, builder);
  36:                 }
  37:                 Console.WriteLine();
  38:             }
  39:             else
  40:             {
  41:                 WriteLine(Convert.ToString(node),true);
  42:             }
  43:         }
  44:  
  45:         private static void WriteLine(string line, bool newline)
  46:         {
  47:             Console.Write(line + " ");
  48:             if (newline)
  49:             {
  50:                 Console.Write(Environment.NewLine);
  51:             }
  52:         }
  53:         
  54:     }
  55: }

Now when I run the Console App, the output looks like this:

image

 

Summary

Here’s the summary of the steps I took, and the end result accomplished:

  • First, we created our languages; we separated some functionalities in separate languages and used these within  the RssLanguage
  • We created some input data and tested the languages combined with the input data within Intellipad
  • We compiled the languages with MG.exe into an .MGX image file.
  • We created a .NET applications which loads the image file and parses the input data through the language.
  • We created a Helper method which walks the result graph tree, and shows us the result within our Console.

Valuable links
Steef-Jan gave some pretty good links last Monday, I’d like to highlight one of those and give you two others:

Go and read what Martin Fowler has to say about Oslo and also check out what MSDN has to say about MGrammar:


Posted in: MGrammar , Oslo  Tags:

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Robert Jan - Sunday, November 02, 2008 - 9:50 PM

So tonight I wanted to take a first look on Azure.
I installed all of the stuff needed :

  • IIS7  (under Vista Ultimate 32bit on my machine)
  • WindowsAzureSDK-x86.msi
  • VSCloudService.msi
  • SDK.msi (Microsoft SQL Server Data Services SDK)

So I fired up VS2008 and started a new Web Cloud Service:

image

To check if all worked out, I pressed F5.. And first saw this:

image

So OK, let’s restart VS2008 under Administrator rights (“Run as Administrator”) and I pressed F5 again.. I then first saw this:

image

And after pressing YES I saw this error appear:

image

What the heck?! It’s using my Username (which is “Robert Jan” as a parameter to initialize the development storage. Fine of course, but please Microsoft, USE QUOTES when doing this! Because now, it stating that “Jan” is an unknown option…

So why not try to initialize this storage ourselves and we’ll use DSInit with the quoted username (and prefixed with the domain name or local machine name):

image

And the result:
image 

So now, I can play along :)


Posted in: Azure  Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Page List

    Calendar

    «  February 2010  »
    MoTuWeThFrSaSu
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    1234567
    View posts in large calendar

    Recent Comments

    Feedburner Statistics 2/7/2010
    23 Readers ~ 46 hits ~ 1 reach

    Disclaimer
    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2010 Inwit.nl