They are my oldest and deadliest enemy. You cannot trust them.
If Hitler invaded Hell, I would give a favourable reference to the Devil.

Wednesday, June 14

Geek

Where The Time Goes

Timings:

Standard PythonPython + Psyco
No Comments0.260.22
Inline Comments0.920.68
Sanitised Comments1.310.92

For last 500 entries on Munuviana. All times in seconds. Offer void where prohibited by federal, state or local laws, regulations or institutional policy. Offer ends June 30, 2006. Benchmarked on a Pentium D 820 running Centos 4.2. Python 2.4.2 compiled with GCC 3.4.4. Mileage may vary. Contents may ship during shrinking. Do not eat iPod shuffle. Sanitisation of comments only guarantees valid HTML. The content is your own problem.

Posted by: Pixy Misa at 02:58 AM | Comments (1) | Add Comment | Trackbacks (Suck)
Post contains 89 words, total size 1 kb.

Rant

Well, Crap

DVI does not support PC function.

It's still got a VGA input, but that's just stupid.

Posted by: Pixy Misa at 12:03 AM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 20 words, total size 1 kb.

Tuesday, June 13

Rant

Crapweasels 'R' Us

Okay, so my place-of-employment is going to buy me the full Adobe/Macromedia bundle, but haven't done so yet. And my 30-day-trial of Paint Shop Pro X has run out.

Paint Shop Pro does 90% of what I need, image-editing-wise, so I'd be happy to buy it. Especially since there's a special trial offer: If your 30-day-trial has run out, you can buy it for just $59, with free copies of Corel Photo Album 6 (which I don't need) and Photo Album Pastel Collection (which I very don't need).

Except that only one of those two is free, and you can't remove either one from your order. By clicking remove you can toggle which one you get for free, but you can't actually get rid of them.

And the offer only applies to US and Canada.

If you live in Australia, it's $299.

And though they have a link for Other Countries, it leads you to a search which cannot find anything.

Posted by: Pixy Misa at 10:42 PM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 167 words, total size 1 kb.

Life

Wait Training

They say that which does not kill us, makes us stronger and it must be true, because this morning I tucked a 27" TV under my arm and carried it home.

Okay, so it's an LCD and only weighs 12kg. Pfft.

Posted by: Pixy Misa at 09:39 PM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 45 words, total size 1 kb.

Anime

Galaxy Express 754

MagiPoka episode 16. (That is, the second half of episode 8.)

Both funny and moving. This is turning out to be quite a good series.

Posted by: Pixy Misa at 12:10 PM | Comments (2) | Add Comment | Trackbacks (Suck)
Post contains 31 words, total size 1 kb.

Life

The Karma Kittens Come Home To Roost

My dishwasher just blew up.

I see a week of take-away in my future.

Posted by: Pixy Misa at 12:49 AM | Comments (6) | Add Comment | Trackbacks (Suck)
Post contains 28 words, total size 1 kb.

Monday, June 12

Geek

Fun With Templates

Minx is currently parasitic* on the MT database and user interface, but it has a template system all its own.

The pages are now fully templated, with no funny stuff going on, so I'll show you what it looks like:

Page Template
<html><head>
<title>Minx Dynamic Pages for Movable Type</title>
<link rel="stylesheet" href="http://ai.mu.nu/styles-site.css" type="text/css" />
<script language="JavaScript" src="http://blog2.mu.nu/cgi/showhide.js"></script>
</head>
<body>
<div id="container"><div id="center"><div class="content">
<center><b>[blog.name]</b></center><p>
[posts:here]
[magic.pager]
[magic.stats]
</div></div></div>
</body></html>
Very simple. You start with a standard HTML/XHTML page, and the Minx tags are marked with [square brackets]. If you have something in your template that's in square brackets that's not a Minx tag - intentionally or unintentionally - it just gets spat out unchanged. (The divs look a bit odd, but that's because I'm using an unmodified MT3 stylesheet for testing.)

We can see three types of tags here:
A simple tag, [blog.name], which just looks up the matching database field for the currently active blog and inserts it into the page at that point.

A here tag, which is used to simplify block processing. The [posts.here] and [comments.here] are the most common examples of this. Without any parameters** they loop through the posts or comments using the default settings for your blog and the default post/comment template, as appropriate.

The post and comment templates look like this:

Post Template
<h2>[post.newdate]</h2><p>
<b>[post.title]</b><p>
[post.text]  
<p class="posted">
Posted by: [post.authorlink] at
<a href="[post.url]">[post.time]</a>
| <a href="#" onClick="ShowHide('cc[post.id]'); return false;">Comments ([post.comments])</a>
| <a href="http://blog2.mu.nu/cgi/mcomment.cgi?post=[post.id]">Add Comment</a>
| Trackbacks (Suck)
</p>   
<div id="cc[post.id]" style="display:none">
[comments:here]
<p class="posted">
<a href="#" onClick="ShowHide('cc[post.id]'); return false;">Hide Comments</a>
| <a href="http://blog2.mu.nu/cgi/mcomment.cgi?post=[post.id]">Add Comment</a>
</p>   
</div>

Comment Template

<div id="c[comment.id]">[comment.text]</div>
<p class="posted">
Posted by: [comment.authorlink] at [comment.datetime] </p>
Again, we have regular HTML, with just a bunch of simple tags to insert the desired values.

