Thursday, March 31, 2011

Session support in the Vyatta REST API

While it may not be exactly faithful to RESTful principals, it is a good feature/option that further enhances security.

Authentication in the Vyatta REST API uses standard HTTP basic authentication (and has since day one). Vyatta uses https so the basic authentication parameters (i.e. username and password) are encapsulated within the https protocol to provide a secure channel. Since the auth is contained within each request the server is not required to maintain state (or track a session), as the username and password are presumably good forever.

The downside of this approach is that maintaining a username and password for access can be risky (see this post)

Thursday, March 24, 2011

Supporting long polling in lighttpd with fastcgi

Long-polling (or comet) is a technique (or hack) designed to support asynchronous server to client messaging. In other words push notification from the browser. Given that the HTTP protocol is a client initiated protocol, there's no provision to support a non-client initiated event from the server to the client. That's where Long-polling comes in. Basically it involves a server that never closes the socket (in other words completes the response to the request), and a client that keeps a socket open (and continues to read from the socket).

This allows the client to continue to receive data from the server. From the HTTP perspective this is as if the response never ever finished. The big win, of course, is that the server is now able to push messages back to the client, creating a mechanism via HTTP that allows for asynchronous message pushing. But given that this is a bit of a hack the pushing of messages back to the client is outside the bounds of the HTTP protocol. Meaning that an "out-of-band" protocol specific to the application needs to be designed for this communication.

So, I've been looking at what it would take for lighttpd plus fastcgi to support this configuration. The good news is that it isn't a whole lot.

Thursday, March 17, 2011

Simple scatter plots using R

Just some basic notes on getting scatter plots up and running. Without a lot of sweat. Occasionally I need to create plots of data. Each time the need arises I do the following: (1) google for the lowest learning curve plotting package, (2) find my way up the learning curve or bail and return to step (1). Then next time I have a plotting need (maybe 6 months later) it's back to step (1) again.

Now, with this post I will at least have a reference with notes to get started next time, skip step (1) and maybe even step (2) (and maybe you can benefit from this as well)...

Thursday, March 10, 2011

Crazy date conversion in java for RSS feeds

Here's a solution I hated at the time--and still really hate.

This was a "solution" a few years back while processing RSS feeds in Java for their date/time format. The goal was to convert the various time formats found in random RSS feeds into the common epoch format.

Friday, March 4, 2011

Blondie and Philip Glass ??? WTF?

Totally not on the topic. But I can't let this one go.

A collaboration between Philip Glass and Blondie? Heart of Glass?

Now, the concept is intriguing to say to the least. An early 80's pop star who has not aged well (think Ozzy Osborne) and classical new music composer Philip Glass.

Well, I just heard the song today and it almost works, but was probably doomed from the start. Philip Glass sounds like he is rehashing some of the familiar early career material, and Blondie's voice is electronically enhanced a bit, but with less inflection--probably to match the Glass accompaniment.

Ends up not meshing together in a particular compelling way for me. But what a strange way to start the day listening to that...

Thursday, March 3, 2011

Bandwidth estimator using a simple Kalman filter, Part 2 of 2

I realized that I didn't run through the simple Kalman filter algorithm in the last posting. So, let's do that now before the promised source code review. The Kalman filter I used is about as simple as it can get:

Weight calculation:
weight = bandwidth_variance / (bandwidth_variance + measurement_variance)

The bandwidth variance (the variability within any single measurement) and measurement variance are used to compute the weight.

Estimate calculation:
estimate = estimate + weight*(bandwidth_measurement - estimate)