Technology


Like I said in my last post I have been working on some tools for writer brainstorming. The first one was the “article title writer” at TheWritersSecret.com. Next is a one for brainstorming movie titles. I call it “Movie Brain”.

The tech behind it:

It is written in JavaScript. That way the work of sorting through the data is done by the client machine instead of the server. JavaScript also has some pretty decent string handling abilities.

I collected over 11,000 titles from the WikiPedia list of movies. These are stored by category and are processed into usable data using a combination of awk, grep, and php scripting. For example:

cat horror_words.txt | awk '1==1 {printf("\"%s\",\n",tolower($2));}' | sort | uniq >movies_all.js

The engine uses a very simple template technique. Examples:
“() meets (2).” The parenthesis would be replaced by two different random words. “Boy meets Bacon.”
“The {} and the ()” The brackets would be replaced by a random amount of random words and the parenthesis would be replaced by a single word. “The egg substitute and the curmudgeon.”
“[]: {}” Here the [] means a year. “2012: Pirates Invade”

The last piece of tech was a fun part. When you generate the random list of movies you can see what they would look like with your standard coming soon movie title over a black screen. Just click on one and see what I mean. It uses JavaScript and CSS to generate and animated the title. For a time I had added zooming in on the title but I didn’t like how much processor it hogged.

I also used a technique for the coming soon generator, to keep it all client side, that I had never used before. A couple days ago a friend asked if it were possible to do forms without a server. Apparently it is possible if you are using method GET. You can just have JavaScript parse the URL to read the data.

While writing the JavaScript I found a wonderful resource JavaScript equivalents for PHP functions.

Last night I demoed the “Trampoline Sensor MK II” (patent pending) at the EFF Plutopia event @ SXSW.

If you were at the event and have any questions please leave feedback here.

Video by Vern Graner of the Sensor in action at a The Robot Group meeting.

The trampoline sensor was awarded an Editor’s Choice Ribbon at Maker Faire Austin. Local news Video of the Trampoline Sensor MK II @ Maker Faire. (About 1/2 way into the clip.)

Some tonemap and hdr images I did from Friday night’s DorkBot event.

Gator Girl

Bio-Mechanicals

SanDraw Machine


<?
$URLTOSENDTO="http://www.unfocusedbrain.com/site/";
header("Expires: Wed, 15 Aug 1984 20:30:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache");
header(”Location: $URLTOSENDTO”);
?>
<a href=”site/”>Enter Here</a>

I am a huge fan of TiddlyWiki and use it all the time. This morning I wrote a quick utility in JavaScript to convert CSV to TiddlyWiki Table format.

I am releasing this code into the public domain. The main reason I am doing this is because I had problems finding a JavaScript CSV interpreter that was already public domain. Mine is quick easy and kinda bug free. //smile

Sure there are over 6 million places on the internet to check your IP Address. I’m sure I’ve written this app at least 7-8 times.

But this one is different. No mission creep. Just a plain minimalist way to find out: What is My IP Address?

Some interesting things have happened Since May of last year when I wrote the “Color Match” article.

  • If you do a google search right now for “Classical Art” the article comes up as the 7th natural link.
  • According to my logs over 400,000 people have seen the article.
  • People have posted blog articles about it at least 6 different languages.
  • The content of the article is now being heisted and put on “Scraper Sites” using tons of my bandwidth by hot-linking the photos.
  • I get great feedback from people using the technique.
  • I think the coolest thing about it is: Sometimes when I meet someone for the first time; they have already read my article.

Some time ago I went on a glue buying freak-out. I needed glue for a particular project and realized that we were really understocked in general. So I went over to the office supply store and bought about 4 different kinds. They all have their uses but the one I keep finding new uses for is the “ELMER’S® Glue-All™” pens.

They seem to just contain the normal white glue but the real advantage of these things is the applicator tip. Just squeeze and out comes a drop of glue. I sometimes use the tip to help spread the glue around. I don’t have a caliper small enough to measure the inner diameter of the tip but it is about 1.5mm diameter.

