Tuesday, July 31, 2007

.Net, IronPython and the shell

One step forwards, two steps back, trying to get a uniformly applicable method to get the displayed icon for a file-name that doesn't drag in attributed code at some point.

We can P/Invoke to get file icons through SHGetFileInfo -- but that involves attribute decorated methods in a C# shim.

We might be able to get at IExtractIcon via COM Interop starting from the Shell like this:

though that route doesn't yet work on Mono (GetTypeFromProgID isn't yet implemented -- and the type being of type System.__ComObject, that's probably not there either). And in any case we still need to either P/Invoke DestroyIcon or read the icon resources directly from PE format, and manage the object ourselves, even if all the other argument passing works.

We could use Icon.ExtractAssociatedIcon if only it didn't restrict itself to just files that exist (in particular, unlike SHGetFileInfo, it does not do folders, or drives, let alone abstract allusions to files by their extension).

*sigh*

Links for 31-Jul

Extending Java with Yield semantics

AD FS integration with Oracle Identity Federation

The Coming Software Patent Apocalypse -- This man speaks great wisdom

XRAY and MODIv2 -- DOM inspection bookmarklets

Monday, July 30, 2007

IronPython/IPCE : Simpler method to get logical drives

The previous enumeration approach allowed you to, as well as getting the drive letters through the "Name" property, also access associated "DriveType" and "MediaType" properties -- effectively between them giving the index of the related Shell32.dll icon. That information, however, seems to be less than useful in the .Net framework without manually unpicking the PE format for the icons. So, you might as well go the direct route like--

giving

System.String[]('C:\\', 'D:\\', 'E:\\', 'F:\\', 'G:\\', 'H:\\', 'I:\\', 'J:\\',
'K:\\', 'L:\\', 'N:\\')

which adds the trailing back-slash; and also has the advantage of working in Mono 1.2.4 with IPCE-r6.

Fortunately Fuzzyman's generate.py to do on-the-fly compilation of C# works there too, so I can still get the icons on that platform. Once I've worked around another quirk, that is -- Mono/IPCE is much more rigorous about the .Net types -- I had to explicitly create an Image, rather than use an Icon with implicit toBitmap() conversion in a call to Graphics.DrawImage

Links for 30-Jul

Polyglot programming -- Two views

IronRuby -- the community embraces it 

What Apple copied from Microsoft -- yes, you read it right

Sunday, July 29, 2007

Anime — Moonlight Mile : 1st Season

Sitting somewhere between Rocket Girls and Planetes in time, but rather more SERIOUS BUSINESS than either. Gritty near-future space story, with two mountaineers -- and American and a Japanese -- who decide that the next stop after Everest is the Moon.

There seems to be a big overarching plot of war in space -- a teaser scene at the beginning doesn't yet get followed through, but the OP animation gives the intention away, even though this 12 episode season ends with the two of them actually operating in orbit.

A bit plodding at times -- I suspect a long-running series in the offing -- and padded with more gratuitous sex scenes than are necessary to establish character. Maybe the amount of tail the two leads get is intended to help make them identification characters for teenage boys, but for me, it acts to distance them.

Logical Drive Enumeration in IronPython

The .Net framework has a lot of useful low level functionality in it that is kept well hidden. Writing in C# or C++/CLI, the temptation is there to P/Invoke the obvious Win32 APIs rather than go burrowing into the unexpected parts of the system. And while we could compile ourselves some P/Invoke C# on the fly in IronPython, that's sufficiently inaesthetic to make it worthwhile looking for another way.

And behold--

which gives, when I run it

['C:', 'D:', 'E:', 'F:', 'G:', 'H:', 'I:', 'J:', 'K:', 'L:', 'N:']

There is a lot of good stuff in the WMI classes, but finding the query strings is a bit of a black art...

Saturday, July 28, 2007

Hello WPF in IronPython

Matching the IronRuby sample

WPF.py


HelloWPF.py

Pretty UIs are going to be dead easy to do, given that XAML just loads.

Also, memo to self -- more here

Tuesday, July 24, 2007

Saturday, July 21, 2007

Glasshouse (again)

I panned this a week or so back.

Picking it up to tidy it away, I did the "I'm never going to read this properly, so let's look at the ending", and a random flick through the pages.