Minx is intended to let you have full control of post and comment selection from the template, overriding the default settings, but those tags are more complex to process and don't work yet.

Finally, we have magic tags. We have two examples of this, the pager and the stats. Magic tags do magic stuff that isn't necessarily available using regular template substitution. The pager lets you go to the next/previous page of the blog (a fancier pager is coming); the stats show performance information (and a fancier version of that is coming too).

The central idea is to make as much of the feature set as possible available without making the templates scary. So you don't need to have a complex nested structure of post tags and comment tags. Just put [posts.here] in your page template (with maybe some optional parameters) and [comments:here] in your post template. Set the appropriate settings on your blog options screen and you're in business!

Next up: A user interface...

Update: Minx now pulls its templates dynamically from the MT database. If you create index templates called mxPage, mxPost, and mxComment, Minx will use them to override the default templates. (Which are loaded dynamically as well.)

You can also include templates using the [include template] tag. The template to be included must also begin with "mx", since Minx only looks at those, but you don't actually specify the "mx" when you use the tag. So, for example, you can create a blogroll template called mxBlogroll and include it with the tag [include blogroll]. (It's not case-sensitive.)

Update: Conditional processing with if and ifn. if and ifn can be used with any simple tag to test whether the value of that tag is "true" or not. A tag is true if it is a non-zero number or a non-empty string, otherwise it is false. Any text between [if tag] and [/if] is included if the value of the tag is true. And any text between [ifn tag] and [/ifn] is included only if the value of the tag is false.

You can't nest if tags, though you can nest an ifn inside an if and vice-versa. If you want to get more complicated than that, for now you'll need to use sub-templates with include.

* Or rather, symbiotic.
** And, um, parameters aren't working yet.

Posted by: Pixy Misa at 11:45 PM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 662 words, total size 5 kb.

Geek

Whee!

It works!

Rather than writing everything from scratch to start with, I put together what I had and pointed it at our existing Movable Type database (which has a number of changes over the original, admittedly). And it works.

40 milliseconds is a bit depressing, though. I'll have to see if I can speed that up a bit.

Okay, some timings: Last 200 entries at Munuviana, with inline comments: 420ms. Without inline comments: 90ms. Having inline comments causes a lot of extra SQL queries; I don't know if it's that or the text processing that's taking the time.

A normal page only shows 20 entries, and takes around 45ms with comments and 15ms without. It's a bit hard to time that more precisely, which is why I bumped the page size up.

Every post and comment has to be passed through the template engine; every comment is also processed through a SGML parser to strip out unwanted or invalid HTML tags. I'd love to get a complete page out in 10ms, but I don't think I can. Well, if it's cached, then sure, but not if the whole thing needs to be dynamically generated.

<Pause.>

<Goes off to implement caching system.>

...

<Comes back again.>

Retrieved from cache, processing time 0.0 seconds.

Yeah, that'll do.

Only problem is that saving the text up to be cached takes an extra 10ms or so. I need to try the StringIO/cStringIO functions and see if they help.

Update: cStringIO provides no performance advantage at all. Which is good in that I know that the easy way to code it is just as efficient, but bad in that I can't speed it up at all.

Posted by: Pixy Misa at 03:27 PM | Comments (2) | Add Comment | Trackbacks (Suck)
Post contains 283 words, total size 2 kb.

Sunday, June 11

Geek

Dum De Dum

I've been working on the blog-code, all the live-long day night...

It's good to be doing development again, rather than running around like a hamster on crack trying to shore up systems under attack by hackers, spammers, and just plain lousy other-people's-code.

What I've mostly been doing so far, though, is installing stuff. Python needed an update, as did Apache. Didn't have PIL installed, or Numpy or Pyrex. Pysco has been patched. Memcached and its prerequisites. Bumped MySQL up to 5.0.22, and PostgreSQL up to 8.1.4. (I may end up just using MySQL, but at this stage I'm keeping my options open.) CherryPy and Django and ReportLab. And PHP 5.1.4... (fixeds MySQL option) And PHP 5.1.4 (fixes MySQL option correctly) And PHP 5.1.4 (what do you mean, you can't find zlib? How should I know where it is?)

Okay never mind PHP 5.1.4. I'll do that later.

To work!

Oh, yes: I'm doing all of this on my notebook. Hooray for VMWare Player!

Posted by: Pixy Misa at 09:01 PM | Comments (2) | Add Comment | Trackbacks (Suck)
Post contains 169 words, total size 1 kb.

Anime

Duck And Cover

Theme harems? Okie dokie:

1. Urd, from Oh My Goddess
2. Lum, from Urusei Yatsura
3. Yuri, from Dirty Pair (original version only!)
4. Faye Valentine, from Cowboy Bebop
5. Lina Inverse, from Slayers
6. Tira Misu, from Sorceror Hunters

Maid: Honey Kisaragi, from Cutey Honey (She has a maid outfit, so she qualifies!)

Life will never be dull. Brief, possibly, but never dull. more...

Posted by: Pixy Misa at 09:53 AM | Comments (3) | Add Comment | Trackbacks (Suck)
Post contains 104 words, total size 1 kb.

<< Page 3 of 5 >>
68kb generated in CPU 0.0346, elapsed 0.7949 seconds.
56 queries taking 0.7822 seconds, 372 records returned.
Powered by Minx 1.1.6c-pink.
Using http / http://ai.mee.nu / 370