What is that?
It's a duck pond.
Why aren't there any ducks?
I don't know. There's never any ducks.
Then how do you know it's a duck pond?

Sunday, April 08



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.


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.

Saturday, April 07



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



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


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).


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.

Tuesday, April 03


Swings, Roundabouts

On the one hand, some tweaks to the template engine have improved FizzBuzz performance to about 0.25 mips.

On the other hand, the new (dynamic) timezone support adds around 30μs per topic.

Now... User profile page.

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

Monday, April 02


Playing It Safe

If you are less adventurous in your choice of habitats [1], [2] perhaps you would care for our third alternative: The Big Ball of Ice™.  The Big Ball of Ice™ works like this: You take a whacking great neodymium magnet* and encase it in about 30,000km of ice, capped with a few hundred kilometres of diamond.**

With a diameter of 60,000 to 70,000km, the structure has the area of 25 Earths, but the low density of ice gives it a surface gravity of around 1g.***  It requires no particular dynamic maintenance; just don't let it get too warm...

* For shielding from the solar wind, and so that boy scouts don't get lost.
** All of this except perhaps the neodymium being in plentiful supply at your local cosmic outfitters.
*** Pumice can have a density one-quarter that of ice, but ice is relatively incompressible; pumice less so.  If you nonetheless decide on building a World of Pumice with a diameter of 250,000km, please do write and let us know how it went.

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


A Choice Of Catastrophes

One way to build a large space habitat with real-world materials is to put a large mass on the inside and live on the outside.  Use the mass, instead of the rotation of the habitat, to generate gravity.

Let's try doing this with Jupiter.

Jupiter has a diameter of 143,000km, and a "surface" gravity of about 2.4g.  So a habitat with a diameter of about 340,000km will experience a gravity of 1g.  With a circumference of over 1,000,000km and a width of 10,000km (preserving at least 93% of Jupiter visible to Earth-bound astronomers), it would have a surface area equal to 20 Earths.

We spin the habitat once every 24 hours to give us day and night.  That works out to about 0.1g of outward acceleration, so we only feel 0.9g.

The problem with this is that the habitat will be under massive compression stress.  Just as an equally large habitat with 0.9g of centripetal acceleration would fly apart instantly, this habitat would instantly collapse and crash into Jupiter.

However, while there are no energy-efficient ways to dynamically reduce tension, there are ways to reduce compression.  What we do is create a second structure just inside the first, and rotate it much faster, so as to balance the force of gravity on the structure itself.*  Gravity still effects people and things on the outer surface of the habitat, keeping them in place, but the habitat is dynamically stable - at least structurally.

The problems with such a structure are similar to Niven's Ringworld, with one or two added thrills.  First, it's not in orbit around Jupiter (though it is in orbit around the Sun), so that if it drifts off course relative to the planet it will keep right on going, or even accelerate.  If it is pushed towards Jupiter vertically, it will accelerate into the planet, which would destroy the habitat and kill everyone on it.

If, on the other hand, it drifts away from Jupiter laterally, it won't collide with the planet, but the loss of gravity will cause the atmosphere, people, pets, trees and so on to drift off into space and asphyxiate.  Well, it would, except that the inner ring, no longer bound by said gravity, would tear itself apart and the main structure along with it, killing the people, pets, trees etc instantly.

Oh, and I think Jupiter's radiation would be lethal.  And the structure would intersect the outer ring, so you might have to remove that.  And you would only get 4% of the sunlight intensity that Earth receives, so you'd either need a mirror 25x the size of the habitat to light things up, or some really warm underwear.

Apart from that, though, it's great.

* You'd need some pretty fancy bearings, but that's a mere engineering detail.

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



FizzBuzz in Minx Template Language.

Admittedly it took me more than a couple of minutes, because (a) I'm at the office and keep getting interrupted, (b) MTL (need a cute name for it) doesn't have proper expressions or loops or even else, (c) there seems to be a bug when using the basic conditional statements with user variables, and (d) I forgot to link the demo folder to something with content, so it didn't actually do anything at first.

(via Coding Horror)

[topics count=100]
[inc i]
[calc.mod m3 var.i 3]
[calc.mod m5 var.i 5]
[if.eq var.m3 0]Fizz[/if.eq][if.eq var.m5 0]Buzz[/if.eq]
[if.gt var.m3 0][if.ge var.m5 1][var.i][/if.ge][/if.gt]

Takes about 55ms to run. 20ms of that is the SQL queries; 28ms is the processing of the topic entries; 2ms is fixed overhead per page; 5ms is the calculation and conditional tags. It has to execute 700 of those to generate the page, so they work out to around 7μs each - about 0.14 mips.

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

<< Page 2 of 2 >>
69kb generated in CPU 0.0607, elapsed 0.2976 seconds.
55 queries taking 0.2542 seconds, 361 records returned.
Powered by Minx 1.1.6c-pink.
Using http / http://ai.mee.nu / 359