It was a bad day. A lot of bad stuff happened. And I'd love to forget it all. But I don't. Not ever. Because this is what I do. Every time, every day, every second, this: On five, we're bringing down the government.

Monday, April 09

Blog

A Post To Pound On

I need to test the breaking strain of the Minx commenting system, so please comment here.  A lot. smile

Posted by: Pixy Misa at 08:57 PM | Comments (441) | Add Comment | Trackbacks (Suck)
Post contains 24 words, total size 1 kb.

Cool

Freebies!

Okay, I might as well get into the game too!

If you're interested in joining the beta test at mee.nu, drop me a line at beta -at- mee -dot- nu.  Beta participants get a free account (no ads, no fees) with at least 1GB of disk space and 10GB of monthly bandwidth for as long as they want to keep it.

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

Geek

Ack. Pfft.

Just doing some security enhancements.  I was thinking over some new code, and I thought... Hmm, I wonder if that library does any checking... Uh oh... Well then, I'd better do some checking, but at least I'm not... I am?! Fix that, make sure it can't happen again, patch the wrapper routines, screen the user input before it gets passed to the wrapper routines (which I'd been very good about until now, but it only takes one screwup...)

Tested the whole thing against various nasties, and it passed with one small glitch, which I've corrected.

Writing code is easy; writing code that will survive when dropped unsupported into a free-fire zone is harder.
  1. Default deny.
  2. Security in depth.
  3. Never trust user input.
  4. Never trust library routines to do your checking for you.
  5. Even if you wrote them yourself.
  6. Especially if you wrote them yourself.

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

Sunday, April 08

Geek

Hey!

I can put function pointers and argument lists into the tag dictionary just as easily as strings (or nearly so).

Okay, I have some hacking to do here...

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

Blog

Well, Poop

The date change logic is busted.  That just might have something to do with all the date/time changes I made a couple of days ago.

Throw another bug on the tracker...

Update: Fixed, and at a cost too small to measure (less than a millisecond for this page, anyway).  Now takes timezones properly into account; I haven't applied all the new date/time rules... Though I guess I should.  Maybe.  Later.

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

Geek

Vista: Good For Something After All

I picked up a new notebook on Thursday to replace my involuntary HTPC.  It's a Compaq Presario 6100, and it's dirt cheap and gorgeous.  It fixes the problems with my (not very) old notebook: It has FireWire and a card reader and Bluetooth and infrared; the keyboard is perfectly laid-out (perhaps a little bit too firm, but that will correct itself over time), and it has a "brite" screen, or whatever they're calling the cheap models without anti-glare coating these days.  I've found that on the whole I actually prefer the "brite" screens; you can usually adjust your position to avoid glare and reflections, and the lack of diffusion from the absent anti-glare coating really makes the screen brighter and more vibrant.  The Turion X2 is about the same performance as the Core (not 2) Duo, and the Nvidia 6150 chipset is a definite improvement on Intel's aging 950.  (It also has at least 14 LEDs scattered about the place, which seems just a tad excessive.)

There's just one fly in this ointment: The battery life is crap. The Acer Expire lasted forever; this Presario only manages about two hours.  There may be an extended battery available, but if so, no-one in Australia has it.

Oh, and the good thing about Vista? If you buy a notebook without it right now, you can get some really good deals.

Update: 16 LEDs.  Remember when blue LEDs were new and cool - and expensive?  This thing has 14 of them, and at least two of those are bicolour blue/orange.

Posted by: Pixy Misa at 04:44 AM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 263 words, total size 2 kb.

Blog

New Toys

The new feature set has been uploaded.  Minx now has proper management screens for posts, files, folders, templates and directories, as well as working site and user options, the date/time enhancements I mentioned before, and account and statistics pages.

And a neat little image management module:

http://ai.mee.nu/images/image-module-small.png

Apart from changing flags and copying, renaming and deleting files, you can perform a few other tricks.

Starting with the original:

http://ai.mee.nu/images/abenobashi.jpg

You can resize, to a fixed size, in proportion to a new height or width, or to a percentage:

http://ai.mee.nu/images/abeno-small.jpg

Convert file formats:

http://ai.mee.nu/images/abeno-small.png

(Which doesn't seem to work terribly well for converting to GIFs; I'll look into that.  I think it might be using a fixed palette.)

Flip or mirror the image:

http://ai.mee.nu/images/abeno-flip.jpg http://ai.mee.nu/images/abeno-mirror.jpg

Switch to black and white or inverted colours:

http://ai.mee.nu/images/abeno-bw.jpg http://ai.mee.nu/images/abeno-invert.jpg

Smooth or blur:

http://ai.mee.nu/images/abeno-smooth.jpg http://ai.mee.nu/images/abeno-blur.jpg

Sharpen or detail:

http://ai.mee.nu/images/abeno-sharpen.jpg http://ai.mee.nu/images/abeno-detail.jpg

Posterize or contour:

http://ai.mee.nu/images/abeno-poster.jpg http://ai.mee.nu/images/abeno-contour.jpg

There will be a whole bunch more of these if I can get PythonMagick working, but (except for the convert to GIF) it will do for now.