Yeah, there would have been some pay-off (they do break out of what might more accurately be termed "I Love Lucy meets the Prisoner" at the very end); and there seem to have been some slow dribbles of what had gone before. But, honestly, neither the characters nor the setting engaged me in the least, and it was only the back-story -- the "out in the Accelerated World" bits -- that I would have been reading it for.

Slowly mellowing

After sleeping on the landing under Karen's wheelchair, or in front of the airing cupboard, then sleeping in basket on the landing, then sleeping in a basket in the spare room, Jemima has now decided that our bed is the place to sleep.

In the evening, she will curl up near Karen's pillows; but when she goes to bed, is happy to migrate down to foot level -- and stay there when I get into bed.

She's still too scaredy-cat to actually snuggle against people, or go anywhere where hands might be laid on her, though.

Nature notes

Yesterday morning, when I was in the kitchen putting breakfast together, there was this sudden flurry of feathers outside.

Looking out onto the patio, I saw hawk holding a young pigeon on the ground, raking around with one foot, while keeping a good look out.

Eventually Jemima wandered up to the patio doors, which was a bit much, so the hawk flew off, promptly followed by the pigeon.

Tuesday, July 17, 2007

Lolcats

Your Score: Longcat

55 % Affection, 49 % Excitability , 47 % Hunger

Protector of truth.

Slayer of darkness.

Loooooong.

Longcat may seem like just a regular lengthy cat, but he is, in fact, looong. For proof, observe the longpic.

It is prophesized that Longcat and his archnemesis Tacgnol will battle for supremacy on Caturday. The outcome will change the face of the world, and indeed the very fabric of lolcatdom, forever.

Be grateful that the test has chosen you, and only you, to have this title.

Link: The Which Lolcat Are You? Test written by GumOtaku on OkCupid, home of the The Dating Persona Test

Links for 17-Jul

A series of articles on designing UI code in C#

Bit Twiddling Hacks 

WCF Security samples

Windows Service Hardening

Rethinking Design Patterns

JavaScript in the JVM in 15 minutes  

Sunday, July 15, 2007

Film — Henry V

The Olivier classic in a restored print. wonderful colour, marvellous use of sets; though the imagination still needed to rise to the occasion of the battle.

Any more gets to be lit-crit of Shakespeare.

Accompanied by a MinInfo piece (Words for Battle) of Olivier reading stirring poetry to stiffen the sinews in wartime Britain.

Film — Copying Beethoven

One of the gambles I took when booking. This could so have been a chick-flick, but fortunately it wasn't.

Beethoven as an irascible old bachelor (aging rock star?), a girl sent to be his copyist, and the rush to finish the 9th, and then his Grosse Fugue.

Entirely frivolous costume romp.

Saturday, July 14, 2007

Film — Azur and Asmar: The Prince's Quest

Gloriously and sumptuously animated (Poser-esque 3D with an interesting touch that worn cloth was rendered in flat colour -- no shading whatsoever), French (subtitled) and Arabic (untranslated).

Azur, blue eyed son of French gentry, and Azmar, his twin brother-in-milk, son of his Moorish wet-nurse, grow up together, enchanted by her tales of the Djinn Fairy.

Time passes. Azur is sent away to learn to be a gentleman; Azmar and his mother are sent packing. But the lure of the Djinn Fairy continues, and, risking all, Azur, when grown, sets off to find her and free her from captivity.

A po-mo reworking of many traditional fairy-tale quest themes, in a happily tolerant and multi-culti Araby (clearly there is a bit of a political message close to the surface here, especially relevant to contemporary France) -- a thoroughly nice film, woefully underattended at its one showing.

Friday, July 13, 2007

Film — The Picture of Dorian Gray

Fin-de-siecle decadence transplanted one century later; where the painting becomes an art installation.

The main trouble with out of period adaptations is that the original contains so many bon mots that the nigh contemporary characters uttering them sound more like they are quoting Wilde rather than being originally witty. Otherwise, a faultless translation.

Yeah, it's a pretty gay movie, but that's just hewing to the original subtext.

The soundtrack was eclectic too -- from 70s ballad (one of Carly Simon or Joni Mitchell) to contemporary post-rock (some Godspeed You, Black Emperor)

Film — Never Weaken/The Freshman

More classic Harold Lloyd.

As before, the short film was far more win than the feature. Overplayed jokes are overplayed.

Thursday, July 12, 2007

Anime — Rocket Girls

