<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Eltit Golb &#187; software development</title>
	<atom:link href="http://roberto.open-lab.com/category/software-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://roberto.open-lab.com</link>
	<description>think upstream</description>
	<lastBuildDate>Wed, 07 Apr 2010 07:22:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='roberto.open-lab.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/e795e2844d05fcc91bed6662c745ab9f?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Eltit Golb &#187; software development</title>
		<link>http://roberto.open-lab.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://roberto.open-lab.com/osd.xml" title="Eltit Golb" />
	<atom:link rel='hub' href='http://roberto.open-lab.com/?pushpress=hub'/>
		<item>
		<title>Ultra-light jQuery calendar</title>
		<link>http://roberto.open-lab.com/2010/04/06/ultra-light-jquery-calendar/</link>
		<comments>http://roberto.open-lab.com/2010/04/06/ultra-light-jquery-calendar/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 20:09:54 +0000</pubDate>
		<dc:creator>Roberto Bicchierai</dc:creator>
				<category><![CDATA[in english]]></category>
		<category><![CDATA[information technology]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[alendar]]></category>
		<category><![CDATA[date picker]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://rbicchierai.wordpress.com/?p=555</guid>
		<description><![CDATA[CalendarPicker: a new concept for date selection. Read the component history. Sometime I maintain my promises (rarely indeed ), so I worked a little bit on CalendarPicker, receiving some suggestions from my previous post. First of all thanks to everybody for precious feedbacks. The hottest news in CalendarPicker is the usage  of mouse wheel to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=555&subd=rbicchierai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<h2>CalendarPicker: a new concept for date selection.</h2>
<p style="text-align:right;"><a href="http://roberto.open-lab.com/2010/03/23/so-hard-to-have-a-date/" target="_blank">Read the component history</a>.</p>
<p>Sometime I maintain my promises (rarely indeed <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ), so I worked a little bit on CalendarPicker, receiving some suggestions from my <a href="http://roberto.open-lab.com/2010/03/23/so-hard-to-have-a-date/" target="_blank">previous post</a>.</p>
<p>First of all thanks to everybody for precious feedbacks.</p>
<p>The hottest news in CalendarPicker is the usage  of mouse wheel to change dates; it is enabled on years, months and days bars.</p>
<p>I used the great <a href="http://brandonaaron.net/code/mousewheel/docs" target="_blank">mousewheel plugin</a> by <a href="http://brandonaaron.net/code/mousewheel/docs" target="_blank">Brandon Aaron</a>; just include the script for activate it.</p>
<p>Then I changed a little the CSS to enhance “today” with a yellow border.</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/04/image.png"><img style="display:inline;border:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/04/image_thumb.png?w=229&#038;h=117" border="0" alt="image" width="229" height="117" /></a> <a href="http://rbicchierai.files.wordpress.com/2010/04/image1.png"><img style="display:inline;border:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/04/image_thumb1.png?w=229&#038;h=119" border="0" alt="image" width="229" height="119" /></a></p>
<p>Another new feature is the ability of customizing the amount of  years/month/days displayed, so you can have bizarre configurations like these:</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/04/image2.png"><img style="display:inline;border:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/04/image_thumb2.png?w=292&#038;h=106" border="0" alt="image" width="292" height="106" /></a> <a href="http://rbicchierai.files.wordpress.com/2010/04/image3.png"><img style="display:inline;border:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/04/image_thumb3.png?w=292&#038;h=103" border="0" alt="image" width="292" height="103" /></a></p>
<p><a href="http://haineault.com/">Maxime Haineault</a> argued that the next/prev buttons are no fashionable: now you can hide them!</p>
<p>Introducing the wheel movement I had to optimize calls, so callback function is invoked only when the user stops to play with the wheel.</p>
<p>I tried to maintain the code short (actually 180 rows), but the customization of years/months/days requires some computation for cell size; I first tried using only css properties in order to makes cells sharing space equally, but no luck. I need a css-expert&#8217;s hint!</p>
<p>You can see CalendarPicker <a href="http://bugsvoice.com/applications/bugsVoice/site/test/calendarPickerDemo.jsp" target="_blank">at work here</a>.</p>
<p>Feedback welcome!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rbicchierai.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rbicchierai.wordpress.com/555/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rbicchierai.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rbicchierai.wordpress.com/555/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rbicchierai.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rbicchierai.wordpress.com/555/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rbicchierai.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rbicchierai.wordpress.com/555/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rbicchierai.wordpress.com/555/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rbicchierai.wordpress.com/555/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=555&subd=rbicchierai&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://roberto.open-lab.com/2010/04/06/ultra-light-jquery-calendar/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/463bee7888aaf9f21ef6e6506622d6f4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rbicchierai</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/04/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/04/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/04/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/04/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>So hard to have a date</title>
		<link>http://roberto.open-lab.com/2010/03/23/so-hard-to-have-a-date/</link>
		<comments>http://roberto.open-lab.com/2010/03/23/so-hard-to-have-a-date/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 09:09:03 +0000</pubDate>
		<dc:creator>Roberto Bicchierai</dc:creator>
				<category><![CDATA[in english]]></category>
		<category><![CDATA[information technology]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[date picker]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://rbicchierai.wordpress.com/?p=449</guid>
		<description><![CDATA[An overview of 13+1&#160; jQuery calendars, and a new ultra-light calendar picker. When I was teenager (oh God, so many years ago!), my secret dream was to have a date with Elisa, curly hairs, blue eyes, tall, wonderful, curvy-classmate; actually this was the secret dream of every boy in my class. Unluckily&#160; I looked younger, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=449&subd=rbicchierai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<h1>An overview of 13+1&#160; jQuery calendars, and a new ultra-light calendar picker.</h1>
<p>When I was teenager (oh God, so many years ago!), my secret dream was to have a date with Elisa, curly hairs, blue eyes, tall, wonderful, curvy-classmate; actually this was the secret dream of every boy in my class. Unluckily&#160; I looked younger, thinner, callow then others boys, so there was no chance of it coming true. So I decided to learn programming!</p>
<p>Today, I <em>still need a date</em>, well not the same kind of&#160; “date”, a “date” in the sense of <strong>calendar</strong> ones, amazing how the years change your priorities!</p>
<p>Developing a new secret product (actually Licorize!) I needed to pick a date in order to roll-unroll the user log.</p>
<p>Using a third party component is a way to speed-up my development,&#160; I narrowed my research to jQuery components; probably there are lots of calendar component for motools,&#160; prototype, or stand alone ones, but jQuery is my choice, not going to change that!</p>
<p>I initially thought this was a simple quest: “of course there will be thousands of date pickers to choose…”</p>
<p>But nowadays is still hard to have a date, at least in a stylish way…</p>
<p>…&#160; (<strong>if you want to see my component at work just go straight </strong><a href="http://bugsvoice.com/applications/bugsVoice/site/test/calendarPickerDemo.jsp" target="_blank">here</a><strong> </strong>).</p>
<p>Here is the list of calendar components I’ve tried (before developing my own!).</p>
<h2><a href="http://www.eyecon.ro/datepicker/" target="_blank">Eyecon Date Picker</a></h2>
<p>Firstly I came to <a href="http://www.eyecon.ro/datepicker/" target="_blank">Eyecon Date Picker</a>. This is a really nice component. What I loved on this component is the flexibility for moving far in the past (or the future) with few clicks. <a href="http://rbicchierai.files.wordpress.com/2010/03/image19.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb19.png?w=185&#038;h=143" width="185" height="143" /></a><a href="http://rbicchierai.files.wordpress.com/2010/03/image20.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb20.png?w=192&#038;h=144" width="192" height="144" /></a><a href="http://rbicchierai.files.wordpress.com/2010/03/image21.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb21.png?w=190&#038;h=143" width="190" height="143" /></a></p>
<p>Clicking on the top row the component changes “scale” moving through years or months.</p>
<p>Date Picker&#160; is released under MIT and GPL license, so it is usable also in commercial products (that actually is my case).</p>
<p>Date picker is fully skinnable, is quite light,&#160; and really easy to use.</p>
<p>Basic usage is really straightforward:</p>
<blockquote><div>
<pre>$('#date').DatePicker({
	flat: true,
	date: '2008-07-31',
	current: '2008-07-31',
	calendars: 1,
	starts: 1
});</pre>
</p></div>
</blockquote>
<p>Another interesting feature is that it supports period selection:</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image22.png"><img style="display:inline;" title="image" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb22.png?w=570&#038;h=176" width="570" height="176" /></a></p>
<p>and a cell renderer that can be used to highlight holidays, disable some days or whatever your application needs.</p>
<p>I was so happy to have found this component that I included it immediately on Licorize, before discovering a little spot that made me discard it: when you change scale by clicking on a month or on a year it closes the popup (when in popup mode). It is completely acceptable in mostly cases, but unluckily not in mine.</p>
<h2><a href="http://jqueryui.com/demos/datepicker/" target="_blank">jQuery UI Datepicker</a></h2>
<p>Then I tried the “standard” <a href="http://jqueryui.com/demos/datepicker/" target="_blank">jQuery UI Datepicker</a>, that is a really rock solid component. <a href="http://rbicchierai.files.wordpress.com/2010/03/image23.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb23.png?w=236&#038;h=197" width="236" height="197" /></a>Supports keyboard navigation, internationalization, lots of options, events, and methods. It is skinnable with ui theme roller.</p>
<p>It is hard to find a component so well engineered.</p>
<p>It relies on an input field, this means it is intended mainly for&#160; data insertion. It can be used as stand-alone calendar too.</p>
<p>Probably playing with the options you can steer Datepicker where you need.</p>
<p>The minimal usage is really “minimal”:</p>
<blockquote>
<div>
<pre>$(&quot;#datepicker&quot;).datepicker();
...</pre>
</p></div>
<div>
<pre>&lt;input type=&quot;text&quot; id=&quot;datepicker&quot;&gt;</pre>
</p></div>
</blockquote>
<p>On the other hand,&#160; mastering this component is not a joke with dozen of parameters. Even the weight is considerable (if you are interested in this single component only). This happens for every jQuery.ui component, either you accept it and embrace the whole platform or you extract a single part – it may be hard. This is why I didn’t adopt it.</p>
<h2><a href="http://www.filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/" target="_blank">Date Range Picker</a></h2>
<p>An interesting extension of jQuery.ui date picker is <a href="http://www.filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/" target="_blank">Date Range Picker</a> by Filament Group.</p>
<p>This manifests the quality of ui components. Seeing this component at work is quite impressive:</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image24.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb24.png?w=578&#038;h=234" width="578" height="234" /></a></p>
<p>It supports preset ranges in menu (e.g.: “Office closed”), range clicking and other catching features. In one world <strong>power</strong>, but definitively not lightness!</p>
<h2><a href="http://keith-wood.name/datepick.html" target="_blank">jQuery Datepicker</a></h2>
<p>Keith Wood&#160; released <a href="http://keith-wood.name/datepick.html" target="_blank">jQuery Datepicker</a> under both GPL and MIT license.</p>
<p>Great the demo/documentation site!</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image25.png"><img style="display:inline;border-width:0;margin:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb25.png?w=215&#038;h=186" width="215" height="186" /></a><a href="http://rbicchierai.files.wordpress.com/2010/03/image26.png"><img style="display:inline;border-width:0;margin:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb26.png?w=216&#038;h=154" width="216" height="154" /></a>jQueri.ui datepicker is based on this component: the ui one has only less features… this should give you an idea about the power of this plugin.</p>
<p>Every kind of feature is supported, multi-languages, cell renderer, range selection, inline, years/months fast switching, cell disabling, date formats, multi events and much more.</p>
<p>The usage is simple, as simple as your requirements are.</p>
<p>Keith developed also the <a href="http://keith-wood.name/dateEntry.html" target="_blank">Date Entry</a> plugin <a href="http://rbicchierai.files.wordpress.com/2010/03/image27.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb27.png?w=130&#038;h=31" width="130" height="31" /></a> a single input field with a pad for changing date fields.</p>
<h2><a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/" target="_blank">jQuery date picker</a></h2>
<p>Kelvin Luck gives us a strong <a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/" target="_blank">jQuery date picker</a>. It is unobtrusive and really well documented, lots of use cases are ready to be used.</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image9.png"><img style="display:inline;border-width:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb9.png?w=194&#038;h=162" width="194" height="162" /></a></p>
<p>It can be used both inline or as input field, in single or multiple views for period selection.</p>
<p>The basic usage is the standard one:</p>
<div>
<pre>$('.date-pick').datePicker();</pre>
</div>
<p>It supports internationalization and cell rendering.</p>
<p>Probably the look-and-feel is not at the top.</p>
<h2><a href="http://tedserbinski.com/jcalendar/index.html#demo" target="_blank">jCalendar</a></h2>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image28.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb28.png?w=197&#038;h=175" width="197" height="175" /></a>I have to cite the <a href="http://tedserbinski.com/jcalendar/index.html#demo" target="_blank">jCalendar</a> by Ted Serbinsky:</p>
<p>This is an outdated component and how the author says “this project has been&#160; superceded by the most excellent <a href="http://jqueryui.com/">jQuery UI</a>”</p>
<p>So why didn’t I&#160; believe in Ted and do the same thing? We’ll see that after all the reviews.</p>
<h2><a href="http://teddevito.com/demos/calendar.php" target="_blank">jQuery date-picker</a></h2>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image42.png"></a></p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image43.png"><img style="display:inline;border-width:0;margin:0 5px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb29.png?w=204&#038;h=239" width="204" height="239" /></a></p>
<p>Now is the turn of&#160; Ted Devito with <a href="http://teddevito.com/demos/calendar.php" target="_blank">jQuery date-picker</a>:</p>
<p>This is a quite rough (and even uncompleted) component, at least compared with previous jquery ones, but at least it has the gift of simplicity.</p>
<p>Usage is in jQuery style:</p>
<p>$(&#8216;input&#8217;).simpleDatepicker();</p>
<h2><a href="http://eisabainyo.net/demo/jquery.calendar-widget.php" target="_blank">jQuery Calendar Widget</a></h2>
<p>Then I found <a href="http://eisabainyo.net/demo/jquery.calendar-widget.php" target="_blank">jQuery Calendar Widget Plugin</a> by Ei Sabai Nyo that is by far the most compact calendar I ever found: <strong>99 lines</strong> of (unpacked <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ) code!</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image30.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb30.png?w=443&#038;h=192" width="443" height="192" /></a></p>
<p>Ok, probably it is not so powerful, but can be easily integrated and used in your applications; yours, not in mine!</p>
<h2><a href="http://code.google.com/p/dyndatetime/" target="_blank">Dyndatetime</a></h2>
<p><a href="http://code.google.com/p/dyndatetime/" target="_blank">Dyndatetime</a> is an iron-looking date selector. Releases under GNU by thetoolman, it has a cold appearance, but is filled of interesting features. First of all it allows fast year switching by holding the fast back /forward buttons.</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image31.png"><img style="display:inline;border-width:0;margin:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb31.png?w=234&#038;h=163" width="234" height="163" /></a><a href="http://rbicchierai.files.wordpress.com/2010/03/image32.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb32.png?w=233&#038;h=212" width="233" height="212" /></a></p>
<p>Documentation is at least weak, well ok absent, but there is a test page with a couple of examples. It supports multiple languages, date formats, time formats (!)&#160; and some small custom features. Easy to use and effective.</p>
<h2><a href="http://www.overset.com/2008/05/12/multiday-calendar-datepicker-jquery-plugin/" target="_blank">jCal</a></h2>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image33.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb33.png?w=349&#038;h=244" width="349" height="244" /></a>Another nice example is <a href="http://www.overset.com/2008/05/12/multiday-calendar-datepicker-jquery-plugin/" target="_blank">jCal </a>by Jim Palmer.</p>
<p>This is a multiday calendar date picker. The focus here is on date range selection, but this seems a nice piece of code.</p>
<p>It is released under MIT license.</p>
<h2><a href="http://jonathanleighton.com/projects/date-input" target="_blank">jQuery Date Input</a></h2>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image34.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb34.png?w=240&#038;h=214" width="240" height="214" /></a>Last but not least is the <a href="http://jonathanleighton.com/projects/date-input" target="_blank">jQuery Date Input</a> by Jon Leighton, “no frills”, as the author says. “No frills” but a really mature component. Release under MIT license supports all main features like first day of week,&#160; date formatting, css.</p>
<p>Stable and cool, is really pleasant to use.</p>
<p>But it is still not on my way.</p>
<h2>… and now?</h2>
<p>At this point you are probably asking <strong>what I’m looking for</strong>: well have you seen on these components a shine of innovation?</p>
<p><em>I want something more, more original, prettier, cool… not another grid, please!</em></p>
<p>Someone can argue there is no reason to innovate on calendars. A calendar is a calendar, full stop!</p>
<p>Well I’m usually reluctant to change user habits, but sometime I need fresh new air. Licorize, ops, my secret product, is full of new user interface techniques, so why not innovate moving in time?</p>
<p>The inspiration come to me looking at <a href="http://haineault.com/media/jquery/ui-timepickr/page/#d-demo-wrapper-1" target="_blank">jQuery timepickr</a> by Maxime Haineault:</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/03/image35.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image_thumb35.png?w=424&#038;h=134" width="424" height="134" /></a></p>
<p>This is a new way to select hours. It’s usage is practical and immediate. The author was brave in choosing to accept the practical limitation of 15 minutes steps, that could receive lots of user complaints, but this always happens when innovating.</p>
<h2>And now, I’m proud to announce my new free-light-weight-jquery-date-picker…</h2>
<p align="right">(read about the <a href="http://roberto.open-lab.com/2010/04/06/ultra-light-jquery-calendar/">new version here</a>)</p>
<p><a name="mine"></a></p>
<p><a href="http://bugsvoice.com/applications/bugsVoice/site/test/calendarPickerDemo.jsp" target="_blank"><img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/03/image41.png?w=258&#038;h=163" width="258" height="163" /></a></p>
<p>At last I decided to develop my own component. I called it <a href="http://bugsvoice.com/applications/bugsVoice/site/test/calendarPickerDemo.jsp" target="_blank">CalendarPicker</a> (<a href="http://bugsvoice.com/applications/bugsVoice/site/test/calendarPickerDemo.jsp" target="_blank">try a demo here</a>). Calendar picker is released it under MIT license.</p>
<p>Eureka! It looks different from all the others, supports multiple languages, and allows fast movement across months and years.</p>
<p>I know that this approach is not suitable for every context, but I hope someone else will find it useful.</p>
<p>The basic usage looks like:</p>
<p><code>$(&quot;#calendarFilterBox&quot;).calendarPicker(); </code></p>
<p>Of course you will probably need to do something with the selected date <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>In this case the callback function will help you:</p>
<pre><code>var dateSelector;
$(function(){
  dateSelector=$(&quot;#calendarFilterBox&quot;).calendarPicker({callback:function(cal){
    alert(cal.currentDate);
  }});
});
</code></pre>
<p>
  <br />A function will allow to change the current date. For instance to set date to today:</p>
<p></p>
<pre><code>dateSelector.changeDate(new Date());</code></pre>
<p>
  <br />A more comprehensive example with names customization looks like this:</p>
<p></p>
<pre><code>$(function(){
  dateSelector=$(&quot;#calendarFilterBox&quot;).calendarPicker({
    monthNames:[&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;<em>…more…</em>],
    dayNames: [&quot;Sun&quot;, &quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;],
    callback:function(cal){
       $(&quot;#mydate&quot;).html(cal.currentDate+&quot;&quot;);
  }});
});
</code></pre>
<p>
  <br />Your feedback will be deeply appreciated, as always.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rbicchierai.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rbicchierai.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rbicchierai.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rbicchierai.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rbicchierai.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rbicchierai.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rbicchierai.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rbicchierai.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rbicchierai.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rbicchierai.wordpress.com/449/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=449&subd=rbicchierai&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://roberto.open-lab.com/2010/03/23/so-hard-to-have-a-date/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/463bee7888aaf9f21ef6e6506622d6f4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rbicchierai</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb19.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb20.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb21.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb22.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb23.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb24.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb25.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb26.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb27.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb28.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb29.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb30.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb31.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb32.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb33.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb34.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image_thumb35.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/image41.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>An html sanitizer for C#</title>
		<link>http://roberto.open-lab.com/2010/03/04/a-html-sanitizer-for-c/</link>
		<comments>http://roberto.open-lab.com/2010/03/04/a-html-sanitizer-for-c/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 11:23:01 +0000</pubDate>
		<dc:creator>Roberto Bicchierai</dc:creator>
				<category><![CDATA[in english]]></category>
		<category><![CDATA[information technology]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JAVA]]></category>
		<category><![CDATA[sanitizer]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://rbicchierai.wordpress.com/?p=442</guid>
		<description><![CDATA[After 3 months gestation and some bug fixes, HtmlSanitizer is reporting no hacking successes. Does it mean that it rocks? I don’t think so, but it is probably strong enough to sail in stormy waters. See my previous post to know how it works, but mainly test it online with the Patapage playground. Being honest [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=442&subd=rbicchierai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://rbicchierai.files.wordpress.com/2010/03/sanitizer.jpg"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="sanitizer" src="http://rbicchierai.files.wordpress.com/2010/03/sanitizer_thumb.jpg?w=229&#038;h=278" border="0" alt="sanitizer" width="229" height="278" align="left" /></a> After 3 months gestation and some bug fixes, <a href="http://roberto.open-lab.com/2009/11/05/a-java-html-sanitizer-also-against-xss/" target="_blank">HtmlSanitizer</a> is reporting no hacking successes.</p>
<p>Does it mean that it rocks? I don’t think so, but it is probably strong enough to sail in stormy waters.</p>
<p>See my <a href="http://roberto.open-lab.com/2009/11/05/a-java-html-sanitizer-also-against-xss/" target="_blank">previous post</a> to know how it works, but <strong>mainly</strong> <a href="http://patapage.com/applications/pataPage/site/test/testSanitize.jsp" target="_blank">test it online</a> with the Patapage playground.</p>
<p>Being honest I received some complaints concerning the black list approach to CSS styles, but no one has hacked the current version (yet <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ). In any case the code is open to changes, and I’m happy to receive your feedbacks.</p>
<p>Now we are proud to announce that there is a porting to C# by Beyers Cronje (thank you). You can find C# sources <a href="http://patapage.com/applications/pataPage/site/test/HtmlSanitizer.cs" target="_blank">here</a> (and Java ones <a href="http://patapage.com/applications/pataPage/site/test/HtmlSanitizer.html" target="_blank">here</a>).</p>
<p>Other portings are welcome!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rbicchierai.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rbicchierai.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rbicchierai.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rbicchierai.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rbicchierai.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rbicchierai.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rbicchierai.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rbicchierai.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rbicchierai.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rbicchierai.wordpress.com/442/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=442&subd=rbicchierai&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://roberto.open-lab.com/2010/03/04/a-html-sanitizer-for-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/463bee7888aaf9f21ef6e6506622d6f4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rbicchierai</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/03/sanitizer_thumb.jpg" medium="image">
			<media:title type="html">sanitizer</media:title>
		</media:content>
	</item>
		<item>
		<title>A delicious javascript tagging input field</title>
		<link>http://roberto.open-lab.com/2010/02/10/a-delicious-javascript-tagging-input-field/</link>
		<comments>http://roberto.open-lab.com/2010/02/10/a-delicious-javascript-tagging-input-field/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 15:42:54 +0000</pubDate>
		<dc:creator>Roberto Bicchierai</dc:creator>
				<category><![CDATA[in english]]></category>
		<category><![CDATA[information technology]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[jquery; tagging; tag; delicious; api]]></category>

		<guid isPermaLink="false">http://rbicchierai.wordpress.com/?p=404</guid>
		<description><![CDATA[A brief review of existing components and the presentation of the powerful “jquery.tagInput” Once again, working on one of our new secret products (which is called Licorize ), I was in need to select a third party component for speeding up development:  this time, a tagging field. &#8230; before continue reading do you like to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=404&subd=rbicchierai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<h1>A brief review of existing components and the presentation of the powerful “jquery.tagInput”</h1>
<p>Once again, working on one of our new secret products (which is called Licorize <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ), I was in need to select a third party component for speeding up development:  this time, a tagging field.</p>
<p>&#8230; before continue reading do you like to go straight to <a title="Demo of tag javascript component" href="http://bugsvoice.com/applications/bugsVoice/site/test/tagInputDemo.jsp" target="_blank">live demo</a>?</p>
<p>I realized in seconds that I already had in mind a delicious solution. <a href="http://delicious.com/" target="_blank">Delicious</a> (.com) and its wonderful tagging system its really nearly what I wanted, probably even a little more…</p>
<p>What I really love in this component as seen on Delicious is the smoothness of user interaction. Let me explain the concept: try to write a tag directly from the input field and the drop down will show your already used tags, in order of frequency. Amazing, mainly it saves me scrolling the list: most used on top, golden rule. This is not different from what usually the other components do, but in this case the string searched is a little bit “boldified”. This is stylish!</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/02/image.png"><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/02/image_thumb.png?w=581&#038;h=244" border="0" alt="image" width="581" height="244" /></a></p>
<p>Another nice feature of delicious’s tagging field is the integration with “recommended” and “popular”: not only by clicking the tag it is inserted/removed like every nerd-programmer will be able to imagine, but even while you are typing in the input field, the suggested tag is magically highlighted &#8211; this is a masterpiece!</p>
<p>Of course the interface behavior is supported by meaningful contents: suggested tags are computed on the base of the analysis of the url contents and mainly, I suppose,  on other users tagging criteria; having million of users makes the term “statistic” meaningful.</p>
<p>(BTW you can access this data using the Delicious <a href="http://delicious.com/help/api#posts_suggest">api</a>)</p>
<p>The only things I would change in this jewel is the tag separator from [space] to [comma]; this will give you the capability to add multiple word tags, even if it may induce the user in using the tag field as a sort of notes one. So the separator “flavor” may open a <a href="http://en.wikipedia.org/wiki/Pandora%27s_box" target="_blank">Pandora&#8217;s box</a>: if ever in my life I’ll write a tag component &#8211; which I&#8217;ll try to avoid as much as possible.</p>
<p>Apart from the separator, I needed exactly this component, but unluckily it is entangled in Delicious’ js library, so I decided to have a look at available jQuery based components.</p>
<p>As usual this list does not pretend to be complete as I’m focused on developing products, not on writing reviews, but someone else could find my hints useful (I have already wrote some reviews on <a href="http://roberto.open-lab.com/2009/12/21/javascript-charting-tools-an-overview/" target="_blank">charting</a> and <a href="http://roberto.open-lab.com/2010/01/18/javascript-grid-editor-i-want-to-be-excel/" target="_blank">grid</a> components).</p>
<p>The top ranked one  is <a href="http://remysharp.com/2007/12/28/jquery-tag-suggestion/" target="_blank">jQuery tag suggestion</a> by Remy Sharp.</p>
<p><a href="http://remysharp.com/wp-content/uploads/2007/12/tagging.php" target="_blank"><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/02/image1.png?w=517&#038;h=70" border="0" alt="image" width="517" height="70" /></a></p>
<p>This nice component is very easy to use and is based on an array of suggested tags that can be supplied via a js array or via Ajax.</p>
<p>A basic axample:</p>
<blockquote>
<pre>$('input.tagSuggest').tagSuggest({  tags: ['javascript', 'js2', 'js', 'jquery']});</pre>
</blockquote>
<p>An Ajax example</p>
<blockquote>
<pre>$('#tags').tagSuggest({  url: '/tag-suggestion'});</pre>
</blockquote>
<p>Layout is configurable via css, and some parameters will help you in fine tuning this component.</p>
<p>Even if this is a nice component it is quite far from Delicious one, at least because it does not implement multiple tag collection: mine, suggested, popular. Another little limitation is that the suggested tag list is static, even if called through Ajax.</p>
<p>Another cool component is <a href="http://plugins.jquery.com/project/tagger" target="_blank">Tagger</a> by <a href="http://chrisiufer.com/" target="_blank">Chris Iufer</a>.</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/02/image2.png"><img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/02/image_thumb1.png?w=237&#038;h=116" border="0" alt="image" width="237" height="116" /></a></p>
<p>Here the focus is on maintaining  a tag list, instead of filling a field.</p>
<p>Usage is really simple:</p>
<blockquote><p>&lt;input class=&#8221;tagger&#8221; type=&#8221;text&#8221; name=&#8221;tags[]&#8221; /&gt;</p>
<p>&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>$(document).ready(function(){</p>
<p>// add to tagger element by index</p>
<p>$(&#8216;.tagger&#8217;).eq(0).addTag(&#8216;photo, design, creative&#8217;);</p>
<p>// add to a specific tagger element by Id</p>
<p>$(&#8216;#places&#8217;).addTag(&#8216;mountain view&#8217;);</p>
<p>$(&#8216;#places&#8217;).addTag(&#8216;chico&#8217;);</p>
<p>});</p>
<p>&lt;/script&gt;</p></blockquote>
<p>But this is even farther from my goal…</p>
<p>Even <a href="http://plugins.jquery.com/project/ptags" target="_blank">Pines Tags</a> by Hunter Perrin goes in the wrong direction, at least compared with Delicious. It is focused mainly on writing / removing tags (like the previous one):</p>
<p><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/02/image4.png?w=516&#038;h=83" border="0" alt="image" width="516" height="83" /></p>
<p>The documentation is little bit weak but usage is still easy:</p>
<blockquote><p>$(&#8220;#tags&#8221;).ptags();</p></blockquote>
<p>In the same flow is <a href="http://www.benoitvidis.com/2009/09/jtags-plugin/" target="_blank">JTAG</a> by <a href="http://www.benoitvidis.com/">Benoît Vidis</a></p>
<p><a href="http://www.benoitvidis.com/files/code/jtags/jtags.demo.htm"><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/02/image5.png?w=649&#038;h=71" border="0" alt="image" width="649" height="71" /></a></p>
<p>cute, but not my prefered one.</p>
<p>Another component that cought my attention was <a href="http://www.geddesign.com/projects/jquery-magictags/" target="_blank">MagicTags</a> by Dave Geddes.</p>
<p><a href="http://www.geddesign.com/projects/jquery-magictags/" target="_blank"><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/02/image6.png?w=546&#038;h=137" border="0" alt="image" width="546" height="137" /></a></p>
<p>Nice graphics, but here the core seems the transitions effects, making the usage of this component at bit annoying.</p>
<p>Nice look, but similar behavior for  <a href="http://devthought.com/wp-content/projects/jquery/textboxlist/Demo/" target="_blank">TestBoxList</a> by <a href="http://devthought.com/">Guillermo Rauch</a>.</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/02/image9.png"><img style="display:inline;border:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/02/image_thumb4.png?w=474&#038;h=51" border="0" alt="image" width="474" height="51" /></a></p>
<p>That’s all folks!  I didn’t find other components, maybe the “tag” search key induces too much noise in search engines, but differently from usual there aren&#8217;t dozens of components, the choice is limited.</p>
<p>So I reached this sad conclusion:</p>
<p><strong>I MUST WRITE MY OWN COMPONENT!</strong></p>
<p>At least now my requirements are clear:</p>
<ol>
<li>supporting already used tag list, eventually filled with an Ajax call</li>
<li>filtering results using user inputs</li>
<li>supporting suggested tags, with “smart” selection</li>
<li>supporting multiple separators</li>
<li>supporting frequency</li>
<li>having a nice-ligth-stylish look</li>
<li>be delicious!</li>
</ol>
<p>After a couple of days of programming this is the result:</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/02/image7.png"><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/02/image_thumb2.png?w=602&#038;h=94" border="0" alt="image" width="602" height="94" /></a></p>
<p>typing on the text field a drop down will show your used tags:</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/02/image8.png"><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2010/02/image_thumb3.png?w=603&#038;h=134" border="0" alt="image" width="603" height="134" /></a></p>
<p>I’ve set up a <a title="Demo of tag javascript component" href="http://bugsvoice.com/applications/bugsVoice/site/test/tagInputDemo.jsp" target="_blank">live demo</a> on <a title="BugsVoice" href="http://bugsvoice.com" target="_blank">BugVoice</a> site (new secret product is offline for the moment).</p>
<p>The usage is quite easy at least in the minimal configuration:</p>
<pre style="background-color:#f0f0f0;"><code>&lt;link rel=stylesheet href="jquery.tagInput.css" type="text/css"&gt;
&lt;script type="text/javascript" src="jquery.tagInput.js"&gt;&lt;/script&gt;</code></pre>
<p>insert your input field:</p>
<pre style="background-color:#f0f0f0;"><code>tags: &lt;input type="text" size="80" id="tag" &gt;</code></pre>
<p>then instantiate the component:</p>
<pre style="background-color:#f0f0f0;"><code>&lt;script type="text/javascript"&gt;
var myTags=[
  {tag:"js",freq:30},{tag:"jquery",freq:25},
  {tag:"pojo",freq:10},{tag:"agile",freq:4},
  {tag:"blog",freq:3},{tag:"canvas",freq:8},
  {tag:"dialog",freq:3},{tag:"excel",freq:4} ]   $("#tag").tagInput({ tags:myTags})
&lt;/script&gt;</code></pre>
<p>This is just a static case example; in case you have thousands of tags, you should use something like a Json Ajax call.</p>
<p>There are some configuration parameters, this is the complete list:</p>
<ol>
<li><strong>tags</strong>: is a Json array of objects with “tag” and “freq” properties; freq is not mandatory if you do not use it for sorting. It is not mandatory if jsonUrl is specified.</li>
<li><strong>jsonUrl</strong>: will receive the text of current tag typed in the “search” parameter.</li>
<li><strong>autoFilter</strong>:  true/false  default=true when active shows only matching tags, &#8220;false&#8221; should be used for server-side filtering</li>
<li><strong>autoStart: </strong>true/false default=false when active the dropdown will appear straight on entering the field, otherwise only while typing</li>
<li><strong>sortBy: </strong>&#8220;frequency&#8221;|&#8221;tag&#8221;|&#8221;none&#8221;  default=&#8221;tag&#8221;. When sorting by frequency is on, the filler should report the “freq” property for each tag</li>
<li><strong>tagSeparator: </strong>default=&#8221;,&#8221; any separator char as space, comma, semicolon</li>
<li><strong>boldify: </strong>true/false default true “boldify” the matching part of tag in the dropdown box</li>
<li><strong>suggestedTags: </strong>callback function to retrieve an object array like ["sugestedtag1","sugestedtag2","suggestedtag3"].If this parameter is not present tag suggestion functionality will be kept hidden.</li>
<li><strong>suggestedTagsPlaceHolder: </strong>jQuery proxy for suggested tag placeholder. If it is not supplied it is created below the input field. When placeholder is supplied (hence unique), tagField should be applied on a single input.Something like  $(&#8220;#myTagFiled&#8221;).tagField(&#8230;) will work fine: $(&#8220;:text&#8221;).tagField(&#8230;) probably not!</li>
</ol>
<p>so a more complex example will look like:</p>
<pre style="background-color:#f0f0f0;"><code>&lt;link rel=stylesheet href="jquery.tagInput.css" type="text/css"&gt;
&lt;script type="text/javascript" src="jquery.tagInput.js"&gt;&lt;/script&gt; 

tags: &lt;input type="text" size="80" id="tag" &gt;
suggested tags: &lt;span id="suggested" class="tagInputSuggestedTagList"&gt;&lt;/span&gt; 

&lt;script type="text/javascript"&gt;
  $(function(){
    $("#tag").tagInput({
      jsonUrl:"tags.jsp",
      sortBy:"frequency",
      suggestedTags:  ["jquery","tagging","tag","component"],
      tagSeparator:" ",
      autoFilter:false,
      autoStart:false,
      boldify:true,
      suggestedTagsPlaceHolder:$("#suggested")
    })
})
&lt;/script&gt;</code></pre>
<p>in this case the jsonUrl “tags.jsp” is a silly JSP page that will return 4 tags starting with the text typed by the user. Here the sample code:</p>
<pre style="background-color:#f0f0f0;"><code>&lt;%@ page import="net.sf.json.JSONArray, net.sf.json.JSONObject" %&gt;&lt;%
  JSONArray jsa= new JSONArray();
  String search=request.getParameter("search")
  search=null?"":search;
  for (int i=1;i&lt;5;i++){
    JSONObject o= new JSONObject();
    o.element("tag",search+i);
    o.element("freq",i);
    jsa.add(o);
  }
  out.print(jsa.toString());
%&gt;</code></pre>
<p>This component is released under <a href="http://creativecommons.org/licenses/MIT/" target="_blank">MIT license</a>. Enjoy it!</p>
<p>Any feedback will be really appreciated.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rbicchierai.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rbicchierai.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rbicchierai.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rbicchierai.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rbicchierai.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rbicchierai.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rbicchierai.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rbicchierai.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rbicchierai.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rbicchierai.wordpress.com/404/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=404&subd=rbicchierai&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://roberto.open-lab.com/2010/02/10/a-delicious-javascript-tagging-input-field/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/463bee7888aaf9f21ef6e6506622d6f4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rbicchierai</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/02/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/02/image1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/02/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/02/image4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/02/image5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/02/image6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/02/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/02/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/02/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>JavaScript grid editor: I want to be Excel</title>
		<link>http://roberto.open-lab.com/2010/01/18/javascript-grid-editor-i-want-to-be-excel/</link>
		<comments>http://roberto.open-lab.com/2010/01/18/javascript-grid-editor-i-want-to-be-excel/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 14:34:01 +0000</pubDate>
		<dc:creator>Roberto Bicchierai</dc:creator>
				<category><![CDATA[in english]]></category>
		<category><![CDATA[information technology]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[spreadsheet]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://roberto.open-lab.com/?p=313</guid>
		<description><![CDATA[A short list of my favorite JavaScript grid components. How many times did you hear users asking you: “something simple, a grid like excel”? When I was a VB programmer, oh yes, I have this dark spot on my career, and it is not the only one… this request threw me in panic. Usually what [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=313&subd=rbicchierai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<h1>A short list of my favorite JavaScript grid components.</h1>
<p>How many times did you hear users asking you: “something simple, a grid like excel”?</p>
<p>When I was a VB programmer, oh yes, I have this dark spot on my career, and it is not the only one… this request threw me in panic. Usually what your “killer” is asking you is not what you, programmer, are thinking of (namely the power of cell functions, programmability, graph etc., that probably your “killer” does not even imagine): what they are thinking about is the editor flexibility, the ability to add columns, rows, move cells blocks, copy and paste from different sources.</p>
<p>After the ritual pointing-out that your application is NOT Excel, the VB solution was to adopt the standard flexGrid or the mythical TrueDbGrid that made happy both the killer-user and the victim-programmer.</p>
<p>But my VB era is long gone and nowadays I’m fighting with JavaScript and Java web applications; how to address the same old request of “something like Excel”?</p>
<p>I spent some days looking around for a solution. I warn you that this post does not pretend to be a complete list of available grid/table editors and that my investigation is mainly&#160; “emotional”: I want to feel on a web-app the same prickle that I experience when using Excel.</p>
<p>Of course it is not only romantic surfing, I needed to edit data to fill the graph snipplet for <a href="http://patapage.com" target="_blank">Patapage</a>, so there are some “nice to have” requirements: to be free of charge, light, based on jQuery, appealing. Server side aspects as pagination, sorting, CRUD etc. are for the moment not the crucial points as the amount of information I need to manage is limited and a totally client side solution would be acceptable.</p>
<p>Actually the implementations I found can be classified in three main groups:</p>
<ol>
<li><strong>data driven</strong>: these are generally components with all the features needed for listing a large number for rows, with server-side pagination, scrolling, search and sort functionality; generally are lacking editing functionality, or when the feature is present is single row based, reflecting the fact that there is an underlying database. Data binding is made through XML or Json, depending the language supported server-side </li>
<li><strong>light edit</strong>: here the focus is given to the “editing agility”, every row is always in editing status,&#160; search and sort are rarely available and in any case working on a limited set of rows isn’t a real limitation. Data is filled starting from a JS object, calling methods, or from an html table.&#160; Some of these implementation supply callback methods that can be used to interact server side. </li>
<li><strong>spreadsheets</strong>: oh yes! there are also some really sophisticated JS clones of the glorious one! These are generally&#160; complex solution (in terms of dependencies), supporting formulas, graphs and lot of functionalities. Here the focus is the “simulation effect”, data management and server side integration are really in background. </li>
</ol>
<p>When I started my search I didn’t imagine that there were so many solutions, so I decided that it would be better here to limit the result to the ones based on jQuery. Lets go in depth :</p>
<h1>&#160;</h1>
<h2>Data Driven</h2>
<p>&#160;</p>
<p>One great example of this category is <a href="http://www.trirand.com/blog/" target="_blank">jqGrid</a> by Tony Tomov. This is a really well engineered solution released under MIT and GPL licenses.</p>
<p><img style="display:inline;border-width:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2010/01/image51.png?w=464&#038;h=171" width="464" height="171" />Supports pagination, search, sort and even edit. There are two specific versions for PHP and .NET that drastically reduce the server-side implementation effort. Loading data is supported in multiple ways through XML, JSON or JS arrays and examples are supplied for PHP and MySql. There is a third party Ruby example <a href="http://www.rubyrailways.com/add-a-powerful-ajax-table-to-your-rails-application-in-5-minutes/">here</a>.</p>
<p>It uses jQuery.UI components for display, so the look and feel is pretty.&#160; Switching to edit mode is something perceivable, the user will see that the edit is active, but this is not necessarily bad in this class of components.</p>
<p>It supports sub-grids, multiple input types, master-detail, multi-selections and other useful features.    <br />Column configuration is done in a declarative way using JS objects:</p>
<blockquote><pre>colNames:['Inv No','Date', 'Client', 'Amount'], </pre>
<pre>colModel:[ {</pre>
<pre>  name:'id',</pre>
<pre>  index:'id', </pre>
<pre>  width:55,</pre>
<pre>  editable:false,</pre>
<pre>  editoptions:{readonly:true,size:10}</pre>
<pre>},…</pre>
</blockquote>
<p>that gives you the flexibility you need for well tailored applications.</p>
<p>Seems a rock solid components, the behavior in resizing, scrolling, paging is really pleasant.</p>
<p>Documentation is not the strongest point but there are lots of examples that will help setting up your grid.</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://www.datatables.net/" name="DataTables" target="_blank">DataTables</a> by Allan Jardine released under GPL v2 and BSD is a powerful data grid component.</p>
<p><a href="http://www.datatables.net/"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image19.png?w=476&#038;h=195" width="476" height="195" /></a></p>
<p>Supports pagination, resizing, filtering, multi-column sorting, jQuery UI theme roller, and lots of interesting features.</p>
<p>Data feeding is provided <em>a-la-carte</em>, from DOM, Ajax XML or JSON sources, JS arrays… it’s your choice!</p>
<p>There is also the icing on the cake: cells and rows grouping, cell custom renderer, multi-row selection and much more.</p>
<p>Provides cell editing via <a href="http://www.appelsiini.net/projects/jeditable" target="_blank">jEditable</a> cell-by-cell, not a row at once, and this in some cases could be a limitation; so you may need more that one update to change a row. Probably you can work around this trivia-point.</p>
<p>Configurations starts from zero-config in case of DOM feeding and can be refined to a real full-control using JS objects.</p>
<p>It is well-documented with a large set of examples and this is another plus!</p>
<p>A black spot (at least for me, Java programmer): server side examples in PHP only.</p>
<p>&#160;</p>
<p>&#160;</p>
<p>Another valid example is <a href="http://flexigrid.info/" target="_blank">Flexgrid</a> by <a name="Flexigrid">Paulo P. Marinas.</a></p>
<p>What I really appreciated in this component is the lightness and its simplest feeding example based on an html table. In this case&#160; the whole setup consists of:</p>
<blockquote>
<pre>$(“#mytable”).flexigrid();</pre>
</blockquote>
<p><a href="http://flexigrid.info/"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image15.png?w=414&#038;h=289" width="414" height="289" /></a></p>
<p>Of course this is a quite minimalist approach to this component that supports also XML and JSON data feeding.</p>
<p>Paging, sorting, resizing and other nice features like button injection are supported.</p>
<p>What is missing is the edit capability that is planned but still not released.</p>
<p>Similarly to the previous component the configuration (if needed <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) is done by JS objects.</p>
<p>Documentation: we all are programmers, we hate to write it but we love to read it… so here too is really succinct with few examples for PHP server-side both XML and JSON.</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://dreakmore.info/tgrid/demos/" target="_blank">tgrid</a> by Mateusz Mikołajczyk is a lightweight datagrid, that supports all main features like sorting, paging, filtering.</p>
<p><a href="http://dreakmore.info/tgrid/demos/"><img style="display:inline;border-width:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2010/01/image141.png?w=473&#038;h=233" width="473" height="233" /></a></p>
<p>I didn’t discover the license type so be careful on usage.</p>
<p>Data is fed by Ajax Json calls that make this component scalable enough.</p>
<p>Documentation supplied is “short” but with some examples, so setup is not a big deal.</p>
<p>This components supports a “row rough” edit, in the sense that it is not in-place, but out of the grid: it did not give me the right feeling. Taken out the edit, tgrid runs well.</p>
<p>Configuration does not offer many options; something nice is the cell custom renderer that allows you to format data.</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://reconstrukt.com/ingrid/" target="_blank">Ingrid</a> (great name!) is a less powerful grid component, but it is really unobtrusive and cute enough to be considered. Released under GPL license, it supports column resizing, sorting, paging etc.</p>
<p><img style="display:inline;border-width:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2010/01/image21.png?w=354&#038;h=242" width="354" height="242" /></p>
<p>Data is fed only by providing an html table, and this could find some criticism.</p>
<p>Google Chrome support has some little creeps on display.</p>
<p>Multiple row selection is a nice feature that earns some points to this component.</p>
<p>Editing is not supported.</p>
<p>&#160;</p>
<p>In the same spirit of loveliness <a href="http://www.overset.com/2008/08/30/animated-sortable-datagrid-jquery-plugin-jtps/">jTps</a> by Jim Palmer is released under MIT license.</p>
<p><a href="http://www.overset.com/2008/08/30/animated-sortable-datagrid-jquery-plugin-jtps/"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image71.png?w=468&#038;h=205" width="468" height="205" /></a></p>
<p>Paging, resizing, sorting are supported; a nice feature is smooth scrolling. Even in this case editing is not supported, but the real limit of this component is in term of scalability: data feeding does not support Ajax sub-sequential loading, so all data is loaded at once. Paging is only client side limiting the meaning of this feature.</p>
<p>&#160;</p>
<p>For the sake of completeness I have to cite <a href="http://dev.iceburg.net/jquery/tableEditor/demo.php" target="_blank">TableEditor</a> by Brice Burgess that seems a little bit outdated (even if really well indexed), and <a href="http://snowcore.net/jquery-data-grid-%D0%BF%D0%B8%D1%88%D0%B5%D0%BC-%D0%BF%D0%BB%D0%B0%D0%B3%D0%B8%D0%BD" target="_blank">Snowcore’ jQuery Data Grid</a> that is in Russian and this fact did not help me to understand how to use it; moreover the site icon <a href="http://rbicchierai.files.wordpress.com/2010/01/noie.jpg"><img style="display:inline;border-width:0;" title="noie" border="0" alt="noie" src="http://rbicchierai.files.wordpress.com/2010/01/noie_thumb.jpg?w=15&#038;h=15" width="15" height="15" /></a>&#160; let’s me suppose that IE testing is not a priority for Snowcore <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>&#160;</p>
<h2>Light Edit</h2>
<p>&#160;</p>
<p>This category, as before stated,&#160; is mainly focused on edit agility instead of server-side data management. This fact steers the implementation towards a all-client-side approach. Implementations in this category are generally a little bit rough with respect to the previous ones.</p>
<p><a href="http://wiki.github.com/mleibman/SlickGrid"><img style="display:inline;border-width:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2010/01/image25.png?w=359&#038;h=331" width="359" height="331" /></a>A&#160; real interesting exception is the excellent <a href="http://wiki.github.com/mleibman/SlickGrid" target="_blank">SlickGrid</a> by Michael Leibman released under MIT style license.</p>
<p>Here the author is particularly careful in rendering performance; he uses a virtual rendering technique to limit the number of DOM elements in order to make SlickGrid really scalable. The example provided with 50000 rows really run in a flash.</p>
<p>The author states in the “grid vs data” paragraph that here the focus is on the grid, not on the data. Despite his intentions, sorting, resizing, filtering, resizing and edit callbacks, give this grid a place even in in the previous category.</p>
<p>Data feed can be done via JS arrays, or via Ajax using the Slick.Data.RemoteModel object provided.</p>
<p><a href="http://rbicchierai.files.wordpress.com/2010/01/image9.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image_thumb9.png?w=267&#038;h=110" width="267" height="110" /></a>Custom cell renderer allows you to express your creativity, as shown explicitly in the examples when injecting a Sparkline graph in the last column (see my <a href="http://roberto.open-lab.com/2009/12/21/javascript-charting-tools-an-overview/" target="_blank">previous post</a> for a excursus on charting components).</p>
<p>Rows multi-selection, ordering, and custom row rendering using John Resig&#8217;s <a href="http://ejohn.org/blog/javascript-micro-templating/">micro-templates</a> makes this component really flexible.</p>
<p>Configuration is done as usual using JS objects.</p>
<p>Having all this features and also having taken care of cell movements with the keyboard and easy editing is a great achievement!&#160; Thanks Michael.</p>
<p>&#160;</p>
<p>Once again Allan Jardine provides us a useful tool called <a href="http://www.sprymedia.co.uk/article/KeyTable">keytable</a> that injects Excel-like key movement on a generic table.</p>
<p><a href="http://www.sprymedia.co.uk/article/KeyTable"><img style="display:inline;border-width:0;margin:0 10px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2010/01/image40.png?w=423&#038;h=142" width="423" height="142" /></a>This can have multiple usages as exemplified on demos available on the site. It easy to understand how a key-movement can change the user experience when it is used on a powerful grid component like DataTables (<a href="#DataTables">see above</a>). Here the author’ <a href="http://www.sprymedia.co.uk/software/KeyTable/datatable.html">example</a>.</p>
<p>&#160;</p>
<p>Another really basic example of editable table is supplied by Greg Weber with <a href="http://gregweber.info/projects/uitableedit">uiTableEdit</a>: there are no examples online, so I built a simple test page, and the components just add the capability to change the cell value. No key movement or other additional features are handled; it can be used as starting point for further refinement.</p>
<p>&#160;</p>
<p><a href="http://joshhundley.com/teditable-in-place-editing-for-tables/"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image36.png?w=244&#038;h=202" width="244" height="202" /></a>Same kind of “roughness” for <a href="http://joshhundley.com/teditable-in-place-editing-for-tables/">tEditable</a> by Josh Hundley, where edit is click based, and key-movement is not supported. This do not mean that this tools is useless, just that it is really far from a complete solution.</p>
<p>It converts DOM cells to text-areas on the fly when editing, and this makes this component almost setup-free.</p>
<p>&#160;</p>
<p>A part of this category (the rough part <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ) is my contribution, used to fill data on <a href="http://patapage.com/applications/pataPage/site/test/testGraph.jsp">PataPage&#8217; charting playground</a>.</p>
<p><a href="http://patapage.com/applications/pataPage/site/test/testGraph.jsp"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/01/image45.png?w=298&#038;h=144" width="298" height="144" /></a> <a href="http://patapage.com/applications/pataPage/site/test/testGraph.jsp"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/01/image48.png?w=286&#038;h=144" width="286" height="144" /></a></p>
<p>Here the functionality are really basic: key-movement, edit, load from url, add and remove only are supported. The grid content is “saved” on a text area with \t and \n separators: same format expected when loading from url. I’m working for supporting&#160; the ^v (paste) capability to facilitate user data insertion as block of cells.</p>
<p>&#160;</p>
<h2>Spreadsheet</h2>
<p>Actually this category comprises solution wider than previous ones, in the sense that a complete solution will probably include all the features listed before; this is on one side a plus, but on the other side if you are interested in extracting some parts (e.g. table edit but not on formulas, server-side integration but not on key-movement etc.), this could be a little difficult due to the complexity of the solutions available.</p>
<p>Light years beyond other solutions at least as first impression, <a href="http://jqueryplugins.weebly.com/jquerysheet.html" target="_blank">jQuery.sheet</a> by Robert Plummer is a really wonderful library. I didn’t find the license type.</p>
<p><a href="http://jqueryplugins.weebly.com/jquerysheet.html"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2010/01/image60.png?w=609&#038;h=254" width="609" height="254" /></a></p>
<p>Really looks like an Excel sheet and the key-movement seems realistic.</p>
<p>Data feeding is done using a DOM table, eventually Ajax-loaded, or by adding row and cols programmatically.</p>
<p>The grid supports resizing, but the real wondering feature is the cell-function support. Not limited to SUM, AVG and other standard functions, but also chart are allowed.</p>
<p>Lots of callback will help you to integrate the sheet on you application.</p>
<p>There are some little bugs on cell selection and some minor layout issue with Chrome, but the overall behavior is impressive.</p>
<p>&#160;</p>
<p>The last, but definitively not least, example of websheet (a web spreadsheet) is the Googledocs one. It is a really good live-teaching example, and even if it is not a ready-to-use library I suggest you to open it and dissect it with, for instance, <a href="http://getfirebug.com/" target="_blank">Firebug</a>.</p>
<p>It is interesting to see how many tricks they used: the whole grid is one iframe, the rows are grouped in small tables of 20 rows (probably in order to scale on IE), the cell value is stored in the <em>td</em> dom; when you edit a cell a text area is printed over the cell (not inside), and so on.</p>
<p>I tried to implement my grid using the same structure, but after some hours I surrendered; the effort to “master” the layout was over my actual estimation, and I fell back to the solution discussed above.&#160; Would be gorgeous to have a jQuery open-source implementation like this!</p>
<p>Google docs spreadsheet is the only application I found that gave me&#160; the right prickle!</p>
<p>Well I stopped my searching here, and I didn’t explore Mootools, Sriptacolous, Ext and maverick ones in detail.</p>
<p>I’ll just list here some other libraries I found:</p>
<p><a href="http://blog.tremend.ro/wp-content/uploads/2006/09/spreadsheet_custom_build/test_spreadsheet.htm" target="_blank">Spreadsheet Dojo Widget</a> <a href="http://blog.tremend.ro/wp-content/uploads/2006/09/spreadsheet_custom_build/test_spreadsheet.htm"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image16.png?w=401&#038;h=198" width="401" height="198" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://www.extjs.com/deploy/dev/examples/grid/edit-grid.html"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image23.png?w=398&#038;h=202" width="398" height="202" /></a> </p>
<p><a href="http://www.extjs.com/deploy/dev/examples/grid/edit-grid.html">Ext JS DataGrid</a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://developer.yahoo.com/yui/examples/datatable/index.html">YUI 2 DataTable</a><a href="http://developer.yahoo.com/yui/examples/datatable/index.html"><img style="border-bottom:0;border-left:0;display:inline;margin-left:0;border-top:0;margin-right:0;border-right:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image24.png?w=402&#038;h=276" width="402" height="276" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://www.simple-groupware.de/cms/Spreadsheet/Home">Simple Spreadsheet</a><a href="http://www.simple-groupware.de/cms/Spreadsheet/Home"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image17.png?w=397&#038;h=250" width="397" height="250" /></a></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://www.blueshoes.org/en/javascript/spreadsheet/" target="_blank">BlueShoes Spreadsheet editor</a>&#160;<a href="http://www.blueshoes.org/en/javascript/spreadsheet/"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image18.png?w=400&#038;h=204" width="400" height="204" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://trimpath.com/demos/test1/trimpath/spreadsheet_demo0.html" target="_blank">TrimSpreadsheet</a> <a href="http://trimpath.com/demos/test1/trimpath/spreadsheet_demo0.html"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image20.png?w=398&#038;h=126" width="398" height="126" /></a></p>
<p><a href="http://trimpath.com/demos/test1/trimpath/spreadsheet_demo0.html"></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://www.sigmawidgets.com/products/sigma_grid2/">Sigma Grid 2.2</a><a href="http://www.sigmawidgets.com/products/sigma_grid2/"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2010/01/image22.png?w=403&#038;h=207" width="403" height="207" /></a></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rbicchierai.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rbicchierai.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rbicchierai.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rbicchierai.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rbicchierai.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rbicchierai.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rbicchierai.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rbicchierai.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rbicchierai.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rbicchierai.wordpress.com/313/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=313&subd=rbicchierai&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://roberto.open-lab.com/2010/01/18/javascript-grid-editor-i-want-to-be-excel/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/463bee7888aaf9f21ef6e6506622d6f4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rbicchierai</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image51.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image19.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image15.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image141.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image21.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image71.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/noie_thumb.jpg" medium="image">
			<media:title type="html">noie</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image25.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image40.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image36.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image45.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image48.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image60.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image16.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image23.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image24.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image17.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image18.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image20.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2010/01/image22.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>JavaScript charting tools: an overview</title>
		<link>http://roberto.open-lab.com/2009/12/21/javascript-charting-tools-an-overview/</link>
		<comments>http://roberto.open-lab.com/2009/12/21/javascript-charting-tools-an-overview/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 14:09:55 +0000</pubDate>
		<dc:creator>Roberto Bicchierai</dc:creator>
				<category><![CDATA[in english]]></category>
		<category><![CDATA[information technology]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[plotting]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://roberto.open-lab.com/?p=240</guid>
		<description><![CDATA[Tons of charting tools, one better than the other, how to find yours? I was working on adding a new widget for Patapage. Sometime you need to publish a simple graphical report on your page, a chart, based on a small set of data that you may want to change quickly online. As requirements, I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=240&subd=rbicchierai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<h1>Tons of charting tools, one better than the other, how to find yours?</h1>
<p>I was working on adding a new widget for <a href="http://patapage.com" target="_blank">Patapage</a>. Sometime you need to publish a simple graphical report on your page, a chart, based on a small set of data that you may want to change quickly online.</p>
<p>As requirements, I wanted to have an immediate feedback of data and configuration changes so I chose a JavaScript charting tool instead of server-side generating “chart images”.</p>
<p>Few years ago this approach was almost impossible due to the lack of cross-browser plotting libraries. Nowadays&#160; there are many powerful plotting tools: this article will introduce some of them and will explain how I got to choose my plotting library.</p>
<p>First of all I had to restrict the selection to those that are licensed for usage in a commercial products, but this is not a big deal; most of them are under LGPL, or MIT license.</p>
<p><a title="Plotr" href="http://solutoire.com/plotr/"><img style="display:inline;border-width:0;margin:0 15px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2009/12/image91.png?w=262&#038;h=191" width="262" height="191" /></a>My second requirement was the compatibility of the JavaScript library: we use jQuery so I had to drop the great <a href="http://solutoire.com/plotr/" target="_blank">plotr</a> library that is based on <a href="http://www.prototypejs.org/" target="_blank">prototype</a>.</p>
<p>Actually Solutoire has also a Prototype porting of flot called <a href="http://solutoire.com/2008/02/27/flotr-javascript-plotting-library/" target="_blank">Flotr</a>.</p>
<p><a href="http://jsxgraph.uni-bayreuth.de/wp/"><img style="display:inline;border-width:0;margin:0 0 0 15px;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2009/12/image2.png?w=265&#038;h=164" width="265" height="164" /></a>Same technology for <a href="http://www.deensoft.com/lab/protochart/" target="_blank">Protochart</a>. For the same reason I quit in tears the amazing <a href="http://jsxgraph.uni-bayreuth.de/wp/" target="_blank">jsxgraph</a>. What I loved of this library is the <a href="http://jsxgraph.uni-bayreuth.de/wiki/index.php/Category:Examples" target="_blank">universe of interactive examples</a> provided by the community. If you do not have library restrictions have a in-depth look to this jewel (if it doesn’t fit, give yourself at least a recreation playing for few minutes with the examples <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ).</p>
<p><a href="http://raphaeljs.com/"><img style="display:inline;border-width:0;margin:0 15px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2009/12/image3.png?w=244&#038;h=242" width="244" height="242" /></a>Also <a href="http://raphaeljs.com/" target="_blank">Raphael</a> is a real impressive product, but even in this case it doesn’t relay on a “standard” JavaScript library, and mainly it is a low level vector library, in the sense that it doesn’t supply any specific chart plotting functions. If I had to write a graph library from scratch I’ll probably start from here.</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://moochart.coneri.se/"><img style="display:inline;border-width:0;margin:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2009/12/image14.png?w=310&#038;h=181" width="310" height="181" /></a><a href="http://mootools.net/" target="_blank">MooTools</a> user will have on their side <a href="http://moochart.coneri.se/" target="_blank">moochart</a> or <a href="http://blog.greghoustondesign.com/canvas-pie-chart-with-tooltips/" target="_blank">canvas pie</a>.</p>
<p><a href="http://blog.greghoustondesign.com/canvas-pie-chart-with-tooltips/"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2009/12/image5.png?w=261&#038;h=168" width="261" height="168" /></a></p>
<p>For <a href="http://jquery.com/">jQuery</a> fanatics, like me, there are lots of bullets too.</p>
<pre class="csharpcode"><a href="http://code.google.com/p/flot/"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2009/12/image6.png?w=244&#038;h=180" width="244" height="180" /></a></pre>
<p>
  <br />First I started having a look at the <a href="http://code.google.com/p/flot/">flot</a> library. I was astonished to see how well engineered this library is . IMHO one of key point is that the whole configuration is defined by using a JavaScript object, so a basic example that will produce the cart on right side will look like:</p>
<p></p>
<pre class="csharpcode">&lt;script&gt;$(<span class="kwrd">function</span> () {    <span class="kwrd">var</span> d1 = [];
    <span class="kwrd">for</span> (<span class="kwrd">var</span> i = 0; i &lt; 14; i += 0.5)
        d1.push([i, Math.sin(i)]);
    <span class="kwrd">var</span> d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
    <span class="rem">// a null signifies separate line segments</span>
    <span class="kwrd">var</span> d3 = [[0, 12], [7, 12], <span class="kwrd">null</span>, [7, 2.5], [12, 2.5]];

    $.plot($(<span class="str">&quot;#placeholder&quot;</span>), [ d1, d2, d3 ]);
});
&lt;/script&gt;</pre>
<p>This approach is very practical when you work with json objects, especially for data series. Another nice aspect of this library is that series configuration and data are on the same object. Of course when you need to use advanced charting features (time series, label formats. ticks etc.) the configuration will become quickly complex and not really readable, but on the other hand the basic approach is straight and painless. Unluckily flot at this moment does not implements pie renderers (to be honest there are some&#160; implementation from the community &#8211; <a href="http://code.google.com/p/flot/issues/detail?id=5" target="_blank">see flot issues</a>), and this was one of my widget requirements. Another little spot is the <a href="http://people.iola.dk/olau/flot/API.txt" target="_blank">documentation</a> that is complete but really ‘60 stylish. Even the examples are a bit poor but enough for starting quickly.</p>
<p><a href="http://rbicchierai.files.wordpress.com/2009/12/image8.png"><img style="display:inline;border-width:0;margin:0 15px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2009/12/image_thumb1.png?w=244&#038;h=214" width="244" height="214" /></a> Then i moved to <a href="http://omnipotent.net/jquery.sparkline/" target="_blank">Sparklines</a> that is a very easy-to-use and intriguing library; I like their site with lots of small charts.&#160; If you need to create dashboards for your site have a look at this plugin. Even in this case configuration and data uses a JavaScript object.</p>
<p>Sparklines was a little basic for my needs so I tested <a href="http://xaviershay.github.com/tufte-graph/" target="_blank">TufteGraph</a> and&#160;&#160; <a href="http://www.reach1to1.com/sandbox/jquery/jqchart/" target="_blank">jQuery Chart</a>; I found both lacking in features.</p>
<p>Then I landed in the <a href="http://www.filamentgroup.com/lab/jquery_visualize_plugin_accessible_charts_graphs_from_tables_html5_canvas/" target="_blank">jQuery Visualize Plugin</a> from Filament group; they have a really smart idea; leave the data on a HTML table!</p>
<p>So the data will look like</p>
<p><a href="http://rbicchierai.files.wordpress.com/2009/12/image9.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2009/12/image_thumb2.png?w=403&#038;h=408" width="403" height="408" /></a></p>
<p><a href="http://rbicchierai.files.wordpress.com/2009/12/image10.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2009/12/image_thumb3.png?w=288&#038;h=290" width="288" height="290" /></a>then the configuration is done as usual by passing&#160; a JavaScript configuration object to the drawer function. On their site there is a nice sandbox to try configuring your chart.</p>
<p>If you already have table displaying data just add a line of code to have your chart.</p>
<p>Of course this is a completely different approach from flot, where to have the same visual effect you must write tons of lines; on the other hand jQuery Visualize does not give you complete configurability, but only reasonable ones <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  . In most cases this could be an effective approach especially if you do not like to spend hours with JavaScript objects and arrays.</p>
<p>I didn’t stops at this station. Next stop <a href="http://www.jqplot.com" target="_blank">jqPlot</a>!</p>
<p><a href="http://www.jqplot.com"><img style="display:inline;border-width:0;margin:0 15px 0 0;" title="image" border="0" alt="image" align="left" src="http://rbicchierai.files.wordpress.com/2009/12/image11.png?w=353&#038;h=285" width="353" height="285" /></a> <strong>jqPlot is a really well engineered solution</strong>, in some sense it has an approach similar to flot, but it has more plotting types (pies too!), a <a href="http://www.jqplot.com/docs/files/usage-txt.html" target="_blank">great documentation online</a> and a lot of examples.</p>
<p>Here both data and configuration are JavaScript objects but are separated, two parameters on the drawing calls.</p>
<p>I appreciated the “default renderer” configuration so you do not need to write too much in case of multiple data series (unlike flot).</p>
<p>The other key factor of this library is the complete pluggability of the renderer; you can have renderers for axis, labels, ticks etc. This approach for instance makes it possible to have labels rendered by canvas:</p>
<p><a href="http://www.jqplot.com/tests/canvasAxisTests.php"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://rbicchierai.files.wordpress.com/2009/12/image12.png?w=605&#038;h=371" width="605" height="371" /></a></p>
<p>The separation between data and configuration helped me to realize my <a href="http://patapage.com" target="_blank">Patapage</a> widget.</p>
<p><a href="http://rbicchierai.files.wordpress.com/2009/12/image13.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://rbicchierai.files.wordpress.com/2009/12/image_thumb4.png?w=312&#038;h=152" width="312" height="152" /></a>I made an editable table that refreshes on-the-fly chart values and a set of options to change the graph layout. Both data and configuration are serialized, so to be easily stored server-side.</p>
<p>I have set up a <a href="http://patapage.com/applications/pataPage/site/test/testGraph.jsp" target="_blank">playground</a> in order to test my Graph component, that covers only few of&#160; jqPlot features, but should give you an idea about this component.</p>
<p>For the sake of completeness I have to cite <a href="http://code.google.com/apis/chart/" target="_blank">Google Chart API</a> and&#160; <a href="http://developer.yahoo.com/yui/charts/" target="_blank">Yahoo YUI Chart Controls</a>, that require to bind tightly with these too small players <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  . No thanks, next time maybe.</p>
<div style="position:absolute;width:1px;height:1px;overflow:hidden;top:228px;left:-10000px;" id="_mcePaste">well engineered</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rbicchierai.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rbicchierai.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rbicchierai.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rbicchierai.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rbicchierai.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rbicchierai.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rbicchierai.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rbicchierai.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rbicchierai.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rbicchierai.wordpress.com/240/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=240&subd=rbicchierai&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://roberto.open-lab.com/2009/12/21/javascript-charting-tools-an-overview/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/463bee7888aaf9f21ef6e6506622d6f4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rbicchierai</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image91.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image14.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/12/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Hallways user testing: the crow on the shoulder.</title>
		<link>http://roberto.open-lab.com/2009/12/03/hallways-user-testing/</link>
		<comments>http://roberto.open-lab.com/2009/12/03/hallways-user-testing/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 14:46:37 +0000</pubDate>
		<dc:creator>Roberto Bicchierai</dc:creator>
				<category><![CDATA[information technology]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[software testing]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[user iterface]]></category>
		<category><![CDATA[user testing]]></category>

		<guid isPermaLink="false">http://roberto.open-lab.com/?p=222</guid>
		<description><![CDATA[Every software-product developer should be familiar with the milestone-book &#34;Don&#8217;t make me think&#34; from Steve Krug, and probably lots of us read it. I did, and I agreed! This happened some years ago… Nowadays my days runs faster, and it may happen that old precious hints get lost. Some days ago, I called Massimo, an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=222&subd=rbicchierai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://rbicchierai.files.wordpress.com/2009/11/20070802_5214.jpg"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="20070802_5214" border="0" alt="20070802_5214" align="left" src="http://rbicchierai.files.wordpress.com/2009/11/20070802_5214_thumb.jpg?w=316&#038;h=376" width="316" height="376" /></a></p>
<p>Every software-product developer should be familiar with the milestone-book &quot;Don&#8217;t make me think&quot; from <a href="http://www.sensible.com/">Steve Krug</a>, and probably lots of us read it.</p>
<p><span style="font-size:large;">I did, and I agreed!</span></p>
<p>This happened some years ago…</p>
<p>Nowadays my days runs faster, and it may happen that old precious hints get lost.</p>
<p>Some days ago, I called Massimo, an expert .NET developer,&#160; for testing our new product<a href="http://bugsvoice.com"> BugsVoice</a>, but secretly to push it to develop, for free, an example of .NET page for catching errors (please don’t tell him).</p>
<p>He sat down in front of me (<a href="http://jblooming.blogspot.com/search/label/office%20space%20pictures" target="_blank">see our space here</a> )&#160; and started to enroll in BugsVoice.</p>
<p>I was peeping him over the monitors barrier watching&#160; his face struggling, and then I</p>
<p>remembered Steve’ rule,&#160; that actually is the all-month tips…<img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="IUCN_054" border="0" alt="IUCN_054" src="http://rbicchierai.files.wordpress.com/2009/11/iucn_0542.jpg?w=256&#038;h=162" width="256" height="162" /></p>
<p>So I moved around the table and I sat behind him, really close, looking over the shoulder , to see both monitor and keyboard, like a crow on the shoulder…</p>
<p><a href="http://www.sensible.com/" target="_blank"></a></p>
<p><a href="http://www.sensible.com/" target="_blank"></a><strong>… and the magic happens!</strong></p>
<p>I discovered in a half hour session that some parts of our application are hard to understand or completely unclear.</p>
<p>We have already used, with satisfaction, professional testing service like <a href="http://www.usertesting.com" target="_blank">UserTesting</a> for our products; they usually provide you a video file recording user voice and screen interaction, but seeing a “human” (are programmers human?)&#160; face give you an emotional feedback that you will miss in video files.</p>
<h2>Some hints to get the best from user testing:</h2>
<ol>
<li>give the tester a small overview of your product. Do not explain your product in detail, give only the context. Prepare a short story board: I gave my tester the following tasks: enroll, choose an error template, configure your server, collect some errors. </li>
<li>invite the tester not to be shy and talk while playing with your app. Explain that it is not a competition, and that you are testing the application not the tester <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </li>
<li>resist to interfere. Do not help your tester and take notes when the tester stops. Eventually hearten him and ask what’s the matter. </li>
<li>look at the mouse movements. If the pointer goes around the screen without a goal, probably there is something too small, in a bad place, or too far. Take notes! </li>
<li>look at the tester&#8217;s face. When you see self-satisfaction (seems that he/she is understanding something) ask what he/she thinks that feature is. Take notes! </li>
<li>let the tester play whith you app discovering features. Take note of the path the tester follows to reach the goal. Is he using different/unplanned ways? Probably there is something to be done on the interface! </li>
<li>look at the clock. Usually a “real” user does not give you more than few minutes before giving up. It is valuable to reach at least a rewarding step in the first minutes. </li>
<li>at the session end ask the tester an overall impression of your application. Ask what he feels about each phase (enroll, step 1 etc.) and take notes </li>
<li>then ask the tester some suggestions to refine your app. Take notes, but then throw them away, you already have a lots of&#160; better feedback. </li>
</ol>
<p>In our case a thirty minute session gave me five A4 pages full of&#160; interesting notes.</p>
<p>What I wonder about user testing is that very often what&#160; misleads the user is a wrong message, a color in a title, a misplaced button, a hidden something; all things that you can fix in minutes and usually every programmer tends to underestimate. Of course sometimes you may get in serious trouble when you miss a core point; this is why it is crucial to start user testing very early. I know that it is sometimes hard to do, how to test an application if a core functionality is missing?</p>
<p>We started user testing quite late with BugsVoice alpha (internally), and we are continuing with the public beta.</p>
<p>Give yourself the opportunity of a day as a crow on the shoulder, you won&#8217;t regret it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rbicchierai.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rbicchierai.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rbicchierai.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rbicchierai.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rbicchierai.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rbicchierai.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rbicchierai.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rbicchierai.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rbicchierai.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rbicchierai.wordpress.com/222/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=222&subd=rbicchierai&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://roberto.open-lab.com/2009/12/03/hallways-user-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/463bee7888aaf9f21ef6e6506622d6f4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rbicchierai</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/11/20070802_5214_thumb.jpg" medium="image">
			<media:title type="html">20070802_5214</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/11/iucn_0542.jpg" medium="image">
			<media:title type="html">IUCN_054</media:title>
		</media:content>
	</item>
		<item>
		<title>Solving the &quot;halting problem&quot;&#8230;</title>
		<link>http://roberto.open-lab.com/2009/11/18/solving-the-halting-problem/</link>
		<comments>http://roberto.open-lab.com/2009/11/18/solving-the-halting-problem/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 09:23:40 +0000</pubDate>
		<dc:creator>Roberto Bicchierai</dc:creator>
				<category><![CDATA[in english]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[JAVA]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[antlr]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://rbicchierai.wordpress.com/?p=78</guid>
		<description><![CDATA[When I asked Gino (alias Roberto Baldi mostmobbed) a software solution for the &#8220;halting problem&#8221;, he told me &#8220;should not be so difficult&#8221;! &#8220;In computability theory, the halting problem is a decision problem which can be stated as follows: given a description of a program and a finite input, decide whether the program finishes running [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=78&subd=rbicchierai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>When I asked Gino (alias Roberto Baldi <a href="http://mostmobbed.blogspot.com/">mostmobbed</a>) a software solution for the &#8220;halting problem&#8221;, he told me &#8220;should not be so difficult&#8221;!</p>
<p>&#8220;In computability theory, the halting problem is a decision problem which can be stated as follows: given a description of a program and a finite input, decide whether the program finishes running or will run forever, given that input.&#8221; (from <a href="http://en.wikipedia.org/wiki/Halting_problem">Wikipedia</a>)</p>
<p>Alan Turing proved in 1936 that a general algorithm to solve the halting problem for all possible program-input pairs cannot exist; but as Gino says, Turing was a pessimist&#8230;</p>
<p>Why I&#8217;m scratching about the halting problem? Because I need power at <a href="http://bugsvoice.com">BugsVoice</a> user&#8217;s fingertips. In particular, I need to allow the execution of user&#8217;s JavaScript code on my server, and knowing if these scripts end may be comforting.<img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="20080102_9458" src="http://rbicchierai.files.wordpress.com/2009/11/20080102_94583.jpg?w=417&#038;h=496" border="0" alt="20080102_9458" width="417" height="496" align="right" /></p>
<p>If you already heard about XSS  you probably know that &#8220;third party&#8221; code execution, authorized or not, could be a nightmare even in the client&#8230; can you imagine how can be ugly on your server a “pirate” code?</p>
<p>Going more in detail, <a href="http://bugsvoice.com">BugsVoice</a> is a service that receives a &#8220;bug&#8221; from a customer’s server, process the request locally, serves a friendly feedback to the user and stores the bug in its database.</p>
<p>JavaScript (JS from here on) server-side execution is involved in the &#8220;processing&#8221; phase.</p>
<p>We supply a pre-filled and certified set of &#8220;rules&#8221; for processing bugs, but we even allow customers to create their own rules.</p>
<p>JS gives you the power of inspecting the error to understand what happened and gives your customer an error better than a &#8220;500 server error&#8221; in order to comfort it and recover a situation where your application credibility is going down. An interesting reading about error recovering and error feedback is  the book &#8220;<a href="http://www.amazon.com/Defensive-Design-Web-improve-messages/dp/073571410X">Defensive design for the web</a>&#8221; from 37 Signal.</p>
<p>The complete BugsVoice process includes mainly three parts:</p>
<p>1) on the customer&#8217;s server side,  an error page that catches the exception, collects as much information as possible (logged user, time, server status, database status, memory etc.) and redirects the user to our BugsVoice server (see <a href="http://blog.bugsvoice.com/2009/11/17/setting-up-an-example-error-trapping-page/" target="_blank">how to configure an error trapping page</a> on BugsVoice blog for more details).</p>
<p>2) our server, reading user preferences recovers the error template. Each template is fully dynamical and customizable; it introduces some “variables” that can be filled from the error happened. Then our server creates two JS objects: the “bug” object filled with the error collected and the “template” object filled from layout skeleton.</p>
<p>3) the JS rules are executed to fill “template” from “bug” or for rejecting the request.</p>
<p>4) the layout is rendered to the user by  using “template” and “bug” objects. The bug is stored on our server.</p>
<p>5) the user feedback is collected and stored.</p>
<p>6) a “thank you” page is displayed to the user.</p>
<p>Then there is the error management but this is interesting “only” for BugsVoice’ users, not for this post. Here some error pages from BugsVoice:</p>
<p><a href="http://bugsvoice.com" target="_blank"><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2009/11/image8.png?w=221&#038;h=264" border="0" alt="image" width="221" height="264" /></a> <a href="http://bugsvoice.com"><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2009/11/image9.png?w=221&#038;h=264" border="0" alt="image" width="221" height="264" /></a> <a href="http://bugsvoice.com" target="_blank"><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2009/11/image10.png?w=224&#038;h=267" border="0" alt="image" width="224" height="267" /></a> <a href="http://bugsvoice.com" target="_blank"><img style="display:inline;border-width:0;" title="image" src="http://rbicchierai.files.wordpress.com/2009/11/image11.png?w=222&#038;h=266" border="0" alt="image" width="222" height="266" /></a></p>
<p>So every user can create its own rules in order to inspect, for instance, the received bug&#8217; stacktrace trying to discover if a database problem happens, or if there is a problem with the latest version of  some browser.</p>
<p>Coming back to rules execution:<br />
during step 3) we get rules from the user configuration and we execute them on our server. We use the <a href="http://java.sun.com/javase/6/features.jsp" target="_blank">Java SE 6</a> scripting features supplying an ECMAScript engine to run rules.  A scripting engine instance is isolated from the JVM environment and you must declare the resource (libraries) you want to made available in the execution context.</p>
<p>Before executing them, the context is fed by “bug” and “template” objects. Then we run the rules…(drum roll!).</p>
<p>A basic (and friendly) rule example :</p>
<pre>if (bug.code==404)  errorPage.errorMessage="Page missing: you get this error because of...";</pre>
<p>Of course this code is safe, but what happens if an evil user composes a pleasant rule like</p>
<pre>while(true);</pre>
<pre>or</pre>
<pre>function snake(s){
  return "s"+snake(s);
}
snake(":-&lt;");</pre>
<p>&#8230; or even worst?</p>
<p>Sadly Turing beats Gino 1-0, and there is no general solution to the question “does this rule ends?”.</p>
<p>The only possible solution is to narrow the scope of the problem by introducing some fences.</p>
<p>A solution is to set up an external observer using  multi-threading and watch dogs in order to kill processes after a while, but the best solution is to avoid infinite loop situations.</p>
<p>Rules in our context are used mainly for discovering string patterns in the error stacktrace and for building better feedback; we do not need to iterate or create complex functions, so reducing the set of possible JS statement is possible without loosing “power”.</p>
<p>Luckily in JS there is a limited set of statements for iteration and recursion; so if we are able to &#8220;kill&#8221; bad intentions by forbidding dangerous statement like &#8220;while&#8221;, “for” or function definition we can run rules with confidence.</p>
<p>This way  we reduce the complex halting problem to the (quite) easy problem of  HTML sanitization  (where you must  remove some unaccepted tags. See <a href="http://roberto.open-lab.com/2009/11/05/a-java-html-sanitizer-also-against-xss/" target="_blank">XSS war: a Java HTML sanitizer</a> ).</p>
<p>Actually identifying “while” or “for” statements in a complex code is not as easy as finding the “while” string. The find/replace approach  it’s too rough, and here we need a more accurate solution in order to understand the difference between</p>
<pre>while (true);</pre>
<p>and</p>
<pre>var dummy= “while(true)”;</pre>
<p>that is obvious for us but not for a string searcher…</p>
<p>You must use something to analyze the code token by token.</p>
<p><a href="http://www.antlr.org/" target="_blank">ANTLR 3</a> supply all you need for tokenizing, parsing and walking your code. You need a JS grammar and then ANTLR will build all the stuff. We used the ES3 grammar from Xebic Reasearch  (BSD license) based on the original work of Patrick Hulsmeyer, that fits perfectly our needs.</p>
<p>With the AS3 grammar we built  parser, lexer and walker to analyze rule’s code to intercept every forbidden statement and avoid accepting dangerous scripts (at least I hope this). Only the rules that pass the test will be saved on the system and will be available to the script engine.</p>
<p>Ok, I can confess you, the post’ title is a little misleading, there is no way to solve the halting problem at least without cheating!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rbicchierai.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rbicchierai.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rbicchierai.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rbicchierai.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rbicchierai.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rbicchierai.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rbicchierai.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rbicchierai.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rbicchierai.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rbicchierai.wordpress.com/78/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=78&subd=rbicchierai&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://roberto.open-lab.com/2009/11/18/solving-the-halting-problem/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/463bee7888aaf9f21ef6e6506622d6f4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rbicchierai</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/11/20080102_94583.jpg" medium="image">
			<media:title type="html">20080102_9458</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/11/image8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/11/image9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/11/image10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rbicchierai.files.wordpress.com/2009/11/image11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>A jQuery text extractor (via Java proxy)</title>
		<link>http://roberto.open-lab.com/2009/11/13/a-jquery-text-extractor/</link>
		<comments>http://roberto.open-lab.com/2009/11/13/a-jquery-text-extractor/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 13:24:59 +0000</pubDate>
		<dc:creator>Roberto Bicchierai</dc:creator>
				<category><![CDATA[in english]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[iframe]]></category>

		<guid isPermaLink="false">http://roberto.open-lab.com/?p=160</guid>
		<description><![CDATA[Developing online services seems always to bring about new challenges: yesterday&#8217; problem was to extract plain text from a generic web page. Using&#160; jQuery you can easily extract text from an element by using $(..).text(), so I wanted to put this function to use; the problem then was to make the entire web page available [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=160&subd=rbicchierai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Developing online services seems always to bring about new challenges: yesterday&#8217; problem was to extract plain text from a generic web page.</p>
<p>Using&#160; jQuery you can easily extract text from an element by using $(..).text(), so I wanted to put this function to use; the problem then was to make the entire web page available to jQuery.</p>
<p>Before extracting text, you should at first load the content of the intended page somewhere; if you want to preserve the integrity of your calling page, the only suitable solution is to use&#160; an iframe as container:</p>
<p>here are the html basic elements:</p>
<pre><code>  &lt;input type=&quot;text&quot; name=&quot;FILLFROMHERE&quot; &gt;
  &lt;span onclick=&quot;fillFromURL()&quot;&gt;&lt;/span&gt;
  &lt;iframe id=&quot;pageExample&quot; style=&quot;display:none;&quot;&gt;&lt;/iframe&gt;
</code></pre>
<p>
  <br />In order to fill the iframe: </p>
<p></p>
<pre><code>function fillSpamFromURL(){
  var url=$(&quot;#FILLFROMHERE&quot;).val();
  if (url &amp;&amp; url!=&quot;&quot;){
    $(&quot;#pageExample&quot;).attr('src', encodeURIComponent(url));
  }
}</code></pre>
<p>You should wait until the iframe loads the page before starting the text extraction; bind the &quot;load&quot; event on the iframe and it will be raised at the right time:</p>
<pre><code>  $(function(){&#160;&#160;&#160;&#160; $(&quot;#pageExample&quot;).load(extractInfos);&#160;&#160; })</code></pre>
<div>At this point you can access the iframe content by</div>
<div><span style="line-height:18px;font-family:consolas, monaco, &#39;white-space:pre;font-size:12px;">$(this).contents()</span></div>
<div>Sadly I discovered what probably I should have known already: cross site DOM inspection is forbidden (see <a href="http://softwareas.com/cross-domain-communication-with-iframes">Cross-Domain Communication with IFrames</a>).</div>
<div>To work around this limitation I wrote a really simple &quot;. jsp&quot; proxy page in order to load the &quot;external&quot; page in my domain:</div>
<p></p>
<pre><code>&lt;%@ page import=&quot;java.io.InputStream,
                 org.apache.commons.httpclient.*,
                 org.apache.commons.httpclient.methods.GetMethod,
                 java.io.InputStreamReader, java.io.BufferedReader&quot; %&gt;&lt;%
  String url=request.getParameter(&quot;url&quot;);
  HttpClient client = new HttpClient();
  HttpMethod method = new GetMethod(url);
  client.executeMethod(method);
  InputStream bodyAsStream = method.getResponseBodyAsStream();
  StringBuffer sb = new StringBuffer();
  InputStreamReader streamReader = new InputStreamReader(bodyAsStream, &quot;UTF-8&quot;);
  BufferedReader reader = new BufferedReader(streamReader);
  while (true) {
    int cr = reader.read();
    if (cr &lt; 0)
      break;
    sb.append((char) cr);
  }
  String thePage= sb.toString();
  bodyAsStream.close();
  method.releaseConnection();
%&gt;&lt;%=thePage%&gt;</code></pre>
<p></p>
<div>Now the iframe load function should be changed to :</div>
<p></p>
<div>
<pre><code>$(&quot;#pageExample&quot;).attr('src', &quot;proxy.jsp?url=&quot;+encodeURIComponent(url));</code></pre>
</div>
<p></p>
<div><em>Warning: the proxied &quot;page&quot; can&#8217;t load relative resources, so this solution may not be a&#160; suitable&#160; for everyone.</em></div>
<div><span style="font-family:georgia, &#39;font-size:small;"><span style="line-height:19px;white-space:normal;"><span style="font-family:consolas, monaco, &#39;"><span style="line-height:18px;white-space:pre;"><span style="line-height:19px;font-family:georgia, &#39;white-space:normal;font-size:13px;">The jQuery .text() function will retrieve text even in the script tags, so you can use a little trick to remove unwanted tags:</span></span></span></span></span></div>
<p></p>
<pre><code>function extractInfos(){
  var ifraBody = $(this).contents().find(&quot;body&quot;);
  ifraBody.find(&quot;script,style,object,link,embed&quot;).remove();
  var text=ifraBody.text()+&quot;&quot;;
  var re = new RegExp(&quot;(\\s){2,}&quot;, &quot;g&quot;);
  text =text.replace(re,&quot;$1&quot;);
  $(&quot;#EXCERPT&quot;).val(text);
}</code></pre>
<p></p>
<p>The regular expression replacement will remove replications in &quot;space like&quot; chars.</p>
<p>I&#8217;m using this code to instruct anti-spam services (like <a href="http://www.defension.com">Defensio</a> or <a href="http://www.akismet.com">Akismet</a>), supplying them sample contents to tune spam detection, which we will use for Patapage (<a href="http://patapage.com">patapage.com</a>)&#8217;s comments. These services usually need to know the content of the main article before rating a comment as spam or not.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rbicchierai.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rbicchierai.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rbicchierai.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rbicchierai.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rbicchierai.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rbicchierai.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rbicchierai.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rbicchierai.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rbicchierai.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rbicchierai.wordpress.com/160/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=160&subd=rbicchierai&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://roberto.open-lab.com/2009/11/13/a-jquery-text-extractor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/463bee7888aaf9f21ef6e6506622d6f4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rbicchierai</media:title>
		</media:content>
	</item>
		<item>
		<title>XSS war: a Java HTML sanitizer</title>
		<link>http://roberto.open-lab.com/2009/11/05/a-java-html-sanitizer-also-against-xss/</link>
		<comments>http://roberto.open-lab.com/2009/11/05/a-java-html-sanitizer-also-against-xss/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 11:07:01 +0000</pubDate>
		<dc:creator>Roberto Bicchierai</dc:creator>
				<category><![CDATA[in english]]></category>
		<category><![CDATA[information technology]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JAVA]]></category>
		<category><![CDATA[sanitizer]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://roberto.open-lab.com/?p=120</guid>
		<description><![CDATA[Yesterday I was testing one of our forthcoming online services, in order to check XSS (Cross Site Scripting) robustness. XSS and CSRF (Cross Site Request Forgery) are the two scary &#8220;black beasts&#8221; of online services in good company with scalability,  but while even nerd-programmers think about scalability, almost nobody takes care of XSS and CSRF, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=120&subd=rbicchierai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was testing one of our forthcoming online services, in order to check XSS (<a href="http://en.wikipedia.org/wiki/Cross-site_scripting" target="_blank">Cross Site Scripting</a>) robustness.</p>
<p>XSS and CSRF (<a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery">Cross Site Request Forgery</a>) are the two scary &#8220;black beasts&#8221; of online services in good company with scalability,  but while even nerd-programmers think about scalability, almost nobody takes care of XSS and CSRF, at least until the first attack <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The XSS becomes a serious  problem when you allow your users to add contents on your site/service; typical situations are blogs, forums, online chats etc.: when you are about to &#8220;print&#8221; user contributions you must do it conscientiously, you may found some &#8220;easter egg&#8221;.</p>
<p>Of course if you limit user contributions to plain text you will solve the problem in minutes, by just encoding every html tag (the idea is to change every &#8220;&gt;&#8221; in &#8220;&amp;gt;&#8221; and &#8220;&lt;&#8221; in &#8220;&amp;lt;&#8221; and so on). But things quickly get harder when you try to accept some basic html tags.</p>
<p>In our case, <a href="http://patapage.com">Patapage</a> is a service that allows to add comments, threads and more options to existing  web sites, it is tailored to appealing interfaces so it is a MUST to allow users to insert a wide set of html tags. We have found on <a href="http://meta.stackoverflow.com/questions/1777/what-html-tags-are-allowed">stackOverflow.com</a> a good balance from admitted tags and refused ones; as usual Jeff  Atwood is prodigal of precious hints, but in our case while his set is fine for &#8220;patacomments&#8221; it is too restrictive for the scope of &#8220;patacontents&#8221;.</p>
<p>As you can imagine, I&#8217;ve found a lots of holes, so going upstream as usual and not giving a damn on, probably, the best Jeff&#8217; suggestion (&#8220;do not re-write you own implementation&#8221;, an advice which he too is not following) I started writing code basing my implementation on <a href="http://delicious.com/robicch/security">these</a> articles.</p>
<p>Another aspect of the problem is the conservation of layout: users can break the page by inserting unclosed or misplaced tags. If you hope that these flaws do not impact on security you are on the wrong path. A well planned <a href="http://i8jesus.com/?p=10">css attack</a> can, for instance, layer your application for click stealing or simply &#8220;switch&#8221; two buttons of your application with funny(?) results.</p>
<p>Of course I&#8217;ve looked around to find something matching my needs, but I found only two kind of approaches: <em></em></p>
<p><em>The first approach </em>is<em> </em>very basic focused on removing &#8220;&lt; s c r i p t&gt;&#8221; tags from your html; obviously this is a silly approach, you can inject js code without a &#8220;script&#8221; tag: you have a bunch of ways to do this by using dom events (onclick, onload etc.).<br />
<em>The second approach</em> is to parse HTML to understand exactly what is happening in the code in order to remove un-allowed tags; this approach is logically the right one, you cannot expect to do better. Your code analyses the HTML, extracts the tags, and then you walk down the tree dropping out unwanted ones. Unluckily this approach requires a HTML parser library really &#8220;strong&#8221; with respect to malicious code, and usually these libraries are built for a different scope. Another aspect is that parser, lexer and walker are quite complicated pieces of code, so it is not a joke to test them completely. I&#8217;ve tested a couple of parsers with unsatisfying results.</p>
<p>This is why we wrote our own sanitizer by hand. Our approach is to remove unwanted tags and properties without testing HTML correctness in deep.</p>
<p>First step is to tokenize the code: a token could be one of : tag start (), comment (<!-- blah blah -->), tag content (blah blah), a tag closing ().</p>
<p>For instance &lt;p style=&#8221;color:red&#8221; align=&#8221;center&#8221;&gt;test&lt;/p&gt; generates three tokens:</p>
<ol>
<li>&lt;p style=&#8221;color:red&#8221; align=&#8221;center&#8221;&gt;</li>
<li>test</li>
<li>&lt;/p&gt;</li>
</ol>
<p>The tokenize method looks for &lt;&#8230;&gt; pairs or <!-- ... --> comments, and that its fine for our scope of restricting accepted tags: if a &lt;&#8230;&gt; pair is badly closed the tag will be html-encoded.</p>
<p>Having the tokens list, we will test every single token whether it is acceptable; again, we do not perform tag matching at first, so for us &lt;b&gt;test&lt;/i&gt; its fine, we are working on security, not on syntax &#8211; we&#8217;ll also fix that afterward, as it is easy in any case to add a tag-pair counter to close at the end unclosed tags, which you actually find done in our code.</p>
<p>We loop for every single token and we test it with regular expressions. The flow is:</p>
<ol>
<li>if token is a comment discard it.</li>
<li>if token is a start tag (&lt;p style=&#8221;color:red&#8221; &gt; ) extract the tag (p) and attributes (style=&#8221;color:red&#8221; align=&#8221;center&#8221;)
<ol>
<li>if tag is forbidden it will be removed</li>
<li>if tag is allowed we will extract every attribute performing a check
<ol>
<li>check &#8220;href&#8221; and &#8220;src&#8221; for admitted tags (a, img, embed only) and check url validity (only http or https)</li>
<li>check &#8220;style&#8221; attribute looking for &#8220;url(&#8230;)&#8221; parameter, and eventually discarding it</li>
<li>remove every &#8220;on&#8230;&#8221; attribute &#8211; e.g. onClick, onLoad, &#8230;</li>
<li>encode attribute&#8217; value for unknown ones</li>
<li>push the tag on the stack of open tags</li>
</ol>
</li>
<li>else the tag is unknown and will be removed</li>
</ol>
</li>
<li>if the token is an end tag (&lt;/p&gt; ) extract the tag (p) and check if the corresponding tag is already open. Eventually close those that are still open.</li>
<li>else it is not a tag and we will encode it</li>
</ol>
<p>In order to avoid js injection on user inserted URLs we will accept <a> tag only if the &#8220;href&#8221; attribute is there and points to a valid URL; we test url correctness with </a><a href="http://commons.apache.org/validator/apidocs/org/apache/commons/validator/UrlValidator.html">Apache UrlValidator</a>, and this will cut out every &#8220;javascript:&#8221; tries. Same approach for the <img alt="" /> and  tags.</p>
<p>Finished my hard work coding the shelter, I give the happy news to our design department that the sanitizer was done, and after a first minute of excitement Matteo (<a href="http://pupunzi.open-lab.com" target="_blank">http://pupunzi.open-lab.com</a>) told me that they have three different usages of user input: for displaying an HTML page on the front office, for displaying a textual abstract in lists in the backoffice, and of course for storing contents on the database.</p>
<p>So a sanitizer needs three different outputs, html-encoded with tag, text-only without tag, and the &#8220;original&#8221; version for the database. This is why the latest version of the sanitizer returns &#8220;.html&#8221;, &#8220;.text&#8221;  and &#8220;.val&#8221;. Why you should store &#8220;.val&#8221; instead of the original input or &#8220;.html&#8221;?  Because the original input may be &#8220;dangerous&#8221;, and may mislead  the user in believing that all tags are allowed. The encoded value is not suitable in case of subsequent modification because of  double encodings (e.g. &#8220;&gt;&#8221; &#8211;&gt; &#8220;&gt;&#8221; &#8211;&gt; &#8220;&gt;&#8221; and so on). On the other side &#8220;.val&#8221; removes only forbidden tags maintaining all other user oddities (strange tags, comments, etc.).</p>
<p>We have set-up a public playground for testing our sanitization code: <a href="http://patapage.com/applications/pataPage/site/test/testSanitize.jsp">http://patapage.com/applications/pataPage/site/test/testSanitize.jsp</a>. This page allows you to input a text and by pressing &#8220;test&#8221; your input will be printed (sanitized) on the page.</p>
<p>Source of our sanitizer are released under MIT license (i.e. free as free beer, just keep the attribution); <a href="http://patapage.com/applications/pataPage/site/test/HtmlSanitizer.html">see the complete code here</a>.</p>
<p><a href="http://patapage.com/applications/pataPage/site/test/htmlGuide.jsp">These tags</a> will be accepted, others will be encoded, and printed. <strong>If you like challenges try  to inject a js in your text and, for instance, get an alert. </strong>Tell us about your victories, if any.<strong><br />
</strong></p>
<p>BTW, I&#8217;ve tested my code using <a href="https://addons.mozilla.org/en-US/firefox/addon/7598">XSS Me</a> plugin for Firefox, and it passed all (about 15o) tests <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rbicchierai.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rbicchierai.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rbicchierai.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rbicchierai.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rbicchierai.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rbicchierai.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rbicchierai.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rbicchierai.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rbicchierai.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rbicchierai.wordpress.com/120/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=roberto.open-lab.com&blog=9711353&post=120&subd=rbicchierai&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://roberto.open-lab.com/2009/11/05/a-java-html-sanitizer-also-against-xss/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/463bee7888aaf9f21ef6e6506622d6f4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rbicchierai</media:title>
		</media:content>
	</item>
	</channel>
</rss>