Update: Looks like PythonMagick is an ex-library.  If I want to use ImageMagick, I'll have to call it directly.  Which is not actually hard; just inefficient.

And dammit, my images aren't showing up in the editor again. frown

Update: Okay, a few more options before bedtime. smile

Adjust the colour: 50% and 150%.

http://ai.mee.nu/images/abeno-colour-50%.jpg http://ai.mee.nu/images/abeno-colour-150%.jpg

Brightness: 80% and 120%.

http://ai.mee.nu/images/abeno-brightness-80.jpg http://ai.mee.nu/images/abeno-brightness-120.jpg

Contrast: 80% and 120%.

http://ai.mee.nu/images/abeno-contrast-80.jpg http://ai.mee.nu/images/abeno-contrast-120.jpg

And sharpness: 1% and 200%.

http://ai.mee.nu/images/abeno-sharpness-1.jpg http://ai.mee.nu/images/abeno-sharpness-200.jpg

Sharpness is relatively subtle, which makes it useful for fine adjustments, unlike the basic smooth and sharpen filters.  I pushed it to fairly extreme settings here to show its range.

Posted by: Pixy Misa at 02:30 AM | Comments (3) | Add Comment | Trackbacks (Suck)
Post contains 260 words, total size 7 kb.

Saturday, April 07

Geek

Accelerando

I'm in the middle of a huge update to Minx - I've uploaded the new software, and I'm testing the new templates on my blog.

One of the things I'm working on is making the template engine even more dynamic.  I've mentioned that there are a huge number of fields available in Minx. One of the problems with that is that the data for those fields is generated whether you need it or not, so simply selecting a post, even if you only displayed a single field from it, took on the order of 2ms.

For my first pass I changed the way dates and times are handled.  This was relatively easy, because all dates and times are datetime objects, and they all had a base tag of the form [something.date].

I took that and ran with it, finding all the date and time fields, removing all the static formatting, and creating alternate references for time, datetime, shortdate, day, month, and year. Eventually I may be able to do away with the references as well, but that requires some more significant changes to the template engine. Right now, a data tag is either in the dictionary or it isn't; tags are statically selected, but dynamically formatted.

The end result?  Existing templates work without change, there are 44 (I think) new date-related fields on the post record alone, the time for processing my main page has been cut by around 12%, and the code is actually smaller.  Plus, all date and time fields can now be custom formatted using the format option; before, the preformatted versions were strings and date formatting options didn't work.

The only downside is that I have to document hundreds of new tags, though the upside there is that they are all perfectly orthogonal, so I can pretty much just cut and paste.

Next cut will be text formatting; I expect similar or greater gains from that.

Posted by: Pixy Misa at 02:43 AM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 321 words, total size 2 kb.

Thursday, April 05

Geek

Why

Don't browsers do at least bilinear scaling these days?  It can't be that CPU intensive.

Update: Turns out, it is pretty CPU intensive.

Resizing a 750x1200 image to 500x800 to suit my blog takes 2ms using nearest-neighbour scaling (which is what browsers use), 49ms using bilinear filtering, and 117ms using bicubic filtering.

The time is proportional to the number of pixels in the target image; starting with a 1500x2400 image took only 1 or 2% longer.

So not great for automated image sizing - not without a healthy cache, anyway - but pretty good for generating thumbnails on the fly.  A 150x240 thumbnail takes 4.5ms to generate; at 200x320, about 8ms.

One thing I will likely use this for is avatars.  I don't want to enforce a fixed size for avatars across mu.nu/mee.nu, because the idea has always been that it's your [blog|forum|wiki|whatever] and you control the way it looks.  But having avatars of all different sizes looks like crap, and having a range of sizes (which is what I was considering) is fiddly.

But if I make it so that you upload one image at say 240x240, and that automatically gets resized according to the template tag, that could work well.  Some timings on that: 50x50 0.3ms; 60x60 0.4ms; 75x75 0.7ms; 100x100 1.2ms.  It takes a minimum of 3-5ms to serve a file in the first place, so that's not a huge imposition on the server.

[comment.avatar size=60] here we come!

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

Wednesday, April 04

Geek

It's A Wonder It Works At All

I've mentioned that I'm a little disappointed in the performance of Minx, given the  power of the hardware and the amount of time I've spent tweaking it to wring out every drop of performance (given that it's written in Python).

Well.

I was just looking at some numbers.  There are currently 342 top-level tags in Minx, that is, block tags, here tags, and magic tags, tags that select data from the database.  (This doesn't include all the flow-control tags such is [if], [loop], and [include].)  That's not the complete set, just what is supported (or partly supported) at the moment.

The [posts] tag, which selects and displays posts, and which in its simplest form consists of the single statement [posts:here] (that's what I mean by a "here tag"), produces 245 data tags for each post.

So that's where all my milliseconds are going...

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

<< Page 6 of 7 >>
325kb generated in CPU 0.2975, elapsed 0.6166 seconds.
56 queries taking 0.5147 seconds, 834 records returned.
Powered by Minx 1.1.6c-pink.
Using http / http://ai.mee.nu / 832