Another thing that has impressed me about these pens is that I have had one ‘active’ for at least 3 months and it hasn’t dried out or clogged yet. The cap seems to make a really snug connection.

I haven’t tried it yet but the applicator tip unscrews from the pen part, so theoretically these things could be re-filled.

A pack of 4 cost me less than $1.50 and each pen holds 10.5mL of glue.

For some reason I got the idea that importing my Firefox bookmarks.html into a TiddlyWiki would be a good idea. I know its just a .html file and that I could just open it in a text editor and paste it inside a TiddlyWiki tiddler and be done with it.

Deciding against the easy option, I decided to have the bookmarks.html file process its self by adding some JavaScript to it. After making a copy of my bookmarks.html file I added this code to the top of the file:



<SCRIPT LANGUAGE="JavaScript">

var theOutput="";

function run_me()

{

    myDiv=document.getElementById("my_div");

    theOutput="";

    theDL=document.getElementsByTagName('dl')[0];

    theOutput=”";

    walkBookmarks(theDL);

    myDiv.innerHTML=”<textarea cols=\”80\” rows=\”20\”>”+theOutput+”</textarea>”;

}

function walkBookmarks(node)

{

    if (node.nodeName ==”H3″)

    {

        theOutput +=”!”+node.firstChild.nodeValue+”<br>\n”;

    }

    if (node.nodeName ==”A”)

    {

        theURL = node.href;

        theText=node.firstChild.nodeValue;

        theOutput += “[["+theText+"|"+theURL+"]]<br>\n”;

    }

    if (node.childNodes != null)

    {

        for (var i=0; i < node.childNodes.length; i++)

        {

            walkBookmarks(node.childNodes.item(i));

        }

    }

}

</SCRIPT>

<div id=”my_div”>Working….</div>

And this code to the end of the file:



<script language="JavaScript">

run_me();

</script>

Which will give wiki formatted text like this:



!Bookmarks Toolbar Folder<br>

[[UnfocusedBrain.com -|http://www.unfocusedbrain.com/]]<br>

[[[Yahoo!]|http://www.yahoo.com/]]<br>

Works pretty nice.

My second attempt was to try using “rdf:bookmarks” as described in the RDF in Mozilla FAQ on the developer website. I really didn’t make much headway with this method. If I were to develop a plug-in for TiddlyWiki that works w/ Firefox’s built in bookmarks this would definitely be the way to go.

My third attempt was to use the ExternalTiddlersPlugin by Eric Shulman. Which allowed me to just put one line in a tiddler and have the bookmarks show up:

<<tiddler "file:///home/username/.mozilla/firefox/l3qbefb3.default/bookmarks.html">>

It almost worked. Since the bookmarks isn’t a really well formed html file it doesn’t come through the tiddly process very well. So I just added a couple lines of code to add around the file and it worked perfectly.



function my_textprocess(text)

{

    text = "<html>" + text + "</html>";

    return text;

}

With this method the links reflect the non editable nature of the real bookmarks from the TiddlyWiki.

In the end I’m not entirely satisfied with any of these methods. What I would like to make would be a plug-in to TiddlyWiki that will open the “rdf:bookmarks” interface. For each folder in the bookmarks it would create a new tiddler and under each tiddler would be the links. In addition to this I would like to add a Bookmarklet to add links to the wiki instead of the real bookmarks.

Tiddly.

I have been developing a couple projects with some friends for the Propeller chip. Which is an extraordinarily powerful micro-controller. The latest project uses the Ping))) sensor and the Hydra Sound System (HSS) to generate sounds based on your hand position over the ping sensor.

To make sense of the HSS sfx_play interface I wrote a little program that allows me to adjust the parameters in real time using a keyboard attached to the propeller. I use it to find a sound then write down those parameters for future use.
tp03.zip This requres the HSS.

Next Page »