Re.Mark

My Life As A Blog

Archive for the ‘Microsoft’ Category

Iron Python at QCon

leave a comment »

I spent yesterday on the Microsoft stand at QCon 2010.  I took a few Iron Python samples with me to show to those who are interested.  I wanted to be able to show three things:  .NET runs Python, Python extends .NET and Python runs .NET.

.NET runs Python

To show that .NET can run Python I used the Text Processing sample I’ve blogged about before.  I’ve subsequently added optparse to it so that it can be driven from the command line.  The point of this sample is that it uses standard Python libraries, the whole application is written in Python (there’s a little XAML to describe the UI) and runs on the DLR courtesy of IronPython.

Python extends .NET

For a simple demonstration of extending a .NET application with Python, I took the sample application described here.  This application allows the user to write Python (at runtime) that interacts with the application.

Python runs .NET

The last sample was an adaptation of the code here that reads a Twitter feed.  Rather than use Twitter (with all the shortened urls and abbreviations) I decided to use an RSS feed from the BBC to create an Iron Python newsreader.  The code is remarkably simple:

import clr
clr.AddReference('System.Speech')
clr.AddReference('System.Xml')

from System.Speech.Synthesis import SpeechSynthesizer
from System.Xml import XmlDocument, XmlTextReader

xmlDoc = XmlDocument()
xmlDoc.Load("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml")
spk = SpeechSynthesizer()

itemsNode = xmlDoc.DocumentElement.SelectNodes("channel/item")
for item in itemsNode:
  print item.SelectSingleNode("title").InnerText
  news = "<?xml version='1.0'?><speak version='1.0' xml:lang='en-GB'><break />" + item.SelectSingleNode("description").InnerText + "</speak>"
  spk.SpeakSsml(news)
 

This is Python using standard .NET libraries to show how a Python programmer has the .NET framework available to them through Iron Python.

Gestalt

The final thing I talked about is Gestalt, which allows you to run Python (and Ruby) in the browser.  It does this by using the DLR, which is part of Silverlight – this is all encapsulated in javascript.

Written by remark

March 12, 2010 at 7:21 pm

Posted in .NET, Events, Microsoft, Python

AIC 2009 – Dynamic Languages and Architecture

leave a comment »

Thanks to all of you who attended my session at AIC earlier today.  The slides will be made available on line over the next week or so. 

I think the interesting capability made possible by the DLR is using static languages and dynamic languages together.  And there’s another benefit of learning a new language: when we only use one language we tend to think in that language – having other languages in our toolkit means that we have other approaches available to us.

So, where can you start to take advantage of dynamic languages?  The areas I discussed today were:

  • extending your application by adding scripting support to your application
  • configuring your application with a dynamic language
  • creating a DSL using a dynamic language
  • writing one or more layers of your architecture in a dynamic language
  • testing your application(s) with a dynamic language

Of all of these, extending and testing are probably the best places to start.

I also talked a bit about the DLR (and a couple of the Iron Languages – Iron Python and Iron Ruby) and the way that C# will be taking advantage of the DLR. It’s fascinating to see the evolution of programming languages and how the trends of dynamic, functional and concurrent programming are influencing this evolution.

Here are the links that I gave out in my session:

http://www.codeplex.com/IronPython

http://ironruby.net/

http://www.codeplex.com/dlr

http://devhawk.net/

http://blog.jimmy.schementi.com/

Dynamic Languages on .NET (www.microsoftpdc.com)

http://ironpython-urls.blogspot.com/

http://www.ironpythoninaction.com/

I also mentioned the Anders Hejlsberg session on the future of C# – you can watch that here – and a Channel 9 video of Anders Hejlsberg and Gilad Bracha discussing language design, which you can find here.

As part of the preparation for the session, I exchanged some emails with a few folks including Michael Foord.  For those of you who’d like to see Michael’s take on this subject, he’s posted about it here.

Written by remark

May 8, 2009 at 5:29 pm

MSDN eBook available

with one comment

Eric has posted the lowdown on the MSDN eBook that’s just been made available.  It includes a short article I wrote about the DLR along with another 12 bite size articles that cover everything (well, nearly everything) from IronPython to developing games with XNA.

Written by remark

April 21, 2009 at 6:04 pm

To Your Good Health

leave a comment »

I’ve been busy with a couple of Proofs of Concept recently. The second of these that I worked on was iWantGreatCare. iWantGreatCare is a website that lets you submit reviews of doctors, both GPs and specialists. The existing site is built using Ruby on Rails and MySql. The Proof of Concept (PoC) was built in three weeks by a small team from Microsoft, iWantGreatCare and DotNetSolutions.

We had a few objectives for the PoC. We wanted to show:

  • Integration with healthcare providers’ systems
  • Intuitive, engaging user experience
  • Extensible architecture
  • Fit of Microsoft Technologies

We focused on a key scenario based around a mother with a son who requires medical attention who has just moved to a new area. This scenario covers finding a GP, reviewing the GP, finding a specialist and reviewing that specialist. We also looked at how healthcare providers could use and analyse the data that is created by these reviews.

 image

We chose to build the site in ASP .NET MVC (version 1.0 of which has just been released.) Using ASP .NET MVC allowed us to build the site quickly and we were also able to extend it easily to provide different views (for instance, mobile phones and RSS feeds.) It is also readily learned by Ruby on Rails developers. The geospatial features of SQL Server 2008 made the location based searching far simpler than the existing implementation (we used Virtual Earth to show locations) – and Reporting Services provided drill-down reports that can be consumed by healthcare providers through the site. We also demonstrated integration with Sharepoint – a common technology in the NHS.

