Why did you say six months?
He's coming.
This matters. This is important. Why did you say six months?
Why did you say five minutes?

Monday, April 02

Blog

Tag Soup

So what's new for today?

Conditions, calculations and variables!

Minx already had four conditional tags, namely [if], [ifn], [iff], and [iffn].

[if] tests a single variable. If that variable exists and has a true (non-zero / non-null / non-empty) value, the template code within the bracket of the [if] and the [/if] is evaluated.

If the variable is false (zero / null / empty), the code is not evaluated.

And if the variable does not exist, the [if] tag itself is not evaluated, and is instead included directly in the output. So if you get the name of the variable wrong, and type [if post.coments] instead of [if post.comments], you will be able to see your mistake right there in the page. In this case, the bracketed code is processed as if the [if] tag did not exist.

[ifn] works exactly the same, except that the condition is reversed. Code inside the [ifn] [/ifn] is evaluated if the variable is false.

[iff] and [iffn] are similar, with one big exception: The bracketed code is evaluated if and only if the variable evaluates to true (or false, for [iffn]). If the variable does not exist, the code is skipped, just as if the variable had been false.

Comparison Tags

[if.eq], [if.ne], [if.gt], [if.lt], [if.ge], [if.le]

These extended conditional tags compare two values, to see if, respectively, they are equal or unequal, or that the first value is greater than, less than, greater than or equal, or less than or equal to the second value. They must be closed by a corresponding [/if.XX] tag such as [/if.eq], not by a [/if].

The values can be either variables or constants. The way Minx determines which is the case is somewhat simplistic: If a variable exists which has the name of the value, it assumes that's what you mean; if not, then it assumes the value is a constant. So unlike the simple [if] tag, there's never a case where the variable doesn't exist.

These tags will perform integer comparisons if both values are integers; otherwise they will perform string comparisons. So [if.gt 10 2] will evaluate as true, just as you'd expect, and [if.gt a10 a2] will evaluate as false.

[I had held off on implementing these for the sake of keeping the template language simple, but it turns out I need them to properly manage context-sensitive selection lists - such as on my new forum pages - so in they went.]

Variables and Calculations

[set]

You can set a variable with the [set] tag. Like the extended conditionals, [set] can take either another variable or a constant, so [set a post.title] or [set a "Wombats in Paradise"] are valid examples. Again like the extended conditionals, [set] assumes a variable if the variable name exists, and a constant otherwise.

The variable can be accessed again with the prefix var. So [var.a] will print the value of a, and [if var.a] will test it. You can use the var.a terminology inside set as well, and it will be interpreted appropriately.

Variables can be used anywhere a normal data tag could be used.

[calc.add], [calc.sub], [calc.mul], [calc.div], [calc.mod], [calc.min], [calc.max]

The [calc] tag performs a calculation based on two values, and assigns the result to a variable. The values must be integer variables or constants; anything else will be evaluated as zero.

So [calc.add x var.y var.z] will set the variable x to be the sum of y and z.

[inc], [dec]

Just want to increment or decrement a counter? These are the tags for you! [inc a] or [dec a] and you're done.

If the variable did not exist beforehand, it is created as zero, and then incremented or decremented.

Note that none of these tags can alter the value of an existing data tag, only user variables.

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

Sunday, April 01

Blog

More Goodness

Subforums work.

Also the random quotey thing.

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

Saturday, March 31

Blog

Catagrees

Categories.  On the right.  On the category icons.  In the trees.  They're everywhere!  Eeeeee!!!

...

Sorry.

Fixed a couple of problems.  The MT->Minx transfer marked posts as unpublished under their individual categories (sort of, it's complicated), so they showed on the main blog page, but not on the category pages.  And a bug in the recent comments query meant that recent comments didn't show up at all on category pages.

Now, back to being driven crazy by this darn editor.

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

Friday, March 30

Blog

Timing Is Everything

70ms for the main page without comments.
150ms with comments.
96 comments displayed (including the Recent Comments thingy).

Hmm. A bit disappointing, considering this is the fastest hardware I'm likely to get this year.

I just hope that Ace, who has 200+ comments on individual posts, doesn't try to do inline comments.

Update: Well, it's not broken, just a bit poky at certain tasks. An individual entry page takes 5.7ms (elapsed time) if you remove the Recent Comments. 2.9ms of that is the SQL queries. The forum page sans sidebar takes 54ms to list 20 posts; 6ms for the queries. (The query times are for cached queries; uncached takes longer in elapsed time, but that doesn't come into CPU efficiency of the application code.)

If I tweak the forum listing to include the body of the post, it takes exactly the same amount of time to within the limits of precision of the built-in timer. Which shouldn't be surprising I guess; all the data processing is done whether the template needs it or not, and Python's string processing is very efficient. It does point to where I need to concentrate my attention, though.

Update: Adding the planned [topics] selector and the associated [topic] data tags reduces the time for a forum page sans sidebar to 13ms. The sidebar adds another 13ms. Extending it from 20 to 50 topics pushes the time out to 42ms: about 500μs per topic, compared to about 2ms per entry.

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

Wednesday, March 28

Blog

Last Tags For Now

Simple, but neat:

[me] Pixy Misa
[you] you
[you=du] du

[me] picks up the author of the current post or comment.  [you] gets your username if you're logged in, or the name you used on your most recent comment if it's still retained by the session code, or the text specified, or if all else fails, "you".

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

Blog

More BBCodes

Let's give these ones a whirl:

more...

Posted by: Pixy Misa at 10:05 AM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 79 words, total size 4 kb.

Tuesday, March 27

Blog

BBCodarama

One of the features I've built in to Minx is BBCode support.  You can use this in both posts and comments.  At least, you should be able to use it in comments.  We'll soon see.


more...

Posted by: Pixy Misa at 10:07 PM | Comments (3) | Add Comment | Trackbacks (Suck)
Post contains 117 words, total size 5 kb.

Saturday, March 24

Blog

Hidden Spoilers Not Safe For Work



Secret message:
Spoiler for any random anime series:


This message brought to you by the tags [hide], [spoiler] and [nsfw].

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

Wednesday, March 21

Blog

Die, Spammer Bastids!

Got my first piece of spam since I moved across to mee.nu.  Took a look at the automated spam filter, and the cupboard was bare.

Minx uses two spam filters: A conventional URL/IP filter fed from a honeypot system, and the statistical system called Snark that I wrote late in 2005 to deal with trackback spam at munu.  Snark worked really well, getting rid of 99.8% of trackback spam with almost no false positives, until I accidentally clobbered its data files during the DDoS attacks.  New Snark uses MySQL, of course, making it less likely for me to accidentally clobber it.

Unfortunately, (a) the honeypot isn't catching any flies and (b) one spam isn't enough to feed a statistical anti-spam engine.

I think, first, I need to fix the honeypot, and second, I need to fix the comment moderation screen.  A Pixy's work is never done.  Particularly when said Pixy embarks on major web development projects...

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

Friday, March 16

Blog

Post Post

Test post...

Edit edit... test edit...

Huh.  Weird.

Update: Oh, template bug.  Right then.

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

<< Page 12 of 44 >>
74kb generated in CPU 0.1009, elapsed 0.198 seconds.
57 queries taking 0.1758 seconds, 257 records returned.
Powered by Minx 1.1.6c-pink.
Using http / http://ai.mee.nu / 255