Weak Delegate

.NET Framework architects continue to disappoint me.

VS.NET2005's WinForms designer, while glamorous, tends to create an increasingly complex web of EventHandler/Delegate dependencies between the top container and the components it contains as well as among components themselves.

Typically, this sort of problem is solved by applying the Command design pattern but .NET 2.0 doesn't have a built-in support. I have no idea why a feature GUI programmers considered essential since the MacApp days is not in .NET.

So I began writing one this morning that used .NET's existing event and delegate support. It took me little time to run into the strong delegate reference problem which just created more work for me. And it looks like .NET 2.0 won't have built-in support for weak delegates although enough people both inside and outside Microsoft have noted the problem.

Duh.

Update:

After more experiments, I've concluded that independent implementation of weak delegate makes little sense because .NET's event and delegate implementation is too deep a level and sealed too tightly. Instead, I am going to abandon using delegates, rigging an interface-based command microframework instead.

A last bit of rant while I am at it. I've found .NET code like below bewildering. First, 'EventHandler' receives an instance of the calling class mysteriously. Second, keyword 'event' turns 'Testing' into a weird collection-like object. And what's with having to instantiate EventHandler to remove an EventHandler?

public event EventHandler Testing;

Testing +=

new EventHandler(Testing_Called);
Testing -= new EventHandler(Testing_Called);

DSG LInks

BoingBoing mention of DSG spawned more thoughtful posts which I thought deserved a read:

And my own which I expect will create more problems.

Post Korean-War Korean culture is called Nambi Sahwae (Tinpot Society) by Koreans which means that things come to boil up and cool down too fast. This results in:

  1. short attention span
  2. hasty policy making

Internet and search engines together solved the short attention span problem but the second problem got worse because Korean politicians are now being pressure-cooked in minutes by the Net-savvy citizen into making policy changes.

AI in Font Design

This post is a capture of my preliminary thoughts on combining artificial intelligence and automated user feedback to generate new fonts. I've designed some fonts during my Apple II display legible text by taking advantage of monitor defectors and also during my Mac days because I couldn't find a good font to program with. Both times, each font took unbelievable amount of time and result was never completely satisfying.

The system starts with a seed font and a font transformation model (FTM) for the font. FTM is created using a GUI tool to mark features of a family of fonts, much like the way latest 3D modeling tools allow animators to draw skeletons and design meshes to ease model transformation. What FTM really does is defining what aspects of a font family can be changed and how they should be changed. A lot of room for innovations in constraint expression here.

The font creation process is divided into two phases. The first phase is the design phase during which the goals is to create a unique design that meets the design goals. Design goals are qualitative and are specified through policy configuration. The second phase is the finetuning phase during which the font is optimized and customized using font hints.

In each phase, the system applies genetic algorithm to design a generation of font by transforming each part of the font randomly. The result is shown to users to gather feedback. Feedback questionaries are dependent on the type of transformation made so if the width of a font was reduced, then the question during the might be:

  • Too thin?
  • Too thick?
  • Just right?

During the design phase, questions will be more abstract like:

  • Too warm
  • Too cold
  • Too sparse
  • Too dense

Another approach is to simply use thumbs up or down.

A variation of this approach can be used for font selection and personalization to help the user select the font they need and then fine tuning it to their need or taste at the point of sales.

Programmer’s Fonts

Here is a nice enumeration and previews of fonts for programmers (via Roy Osherove and Bradbury Software Forum). My favorite was Bitstream Vera Sans Mono (download) which looks a bit thin and sparse but crisp enough. Anonymous preview looked nice too but ended up looking too thin in ClearType. So I am going to give Bitstream Vera Sans Mono a spin in both VS.NET 2005 and Eclipse.

The font I really want is Consolas which will ship with Longhorn. Rest of Longhorn fonts look great as well. Yummy. Too bad I don't have time to play with Longhorn prelease bits.

Korea Expected to Limit Online Anonymity

I haven't found any english versions of the news articles but Korean government officials have announced their intent that they are looking into ways to limit online anonymity in certain areas (i.e. portals) to curb verbal abuse, defamation, privacy violation, and cyber terrorism. Dog Shit Girl incident was mentioned as an example of privacy violation. According to polls, 60+% of the netizens think limiting online anonymity is a good idea while 30+% were against it.

