July 06, 2005

Traffic light versus stop sign

Quick question to which I could not find an answer: between a traffic light and a stop sign, which is the best for an isolated four way intersection?

Continue reading "Traffic light versus stop sign"

May 31, 2005

AJAX Debugging with Greasemonkey

Following up on my last Greasemonkey user script, "XMLHttpRequest Tracing", I wrote a new script that goes beyond tracing: "XMLHttpRequest Debugging".

Here is a screenshot of the new UI.
What it shows is the XMLHttpRequest debugging console, a floating div embedded in the page being debugged. This replaces the javascript console, which the previous script used for tracing.
Each individual XMLHttpRequest invocation will get listed there, with all the details on the request and the response, as well as options to edit and replay the request or replay the response callback.

Update: A newer version of the script is available.

Continue reading "AJAX Debugging with Greasemonkey"

May 10, 2005

"XMLHttpRequest Tracing" for AJAX debugging

Here's a Greasemonkey user script to trace XMLHttpRequest calls in the javascript console. It logs the "open" and "send" calls, as well as the response status code and text.
Its purpose is to help peek into AJAX applications, to learning or troubleshooting, without having to run a network sniffer.

This screenshot shows a sample output (Google Suggest). Each XMLHttpRequest instance is assigned a random ID (781 in this example) that allows you to track multiple requests being run in parallel.

It's a pretty early version, so feel free to send some suggestions and feedback.
It doesn't work on GMail. I'm not sure why yet (any pointers appreciated ;-).

Thanks to the anonymous contributor that posted that idea in the Greasemonkey user script requests page.

Continue reading ""XMLHttpRequest Tracing" for AJAX debugging"

March 15, 2005

BoingBoing Ad Remover

BoingBoing was just pointing at Mark Pilgrim's Google Butler, which strips Google ads and adds a number of useful features.
Since I was just posting about the coming conflicts around ad-filtering, I wanted to have some fun throwing oil onto the fire, as well as experiment with the Greasemonkey extension for Firefox. So here is "BoingBoing Butler" (requires Greasemonkey), which hides all non-content from BoingBoing.

While I'm at it, here's a some challenges to Greasemonkey hackers:

  • Could we use this to bring Google auto-completion to the main Google search page? or add more integration between the various Google services (search, mail, maps,...)?
  • Could this be used to create some in-page annotation using del.icio.us or wikis? or would javascript/domain restrictions prevent that?
  • Create an easy way to find Greasemonkey scripts for a site that you're at. It would search, list and describe all the useful customizations that you could apply to the site. Can this be done by re-using the existing search engines, using a distributed approach (FOAF, a file type or a standard url format?), instead of creating a dedicated directory site with a "search by site" functionality?

And also some questions:

  • How to avoid the blinking effect, as the sidebars are loaded and then hidden? Is it cleaner to completely remove the elements from the DOM, rather than using CSS to hide them?
  • Those user scripts are completely unsecure, aren't they? Any of them could include some spyware/adware script to phone home (log the websites that I visit) or display ads, is that right?

Continue reading "BoingBoing Ad Remover"

March 01, 2005

The brewing war over ad filtering

... and content modification.

It seems like the war for content control (DRM, implicit EULAs, DeCSS, PVRs, ...) is increasingly extending from the music and movie industry to the internet.

Services built on top of other sites generate a good portion of the conflicts: sites with deep-linking policies, lawyers restricting how their RSS can be redistributed or simply, general questions about copyright and caching/proxying/quoting/converting...

But the client (browser) is also a major friction point, because of its ability to modify the content, as illustrated in the debate over Microsoft's SmartTags and Google's AutoLinks.
Advertisement filtering is just a variation on the usual conflict between content producers or users, and many of the classic arguments apply. It's only more sensitive because ads are the revenue source for many websites.

Continue reading "The brewing war over ad filtering"

January 30, 2005

Laminate floor installation 101

Home hacking isn't just about home networking or other X10 kind of things. After moving into my new place, doing some remodelling and becoming a familiar face at Home Depot, I see that home improvement is really like hacking. You need to become familiar with the system, the tools and rules and come up with your own solutions for your unique situation.

A month or so back, my fiancee and I spent a couple week-ends installing laminate at our new place. Installing yourself saves a lot of money and isn't too hard. But the more you understand about the process beforehand the easier the task will be.
I'll try to share some of the tricks I learned.

Continue reading "Laminate floor installation 101"

May 12, 2004

PDML PHP tricks

Portable Document Markup Language (PDML) is a library to output PDF using PHP and an HTML-like markup language.
The "getting started" page describes how to use it: install the library, create a PHP file starting with <?php include "pdml.php" ?> and start outputting PDML.
The PDML will be automatically converted to a PDF file using the FPDF class.

I was curious how this works, as it seemed pretty different from previous similar libraries (PDFLib, FPDF), that offered a programmatic API to generate PDF DOMs instead of a markup language.

Looking at the very end of pdml.php you can notice a call to ob_start("ob_pdml"), with ob_pdml being defined above as function ob_pdml($buffer).
That turns out to be the key. Check out the documentation for the ob_start PHP function.

ob_start will turn output buffering on and will give the callback function a chance to process it. That's the trick for this seamless custom markup conversion using PHP ;-)

I wonder if Flash could be similarly outputted from PHP using a markup language (that would wrap the Ming library).
There could also be an Excel markup language, based on PHP Spreadsheet_WriteExcel, or an image markup language to generate PNG and JPEG image using the GD graphics library.

Continue reading "PDML PHP tricks"

April 23, 2004

TypeKey is live (beta)

I ran into a site that is running MovableType 3.0 (beta1) with TypeKey support.

There is no public protocol doc yet (afaik), but here's a quick analysis attempt.

Continue reading "TypeKey is live (beta)"

March 26, 2004

HTTP 101

...what one should know about HTTP...
After explaining the basics of HTTP to a number of people around me, I decided I should write it up.

Continue reading "HTTP 101"

April 29, 2003

C# events vs. delegates

We have looked at delegates and their implementation in two previous articles. But if you searched some more information about delegates on the web, you surely noticed they are almost always associated with the "event" construct.
Online event tutorials make it look like events are something pretty different from regular delegates instance, although related. Events are usually explained as if they were a special type or construct. But we will see they really are a modifier on the delegate type, which adds some restrictions that the compiler enforces and also adds two accessors (similar to the get and set for properties).

Continue reading "C# events vs. delegates"