“This is Tanpopo Commander Yukari Morita. I'll enter the transfer orbit now.”

— spoken in delightful Engrish at the end of the intro sequence.

So, you're the director of a space agency with a tight budget, your booster uprating is giving the locals an expensive fireworks show, and your test pilot is objecting to be starved to fit inside the mass budget that the proved series permits. What do you do?

Enter Yukari Morita, high-school girl, who's turned up on your patch, looking for her long lost father. You think you may know who it is -- and she weighs less than you're trying to get your pilot down to… maybe your manned satellite launch and repair system might get off the ground, after all.

A light-hearted, series, but generally grounded in engineering, and an antidote to the SERIOUS BUSINESS from Moonlight Mile running at the same time.

Wednesday, July 11, 2007

Film — Paprika

Once again, Satashi Kon delves into the world of film, and dream, and their entanglement with reality. Where 2005's Millennium Actress was melancholy, and centred first about film, this is more uplifting, and focussed on dreams first, and their actualization second.

The maguffin is device that allows dreams to be seen and shared, a tool for therapy that then becomes a snare, as dreams start to invade the waking world.

The plausible sliding reality of dream is well captured in the visuals; and the allure by the intoxicating intense and catchy music that plays as the dream carnival wends its way through the movie.

Simply excellent. The best film of the festival to date, and probably of the whole thing.

Tuesday, July 10, 2007

Book — Glasshouse by Charles Stross

What I read:- Charlie Stross' new novel

What I expected:- Accelerando, part 2

What I got:- I love Lucy

 

What the blurb doesn't tell you is that the "unique experimental polity, the Glasshouse" intended to "simulate a pre-accelerated culture" is a fairly crass -- presumably satirically intended -- pseudo mid/late 20th Century environment, living in which becomes a source of terror to superior post-Acceleration folk.

Stross is an infuriating writer at times. It's bad enough that he always lards his cascades of ideas with a heavy doses of what in fanfic circles would be called "Lime" -- I find coy not-quite-smut vastly more annoying than the outright, no apologies stuff. But this -- well, I was just getting settled into the plot and looking forwards to something inventive as the Glasshouse and then ran into this. Not so much a brick wall, as a quagmire, in that momentum carried me in a chapter or two. But then I put it down, and I don't know that I'll pick it up.

In sum -- if I wanted to read social satire on the 1950s in SF, I'd go back to stuff from the heyday of Galaxy. Sorry, Charlie.

Book — The Prefect by Alastair Reynolds

More competent space-opera in the Revelation Space setting, back in the glory days of the Glitter Belt, before the Melding Plague.

It's a whodunnit with a minor colony habitat as the victim, which escalates from there, while trying to keep the space-lanes free for participatory democracy.

Absorbing reading -- I read it in one sitting.

Film — Tales from Earthsea

I read and greatly enjoyed the first 3 Earthsea books when they were new; when 20 years later, another book came out, what I read about it did not incline me to read it -- it seemed to be more a repudiation of what went before, rather than an extension.

So it was with a little trepidation that I went to see this movie. And alas…

Happy Ghibli fantasy land folk trotting around, just like we saw them in Nausicaä or Laputa. White people. Oops! One big systematic failure there -- the folk of the Archipelago are dark of skin (that was part of the point, to be antithetical to the blond barbarian hero stereotype). Names grabbed from various books, of people who never actually met, entirely, I am sure, to provide a hook for the typical Ghibli-girl. Themes from the start of book three segueing into what I am told was the end of book four, with a stock Ghibli subordinate-villain prancing around to try and hide the join. And the typical bit of environmentalism building on the notion of balance; a sad confusion of the interior and the exterior (the same confusion that leads some young men to blow themselves up on public transport).

There are other bits I could go on about, but those tend to be inherited from the source material. As it is, the film verges close to Ghibli self-parody under the direction the younger Miyazaki (at least they refrained from flying machines).

Probably best suited to young teens who haven't read any of the books yet.

Film — GitS:SAC - SSS

The movie of the TV series, Ghost in the Shell:Stand Alone Complex, Solid State Society revisits some of the motifs of the first movie (and original manga), while evolving in the direction of the second manga.

Nowhere near as lush as last year's GitSII : Innocence and in a different continuity again.

Monday, July 09, 2007

Films — Speedy and An Eastern Western

Two Harold Lloyd classics.

