This is the geek *** session Don Box mentioned. Chris Anderson and Giovanni Della-Libera are presenting, the entire Oslo team that’s here is inside this room.
module PDC
{
language Contacts
syntax Main = checked:Contact => checked;
syntax Contact =
"Contact" ":" a:Alias =>
Contact { Alias { a } };
|
"Contact" ":" a:Alias "-" n:PhoneNumber =>
Contact { Alias { a }, Phone {phone} };
token Alias = ('A'..'Z' | 'a'..'z')+;
token Digit = "0".."9";
token PhoneNumber = Digit#3 "-" Digit#3 "-" Digit#4;
interleave TokensIHate = " " | "\r" | "\n"+;
}
Tokenize is the first thing to do. The above can transform “Contact : dvdstelt - 425-555-1212”, and it removes weird characters. Chris and Gio than show how lists work, how the recursive results are flattened out, how to add comments and
mgx.exe is used to generated an mgx file.
mgx /r:contacts.mgx input.contacts will generate M language code. The mgx is just a plain .zip file, as said before in one of my posts.
mgx /r:contacts.mgx input.contacts /t:xaml for transformation to xaml
You can Integrate MGrammar into the CLR
A cool example of some MGrammer was grammar code for MSI setup package. MSI is really complex to write, so Chris and Gio build MGrammar to build the MSI. But their MGrammer became so complex, that they wrote another MGrammer code library to generate the other MGrammer code to generate the MSI installer ‘code’. The final result is about 50 lines of MGrammer and 400 lines of C#, pretty maintainable I’d say.
To sum up, MGrammer is a language for creating textual DSLs. The specification will be released under OSP, as noted on many other weblogs.
You can build your own language right now! Download at http://msdn.microsoft.com/oslo/
I’ve been talking to people and perhaps here on the blog that during the Doug Purdy talk they showed a demo of MService where, with a few lines of code, a REST enabled WCF services with WF activities was created with only so few lines of actual code.
service Service
operation PhotoUpload(stream : Stream) : Text
.PostUriTemplate = "upload";
index : Text = invoke DateTime.Now.Ticks.ToString();
filename : Text = "d:\\demo\\photo\\" + index + ".jpg";
invoke MService.ServiceHelper.StoreInFile(stream, filename);
return index;
operation PhotoGet(index : Text) : Stream
.UriTemplate = "getphoto/{index}";
.ContentType = "image/jpeg";
return invoke File.OpenRead(filename);
endpoint HttpEndpoint
Binding = WebHttpBinding;
Address = "http://localhost:8080/service/";
Add breakpoints, post a photo or get one and the breakpoints are hit under debugging. You can see activities and endpoints in the locals window.
At the bottom you can see the endpoint defined. The first operation is PhotoUpload and it invokes code to store a file. Runtime this results in a WF activity storing the file on disc. The second operation is the get and it invokes a file read activity.
In the PhotoUpload operation you also see the invoke of DateTime.Now.Ticks.ToString(), which will result in a code-activity in WF, running the specified code.
This is just it, a REST enabled service for uploading, storing and retrieving images.
Remember that this is MService, including a WF/WCF runtime that understands the language ‘M’, hosted inside Dublin.
Just saw Chris Sells show a session on some other expects of Oslo that wasn’t introduced yet.
It was again stated that the repository in Oslo is a normal SQL Server database. All your models are just SQL in the database and everything is designed for extensibility.
Some of the core features are:
The Oslo SDK provides tools to
Again, once your models are in the database, it’s just plain SQL data. Currently only SQL Server is supported, but of course the next logical step is XML and especially web services to put your models in the cloud!!!
Repository tables keep track of claims, resources and operations
Domain-specific security containers
Together with Alex Thissen, Paul Gielens, Marco Stolk and Dries Marckmann we’ve been reflecting our thoughts on “M”. Right now we’re all at another Oslo talk about Quadrant.
Why “Quadrant”?
What is “Quadrant”?
“Quadrant” is the tool to work with. You have a canvas where you can drag everything you’re working with on that canvas. Icons that are blue can be dragged out and placed on the canvas again to get a full view on that item again. That way you can drill down in all models. Everything of course in WPF and this provides a great visual experience, or at least this is the idea I get from looking at the screen.
Terminology and features in quadrant
Using Quadrant Takeaways
Customizing “Quadrant” Takeaways
Quadrant Architecture
The shell and surface has some core services like drag/drop, undo/redo, error handling, search, etc. The composition engine is getting data from a dataflow engine, giving queryable data, having target data, configuration and view state, which is all coming from M.
Where are we?
I’m at the “Lap around ‘Oslo’” talk together with Alex Thissen and Paul Gielens. This is by far the best session I’ve seen so far!
The talk began about models. We were looking at modeling and modeling domains, but what is a model? We have…
According to Douglas Purdy, Don Box says we’re on a 30 year journey and we’re 15 years in. We had COM(+), .NET 1.0, Web Services, .NET 3.0 and now we’re entering the next phase. Oslo is the next level for a model-driven platform. We’ve been heading there via configuration, attributes and doing more and more declarative instead of typing everything out. A great example for declarative development is of course LINQ.
Why is this happening? Transparency (better understand your application), flexibility (add changes to your application faster) and productivity. We need models
So what is Oslo? It is the platform for model-driven development. Microsoft will bring us Oslo with the following components:
“M” gives you the modelling and textual DSLs. According to Douglas Purdy and to Don Box, this is going to be the next big thing. I could not agree more. I am SO excited about what I just saw. Take the example they’ve shown.
Module Microsoft.Samples
// MusicItem is the schema
type MusicItem
// Primary key
Id : Integer64 = AutoNumber();
Album : Text; // Album is constraint by type
Artist : Text;
// Rating is constraint and expression
Rating : Integer32 where value <= 3;
} where identity Id;
// * is 0..n multiplicity
MusicLibrary : MusicItem*;
The above declares a schema named “MusicItem” and a collection of those in a “MusicLibrary”. We compile this and than populate the result in the database.
// M compiler
// Repository is the database. When choosing -t:xml we generate XML
m.exe myfile.m /p:image -t:Repository
// Populating
mx.exe /i:myfile.mx /db:repository /ig /f
mx uses the compiled “binary” (this is a zip archive actually) and generates T-SQL.
create table [Microsoft.Samples].[MusicLibrary]
(
-- the rest
)
You can fill the database with the following
MusicLibrary
Album = "Slippery when wet",
Artitst = "Bon Jovi",
Rating = 3
},
Album = "Into the dark",
Artitst = "Europe",
Rating = 2
This creates two rows in the table MusicLibrary. But this is all the language “M”. How about a textual DSL? How’s this for coding:
"SomeAlbum" by "Led Zeppelin" is awesome!
"Back in Black" by "AC/DC" is so so.
"Bad" by "Michael Jackson" is terrible.
The above code can be transformed into the exact same code-block as above, where we filled the database with two records. How is this achieved? Take a look at the following code.
module Microsoft.Samples
import Language;
language MusicLibraryLanguage
syntax Main = s:Statement+ => MusicLibrary(valuesof(s){l
syntax Statement = al:Grammar.TextLiteral "by" ar:Gramar.TextLiteral "is" ?????
=> { Album {al}, Artist {ar}, Rating
@{(Classification["keyworkd"]} // colorize "awful"
token Rating1 = "terrible" | "awful";
token Rating2 = "so so";
token Rating3 = "awesome";
syntax Rating = Rating1 => 1 | Rating2 => 2 | Rating3 => 3;
interleave skippable = Base.Whitespace
I lost the code where it says “????”. The above code tells to look at by and is and takes the text there and parse it. It than looks at the rating and gives it an actual number. The Classification keyword makes the words “terrible” and “awful” become bold in the editor.
Now is this awesome or what? I’m so excited by this. This is one of the biggest steps in my history of developing software. You can now write code like
Give me a table called “Customers” with a primary key called “Id” and make it an integer with identity on, seeding from 1.
The best thing is, if you can think of a way to make that sentence shorter or more self-explaining, go ahead! Use MGrammer to define your own textual DSL.
MService Another great demo was when they showed MService. With only a few lines of code (my battery ran flat, so I could not copy the code, but I photographed it and it will come in this blog!) they created a WCF service where they could upload an image and request it again, using a WF workflow. In about 38 lines of code, { and } on empty lines included!!! Courtesy of Paul Gielens, I got the code from his weblog. The following starts a REST enabled WCF Service with a WF Writeline activity. Not a Console.Writeline, but a real WF activity.
module Service25
operation Echo(str : text) : Text
.UriTemplate = "echo/{str}";
WriteLine { Text = "Message : " + str }
return str;
Debugging At first I thought this was an awesome code generator. But boy was I wrong. They showed debugging and hitting breakpoints inside the textual DSL!!! The stack and locals windows showed the WCF channels and WF activities active. Can you believe it? Probably not, you just have to watch the stream on Channel9.
I’m now going to follow Don Box, hold on for more!
Loving it, loving it, loving it, as Don Box would say!
Mark Miller from DevExpress just announced CodeRush Xpress for C# developers, for free!!! In a partnership with Microsoft, DevExpress is making this tool available for Visual Studio. It’s a selection of CodeRush and Refactor! Pro features.
Refactor! Pro is one of my favorite tools available for Visual Studio. I haven’t really used CodeRush yet, but I will definitely install CodeRush Xpress.
Go get it here…
A lot of photos, many many more to come…
Most are Los Angeles, Santa Monica beach and other locations. PDC 2008 isn’t that interesting to look at! ;-)
http://flickr.com/photos/dvdstelt/sets/72157608454625991/
Scott Guthrie is talking… Very fast what he’s talking about…
Strange, nothing about Silverlight 2.0 on mobile. There is a session about it though, but I’m going to “Oslo” sessions.
Yesterday, Alex and I were talking to a lot of people at the main hall when we walked by the Oslo booth. Don Box and David Langworthy were doing a presentation on the language ‘M’. Today we’ll hear much more during the keynote from Don Box and Chris Anderson, but it was great to see a demo already.
I write ‘yesterday’ because I’ll post this on Tuesday. It’s now Monday 11:30pm and I definitely need some sleep!
Yesterday Alex and I spoke to some people and from two resources we got to learn that Silverlight for mobile devices will most likely be revealed today at the keynote by Scott Guthrie.
The best is, it’s already able to run managed code. So that means Microsoft is skipping the first version and is immediately releasing Silverlight 2.0 for mobile devices.
More on this today, most likely on many weblogs!
Blogging live at the PDC 2008 keynote…
Windows Azure This new version of Windows was just announced. We’ve got desktop and server (back-end) versions of Windows and this should be the web tier, the operating system for the cloud. Windows Azure is about scaling up and keeping your applications and services up 24/7, no need to take them offline when updating. It contains Live Services, .NET Services, SQL Services, SharePoint Services, Dynamics CRM Services.
Microsoft is betting big on Windows Azure and cloud computing and will be offering the following products in Microsoft Online Services initiative.
Bluehoo On demo website running in the cloud is a cool website running on Azure. http://keynote.bluehoo.com/ It’s a social networking site where you can install software on your mobile and see other mobile devices (using bluetooth) around you. If they’ve installed Bluehoo on their mobile you can chat and share interests, etc.
http://m.bluehoo.com is the address to go to with your mobile. It seems an awesome app, we’ll have to try it!
I just noticed the PDC session schedule is online. This means you can find out which sessions are in which slot(s) and you can finally start really planning sessions. This is always extremely difficult as I always want to be in multiple rooms at the same time! :-) I haven’t figured out if some sessions are repeated, as this makes choices sometimes more easy.
Very nice is that you can click sessions in the agenda and mark them so you’ll know which one you want to visit. You can also create a printable version you can take with you to the PDC. Or if you have Windows Mobile (or Outlook on your laptop) you can import the schedule. That should make it also very easy to see where to be at which time! :)
Go check out your own schedule here.
Update : The future of C# by Anders Hejlsberg will be given twice. Once on day one and once on day 3. That’s good, because on day 3 I have 2 other sessions in the same slot.
Silverlight 2.0 was just released a few hours ago! Awesome news! If you look at Scott Guthrie’s website, it was released a 3:07 AM. Some sick people over there! The first comment is more than three hours later, when people turned up for work! :-)
At Class-A we’re definitely going to provide training in Silverlight 2.0 so keep a watch on our site for more info. If you want to be mailed about it, get in contact with us and we’ll notify you.
If you want to get started with Silverlight 2, go get it here.
I love ClickOnce, automated builds and a lot more Microsoft stuff. Unfortunately not for everything there is a simple solution. I ran into a new problem today. I was playing around with certificates, signed manifests and all of this in an automated build. I needed to make some application deployable via ClickOnce and instead of everyone else on the project, I used a certificate with a password in it.
Hence that I was the first to run into the problem when you deploy your beautiful little app into the automated build script. Without adding ClickOnce enabled deployment in the build script, when compiling it gave the following error:
ERROR MSB4018 in C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1805,7) : The "ResolveKeySource" task failed unexpectedly.
Something about popping up a dialog box. You get on guess why…
The problem lies in the fact that at first compilation of the project, the certificate needs to be installed into the users personal store. Again, the users personal store. This means that our build user needs to have it in its own store.
You should start looking for your problem on the internet. Try this one. See how many MVP’s you can count that’ll tell you to login under the build user, open Visual Studio and build the project. That’s not a solution, it’s a work around. And a bad one. I don’t want to login under the build user and definitely not have Visual Studio build the project.
I’ve search and search, but there seems to be no simple solution. My solution was as follows
Try your build again.
Now we did not log into Windows as the build user. We went via cmd.exe because mmc.exe needs elevation and you can’t run it immediately via ShellRunas.
Hopes this helps some users…
A customer of us ran into some problems today. The following kind of describes the problem.