I wanted to quickly and easily convert a series of reStructured text documents into HTML equivalents. For reasons too dull to discuss here I couldn’t just use rst2html.py and didn’t want to go to the trouble of remembering enough bash syntax to write a shell script.
So I thought that as long as docutils is written in Python it would only take a moment or two to knock up a script to do what I needed. Well yes, and no. The script itself is fairly simple;
from docutils import core
def convert_files(name_pattern):
for file_name in glob.glob(name_pattern):
source = open(file_name, 'r')
file_dest = file_name[:-4] + '.html'
destination = open(file_dest, 'w')
core.publish_file(source=source, destination=destination, writer_name='html')
source.close()
destination.close()
The most useful line being the one where I call core.publish_file. But it wasn’t immediately obvious from the docutils documentation what series of incantations would achieve my desired results. Luckily, after some time spent perusing the documents I came across this dissection of rst2html.py. This, in turn, lead me to the description of the Docutils Publisher, which lists the convenience functions available to work with the engine.
The end result isn’t particularly elegant but it does get the job done and I thought I would share it in case anyone else has a similar need in the future.
I’ve always said that the appeal of any operating system – for me – is that I can fire up a terminal window and tinker around. When I say that many people look at me like I’ve got rocks in my head. But I’m glad I am not alone.
I just read a fascinating article by Ed Smith called “Are We Too Professional?” which, although it is ostensibly about cricket, covers too many interesting topics to disect here. But it did prompt a couple of observations.
One is that he is bang on the money and that some of the best performances – at work, play or scientific endeavour – come from those who don’t always follow the proscribed practices. But this then lead me on to the thought that professionalism, especially in the contexts that Ed quotes it in the article, is often just used as an excuse to implement restrictions on people who are perfectly capable of thinking for themselves and shouldn’t need them. But for whatever reason those in authority don’t trust and think that without these controls there will be chaos. This is illustrated by the example he quotes of teachers having to plan their lessons in 3 minute chunks. Some of my favourite teachers at school often couldn’t plan how to get to their classrooms from the staff room, heaven help them if they had had to go into this level of lesson planning.
The other observation is that, as with many other things, the devil is in the details. Professionalism itself isn’t a bad thing, as long as you don’t confuse it with being good at what you are supposed to be achieving. Sure, having a “mission statement” can be a bad thing. Especially if it is as bad as –
“ICI’s vision is to be the leader in creating value for customers and shareholders through market leadership, technological edge and a world competitive cost base.”
After reading that I still don’t know what it is that they do. What is wrong there is not trying to define the purpose of the organisation, it’s how they have gone about doing it. Maybe they should have gone for “Be the best chemical producer in the world”. Just a thought.
Anyway, enough of my rambling, go and read the article.
This last weekend I released version 0.3.5 of gerald.
The major component of this release was to add a ‘User’ class to the oracle_schema module. This is similar to the ‘Schema’ class but whilst that shows all of the objects a database user owns the ‘User’ class contains details of all of the objects they can access, including those owned by other database users. This was requested by the sqlpython project to enable them to use gerald for database introspection.
The only other change was to ensure that the NotImplementedError exception is raised in all of the super type methods that are just stubs. This is mainly in the Schema.py module and thus meant that I had to add a set of tests for this module.
Development, bug and issue tracking and the project wiki are available on the project Trac site. Source code and distribution files are available at the sourceforge page.
The next release will be 0.4. Exactly what will make up that release is still evolving. To see what is in the release and to track progress take a look at the version 0.4 roadmap.
I had a bit of an epiphany over the weekend. Luckily I managed to clean up afterwards. Actually, it was whilst I was cleaning up that I had the thought.
As I removed the plastic wrapper from the latest set of phone books, dutifully placed it in the bin and then took the books themselves and put them straight into the recycling I realised that I haven’t used a phone book in nearly ten years.
I don’t need phone books any more. I have White Pages, and Yellow Pages. In this country both of these web sites are provided by Sensis, who also publish the paper books that land on my doorstep only to be put straight in the bin. But then I realised that I don’t use those sites either.
If I want the number for a business I Google them and look for a number on their web site. Because these days everybody has a web site, right? If they don’t have a web site they generally don’t get my business. Which is harsh, but who wants to open up a big book and find a business, or even worse figure out what category to look up and find an advert for an appropriate business on one of several pages in a directory.
For people my approach is just as simple. If I want to call someone I generally have their mobile number. Failing that I’ll have their email address and I’ll send them an email asking for their number.
Thinking about it I rarely ring more than a handful of people on their home or other fixed line phones. There are people that I’ve known for years who’s home telephone numbers are a complete mystery to me.
It would seem that I am not alone in this either. There was a big story in the Fairfax press only a day after I had chucked my phone books away – Millions set to disconnect their fixed-line phones – and even the Telegraph in the UK had this issue as number 8 in their list of 50 things that are being killed by the internet.
As I think about this I struggle to think of any reason why I would need a printed phone directory ever again. Is there a way to tell Sensis not to send me them any more?
I sent an email to a colleague earlier today. I just read the out of office auto reply that I received in response:
“Note: I will be on a holiday until 5th January 2009. Please resend your important emails after my return date as I will delete all email sent before that date. Perhaps put a calendar entry in your diary. See you all when I come back.”
Who said customer service was a dead concept?
Dear Lazyweb, what should I put in a website style and branding guide?
When I’m developing software applications I am used to producing a number of guidelines that should be followed during development. These usually cover:
- Architecture – these are the parts of the system and how they interact
- Tools – these are the things you will use to build the system
- Coding standards – these are the practices you should adopt with the tools we are using
- Design – this is how the application will look and interact with people
I’m currently building a web site and struggling to find good examples of the last part. We have graphic designers engaged on the project but they don’t have any templates to work from so we need to come up with our own. I don’t want to re-invent the wheel so can anybody recommend a good template for a web site style guide?
I have found a couple of examples on the web, from Monash and Penn State Universities but would be interested in looking at any more that anyone can suggest.
I’ve just added a couple of plugins to this here blog, in preference to writing something useful, can you do me a favour and leave me a comment. In it you can tell me if the funky new preview functionality works for you or not.
And if you are using Internet Explorer 6 you should be seeing a yellow bar at the top of the page. Shame on you and let me know, because then I will know that the plugin is working and I can remove you from my address book. Double bubble.
I’m currently in the foyer of the Sydney Masonic Centre setting up the registration desk for the Open Source Developer’s Conference 2008.
It may be late notice but if you want to see keynotes by Larry Wall, Chris DiBona, Anthony Baxter and Pia Waugh, not to mention interesting talks by another sixty or so speakers, you can still register up to the official conference opening tomorrow morning. More details can be found on the conference web site. Come and say hello if you make it.
Early bird registration for The Open Source Developers’ Conference 2008 is now open.
OSDC 2008 is a conference run by open source developers, for developers and business people. It covers numerous programming languages across a rangeof operating systems, and related topics such as business processes, licensing, and strategy. Talks vary from introductory pieces through to the deeply technical. This year we have an exciting selection of presenters and keynote speakers including:
- Larry Wall, the creator of Perl
- Chris DiBona, Open Source Programs Manager for Google
- Andrew Tridgell, Founder, Samba Team
- Anthony Baxter, Python Evangelist
- Pia Waugh, Consultant, Waugh Partners
Check out the draft program: http://www.osdc.com.au/2008/papers/
Please visit http://www.osdc.com.au/2008/registration/ to register. Early bird registration closes on the 27th October, 2008.
For more information about this event, please visit: http://www.osdc.com.au/.
Comments Off