Wednesday, October 27, 2004

Forthcoming projects, encryption and javascript.

Well I've done it, I've written a program in a language other than Python - and it wasn't one of the ones I expected to learn.

I admire and envy those who can speak more than one language. They say the language you speak shapes the way you think. More than that though, it shapes the things you are able to think. Computer programming is similar - the language you use affects the way you approach problems. For a while I've known it would make me a much more flexible programmer if I learned another language.

I already have a partial advantage over people who are studying computers now. Don't get me wrong, I'm no expert - I did a year and a half of law at university before dropping out. Now I sell bricks for a living ! I'm not a computer professional. When I was young though, the average CPU was clocking a blistering 4mhz and could address a whole 64 KiloBytes of memory. It made sense to attach LEDs to processors and program them with switches, and it wasn't too serious if you blew a few up. These days the hardware is so phenomenally expensive and complex that you would never dream of doing anything like that. Not only is blowing up a Pentium 4 a serious business, but even if you could learn the pin out, what would you do with it ? Hand program 32 bit machine code to flash lights on and off ? As a result of my early 'hacking' I understand the basic elements of the computer on a physical level - like the data bus, address space, IO handshaking and other gnarly things. Most modern computer users are forced to deal with abstract concepts, that at best are analogies for the physical and electrical processes that are really taking place. Even programmers are sheilded from these 'implementation details'. This is particularly true for users of the modern dynamic languages, where memory management and other painful issues are all handled for us. There is a brilliant article on the subject called 'In the beginning was the command line', by Neal Stephenson. He says it far better than I ever could. I think a copy of it is in the computer section of voidspace.

I expected my next language to be C - because I thought I needed to learn a horrible static typed language for the speed advantage I would gain. A tasty blend of Pyrex and C would allow me to write python extensions for my speed critical stuff (and give me experience of those magic compiler chain incantations that seem so intimidating). Then I briefly toyed with the idea of learning Lisp. It's so weird that getting your head round it teaches you a lot about progamming.... apparently. Some very bright people say you *must* learn it, and some other very bright people say stay well away... I'd still like to learn it, but it will have to wait. With both these languages I got as far as the basics - a bit further with C. But.... wait for it.... I've just started messing around with Javascript.

My first program that is all my own work (very basic) just generates random strings for some javascript encryption stuff. I'm also wanting to build some more effective user interfaces to my CGIs and javascript seems to be becoming the way forward. So far I'm finding it a 'dinky little language'. I haven't got to grips with the document object model yet, which is how javascript interacts with the browser. There are two basic problems with javascript. The author of diveintoaccessibility reckons that as many as 11 percent of surfers don't/can't use javascript. A combination of old and weird browsers and company security policies. IE on XP with SP2 (how many two letter acronyms ?? yuck) switches Javascript off by default and forces you to allow it for every page - which makes browsing *really* annoying. The other problem of course is that every browser, and different versions of the same browser, implement javascript differently. This can result in nightmarish problems. My solution is to try and stick to core stuff and not use Javascript for basic navigation. My site must at least be navigable to people without javascript. I would like to use it to create better interfaces for my 'web applications' though.

Take a look at Kupu on This is the most impressive thing I've ever seen in Javascript. It's a WYSIWYG web page editor entirely written in Javascript. I'm *almost* building a project just to use it. You combine it with CGI to allow the online editing of webpages - for non-technical people. Very nice. I'm doing a set of webpages for the funding of our Jesus Centres where we have three teams working who need to share information.

