When possible, I generally live in ssh.
I rarely boot my desktop any more. Most of my active work lives on an always-on Raspberry Pi. So I ssh in either from my netbook, wi-phone, or, if I'm trapped on a Windows box, PuTTY.
Really, it's a wonderful protocol. But it has it's shortcomings: topically, graphics and audio. I've experimented with a few different ideas for audio--UDP streams, web servers using chunked encoding, etc.--with mostly unsatisfactory results. If you know of anything that solves this problem, please contact me.
Today's post, however, is about graphics. The de facto standard for dealing with graphics over ssh has always been X forwarding. Unfortunately, it's kind of a joke. Don't get me wrong. I'm thankful for it, but as proponents of the slew of new windowing systems have pointed out, the number of round trips can make the latency unbearable.
So what if we could do something similar to sending audio data via a web server? Only instead of chunks of audio data, we send snippets of javascript manipulating a canvas element? It might turn out to be just as bad as X, but at least it gives me an excuse to learn something.
With that in mind, I started learning a little about the canvas API today. It's a little higher level than blitting pixels to the screen, so I abused it quite severely in my first project, but it got me started.
A while back, I wrote a mandelbrot set visualizer that rendered to the console (due not as much to ssh graphics shortcomings, as to my limited graphics library vocabulary) in c. The implementation is almost verbatim copied from Wikipedia and is naive more than it is performant, but it got the job done at the time. My javascript has never been idiomatic, but I'm at least conversant, so porting it was straightforward.
The initial rendering actually looked so nice, it made me wish I could navigate it interactively. Then I remembered this is javascript, so anything goes. A little googling turned up this StackOverflow answer and after correcting a couple of my arithmetic mistakes, I had a functioning project.
The code is not pretty, but I feel pretty good about how simple it was to get it working. Let me know what you think.