Tuesday, May 25, 2010

A Good Mix 36: Jim Hugunin, Selenium Two, Embedding IronPython & IronPython with Expression Blend

Another collection of IronPython and DLR related articles from recent weeks.

Jim Hugunin is a bit of a Python veteran. As well as being the creator of two implementations of Python (Jython and IronPython), he also started the Numpy project (back when it was called Numeric). Not long ago he was swallowed by Microsoft, who also took on the development of IronPython and turning it into the Dynamic Language Runtime.

In this video interview Jim explains not only how he got involved in Python, but also what he has been up to recently.
One of the ways that .NET helps you separate your visual design from your application logic is through XAML; an XML based declarative language that can be used with both Windows Presentation Foundation (WPF) and Silverlight.

Naturally there are design tools that will generate XAML. Visual Studio is one of them, but the best one is Expression Blend. XAML has features that make it particularly suited for integration with statically typed languages (statically binding events to your code in your XAML for example), but it can still be used with IronPython - slurping up the XAML dynamically at runtime (including generating or transforming XAML) with the XamlReader.

Simon Segal has been looking at how he can use both Expression Blend and Visual Studio with his IronPython projects:
Finally I decided to synchronize two separate .XAML files in each of the two different projects, so the challenge was to find the most unobtrusive way of working in both IDE’s and easily syncing the the .XAML files after edits had been made. Given that one of the IDE’s was running a dynamic language with a REPL built in, I thought it shouldn’t prove too difficult.
...
Like I said its far from a perfect solution and to be frank it’s somewhat annoying however my frustration is another thing altogether if I’m faced with doing all my layout and design in Visual Studio – so I will live with it for the moment. Hopefully the IronPython team and or the Expression Blend Team can find a solution that flows changes through more seamlessly in the short term and the perhaps in the long term allow us to open IronPython and IronRuby projects in Blend.
By the way if your wondering about the codename of the project that drove this adventure (PONGO) – the answer is yes if you guessed that it’s something that revolves around IronPython and MongoDB and I will be blogging about that more in the coming weeks.



Selenium is probably the best known / most widely used web testing tools and it supports a host of different languages. At Resolver Systems we've used the .NET Remote Control for Selenium from IronPython for quite a while. This article is a tutorial on using Selenium 2 with IronPython and Internet Exploder:
This tutorial is to show how to use the .NET Selenium 2 with dynamic languages that run on the .NET Common Language Runtime. This tutorial uses IronPython.
To complete this tutorial you will need to have IronPython installed and you will also need to download the .NET Bindings from Google Code
This tutorial will not be using the Remote Driver and it will be using the InternetExplorerDriver as this is the only complete browser at the moment that doesn't need to be built from the Repository.
Yes, over the years I've been making entries in this blog we've seen a whole host of blog entries showing examples of embedding IronPython in .NET applications, but it is always fun when another developer discovers just how easy it is:
A requirement I have in an app I am writing is to allow the administrator to set up formulas which can be calculated at runtime. The client app is completely disconnected from Enterprise Core Objects, it uses a (query/command)->response approach so I didn’t want to expose OCL on the client, I also didn’t want to use OCL because I didn’t want arbitrary browsing of the model.
So I have been looking at IronPython – and I like it! I’m not going to go into details of what this code does, I’m just going to paste it so that you may take a look. In short the requirement is for the Admin to be able to retrieve values from the DB by name and perform whatever logic they wish in order to return a decimal result.


No comments:

Post a Comment

Note: only a member of this blog may post a comment.