Python Programming, news on the Voidspace Python Projects and all things techie.

Embedding IronPython 2 and the Dynamic Language Runtime (turtles and articles)

emoticon:home One of the most impressive things about DLR based languages like IronPython and IronRuby is how easy they are to host in applications to add dynamic features. You can even host IronPython in IronPython, something that Resolver One makes good use of to provide a separate execution context for each spreadsheet.

During the development of IronPython 2 the DLR was changing regularly and each new release seemed to bring breaking changes to the API. This means that most of the online examples, including my own articles, quickly became out of date. I've finally updated all my articles (except for one on creating a custom executable which is clearly marked as being for IronPython 1). There are quite a few different articles and examples for download here, covering various different aspects of embedding IronPython in C#. As the hosting API is common between DLR based languages, most of these articles also apply to IronRuby as well:

Included there are a couple of new articles. My favourite being the Scripted Turtle!

The logo-like-turtle moved by the power of Python

This is a logo like turtle that can be moved around by either pressing buttons or using an IronPython scripting interface. It started life as an example of embedding Powershell, but was very easy to adapt for Python. It comes with a bunch of examples built into it and is a great example of how easy it is to add Python scripting to an application (just a handful of lines of code).

Perhaps more useful is this article:

This is quite a long article that gives you a great overview of the DLR hosting API, including details like error handling and interacting with dynamic objects from a statically typed language like C#. It walks through one of the embedding examples from chapter 15 of IronPython in Action, which is still the best reference if you are interested in embedding IronPython. Smile

All of these examples, along with my Silverlight Examples, book code and sources for the PyCon IronPython Tutorial are all stored in a Google code repository:

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2009-02-15 15:11:40 | |

Categories: , , , Tags: , ,


Supporting Free E-books with Book Donation

emoticon:car Here's a really good idea that someone should do. Smile

Cory Doctorow likes giving electronic versions of his books away free; he believes in it and his publisher doesn't really mind because there isn't a lot of money in selling ebooks anyway. He isn't the only one, there are several prominent authors, and many not so prominent ones, who give away their ebooks free under a creative-commons license.

The problem is, what to do about the people who want to donate after reading the ebook. He can't accept donations because it screws with his tax and makes his publisher unhappy!

He had this brilliant idea of matching up people who want to donate with schools and public libraries that would like a copy of the book. That way giving away the electronic version directly drives more sales of the paper book and more people get access to the book. He started this program with his last book Little Brother.

The downside is that vetting people who request the book and administering the system costs Cory money. However, it could be centralised, with vetted individuals eligible for books from any of the committed authors / publishers.

Income could come from Amazon referral fees - and possibly a small charge either to the publisher per book or to the vetted individuals. It would certainly be cheaper than what Cory is currently doing as the vetting is the main cost and you only need to do that once. It is potentially a profitable idea, but would be better run as a not for profit so that it could take donations of money and people's time.

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2009-02-15 15:07:31 | |

Categories: , Tags: , , ,


Hosted by Webfaction

Counter...