At the conclusion of the PoC, we had a working application that included all the features we had planned along with a couple of extras (the RSS feeds being an example.) ASP .NET MVC and the speed at which we were able to develop made this possible. iWantGreatCare are already well advanced with the migration to SQL Server 2008, and I look forward to seeing the ways in which the site develops.

Written by remark

March 20, 2009 at 5:32 pm

Posted in .NET, Architecture, c#, Microsoft

Tagged with

An Intelligent City

with 2 comments

Last week I presented the results of a Proof of Concept (PoC) at the Local Authority Urban Interest Conference, a sub group of ITS United Kingdom, which is the intelligent transport society for the UK. The PoC was completed the week before in the Microsoft Technology Centre (MTC). We had a team that included people from Microsoft, Birmingham City Council, Coventry University Enterprises, Shoothill and EMC Consulting. A PoC in the MTC is a three week exercise so you need clear objectives and a focussed team.

The Intelligent City programme is a Birmingham City wide initiative to “address key urban issues relating to transport, tourism, security and climate change through the exploitation of information technology”.

As with any PoC, there are some proof points. In this case the key points are to:

  • Articulate and demonstrate a slice of the shared Intelligent Cities vision for Birmingham
  • Demonstrate an interoperable service layer platform integrated with existing data / services
  • Demonstrate compelling user experiences cross-device – manage a journey tracking and hopping across devices and modes of transport
  • Demonstrate empowering individuals to make more informed, smarter choices

For the PoC, we focussed on transport and looked at a couple of specific scenarios. The first scenario is that of someone – we called him Colin – staying in a hotel in Birmingham who wants to visit his aunt during his time there. The second scenario focuses on Colin driving into the centre of Birmingham to go to the offices of a client.

We had data about the road network, the bus routes and schedule as well as access to a service that gave us real time positions of buses on some routes and data of traffic levels.

At the heart of the solution is a service layer that is able to create, store and share routes using that data and services we had available to us. We also built 3 client applications that used this service layer: a website, a mobile application and a mock sat-nav application. As you’d expect, the service layer is WCF, C# and a SQL Server 2008 database.

It’s probably worth saying a little about the routing before going any further. The routing algorithm had a model we built up of the road and bus network (including the schedule we had) so it could provide multi-modal routes across Birmingham – there is no park and ride scheme as such in Birmingham, so a car route is a car-only route for the purposes of the PoC. The way the model was created means that adding in other forms of transport would be relatively simple, provided you know where the modes of transport intersect (e.g. where a train station or car park is.) Adding in realtime information about journey times would also be simple.

The website is an ASP.NET App that shows traffic levels in Birmingham along with the realtime bus positions we have layered on Virtual Earth. It can also be used to get a route across Birmingham – once a route has been created, the user can log in and save the journey. The journey can also be shared – this allows other users with whom the journey has been shared to see your progress along the route.

NetworkStatus

The mobile application is a Silverlight app that addresses a problem we all face getting around. It’s all very well plotting a route on a website, but can you remember it? You can print it out, but the print out doesn’t know where you are. A mobile application can take advantage of GPS, which is increasingly prevalent in mobile devices. You can log in and retrieve the route you previously saved and the application will guide you along your route – including getting on and off buses. If you’ve chosen to share your route, it’ll upload this information so those people with whom you’ve shared your route can see where you are and when you’re expected to arrive.

Mobile UI

The mock sat-nav application is a WPF application that is intended to show what a sat-nav could do to take advantage of the service layer. It shows how you could choose to be directed to a public car park near to your destination (you could use the mobile app to get from the car park to your destination.) During the journey, the car park fills up, so the sat-nav alerts you and directs you to the next available car park.

SatNav

Having the service layer made each of these applications quick to develop – and allows the development of other applications. Demonstrating these applications brings that point home and shows how a big difference can be made to our experience of Birmingham in the very near future.

Written by remark

March 12, 2009 at 7:35 pm

National Rail Enquiries at TechNet Video

leave a comment »

The video from the TechNet Event that was held on October 1st at which the National Rail Enquiries Proof of Concept was shown is now online.  You can watch it here – click the National Rail Enquiries link beneath the video player.  On my screen the video is a little small to get the full UI experience, but the commentary from Jason Webb and Stuart Harris is well worth it. While you’re there, check out some of the other videos.  And if you’d like a second opinion, Mark Roddis shares his thoughts here and here (right at the end of this post) about the presentation.

Written by remark

November 4, 2008 at 11:26 pm

PDC 2008

leave a comment »

I was at PDC 2008 last week.  There’s been a lot of coverage of the keynotes – I really got the sense that these keynotes were marking an important point in all things computer-related.  If you missed the keynotes, you can watch them online (day 1, day 2 and day 3.)  Beyond the keynotes, I was impressed by the number of delegates and the required logistics.  There was some great content outside the keynotes, too.  There were three sessions that stood out for me:

Dynamic Languages and .NET – If you have any interest in .NET, you must watch this session.  The evolution of the .NET platform to accommodate dynamic languages has some unexpected bonus side-effects.

.NET Services – Clemens Vasters explains the .NET Service bus, which solves a bunch of otherwise difficult problems.

Contract Checking and Automated Test Generation with Pex – I’ve always been interested in design by contract because it makes the intent of your code clearer and should reduce the need for a lot of grunt tests.  This session shows how this functionality is coming to .NET and how Pex can help.  Eye-opening.

I heard and learned a lot last week.  I think we’ll be hearing echoes of this conference for quite some time.

Written by remark

November 3, 2008 at 7:33 pm