A Good Mix 10: WPF, .NET Introspection, the Solver Foundation, Resolver One and Cobra

Another selection on a wide range of topics from the last few weeks.
Resolver One is an IronPython spreadsheet system and is the largest IronPython codebase in production. Normally a new release would be big news but we've already covered the Python console which is the biggest new feature in version 1.5. Other big new features include CSV import / export and a goto line dialog for the code editor. You can read a full list of all the improvements in the changelog. Now that 1.5 is out we're working hard on features for version 1.6. Our latest blog entry has a sneak preview of one of the coming attractions.
For Python methods you can use the inspect module to get information about methods / functions; like what arguments they take and so on.

Methods on .NET types don't have the attributes used by inspect (although methods of Python objects defined in IronPython work fine). We can get around this by using .NET reflection to introspect them them.

Reflection is normally done with classes from the System.Reflection namespace. We don't have to use these classes directly, but get them indirectly.

This IronPython Cookbook entry is an example of getting information about the OpenStandardOutput method of the System.Console class. We can then get the return type (something not available in Python) and the names of all the parameters.
A Japanese blog entry showing example IronPython code for a movie player capable of playing H264 encoded movies using the Windows Presentation Foundation MediaElement class (in 34 lines of code).
Microsoft Solver Foundation is a solver framework. The webpage is so full of buzzwords that its hard to get a clear definition of what it does. This looks like the closest:
Solver Foundation uses a declarative programming model, consisting of simple compatible elements that are solved by application of solvers, meta-heuristics, search techniques, and combinatorial optimization mechanisms to accelerate the solution finding process. Building a model in Solver Foundation is as simple as specifying the decisions to be made, constraints to be respected, the goals to be used to evaluate candidate proposals (solutions) and the data to be processed by the model (historical or projected parameters).
This kind of approach is very useful for working with data in spreadsheets. Suresh has posted some example IronPython code (an Optima Petro Sample) which works standalone or can be used with Resolver One.
Another Japanese blog entry from the blog that brought us the video player example. This example code shows using the Windows Presentation Foundation GUI library to create a simple window with Menu and shortcut keys. The menu is populated from a small snippet of XAML.
Cobra is a Python inspired programming language for the .NET framework. We've often covered news and updates on Cobra here on the IronPython-URLs blog. This article in the June edition of MSDN magazine, by well known .NET developer Ted Neward, is the first installment of a column on Cobra:
In the first installment of this column, I discussed the importance of understanding more than one programming language, and in particular, more than one kind of programming language; just knowing C# and/or Visual Basic isn't enough to stand out against the mob anymore. The more tools in your toolbox, the better the carpenter you become. (Up to a point, anyway—'tis the poor carpenter who owns every tool ever made and yet still doesn't know how to use any of them.)

In this installment, I'll examine a language that's not too far removed from the object-oriented languages you're familiar with, but has a few new features that will not only offer some new ideas, but potentially kick-start some new ways of thinking about your current tool set.

Allow me to introduce you to Cobra, a descendant of Python that, among other things, offers a combined dynamic and statically typed programming model, built-in unit test facilities, scripting capabilities, and some design-by-contract declarations.


Comments

Popular posts from this blog

Extending Abobe Flash Player and AIR with Python and Ruby

IronPython Tools for Visual Studio CTP3

Further Adventures of the Debugger