Posts

Showing posts from August, 2009

apple broke a lot of its developer reference links... again

Was just reading a link on the apple developer reference, and sent a link to someone to read...

Then I noticed that the link no longer worked... and instead was redirected by the apple website to the generic front page of their developer reference.

I wish someone would point them to Cool urls don't change, and help them understand the web.

This isn't the first time they've broken their reference urls... the web is full of old, bad links to their documentation.

They've updated their online documentation... however they haven't kept the old urls around.

stab. un-cool.

ipython and doc tests. Cutting and pasting doctests into your shell.

Doc tests are a kind of literate programming for python. Where you type tests like you're typing stuff into an interpreter. In fact, it's easy to just type stuff into the interpreter and once you've finished playing around, copy the results from your terminal into a test file. This is a great, fairly low effort way of writing tests.

However, what if you have written them in your source code file, and not in the interpreter? Ok, so you've written some doc tests and you want to paste doc tests into your interpreter?

With the normal python interpreter you can't paste doc tests in(I don't think).

However the advanced ipython interpreter can. It has a special mode from writing doc tests. The command is called '%doctest_mode'.

The %doctest_mode command allows you to paste in doc tests, into the interpreter... and have them run. The normal python shell fails at this, as the '>>>' is not valid python syntax. The ipython ignores the '>…

cherrypy file upload

A common thing to do with web applications is to upload files. People want to upload their pdfs, upload their images, their word documents etc.

With cherrypy you can upload files using a few different ways...

This http://tools.cherrypy.org/wiki/DirectToDiskFileUpload method for uploading files with cherrypy seems a pretty good way *1.

This tool lets you upload a file directly to disk... which is handy if you're uploading a very large file. This means the webserver doesn't need to write it all into memory, and that it doesn't need to copy the file when it's finished uploading.


*1 However there are some security, and usability issues with this cherrypy tool(as currently written). Can you spot what they are?

zodb cherrypy and lxml - simple CRUD and OO database with python.

Below I have combined three python libraries to let you do a free-form CRUD document oriented database with a webserver. Where you can just pass it most any text based html form and it will be able CReate, Update, and Delete pages.

In the post I made about cherrypy + zodb and python I combined the best python object database 'zodb' with arguably the best python webserver 'cherrypy', to create a very simple key/value datastore. This time I've combined it with lxml, to give you a very simple free form CRUD document web application.

lxml is an xml library with a number of interesting features. Including a form filling library.

Below is a script which uses 'lxml' to fill in a custom form - specified in normal html - with data you have. lxml has many html/xml related stuff in it... including a css library, and is very fast. Well worth checking out if you need to do anything webby.


You can define your html form, and it'll save whatever fields you have into t…

london

So, here I am in London - having moved from Melbourne.

I've visited here a few times, but this time I'm going to live in London for a while. Maybe I'll like it and stay, perhaps I'll move on. Whatever the case I'll be living in London for a while.

Looking forward to meeting London people interested in art, programing, python, graphics, image processing, sound, music, video, games, multi media etc. I'll be at the 'August London Pyssup', Wednesday 7pm at The George.

Learning bits of the local language has been fun: in'it, cheers-ta, etc

pyconuk unconference - september 5th.

'PyCon UK 2009 will be held on Saturday 5th September at the CBSO Centre, Birmingham.

Pycon UK 2009 is an UnConference. This means that the delegates arrange the schedule on the day. There's no submission process, and no schedule. You turn up with whatever material you wish to present, you choose which talks are given and which workshops are held on the day.'


It's only £10 if you pre-book. http://pyconuk.org/booking.html. If you're planning on going, please pre-book now, so the organisers have a better idea of numbers.

More information can be found about the unconference at the website: http://www.pyconuk.org/

gvim cmdline OSX - macvim from the terminal

macvim doesn't seem to install a 'gvim' command. So opening files from the terminal with gvim doesn't work.

Add this to your .bash_profile
function gvim { /Applications/MacVim.app/Contents/MacOS/Vim -g $*; }
Then you'll need to source your shell, or open new shell tabs. Or paste that line into your current shell. Then you can open your files again with OSX gvim and the terminal.


aaaaaaah. Sigh of relief at being able to open files from the cmd line again :)

pygame 1.9.0 released!

Image
What's new (heaps of things since 1.8.1):
http://www.pygame.org/whatsnew.shtml

Takes the "pure" out of "Game Development"
An Open Source Community Project


Summary of changes:
- many, many fixes and improvements. The largest amount of changes has gone into this release than any other pygame release.
- bug fixes for backwards compatibility issues introduced in pygame 1.8.x series. old games like solarwolf and libraries like PGU work again.
- experimental camera webcam module (still in development).
- experimental midi module based on portmidi and pyportmidi (99% complete).
- experimental gfxdraw module based on SDL_gfx (including AA circles, textured polygons and other goodness).
- python3, and python3.1 support mostly completed. Some modules still remain to be completed - but mostly it's working.
- nokia mobile phone s60 support.
- improved OSX support (dropped pyobjc dependency, improved installer, sysfont now works on OSX).
- pygame.examples + pygame.tests …