Kevin Vance - My personal website is long overdue for some work. While it is…

Entries | Archive | Friends | Friends' Friends | User Info

10:26 pm

Saturday, May 16th, 2009
Previous Entry Share Next Entry
My personal website is long overdue for some work. While it is mostly dynamically generated, that generation comes from a handful of perl CGI scripts, rewrite rules, and (thankfully, at least) HTML templates. The problem is that if I want to add new content, I have to use the mysql command line to manually add it! This has dissuaded me from updating the site with little programs, etc. that should be in the archive.

I'm also extending the site to aggregate my various bloggy things into one page. I've been using twitter a lot more than LJ lately, so the LJ front-end currently on kvance.com isn't doing much good. Once that's set, it should be pretty easy to put out a complete RSS feed, maybe filtered over service, tags, or other parameters.

I'm doing the work with the django framework, which just for starters automatically gives you an admin interface based on your data model. And it's in my favorite programming language, and seems to be pretty popular, etc. Every once in a while, I'll poke around at some python web frameworks (I've used TurboGears in the past) but I seem to be making pretty good progress here.

I have it spitting out very plain views for projects, file lists, screenshot lists, and the multiblog. And I have a script to pull entries from twitter and LJ. Soon we come to my least favorite part: the actual web design and horrible, horrible testing process to make it work in every incompatible web browser. I heard somewhere that IE6 was dead, so nobody tell me otherwise okay? :P
Link )Reply )

Comments
[User Picture]From: rspeed
2009-05-17 07:02 am (UTC)
You know what's annoying? When using the zipfile module, there's no way to open a file inside the archive directly in text mode. Laaaaaame!
(Reply) (Thread)
[User Picture]From: kvance
2009-05-17 08:01 am (UTC)
Text mode as in translating \r\n to \n? You need to use the universal newlines mode.
>>> zip.open('dos.txt').readlines()
['Hello\r\n', 'world\r\n', '\r\n']
>>> zip.open('dos.txt', 'U').readlines()
['Hello\n', 'world\n', '\n']


Edited at 2009-05-17 08:01 am (UTC)
(Reply) (Parent) (Thread)
[User Picture]From: rspeed
2009-05-17 08:18 am (UTC)

Nah, that's not the problem. I wish it was that simple.

In Python 3 (I don't think is the case in version 2) zip.open() returns bite array object rather than a string. This makes some sense since a zip file is likely to contain binary objects, but it should allow a binary or text flag just like io.open. Here's what happens:

>>> zip.open('blah.txt').read()
b'whatevs'

If you try to use that as a string, all hell breaks loose. Luckily byte arrays seem to share some of the same methods as strings, including decode and encode.

>>> zip.open('blah.txt').read().decode('utf-8')
'whatevs'

The solution is simple, just annoying that it's necessary.



Edited at 2009-05-17 08:18 am (UTC)
(Reply) (Parent) (Thread)
[User Picture]From: kvance
2009-05-17 08:37 am (UTC)
Ah, gotcha. Yeah the bytes object is new for python 3. I guess the zipfile thing is an unintended consequence, but I still think the change was worth it. It's 2009, every string needs to be a unicode string at this point :P
(Reply) (Parent) (Thread)
From: (Anonymous)
2009-05-18 12:32 am (UTC)
Great, that's perfect. Not only was I cleaning outr my old backups onto my HDD, and saw the old mzx files, but I actually got you posting your website again.

Currently playing in Schism Tracker: Proton.s3m

--md
(Reply) (Thread)
[User Picture]From: kvance
2009-05-18 02:19 am (UTC)
Hah! That's great!
(Reply) (Parent) (Thread)
[User Picture]From: lipid
2009-05-19 04:26 am (UTC)
I am Captain Proton!
(Reply) (Parent) (Thread)
From: (Anonymous)
2009-05-19 02:44 pm (UTC)
Destroy him, my robots.
(Reply) (Parent) (Thread)
[User Picture]From: wikle
2009-05-18 12:43 am (UTC)
My work computers are still running windows 2000 which means IE5, they won't even display a transparent png file correctly. So I just use firefox ;)
(Reply) (Thread)
[User Picture]From: kvance
2009-05-18 02:20 am (UTC)
How horrible!
(Reply) (Parent) (Thread)