The login will be done with a combination of Javascript for encryption on the client side and Pycrypto to unravel it on the server. New logins are done with DES encryption and subsequent logins just send the SHA hash of the password (hashed with a random string as well so that the hash sent is different every time - that's why wrote a javascript random string generator). This is all done by the way and will be 'released' for others 'soon' ! Logins that never send the plain password over the wire... Whilst we're on the subject of encryption - let me mention Truecrypt. It's effectively an encrypted filesystem - but the best I've ever seen, very nice. You give it a chunk of your hard drive and it 'formats it' with random data.It then encrypts files into this as you save them. It appears on your filesystem as a single file, but behaves like a file system. You can find it on sourceforge. I wonder if I ought to set up sourceforge projects for ConfigObj, Nanagram, Dirwatcher and approx ??

*sigh* Blogger is failing to publish this...... lots...
posted by Michael Foord on Wednesday, October 27, 2004

(1) comments

Monday, October 18, 2004

For a long time I've been looking for a decent 3d graphics engine for use with python. Either a real time game engine with texture mapping or a good renderer. Open source (or at least free as in beer) is also a necessity. Unfortunately all I could find was a collection of half maintained projects that weren't quite what I want. Thanks to a new set of links at I've discovered the nebuladevice.

Nebula Device is an open source realtime 3D game/visualization engine, written in C++. Version 2 is a modern rendering engine making full use of shaders. It is scriptable through TCL/Tk and Lua, with support for Python, Java, and the full suite of .NET-capable languages pending.

The screenshots look nice anyway.
posted by Michael Foord on Monday, October 18, 2004

(0) comments

Friday, October 15, 2004

I'm at my sister's house in York (that'sthe original, not the new one :-)

She's got a lovely broadband connection which I've been playing with whilst trying to clean up their computer. I think 'riddled with spyware' would be fair to say. Some of it extremely pernicious. I've always found the lavasoft ad-aware very good before, but it didn't recognise several of these. The most pernicious of these were midADdle and VX2. Ad-aware claims to have a special plug-in to remove VX2, which I run - it declares the system clean, I reboot and *bang* back again. It *might* be due to the way XP stores profiles - but ad-aware ought to be 'profile-aware' *sigh*. Anyway, I'm going to do an SP2 upgrade and try again. There's also something which has hijacked IE in a peculiar way. When you enter a domain that doesn't exist you get their custome search page. Unfortunately I can't find where it's hiding.... and neither can spybot or ad-aware. The hunt continues.... midADdle was very nasty - pop ups everywhere, but it was reasonably easy to get rid of once I'd found it.

Ha - update. The 8 viruses and trojans might have been a problem as well - someone's been doing some unsafe surfing !! Looks like Kapersky antivirus will put an icon in your system tray, but doesn't switch the monitor on by default !! Bizarre. You also have to create update tasks yourself. Reasonably easy for me, but not friendly for the beginner. It also alerted me about some viruses which it claimed it couldn't delete - when I went to delete them manually... no problem...
posted by Michael Foord on Friday, October 15, 2004

(0) comments

Tuesday, October 05, 2004

There's been some progress on the website revamp. I've worked out what I want to achieve with the new voidspace. I've typed it up as a ResT document, so there's now an online version of the New Voidspace Manifesto. There is also a link to the Temporary Location for New Voidspace, whilst I develop it. At the moment the odd size of the 'cyberpunk top 100' logo has pushed my sidebar down... bu it's getting there. All I've got to do now is convert my content across *grin*.

On the subject of which, I didn't realise how flippin' big Voidspace is. I'v been going through it and trying to see what content I want to keep. There's loads of stuff... It's going to be hard to decide what to keep and probably even harder to convert it.

I'm still looking for a new webhost. Three current front runners are, and It's a tough choice because changing host is a real PITA... on the subject of which I'm recovering from my op.
posted by Michael Foord on Tuesday, October 05, 2004

(0) comments

Sunday, October 03, 2004

I threatened to do it.. and I've done it !! I've learnt ResT... and it was nothing like as painful as my initial glance a year ago led me to believe. For most of the civilized world who won't have a clue what I'm on about... a few words of explanation.

HTML is rubbish for writing text in. It's ok for marking up documents for presentation - but it's no good for actually reading. This means most people have to write their content and then convert it to HTML. The trouble is that HTML has lots of fancy widgets - but generating them yourself can be a pain. This is why so many people use products like Dreamweaver. If you want to focus on your content you need some form of content management system.

I produce various kinds of documents I want to present online. Notably personal essays, which I haven't done any of for a while tut tut, and technical docs.

ResT is a plain text minimal markup. You only need the most basic of markup to delimit section titles, emphasis, paragraphs, code examples, links and even tables or images. It won't do everything that HTML does but it is very easy to write by hand and the text just looks like text. That means if you want to hand edit the source at any point it's no trouble. The trick is that instead of having to hand code any changes, a proram called Docutils generates the HTML from ResT source. It can actually generate documents in all sorts of formats, XML, LaTex, even PDF I think. It automatically produces a table of contents aand generates footnotes etc. The great thing is that it will also add class attributes to a lot of the stuff it generates. This means that in combination with CSS - that allows you to define styles for classes - you could actually use it to generate nice looking HTML.

To start with I'm just using the basic (obviously), but I've converted the ConfigObj documentation to ResT. There is a funky new HTML ConfigObj Homepage online. You can also view the ResT source to see what the markup looks like... very nice. (Link at bottom of the ConfigObj page).

Now that I'm starting to get to grips with CSS it might be possible for me to produce documents without so much heartache on the style and markup. When I say I'm getting to grips with CSS - I mean I understand the principle and have found an example that will produce the look I want. A leaner and meaner voidspace may yet happen.....

I've also got file upload from teh python urllib2 library working... hooray...
posted by Michael Foord on Sunday, October 03, 2004

(0) comments