Generally superior slap-stick; though the Coney Island sequence in the former (for all it was a first for location shooting) overplayed itself.

Happier products of a less sophisticated age.

Sunday, July 08, 2007

Film — Vineta, the secret project

Part of this year's German Cinema stream.

A prize-winning architect, obsessed with water as a motif, working compulsively, fuelled by little other than a constant stream of walnuts, is interrupted in the middle of one commission (a retirement home) by the chance to work on developing the utopian city of the future on a Baltic island.

Obviously, as the ill-assorted team gathered there pull apart as much as together, there is more to this endeavour than meets the eye -- but what exactly that turns out to be is the surprise.

Very effective cinematography to convey the compulsive work-style of the architect; and with fade-to-red/fade-to-blue, the emotional tenor of the film is well underscored.

The least predictable of the films I've seen so far, and in that respect, enjoyable.

Saturday, July 07, 2007

Film — As You Like It

Suddenly, ninjas! Hundreds of them.

Branagh takes Shakespeare's Arcadian rom-com and relocates it to a gaijin trading colony in Meiji Japan, with Brian Blessed playing both dukes, and English woodland, with a thin patina of props and extras plays Japan playing Arden -- Japan being Branagh's choice for somewhere that in the modern world has the split between rus and urbs on such a fine scale and in such proximity, rather than simply an excuse for Orlando to decorate the forest with massive calligraphy dedicated to his ロザリンド.

The film elaborates on the play by opening with the overthrow of the elder Duke; and book-ending it with the younger's conversion and Jacques joining him in the contemplative life. Oh, and then the epilogue, which breaks the 4th wall as cunningly here as it does in the original.

Branagh and Blessed spoke and took questions after the film; the one looking very artistic in casual jacket, the other looking at first glance like some special needs or homeless person in scruffy shell-suit and fleece. There was initially a problem with the radio mikes -- they seemed to be relaying the dialogue from obe of the German films -- but Brian Blessed was able to work around that little technical difficulty.

There was a bit of luvvie-anecdotage, a measure of Shakespeare worship, and answering of "Why Japan?"

Film — Highlander, the Quest for Vengeance

Manly 1980's anime (Fist of the North Star and similar) tropes + the skeleton of the 1986 American movie + '00s level CGI backgrounds. One hardly needs to say any more.

Maybe it was that it was Saturday morning, but this was shown as a dub -- and for the Scottish and Ancient Briton flashbacks, the voice acting was more than adequate. For the next century New York (the post-apocalyptic setting so beloved of old-school anime), it reminded me why dubs suck. At least they pronounce "Colin" properly (and not like General Powell).

The only trouble with settings like this -- lone hero (with assorted rag-bag of scavengers following) vs leader of orderly technological society, is that my sympathies tend to the latter, indeed as in any similar tale with a motif of Rome vs barbarian hordes.

Friday, July 06, 2007

Film — The Thief of Baghdad

Yes, time once again for the event that first drove me to blogging, the Cambridge Film Festival.

Unlike last year, none of the first night opening films struck me, so the first out the door was this remastered print of the original 1940 classic Arabian Nights style tale.

The lushness of Technicolour showed -- for all that the effects indicated towards the bleaching desert sun, the sets strove to be as lush as any of those in the Yimou Zhang wuxia movies. That you could at times see the join did not detract from the extensive use of blue-screen effects.

Rather, the film showed its age more in the conventions of its story telling and its pacing -- and that we were spared being emoted at for the romance strand of the plot. Definitely a movie from a simpler time, when Araby was a far and mystical land, where orderly regime change could be effected simply by a brief aerial bombardment.

Thursday, July 05, 2007

Links for 5-Jul

Patterns I Hate #1: Singleton -- Global variables in OO clothing

The links in the comments to this post make it, well, suitable for singleton instantiation for today's links.

Tuesday, July 03, 2007

IronPython and PyFit -- revisited

In my earlier post, I omitted one crucial detail, which I hadn't actually connected with getting the PyFit system to work, and that is I had already added the existing Python 2.5 standard libraries to my IronPython 1.0.1 site.py file thus:--


This should not be needed if you use FePy instead; and may not be needed for 1.1 or 2.0

Links for 3-Jul

Writing Orthogonal Code

The Big Ball of Mud Anti-Pattern

DLR Hosting Services -- For IronPython 2.0α1 and Silverlight 1.1α1