Friday, December 11, 2009

Playing around with JavaScript, Tag Clouds, Delicious

This is a post about an usage of a Cumulus Tag Cloud for delicious user I wrote. After providing a delicious name the application fetches your tags plus their frequency of usage for the corresponding delicious user. It can be found here.
Here an example screenshot.
image
This is done solely client side (no connection to my server, okay but delicious of course) by combining several JavaScript libraries (jquery, jquery URLEncode plugin, swfobject) and a flash tag cloud component.
1. The tags for a user are fetched from delicious. The same origin policy is bypassed with a little old trick (*):
var script = document.createElement('script');
script.setAttribute('src', 'http://feeds.delicious.com/v2/json/tags/' + user + '?callback=doTagCloud');
document.getElementsByTagName('head')[0].appendChild(script);

This trick inserts a script element in the head section of a html page. In html it will something like that:
<script type="text/javascript" src="'http://feeds.delicious.com/v2/json/tags/{user}?callback=doTagCloud"></script>

By providing a callback the actually loaded JavaScript code has the form:

doTagCloud({".net":1,"\\todo":1,"\"design":1, […]});
the function doTagCloud is called with the filled in tags.
2. The tags are sorted, pruned and rendered with the computed relative font weights.
swfobject.embedSWF("flash/tagcloud.swf", "tagCloud", "400", "500",
"7.0.0", false, flashvars, params, attributes);
 

(*) I am no big fan of the same origin policy since it does not actually prevent serious cross scripting attacks but on the other hand it hinders developing advanced client side mash ups without data proxies.

Thursday, September 10, 2009

European Summer School in Information Retrieval (ESSIR) 2009 in Padua

I have been on a Summer School about Information Retrieval in Padua last week - ESSIR 2009. In general it was awesome. I met many interesting people, had a lot of fun and also gathered some input concerning my current work. Most of the talks were excellent and really led me to some new insights about Information retrieval in

general.

Talks I liked most - no special order or distinction between quality (or my interests in the topic) of the talk:

  • The User in Interactive Information Retrieval Evaluation - Peter Ingwersen
  • Information Retrieval in Context - Ian Ruthven
  • Web Mining and Next-Generation Search - Aristides Gionis
  • Indexing Techniques - Mark Sanderson

Here are some pics:

image image 

image image

There are also some more pics at flickr.

Monday, August 17, 2009

JSLint with Eclipse

Some simple steps to check your JavaScript Code with JSLint:

  1. download and install JSRhino
  2. make it somehow available, e.g. create a js.bat (one line: java -jar "path/to/rhino/js.jar" %*
  3. download JSLint and put it in some folder, e.g. /path/to/jslint.js
  4. Add an external tool configuration in Eclipse:

    Location: path/to/js.bat

    Working Directory: ${workspace_loc}

    Arguments: path/to/jslint.js ${resource_loc}

  5. you can now check your JavaScript code with JSLint by calling this external tool.

Enjoy.

P.S.: There is a very interessting talk by Douglas Crockford  (creator of JSON and JSLint) at google tech talk that highlights the good and bad aspects of JavaScript. I liked that a lot.

Monday, July 6, 2009