Saturday, February 23, 2008

Unplot

Sometimes I want to "un-plot" data. I find myself in the situation where I have a plot of the data, but not the actual coordinates of the data itself. So, today I wrote this little tool for turning a bitmap image into the x and y coordinates of the curve. (Some Photoshop work may be necessary for cleaning out other lines in the image). It simply takes the image, starts at the top, and scans downwards until it hits the curve, and then works from left to right. The data can be saved as CSV, to be easily loaded into Excel or Matlab.


I've tested this on figures from research papers, and it works. This will be useful for recovering data from a figure when the original data has been lost. Also, I can use it to get audio data from Audacity.

Watch this screencast of it in action. This will show how to use it.

And here is the program (897K). Currently Windows only, but I can port it to Linux if there is interest.

WordMash

In high school, I wrote a short JavaScript program to create Markov chains while waiting in an airport. The idea is simple but yields incredible results. First, you enter some lengthy text. A model is created by keeping track of all of the words that follow a given word. If there is a fairly large input text (Sherlock Holmes, or the Times), the slight amount of context will be enough to create sentences that (almost) make sense:

I told you yesterday, and I trust, with you, however, as I spoke, and it is clear and concise.


However, the randomness produces results that are often ridiculous!

Mr. Gordon, a retired Marine lieutenant general and a metal-schooled three-ax attack into songs that are both action-packed and gratuitously stylized. "Where Can I Stab Myself in the course of research for gut-level emotional impact," sheriff's officers said.


I recently made a site called WordMash where you can try it yourself, with texts like The Adventures of Sherlock Holmes. Best of all, you can paste your own text in, and see what happens. The code is all GPL, so have fun with it. Leave a comment if you come up with something good.

Tuesday, February 12, 2008

3 Windows Utilities

First, a rich text-to HTML converter. You can use it alongside WordPad to get a ghetto Dreamweaver.

I was looking for a quick way to convert some RTF documents to HTML. Parsing the RTF was too much effort. Pasting into Dreamweaver seemed to strip formatting. I then thought of an idea that would make this very easy. You can paste rich text into a "ContentEditable" element in Internet Explorer, and it will retain much of its formatting - and then getting the innerHTML of that element produces the HTML!

Bold/italic/underline, fonts, colors, indentation, and even tables(!) are supported. I threw together a demo here. (Requires Internet Explorer). Also of note is this cross-browser rich text editor that also works in Mozilla using designMode.

Next, a small tool for finding colors. You know the eyedropper tool in Photoshop that can pick up a color from an image? This will do something similar for anything visible on your screen. It will grab the RGB value of the color just underneath your cursor, in any Windows program.

Download it here (zip, no installer). Run the program and press the space bar to update the color to be whatever color is beneath the mouse. The idea came from altAnswerColor from Altuit.

Finally, I use Microsoft Paint occasionally to draw simple lines and diagrams. To get arrows, I'll have to copy screenshots from Word or something. I wrote this small program to have quicker access to arrows.


When you click an arrow, it places an image on the clipboard that can be quickly pasted into Paint. Simple, yet useful.