Python Programming, news on the Voidspace Python Projects and all things techie.
Computer Problems: Any Ideas ?
A few months ago I upgraded my computer, to the Delta ST6, a move I'm very happy with.
The old computer is an AMD XP 3000+ with 1 gig of RAM, so not quite obsolete yet.
I'd like to give it to a friend, but it has just died on us.
I wonder if any of you can give me any insight into the problem. It may just be a PSU problem, but I'm worried there may be more to it. Maybe you could suggest some things to try.
On switching it on a few times my friend noticed a some odd crackling noises. Eventually it crackled its last, made that computer-death-burning-smell and died. sigh
The only spare PSU I have is an old ATX 230Watt one, which doesn't have its own on/off switch.
The original one was 500W, but only because I specced that when I bought the computer. I have no idea how much juice a modern computer actually needs .
I tried replacing it with an old 230W PSU, the only spare I have, which doesn't have an on/off switch. Putting this in does absolutely nothing. This surprises me.
I guess that power supplies without an on/off switch only spin-up the fan when power is being drawn. The computer has an on/off button on the front, which has the usual 'on-motherboard' logic to manage it. There is no response to pushing this button.
This makes me worry that the motherboard is blown as well ? It is a fairly standard ASUS A7N8X-X. I can buy a replacement PSU fairly cheaply, but does anyone have any clue as to whether this is likely to be the problem (or any other clues for that matter) ?
I've tried stripping the computer down to a motherboard, cpu and ram (no drives or PCI cards) and connecting a PSU which I'm pretty sure works. A green LED on the motherboard lights, but the PSU fan doesn't spin up. So either the motherboard power logic / switch is faulty, or the motherboard is dead. (Or both power supplies are dead; which is pretty unlikely.)
Thanks to those who made suggestions.
|||Single hard drive, 1 gig of ram, 128mb graphics card, a big fan for the CPU and a couple of CD/DVD drives.|
PyCon and the Test Driven Development Tutorial that Could Have Been
The PyCon organisers have decided on the talks and tutorials :
There is also a draft conference schedule available as a google spreadsheet.
Our talk on IronPython and Windows Forms has been accepted, and is currently scheduled for Sunday morning in the Mesquite room.
We also proposed two tutorials which have been rejected.
- Developing with IronPython and Windows Forms
- Test Driven Development
I'm quite pleased they have been rejected (although surprised that neither was accepted). Work is going to pay for us to go to the conference and I have a project scheduled for next year that will occupy most of my time.
Talking at PyCon and RuPy should be quite enough.
We didn't get any reviewer feedback on the tutorials, which would have been helpful.
In retrospect we could have retargeted the IronPython tutorial on broader aspects of .NET and the TDD tutorial may have been more interesting if we hadn't suggested using our IronPython functional test suite. It was convenient for us as we have a very well developed functional test suite written for IronPython , and the principles are very portable for developing a functional test suite for any framework, but it probably made the tutorial less appealing.
We also billed the tutorial as Developing Rich Client Applications through Test Driven Development. The TDD approach is applicable to most forms of development, so pitching it only for developing Rich Client applications was unnecessarily restrictive.
I include the text of the proposal below, as some time in the second half of next year it would still be an interesting thing to do. I have a plan for a project on the back-burner that (if I ever get round to it) will involve creating a functional test suite for a GUI toolkit, probably wxPython. Perhaps the tutorial could be worked around this.
Developing Rich Client Applications through Test Driven Development
The Test Driven Development Methodology
A tutorial proposal, by Michael Foord and Andrzej Krzywda.
Andrzej Krzywda has previously given the following presentations:
- The Academic IT Festival (Poland) 2006: Developing with Ruby on Rails (including live coding)
- National Software Engineering Conference Poland (2004): Aspect Oriented Programming with Java
Andrzej and Michael are both currently employed at Resolver Systems, developing a desktop application with IronPython and Windows Forms.
The development techniques we use include various aspects of eXtreme Programming.
- pair programming
- 'User Stories'
- DTSTTCW (Do the simplest thing that could work) and YAGNI (You aint gonna need it)
- continuous integration
- TDD (Test Driven Development) with both unit tests and functional tests.
Our product is a full desktop application, and has Python integrated in a very interesting way. We are hoping that we will be able to briefly demo the project as part of the tutorial, to show what is possible with IronPython.
Test Driven Development is a development methodology that results in better code, and a happier experience for the developer. Many developers are scared of this approach, fearing that writing tests first slows down the development procedure. We aim to show that not only is TDD simpler, by structuring your thinking about the code, but also saves time in the long run by making 'bug hunts' a less frustrating and time consuming procedure. It results in higher code quality, by encouraging developers to code in testable modular units and making API decisions before they hack out the code.
The tutorial will illustrate the Test Driven Development process (with 'live examples' using IronPython and Windows Forms) :
User Story -> Functional Test -> Unit Test -> Code
Although this proposal will illustrate TDD with a rich client application, the principles are applicable to most projects.
The subjects covered by the tutorial will include :
- The advantages of Test Driven Development
- Functional testing and unit testing: the difference (and why have both)
- The principles of testing and using unittest.py
- Developing (and evolving) your functional test framework
- Mock Objects for testing
- Write the functional test, then the unit test, then the code: Test Driven Development. How and why.
- Unit testing, what is a unit ?
- Refactoring - evolutionary architecture
- Finding solutions - Spiking
- That bug is really dead - regression tests
- Testing performance problems
- Retrofitting tests to an existing project
- Tests as specification, behaviour driven development
This is relevant to both professional developers and those running open source projects. It is accessible to anyone of an intermediate level and beyond, although as it is largely architectural and not highly technical the bar is quite low.
|||Which it may be possible to Open Source some day.|
TBS Website Award (and other programming chit-chat)
The builder's merchant I worked for for ten years, Towcester Building Supplies, has come runner up in an award for the quality of its website :
This is great for TBS and also for Jimmy Norden who created the website. He is largely self-trained and has done a great job.
The reason they didn't scoop the top place was because they don't yet have automated buying through the website.
Terry is one of the cleverest geeks I know. He has created a barcode generator written in pure postscript so that it can run on the printer. This thing gets used everywhere. He has also worked with CERN on developing a compressed XML format, which can be queried in its compressed form . He turned down a job with google because he wasn't willing to move away from Leicester because he wanted to stay involved with his church. It was through the church that we met.
Despite his geek credentials we still have 'technical differences' (of a friendly kind). The online buying system of Goodness Direct is written in Perl. Terry became a fan of Perl back when it was the logical choice for web-developers wanting a dynamic language. I think he has now tried Python, but doesn't like it. He would probably appreciate Ruby.
I know lots of people who develop with Python who have experience of C++. Very few of them have much good to say about it, particularly compared to its 'still-going-strong-predecessor' C.
When I was considering learning C in order to extend Python , Terry recommended C++ instead. He said that moving from C to C++ was like the donkey who had been tethered to a pole. Even when the tether is removed (and you move from C to C++) the donkey never moves far from the pole... To learn C++ at its best, do it without being contaminated with preconceptions learned from C.
|||Part of the same group of companies as TBS.|
|||So that the tera-bytes of data generated by atom smashers can be stored using a lossless compression, but searched and queried in its compressed form.|
|||Extending IronPython with C# is much easier as you don't have to worry about memory management and don't have to use the Python C-API at all. Because IronPython objects are also .NET objects, the integration is virtually seamless.|
Categories: General Programming
IronPython and Windows Forms at PyCon
The talk is entitled Developing with IronPython and Windows Forms and will cover subjects like :
- What is IronPython
- Why use IronPython (and when not to use it)
- What is Windows Forms
- Examples of using Windows Forms (quickly show off the API and the way to access it from IronPython)
- Problems developing with IronPython and differences from CPython
- Integration with C#: Extending IronPython, using third-party components and .NET classes, the IronPython engine (integrating IronPython into C# applications)
The comments from the reviewers were very interesting. Lots of them thought that the topic was too broad for a half hour talk although there was disagreement on whether we should focus on the .NET integration or the Windows Forms stuff.
A couple of the reviewers came down on the side of the Windows Forms integration (which in my view is a killer use case for Python: Windows Forms is a great GUI API for Windows developers).
We can do a very quick overview of IronPython itself, I guess all the attendees will be familiar with it. We will also cover the differences between CPython and IronPython and what sorts of projects IronPython is suitable for.
I think that in twenty minutes or so we can give a good (if shallow) introduction to Windows Forms, and possibly also demonstrate extending IronPython with a simple C# class.
We have submitted a tutorial proposal to give a three hour session on the same topic. Obviously this would go into a lot more depth. We haven't heard back on the tutorial yet. (We have also submitted a Test Driven Development tutorial proposal and offered to do one or the other.)
|||Myself and my colleague Andrzej Krzywda.|
Movable Python Documentation Complete
At long last the documentation for Movable Python 2.0.0 is complete.
If you can't wait for the next release, you can download them as a zip file :
The documentation now covers all the new features in Movable Python 2.0.0.
New and updated pages include :
How to configure Movable Python and use it with multiple interpreters. This can include installed versions of Python or any executable.
Configuring the programs launched by your Quick Launch buttons.
Launching the IDE of your choice from Movable Python.
Movable Python can log the output of all Python files that you run. This page will tell you how.
Using Movable Python from the command line, including the special options unique to Movable Python.
The special files that Movable Python uses. (Including customize.py and the movpy module.)
Movable Python itself, including a free trial version, can be downloaded from The Movable Python Download Pages.
Ordered Dictionary 0.2.2
After a break of almost a year there has been an update to odict the Ordered Dictionary.
The latest version is 0.2.2, with changes implemented by Nicola Larosa.
What is odict?
odict is a pure Python implementation of an ordered dictionary. It keeps keys in insertion order and allows you to change the order. Methods (including iteration) that would return members in an arbitrary order are now ordered.
There is also the SequenceOrderedDict that behaves like a sequence as well as a dictionary. It allows slicing and the keys, values and items methods are special sequence objects (which are also callable and so behave as methods too).
What's New ?
Removed the TODO and CHANGELOG sections in the tail docstring (they are in the docs anyway).
Disabled warnings during tests.
Explicitly disabled tests execution on Python v.2.2 . In addition to the slicing tests, other ones are failing.
Removed code duplication between the __init__ and the update methods.
Also, based on code from Tim Wegener:
- added the rename method;
- removed a has_key usage in the __setitem__ method.
Moved the ISSUES chapter from code's tail docstring to here.
Moved up the Creating an Ordered Dictionary chapter.
Added prompts to the code examples and removed the superfluous print statements (sometimes they were there, sometimes they were not).
|||So either no-one is using it, or it's really good...|
IronPython at the RuPy Conference
It looks likely that my colleague Andrzej and I will be talking at the RuPy Conference in Poznań, Poland.
The subject will be Developing with IronPython and Windows Forms. We haven't submitted a full proposal yet, but the topics covered will include things like :
- What is IronPython (dynamic languages on the CLR)
- The basics of IronPython - the console
- The Python standard library and pure Python modules
- .NET terminology; assemblies and namespaces
- Accessing .NET classes
- The Windows Forms application event loop
- Event handlers and widgets
- Reading the Microsoft documentation
Whether or not our talk gets accepted the conference should be great. Of course it will be better for Andrzej who is Polish and develops with both Ruby and Python.
By then Resolver should be public, so we should finally be able to do a public demo...
On the subject of conferences, still no word from PyCon.
Sometimes it's Ok to be Smug
Obviously the language you program in is the best language there is, but sometimes it's ok to be smug :
A single global namespace for functions, with case-insensitive names. A recommendation not to use recursion, and you can't redefine a function.
Categories: General Programming
rest2web and Ordered Dictionary Improvements
There will be new releases for both of these soon, but in the meantime you can download the new versions from subversion :
The Ordered Dictionary is a class that keeps keys in the order of insertion, and allows you to change the order. Methods that would normally return items in an arbitrary order are ordered.
There is also a subclass SequenceOrderedDict that behaves much more like a sequence as well as a dictionary.
The latest changes make the Ordered Dictionary compatible with Python 2.5 plus some cleanups and efficiency improvements. These changes were made by Nicola Larosa.
rest2web is a website creation tool, using templates and ReStructuredText (optional) for page contents.
The latest changes are for compatibility with Python 2.5, improved error messages for some errors in templates and a new sortpages method for the sections in templates. Usually the page order is determined by the section-pages value in the restindex. If you don't use the section-pages value, you can use the sortpages method to sort the order. You either pass in a function to sort the pages, or the string link-title to sort the pages alphabetically :
This work is licensed under a Creative Commons Attribution-Share Alike 2.0 License.