partiallydisassembled.net

Ad stats

2007-09-23 20:42:10

I watched a lovely French film on SBS last night called \"Je préfère qu\'on reste amis\". Recall that recently SBS introduced advertisements that interrupt the program in order to supplant their income, which I suppose has been neglected by this government. *Every single* ad break featured a workplace reform ad. Every second break *also* contained that money-for-rich-pensioners ad. One of the ad breaks (all 4 minutes of it) consisted *entirely* of workplace reform propaganda. No kidding. That break didn\'t even have a station promo. I have two things to say about this. Firstly, I have to point out the irony of having the government-owned station supplanting its income with government-provided ads. Brilliant! Isn\'t this the economically-frugal government? Shouldn\'t there be some message about privatisation here? Secondly, thanks to all these brilliantly produced ads, I am now a workplace reform convert. It\'s clear to me now that if Labor were to be reelected: * The scary music will come on and the BIG MUSCLED UNION guys will come and turn off the LIGHT SWITCH. * No-one will be around to make sure I\'m being paid enough. That\'s right, workplace reform introduced minimum wage, award rates and the ombudsman. Oh, and giving companies fines for doing naughty things. * People will lose jobs. The thousands of hard-working workplace reform office people, visible behind the speaker in the three interior office ads. Watch what these background extras do! They walk from one side of the camera shot to the other. S.l.o.w.l.y. Sometimes they\'re holding paper.

Richard writes:

No, you\'ve got it all wrong. Some of those ads are only *organised* by the Government, but they\'re paid for by business. Did you also note the hypocrisy around the outrage yesterday when it was discovered that (shock) the *workers* are ultimately paying for the ads that the unions are running? No-one thought to point out how business ads are funded (hint: it\'ll ultimately be the workers too).

Self: programming tomorrow, yesterday

2007-08-28 16:29:00

So I\'ve been getting quite deep into the Self programming language because of its interesting object model and optimising compiler. All along I\'ve been reading that it\'s accompanied by a revolutionary user interface, which I\'d never seen because it crashes and burns on modern Solaris (needless to say, it doesn\'t even build on x86). Today I found this Sun promotional video [200 MB] from 1995. It focuses almost entirely on the UI, which is like nothing else I\'ve seen (I hear that Squeak has something similar, but haven\'t looked). Besides the programming side, there\'s a lot of neat ideas which GUI and drawing tools in general could steal. * The \"core sampler\" tool, which shows a list of all objects currently under the mouse. Each menu item is a proxy for the real object, so dragging that away removes the object from its current composition (much nicer than the \"ungroup\" tool we get in drawing programs). * In(tro)spect properties on objects, then drag them out of the view to make them stand-alone buttons linked to that object. Because you can do this on the UI tool itself (and its own menus), you can customise your working environment in the same way you work within it. * The networking side of it, near the end of the video. (I guess because Sun and PARC were so into networking, the guys presenting it didn\'t really consider it worth mentioning especially---this is the first I\'d even heard of it in Self).

Alex writes:

Hmm. Apparently some Harry Potter PHP \"garbage-my-data-with-backslashes\" flag is turned on. Won\'t be able to fix it until I get home.

anthony writes:

I remember playing with self years and years ago, and it was a neat little thing. Without a solid userbase behind it, it\'s more a novelty than anything.

Ye olde bloggery

2007-08-25 11:57:40

This update fixes many bugs from previous and works in more browsers (i.e., no more JavaScript). Other features: * Amazing WYSIWYG comment and post editor! * rel=nofollow * RSS feed includes body * permalinks Hope you like your monospace :-)

Richard writes:

M M OO N N OO SSS PPP AA CCC EEEE MM MM O O NN N O O S P P A A C E M M M O O N NN O O SS PPP AAAA C EE M M O O N N O O S P A A C E M M OO N N OO SSS P A A CCC EEEE RRR OO CCC K K SSS R R O O C K K S RRR O O C KK SS R R O O C K K S R R OO CCC K K SSS :)

Faster dispatch

2007-08-21 18:42:15

Here's something that's almost certainly useless to everybody; faster dispatch of static methods:: def faststatic(func): class _c(object): __call__ = func return _c Profiled with:: class ns(object): class SlowClass(object): @staticmethod def foo(): return 1 class FastClass(object): @faststatic def foo(): return 1 import sys sys.modules['ns'] = ns() timeit.Timer('x.foo()', 'import ns; x = ns.SlowClass()').repeat() timeit.Timer('x.foo()', 'import ns; x = ns.FastClass()').repeat() Results are:: SlowClass: 0.439791917801 FastClass: 0.390356063843 The speedup is due to avoiding the _get_ descriptor call, which is completely unnecessary for static methods. A similar performance benefit can be gained with instance methods if you're willing to bind the method during instantiation; here done with a metaclass:: def fastinstance(func): class _c(object): _prebind = True @staticmethod def bind(obj): class _d(object): __call__ = lambda *args, **kwargs: func(obj, *args, **kwargs) return _c class fastdispatch(type): def __init__(cls, name, bases, dict): prebound = [n for n, f in dict.items() if hasattr(f, '_prebind')] old_init = dict.get('__init__') def init(self, *args, **kwargs): for name in prebound: getattr(self, name).bind(self) if old_init: old_init(self, *args, **kwargs) setattr(cls, '__init__', init) super(fastdispatch, cls).__init__(name, bases, dict) Profiled with:: class ns(object): class SlowClass(object): def foo(self): return self class FastClass(object): __metaclass__ = fastdispatch @fastinstance def foo(self): return self import sys sys.modules['ns'] = ns() timeit.Timer('x.foo()', 'import ns; x = ns.SlowClass()').repeat() timeit.Timer('x.foo()', 'import ns; x = ns.FastClass()').repeat() Results are:: SlowClass: 0.59463095665 FastClass: 0.383502960205 You pay for the dispatch speedup at instantiation:: timeit.Timer('X()', 'from ns import SlowClass as X').repeat() timeit.Timer('X()', 'from ns import FastClass as X').repeat() SlowClass 0.0308895111084 FastClass 46.911907196 All times are in microseconds, test bed was:: Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 Linux aholkner-desktop 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686 GNU/Linux Intel(R) Pentium(R) 4 CPU 3.00GHz

Conserve

2007-08-19 22:55:28

'tis the weekend for releases. Here is Conserve, a PyWeek #5 warmup entry.

André Roberge writes:

I\'m just learning to use pyglet from scratch. I\'m *extremely* impressed by it, and by conserve which I just found today. I have no experience writing games but plan to learn by teaching my kids to write a super-Mario type game (I\'ve started writing a very basic tutorial for them, which I will make public when they give me feedback). Great work!
login