Note that Korean net culture is different from US and Europe, often more extreme. Also, use of foul language in Korean culture has increased sharply since the introduction of Internet into Korean culture (a recent research conducted on Korean college students counted more than 17,000 unique foul expressions). 17,000? I am not sure if I should feel proud or sad.

Also the Korean government announced that they plan to shutdown email accounts and phone numbers of spammer.

Korea, the land of morning calm and no middle ground. You have too much gung-ho, grasshopper.

Return of the Dog Shit Girl

Apparently my Dog Shit Girl (DSG hereafter) post resurfaced on the blogosphere and comments are snowballing. Well, this proves that she won't be forgotten. As I wrote in one of my comments: attention cuts, retention bleeds.

Update:

Apparently the resurfacing was due to being mentioned on Fark. Go check out the massive pile of comments and pictures gathered there. The funny thing is that they are fascinated by her middlefinger just like Korean netizens were.

Farkers have clicked on the above link 34528 times.
Oy. That's a lot of farking around. – Don Fark.
 
And here is the Technorati link for BoingBoing mention. I guess Mark doesn't subscribe but reads Fark.

Comment on Microsoft Embracing RSS

Others have already discussed this news into realms of fantasy and paranoia so I'll just point out one aspect I think no one has addressed yet: security.

Blogging and syndicated data technologies in general have yet to fully test the fires of hostile computing world. As their prime time nears, they will be subject to abuse and exploitation.

For example, the primary mechanism behind podcast, RSS enclosure, can be used to deliver worms and worse to the desktops. If there are any vulnerabilities in iPod (or any MP3 player hooked up to podcast sync client) codec, then podcasting is a good way to deliver overflow inducing content.

While some might consider social networking aspect of blogging and syndicated data as enhancing security, I see it more as a potential problem because I think trust itself is a primary source of vulnerability.

If you subscribe to 1000 feeds, you are hanging on a chain with 1000 links. Each of those 1000 links (feeds) are potential targets for hackers to attack to gain control over its content. All they need is one vulnerable feed hosting server to change what is delivered to your desktop. If you are using an insecure news client that pools news items from multiple sources, a hacker in control of Ponzi's Schemes feed (hi Ponzi :-)) will be able to send out posts that looks as if they came from the American Express feed.

Some of these problems are easy to fix, some are not. But it's difficult to fix them if you haven't thought about these issues and not many have so far because we were too busy enjoying the heat of creation and smelling the morning rose petals.

I think engineers at Microsoft who had more than their fair share of security-related criticisms will be able to help out in enumerating and addressing the security issues in blogging and syndicated technologies.

That's all.

Update:

FYI, this post is being slashdotted today. You can find their comments at Slashdot and AlterSlash. So far I am happy to see this blog withstand being Slashdoted and Farked at the same time. My fingers are still crossed though. Back to my work pile.

Biscuit – C++ recursive-descent parser framework

Biscuit is a C++ template-based recursive-descent that combines YARD and C++ Metaprogramming finite state machine to write, in C++, reasonably readable EBNF. While I suspect not all the kinks and bugs have been flushed out, I thought the project was interesting enough to keep an eye on.

For example, following EBNF grammar fragment:

group  ::= '(' expression ')'
factor ::= integer | group
term  ::= factor (('*' factor) | ('/' factor))*
expression ::= term (('+' term) | ('-' term))*

is written in biscuit like this:

struct expression ; // magic!
struct group  : seq< str<'('>, expression, str<')'> > { };
struct factor : or_< integer, group > { };
struct term  : seq< factor, star< or_< seq< str<'*'>, factor >, seq< str<'/'>, factor > > > > { };
struct expression : seq< term, star< or_< seq< str<'+'>, term >, seq< str<'-'>, term > >

And here is a XML comment micro-parser:

typedef seq<
  str<'/','*'>,
  star_until< any, str<'*','/'> >
> c_comment;

which can be used like this:

if (match<c_comment>("/* hello, biscuit */")) {
  //…
}

If you are not attracted to the fatal beauty of C++ template programmng, nevermind.