Back from Python Jungle

Whew.  Last night, I finally nailed the bug that forced me to get lost inside Python.  Debugging Python inside Internet Explorer is not easy.  To debug native code inside Python, I had to rebuild all of Python, Pythonwin, and PyWin32 native code because you have to have debug builds of all the DLLs.  To debug Python scripts, I wrote some debugging helper code that lets me watch each line of Python code executing.  I am going to hook up a real Python debugger as an IE explorer bar (like the Favorites bar) so I can step through Python scripts and set debug points.  That would be so cool!

Finding out that win32ui module required hosting application to be written in MFC stumped me because I was hosting Python as a DLL written in ATL/WTL and IE doesn't seem to be written in MFC.  Come to think of it, its been ages since I last wrote an MFC application.  I think the last one was NetDynamics Studio.  NetDynamics was bought by Sun and NetDynamics products turned into iPlanet and I have no idea if they are still using the code I wrote.  I was going to replace it with a XUL-engine written Java, but that never happened.

Coercing Win32com module to use existing IE automation objects took some effort, mostly spent on trying to figure out how Win32com works.  I had to patch win32com.client.dynamic.py to do what I needed to.  Real bummer was finding out that most of Win32com is written in Python.  This means its much slower than native glue code.  For most COM automation use, this is no problem since tasks performed by each COM method takes much longer than the time it takes to invoke the method via Python-based Win32com code.  But for manipulating IE DOM, this is dog slow.  Sometimes, I can literally see changes being made to a web page.  Also, each COM dispatch object uses too much memory in Win32com.  Just touching all the nodes in a document will be prohibitive.

I'll have to write my own optimized COM glue for Python at some point.  For now, I am pushing forward with Win32com.

Yahoo URL Screwup

Have you noticed that Yahoo URLs have been screwed up in the past few days?  News seems to work, but maps and other Yahoo services end up with 404, thanks to some URL being prepended.  You can workaround it by removing the first part starting with "http:" to just before the second "http:".  I figured this bug would get fixed within an hour or a day at the latest, but the bug is still there as I write this.

Update: This problem turned out to be my fault.  For a while, I have blocked — by rerouting to echo back – most of the ad sites using the KazaaLite's hosts file which has a list of domain names known to be used to serve ad contents.  Yahoo has decided to reroute requests through a domain in the filter list, resulting in 404.  I removed rd.yahoo.com from the filter list and the problem went away.

Power Network Predators

While everyone was studying properties and behaviors of complex networks, predators like Enron were preying on the weaknesses of the power grid network.  I still remember the damn PG&E bills.

"As chief of Enron's Western energy trading wing, Timothy N. Belden is the guy who turned out the lights in Silicon Valley during summer 2001's bogus energy crisis. He described his depredations as "experiments," and in some profound sense that was true: They were so far ahead of the curve that a lot of them probably weren't even illegal. Nonetheless, he recently pleaded guilty to conspiracy to commit wire fraud, coughing up $2.1 million and promising to sing in federal court. His cadre of 100 or so energy traders, crammed onto a tight little floor together under his supervision, was just like Johnson's Skunk Works – an elite division of wonks who were quick, quiet, and right on time.

They were so quick they made a business of selling lightning. Electric power doesn't sit still long enough to be stored.

They were so quiet that, despite endless press coverage, nobody realized Enron was gaming California's power system. No one imagined that a Texas-sponsored cabal of traders hidden in deepest Oregon could accomplish such marvels. But every time Belden's crew pushed the F1 key, California magically "congested" and "decongested," and Enron made money – more than $800 million amid the crisis of 2001." [Wired 11.03]

Inside Python Jungle

Eeeks.  I spent most of today stepping through innards of Python interpreter and PyWin32 extension modules to debug some bugs caused by my embedding Python inside Internet Explorer.  Its pretty creepy in here and easy to get lost.  I am not very happy about this part of developer's life, particularly when I have to work with messy result of accumulated hacks like Python and PyWin32 is.  To quote my father: "it looks as solid as fart wrapped in spider web."

Ganglog, Mafialog, Yakuzalog, Triadlog

Are there any ganster bloggers out there?  I know that many gangsters in Korea are avid online game players, enough to cause online wars between gangs to spill into meatspace, but I haven't heard of any gangsters bloggers.  Judging from popularity of gang-related movies, gangster blogs should be popular although it would be difficult for the blogger to gab without being grabbed.  Just a thought.

Its all in the <description>

Check out the RSS 2.0 feed for job information.

Looking for a job in Spartanburg, South Carolina? It's now a weblog with an RSS 2.0 feed, a first, as far as I know, and a very valid application of RSS. [Scripting News]

While I am very happy with new application of RSS like this, it is disappointing to see all the key information crammed into <description> tags.  Best solution is to add more details to input forms, but this is not always possible because most people zone out when are faced with a complex form.  With complex forms, there must be a compelling reason to fill it out, like getting tax refund for filing out the tax form.

Textual search technologies, often used with monolithic text, can easily handle seaching with time and location parameters.  Does Google search engine know that San Francisco is 1 hour drive away from San Jose?  Does my RSS reader know?  We'll see a lot of interesting future development in this area.

Battlesuit and Bazooka for everyone

Nanotech suit of armor with airconditioning for American GIs.  Cool.  Whats next?  Bullets with spent uranium core to pierce nanotech armor suits?  It would be more practical to develop exploding bullets that can kill or wound everything within six feet.  Most soldiers have terrible aim under pressure, wasting most of the bullets.  Sure, they call it suppression, but why suppress when you can destroy?  With enough force, tiny fragments of the bullet will go right through a human body, leaving tiny holes that cause internal bleeding.  It will also pop eardrums and knock enemy soldiers down.  Less mess and more prisoners.  With exploding bullets, each M-16 will turn into a Bazooka.  Hmm.  Wasn't there some research done on ways to turn chips into bombs?

IMG: super soldiers

Infrastructure needed for blockers

While Mark is fighting his battle against what I call A-bots (A as in A**hole), not everyone can do what he does nor afford the time to maintain it.  What we need is something similar to Micrsoft Update that will allow average people to pick and choose individual filters as well as filter packs.

How to block spambots, ban spybots, and tell unwanted robots to go to hell. I fight back against telemarketers who abuse my phone, and now I'm fighting back against robots who abuse my web site. (1716 words) [dive into mark]

Smart webskin for cellphones

Many have written about how cellphones might be used as a universal remote, controlling not only everything inside the house, but outside as well.  This morning I woke up from a dream in which I was actually using my cellphone as a universal remote, changing traffic lights and such.  I had similar dreams before as results of impatient creativity, but this time there was a difference.

I was in France and sitting inside my car in front of a restaurant (hey, its a dream).  When I pointed my cellphone at the restaurant, I was given a menu (I think it was in Flash).  What surprised me was that it was in English and prices were in dollars.  I then woke up and tried to make sense of the dream.

It must have been that when a menu in French was received on my cellphone, the menu was forward to a specialized translation service that returned a menu in English with prices converted to dollars.  Hey, its a smart webskin of sort.  Smart webskins filters and modifies the user's view of the web as well as offering missing features such as search and sortable tables.