<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>In usability we trust</title>
	
	<link>http://www.svennerberg.com</link>
	<description>A blog about web developement and usability.</description>
	<pubDate>Fri, 21 Nov 2008 08:22:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/InUsabilityWeTrust" type="application/rss+xml" /><item>
		<title>Ultimate Site Logo 2 - For real this time</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/460521708/</link>
		<comments>http://www.svennerberg.com/2008/11/ultimate-site-logo-2-for-real-this-time/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 08:18:24 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[CSS]]></category>

		<category><![CDATA[XHTML]]></category>

		<category><![CDATA[SEO]]></category>

		<category><![CDATA[site logo]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=792</guid>
		<description><![CDATA[After writing my first article on the subject, Ultimate Site Logo, I&#8217;ve come up with two significant enhancements.. With the original solution, there were two major flaws. The first one was a semantic one and the other one a more obvious and technical one.
This time around I think I&#8217;ve got all the details right. Well, [...]]]></description>
			<content:encoded><![CDATA[<p>After writing my first article on the subject, <a href="http://www.svennerberg.com/2008/06/ultimate-site-logo/">Ultimate Site Logo</a>, I&#8217;ve come up with two significant enhancements.. With the original solution, there were two major flaws. The first one was a semantic one and the other one a more obvious and technical one.</p>
<p>This time around I think I&#8217;ve got all the details right. Well, if that&#8217;s not <a href="http://en.wikipedia.org/wiki/Kaizen">Kaizen</a>, what is?</p>
<p><span id="more-792"></span></p>
<h3>The old article</h3>
<p>In the original article, <a href="http://www.svennerberg.com/2008/06/ultimate-site-logo/">Ultimate Site Logo</a>, I described how to code a site logo to meet these needs:</p>
<ul>
<li>Search engine optimized</li>
<li>Clickable</li>
<li>Accessible</li>
<li>Looks good</li>
<li>Hover effect</li>
</ul>
<p>If you haven&#8217;t already read it, this could be a good time to do so to fully grasp the concept. But if you feel confident enough, then by all means, do read on.</p>
<h3>The semantic problem</h3>
<p>In my first solution I suggested that <code>&lt;h1&gt;</code> would be an appropriate element to host the logo. Even though I already back then felt that a different element could be used, I personally was leaning more towards <code>&lt;h1&gt;</code>.</p>
<p>After reading up a little and listening to remarks from others I have now changed my mind. Especially after reading Chris Pearsons article <a href="http://www.pearsonified.com/2007/04/definitive-guide-to-semantic-markup.php">The Definitive Guide to Semantic Web Markup for Blogs</a>. </p>
<p>I now believe that <code>&lt;h1&gt;</code> should be reserved for the most prominent heading on each individual page. So for the front page, the logo (e.g. site name) might as well be the most prominent one, while on sub pages such as an article page, the articles title should be the most prominent one. </p>
<p>Therefor I now recommend using a <code>div</code> to hold the site logo. The code for this would be:</p>
<pre name="code" class="xhtml">
&lt;div id="branding"&gt;
	&lt;div id="logo"&gt;&lt;a href="#"&gt;&lt;span>&lt;/span&gt;In usability we trust&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p class="note"><strong>Note:</strong> I haven&#8217;t actually implemented this technique on this site yet, but I will do so in an upcoming redesign. Still you can watch it in action on the <a href="http://www.svennerberg.com/examples/ultimate_site_logo_2/">example page</a> for this article.</p>
<h3>The flicker problem</h3>
<p>In my last solution I changed the background-image of the <code>&lt;span&gt;</code> displaying the logo, when hovering over it. The problem with this is that if the hover-image wasn&#8217;t cashed, there would be an occasional flicker revealing the text underneath it, before the image was loaded. To solve this issue I now use <a href="http://www.alistapart.com/articles/sprites/" title="CSS Sprites: Image Slicing’s Kiss of Death - Article by Dave Shea on A List Apart"><acronym title="Cascading Style Sheets">CSS</acronym> sprites</a> instead. </p>
<p>A sprite is basically an image that contains several images, in this case two. The trick is to, with the help of <acronym title="Cascading Style Sheets">CSS</acronym>, just show a part of it at a time. By aligning the background-image to either the left or the right side of the <code>&lt;span&gt;</code>, a roll-over effect is created.</p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/11/logo_sprite.png" title="The sprite for the two different states of the logo" rel="lightbox[imageset]"><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/logo_sprite-410x57.png" alt=""  class="alignnone" /></a></p>
<p>As you can see this image contains two version of the logo, one in normal state and one in hover-state. By making the container only half the width of the complete image, it&#8217;s easy to show the different versions by either aligning the background-image to the left or to the right side of the container.</p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/11/logo_sprite_masked.png"title= "The logo in normal state - Only the normal image is visible in the containing &lt;div&gt;. " rel="lightbox[imageset]"><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/logo_sprite_masked-410x57.png" alt="" class="alignnone" /></a></p>
<p>The logo in it&#8217;s normal state, where only the left part of the image is visible in the containing <code>&lt;div&gt;</code> (the red area). </p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/11/logo_sprite_masked_hover.png" title="The logo in hover state - Only the hover image is visible in the containing &lt;div&gt;. " rel="lightbox[imageset]"><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/logo_sprite_masked_hover-410x57.png" alt="" class="alignnone" /></a></p>
<p>The logo in it&#8217;s hover state, where only the right part of the image is visible in the containing <code>&lt;div&gt;</code> (the red area).</p>
<p>The <acronym title="Cascading Style Sheets">CSS</acronym> to accomplish this is:</p>
<pre name="code" class="css">
#logo span {
	background: url(../img/logo_sprite.png) left top no-repeat;
}
#logo a:hover span {
	background-position: right top;
}
</pre>
<p>It was actually a comment from <a href="http://www.dollypower.com/">r-doll</a> on a <a href="http://www.svennerberg.com/2008/09/imagemap-rollover/" title="Imagemap rollover">different article of mine</a> that made me realize that <acronym title="Cascading Style Sheets">CSS</acronym>-sprites would be the way to go in this solution too. Thanks a lot!</p>
<h4>The (almost) complete <acronym title="Cascading Style Sheets">CSS</acronym></h4>
<p>I say almost complete because there is two additional Internet Explorer fixes, that is best put in a separate <acronym title="Cascading Style Sheets">CSS</acronym>-file only served to <acronym title="Internet Explorer">IE</acronym>.</p>
<pre name="code" class="css">
#logo {
	position: relative;
	margin: 0;
	width: 442px;
	height: 125px;
}
#logo a {
	position: absolute;
	width: 100%;
	height: 100%;
}
#logo span {
	position: absolute;
	z-index: 1;
	width: 100%;
	height: 100%;
	background: url(../img/logo_sprite.png) left top no-repeat;
}
#logo a:hover span {
	background-position: right top;
}
</pre>
<p class="note"><strong>Note:</strong> For a full explanation of the <acronym title="Cascading Style Sheets">CSS</acronym> and the additional fixes needed for <acronym title="Internet Explorer">IE</acronym>, read the old article, <a href="http://www.svennerberg.com/2008/06/ultimate-site-logo/">Ultimate Site Logo</a>.</p>
<h3>Further improvements</h3>
<p>If you can think of further improvements I would be more than happy if you would share it with me.</p>
<p>One issue that I&#8217;m aware of is when printing the web page. The logo just shows if you have <em>print background images</em> turned on, otherwise the text underneath the logo will show. If you have a solution for this, please let me know!</p>
<h3>The files</h3>
<ul>
<li><a href="http://www.svennerberg.com/examples/ultimate_site_logo_2/">Watch the live demo</a></li>
<li><a href="http://www.svennerberg.com/examples/ultimate_site_logo_2/css/style.css">style.css</a> [The main style sheet]</li>
<li><a href="http://www.svennerberg.com/examples/ultimate_site_logo_2/css/ie.css">ie.css</a> [Style sheet fed to <acronym title="Internet Explorer">IE</acronym> alone]</li>
</ul><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/460521708" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/11/ultimate-site-logo-2-for-real-this-time/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/11/ultimate-site-logo-2-for-real-this-time/</feedburner:origLink></item>
		<item>
		<title>Spotify is right on the spot</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/458626778/</link>
		<comments>http://www.svennerberg.com/2008/11/spotify-is-right-on-the-spot/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 17:41:40 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[UX]]></category>

		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=650</guid>
		<description><![CDATA[I&#8217;ve been using the beta web service Spotify for a couple of months now. And I must say that I&#8217;m really impressed. I would almost go as far as to say it&#8217;s the best piece of software I have ever used.

What is Spotify?
Spotify is a music player that allows you to play music from the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/10/spotify_logo.png" alt="Spotify"  class="alignright" />I&#8217;ve been using the beta web service Spotify for a couple of months now. And I must say that I&#8217;m really impressed. I would almost go as far as to say it&#8217;s the best piece of software I have ever used.</p>
<p><span id="more-650"></span></p>
<h3>What is Spotify?</h3>
<p>Spotify is a music player that allows you to play music from the Internet without any restrictions. Here&#8217;s how they describe it at <a href="http://www.spotify.com/en/about/what/">spotify.com</a>.</p>
<blockquote cite="http://www.spotify.com/en/about/what/"><p>Spotify is a new way to enjoy music. Simply download and install, before you know it you’ll be singing along to the genre, artist or song of your choice. With Spotify you are never far away from the song you want.</p>
<p>There are no restrictions in terms of what you can listen to or when. Forget about the hassle of waiting for files to download and fill up your hard drive before you get round to organizing them. Spotify is instant, fun and simple.</p></blockquote>
<p>Essentially it&#8217;s all about playing music and to share songs and musiclists with others. </p>
<h4>The User Interface</h4>
<p>At first glance it looks a lot like a slimmed down iTunes. It&#8217;s a simple and functional interface but still visually compelling. I find it very intuitive and easy to use. It simply enables me to what I want to do with minimum effort.</p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/10/spotify_1.png" title="The Spotify playlist" rel="lightbox[imageset]"><img src="http://www.svennerberg.com/wp-content/uploads/2008/10/spotify_1-410x284.png" alt="" class="alignnone" /></a></p>
<h4>Synchronization</h4>
<p>If you create a new playlist on one computer it pops up in other computers that runs your account. But you can only play music on one computer at a time. If you start playing at another computer the music stops at the first and a message is displayed.</p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/10/spotify_2.png" title="You can only play music on one computer at a time" rel="lightbox[imageset]"><img src="http://www.svennerberg.com/wp-content/uploads/2008/10/spotify_2-410x106.png" alt=""  class="alignnone" /></a></p>
<p>Nice, unobtrusive and easy to understand!</p>
<h4>Share music with others</h4>
<p>One cool thing with it is that you can easily share music and playlists with others. This is something that I find very nice since it makes me discover new great music. </p>
<h4>Speed</h4>
<p>I&#8217;m astonished by the speed of the application. Even though it&#8217;s a Web based software it responses immediately, like if the songs were on my computer.</p>
<h4>Price</h4>
<p>Spotify is free to use, but then it plays a commercial every five song or so. To get rid of the commercials you can either pay 99 SEK per month (about 10 Euro) or buy a daypass for 9 SEK (about 1 euro).</p>
<h3>Compared to iTunes</h3>
<p>I can&#8217;t help but compare Spotify with iTunes. Even though iTunes is packed with a lot more features it&#8217;s much more intrusive and above all, slower than Spotify. Why is it that iTunes is so much slower playing and displaying music on my harddrive than Spotify, doing the same with stuff from the Internet? </p>
<p>This leads me to believe that the responsiveness of an application is one of the most important factors for how much we appreciate it. </p>
<h3>Conclusion</h3>
<p>I think the reason that I like Spotify so much is that it supports me so well in the things I want to do with music.</p>
<ul>
<li>I have <strong>instant access</strong> to the music I want to listen to</li>
<li>I can easily <strong>find</strong> the music I want to listen to</li>
<li>It&#8217;s <strong>fast</strong></li>
<li>I <strong>don&#8217;t have to worry</strong> about files or copyrights</li>
<li>It let&#8217;s me <strong>explore</strong> music and helps me find new music that I might like.</li>
<li>It let&#8217;s me <strong>share</strong> music with others.</li>
</ul>
<p>I can&#8217;t see any reason that Spotify wouldn&#8217;t be a huge success. I think it&#8217;s one of the best software I have ever used and I highly recommend it.</p>
<p>Now I&#8217;m just waiting for a mobile version so that I can use it on the go as well.</p>
<p>Learn more at <a href="http://www.spotify.com/">www.spotify.com</a>.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/458626778" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/11/spotify-is-right-on-the-spot/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/11/spotify-is-right-on-the-spot/</feedburner:origLink></item>
		<item>
		<title>Populating Google Maps with Microformats revisited</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/454999632/</link>
		<comments>http://www.svennerberg.com/2008/11/populating-google-maps-with-microformats-revisited/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 15:51:38 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Mashups]]></category>

		<category><![CDATA[Microformats]]></category>

		<category><![CDATA[Google Maps]]></category>

		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=446</guid>
		<description><![CDATA[A few month ago I posted about a demo where I used content marked up with Microformats to populate a Google map using Javascript. Well, now I&#8217;ve improved that demo somewhat. 

Please read about my first take in Using microformats to populate Google Map.
The demo is still in Swedish since I originally made it for [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/mf-logo.gif" alt="" title="mf-logo" width="100" height="98" class="alignright size-full wp-image-838" />A few month ago I posted about a demo where I used content marked up with Microformats to populate a Google map using Javascript. Well, now I&#8217;ve improved that demo somewhat. </p>
<p><span id="more-446"></span></p>
<p>Please read about my first take in <a href="http://www.svennerberg.com/2008/05/using-microformats-to-populate-google-map/">Using microformats to populate Google Map</a>.</p>
<p>The demo is still in Swedish since I originally made it for a lecture here in Sweden about using Microformats. But despite that I think it&#8217;s fairly easy for all you non-swedes to follow the code. </p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/10/screenshot.png" rel="lightbox[imageset]" title="Screenshot of the mashup."><img src="http://www.svennerberg.com/wp-content/uploads/2008/10/screenshot-410x316.png" alt="" class="alignnone" /></a></p>
<p><a href="http://www.svennerberg.com/examples/visfestivaler/">Watch the live demo</a></p>
<p>So what have I done in this new version?</p>
<h3>Updated the Google Maps code</h3>
<p>In the old demo I used some deprecated Google Maps 1.0 methods. In the new demo these are replaced with Google Maps 2 methods.</p>
<p><code>GPoint</code> is changed to <code>GLatLng</code><br />
<code>GMap.centerAndZoom()</code> is changed to <code>GMap2.setCenter()</code></p>
<h3>Switched Javascript Library</h3>
<p>I have switched Javascript library from <a href="http://www.domassistant.com/">DOMAssistant</a> to <a href="http://www.jquery.com/">jQuery</a>. Lately I&#8217;ve been working a lot with jQuery so it seemed like a natural switch. </p>
<h3>Added a slider</h3>
<p>I wanted to be able to easily filter the result by month using a slider. Since <a href="http://ui.jquery.com/">jQuery UI</a> features a nice Slider I went with that. </p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/10/slider.png" alt="" class="alignnone" /></p>
<p>Adding the slider was fairly easy. I used the default graphics and just tweaked the slider-background a little bit in Photoshop.</p>
<p>To put the slider in place all that is needed is to add a div with <code>id="date_slider"</code> to the <acronym title="HyperText Markup Language">HTML</acronym>-document and the code below:</p>
<pre name="code" class="js">
$('#date_slider').slider({
	handle: '.handle',
	steps: 3,
	min: 5,
	max: 8,
	startValue: 8,
	slide: function(e, ui) {
		// Changing the label to the selected monthname
		$('#selected_month').html(monthName(ui.value));
	},
	change: function(e, ui) {
		// filtering event list
		filterEventList(ui.value);

		// filtering markers on map
		filterMap(ui.value);
	}
});
</pre>
<h3>Scrolling the list</h3>
<p>When you click on a marker in the map the appropriate element in the sidebar list is highlighted. When the list is long enough to be scrollable it sometimes means that the highlighted item isn&#8217;t visible. I wanted a way to make the list scroll so the item came into view.</p>
<p>The jQuery plugin <a href="http://plugins.jquery.com/project/ScrollTo">ScrollTo</a> came to the rescue. It&#8217;s a really nice plugin that makes it easy to do just this. The syntax is: <code>$(element).scrollTo(obj);</code></p>
<p>Where <code>element</code> is the list and <code>obj</code> is the selected item.</p>
<h3>The files</h3>
<p>If you want to try the demo and check out the files, please use the links below.</p>
<ul>
<li><a href="http://www.svennerberg.com/examples/visfestivaler/">View the Live Demo</a></li>
<li><a href="http://www.svennerberg.com/examples/visfestivaler/js/map.js">map.js</a></li>
<li><a href="http://www.svennerberg.com/examples/visfestivaler/css/style.css">style.css</a></li>
</ul><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/454999632" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/11/populating-google-maps-with-microformats-revisited/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/11/populating-google-maps-with-microformats-revisited/</feedburner:origLink></item>
		<item>
		<title>Report from World Usability Day</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/453039418/</link>
		<comments>http://www.svennerberg.com/2008/11/report-from-world-usability-day/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 15:37:41 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Usability]]></category>

		<category><![CDATA[event]]></category>

		<category><![CDATA[World Usability Day]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=796</guid>
		<description><![CDATA[
On World Usability Day on 13 of November we gathered a bunch of people to put focus on usability. The event which we called A nice cup of coffee on Usability Day, was held at my former employer, Visma Spcs office in Växjö. Chris Jangelöv was host for the event.
Here&#8217;s some pictures taken by from [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/logo.gif" alt="World Usability Day - Making life easy!" class="alignnone" /></p>
<p>On World Usability Day on 13 of November we gathered a bunch of people to put focus on usability. The event which we called <a href="http://www.worldusabilityday.org/nice-cup-coffe-usability-day">A nice cup of coffee on Usability Day</a>, was held at my former employer, <a href="http://www.vismaspcs.se/">Visma Spcs</a> office in Växjö. <a href="http://www.linkedin.com/pub/3/889/248">Chris Jangelöv</a> was host for the event.</p>
<p>Here&#8217;s some pictures taken by from the event along with some comments. The pictures are taken by Ola Karlsson. Thanks a lot Ola!</p>
<p><span id="more-796"></span></p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/11/chris.jpg" title="Chris Jangelöv held an introduction" rel="lightbox[imageset]"><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/chris_face.jpg" alt="" class="alignnone" /></a><br />
<a href="http://www.linkedin.com/pub/3/889/248">Chris Jangelöv</a> welcomed everyone and held a short introduction. Later he talked about one of his cars and some usability problems with it. He also talked about ventilation systems and water taps.</p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/11/alla.jpg" title="Around 25 people participated in the event" rel="lightbox[imageset]"><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/alla-410x273.jpg" alt=""  class="alignnone" /></a><br />
About 25 people showed up at the event.</p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/11/gabriel.jpg" title="I&#039;m rambling on about intelligent cars" rel="lightbox[imageset]"><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/gabriel-410x273.jpg" alt=""  class="alignnone" /></a><br />
I talked about usability in general but also about some usability issues I&#8217;ve encountered in my daily life. </p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/11/andreas.jpg" title="Andreas Nivard talked about  a few usability issues in his daily life" rel="lightbox[imageset]"><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/andreas-410x273.jpg" alt="" class="alignnone" /></a><br />
<a href="http://www.linkedin.com/pub/3/754/945">Andreas Nivard</a> from Visma Spcs talked about the design of his and his wifes cars, packaging of different sorts and how to keep warm in the office. A both humorous and interesting talk that was highly appreciated by the audience.</p>
<p>I haven&#8217;t got a picture of him but <a href="http://www.linkedin.com/pub/4/986/926">Staffan Gustafsson</a> from Visma Spcs talked about how much he appreciated the possibility to import all settings to one Mac from another. Very handy when you&#8217;re buying a new computer. He only wished that it was possible on Windows machines, cause then he wouldn&#8217;t have to spend so much time acting computer support for his parents. <img src='http://www.svennerberg.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>After the talks we had interesting discussions about different aspects of usability. All in all it was a really nice get together with lots of good conversations.</p>
<h3>More info</h3>
<p>For more information on World Usability Day please visit their web site at <a href="http://www.worldusabilityday.org/">www.worldusabilityday.org</a>. There&#8217;s also a Swedish site at <a href="http://www.wud.se/">www.wud.se</a>.</p>
<p>If you&#8217;re living in the area and wish to participate in future events, contact me through my <a href="http://www.svennerberg.com/contact/">Contact page</a>.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/453039418" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/11/report-from-world-usability-day/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/11/report-from-world-usability-day/</feedburner:origLink></item>
		<item>
		<title>A Nice Cup of Coffe on Usability Day</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/448375275/</link>
		<comments>http://www.svennerberg.com/2008/11/a-nice-cup-of-coffe-on-usability-day/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 12:57:57 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Usability]]></category>

		<category><![CDATA[event]]></category>

		<category><![CDATA[World Usability Day]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=774</guid>
		<description><![CDATA[This Thursday (November 13) is World Usability Day. It&#8217;s an event that takes place at different locations around the globe each year to put the spotlight on usability in our daily lives. 

Here in Växjö, Sweden we&#8217;re going to celebrate this with a get together where I&#8217;m going to talk a little about usability in [...]]]></description>
			<content:encoded><![CDATA[<p>This Thursday (November 13) is <a href="http://www.worldusabilityday.org">World Usability Day</a>. It&#8217;s an event that takes place at different locations around the globe each year to put the spotlight on usability in our daily lives. </p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/logo.gif" alt="World Usability Day - Making life easy!" class="alignnone" /></p>
<p>Here in Växjö, Sweden we&#8217;re going to celebrate this with a <a href="http://www.worldusabilityday.org/nice-cup-coffe-usability-day">get together</a> where I&#8217;m going to talk a little about usability in general and a few others are going to talk about specific usability problems and solutions. Other than that we&#8217;re just going to have a nice cup of coffee, some cookies and a nice chat. The event takes place at <a href="http://www.hitta.se/ViewDetailsPink.aspx?Vkiid=Gp%2bbWYuk%2bkzbN4xhL6AnVA%253d%253d&#038;vad=visma+spcs&#038;var=v%e4xj%f6">Visma Spcs</a> at 15.00 and will last for about one and a half hour.</p>
<p>If you&#8217;re in the area and are interested in participating, sign up by leaving a comment or by contacting me through this blog&#8217;s <a href="http://www.svennerberg.com/contact/">contact page</a>. It&#8217;s completely free of charge but you have to let us know in advance that you&#8217;re coming.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/448375275" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/11/a-nice-cup-of-coffe-on-usability-day/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/11/a-nice-cup-of-coffe-on-usability-day/</feedburner:origLink></item>
		<item>
		<title>Polylines in Google Maps [Part 2]</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/444567141/</link>
		<comments>http://www.svennerberg.com/2008/11/polylines-in-google-maps-part-2/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 17:05:56 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Mashups]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Google Maps]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=687</guid>
		<description><![CDATA[In part 1 I showed how to use and optimize performance on polylines in Google Maps using Javascript. In this article I will show you how to get even better performance by encoding the polylines on the server.

Encoding polylines on the fly
When dealing with dynamic data you may have to encode the polylines on the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/10/maps_logo_small_blue.png" alt="" class="alignright" />In <a href="http://www.svennerberg.com/2008/10/polylines-in-google-maps/">part 1</a> I showed how to use and optimize performance on polylines in Google Maps using Javascript. In this article I will show you how to get even better performance by encoding the polylines on the server.</p>
<p><span id="more-687"></span></p>
<h3>Encoding polylines on the fly</h3>
<p>When dealing with dynamic data you may have to encode the polylines on the fly. In this example I will use <acronym title="Pre-Hypertext Processing">PHP</acronym> to perform the encoding. I have rewritten a <a href="http://www.jimhribar.com/cgi-bin/moin.cgi/PolylineEncoder">php script made by Jim Hribar</a> and built his functions into a class for more convenient use. I&#8217;ve also made some small changes to the code. The code itself is essentially a rip-off from <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/">Mark MacClure&#8217;s</a> Javascript class.</p>
<h3>The PolylineEncoder Class</h3>
<p>To use the class is simple. First you need to call the constructor of the class: <code>$polylineEncoder = new PolylineEncoder($point); </code></p>
<h4>The constructor</h4>
<p>PolylineEncoder optionally takes four other arguments. When they are left out these default settings are used:</p>
<ul>
<li>numLevels = 18</li>
<li>zoomFactor = 2</li>
<li>verySmall = 0.00001</li>
<li>forceEndpoints = true</li>
</ul>
<p><code><strong>numLevels</strong></code> and <code><strong>zoomFactor</strong></code> controls how many zoomlevels the encoding should take account for and in which intervals the map should change the number of displayed coordinates. </p>
<p><code><strong>verySmall</strong></code> controls what distance between coordinate the algorithm should regard a short enough distance for a coordinate to be removed. So if you want to decrease the number of coordinates used, you should set the <code><strong>verySmall</strong></code> argument to a higher number.</p>
<p><code><strong>forceEndpoints</strong></code> is a boolean and if set to true ensures that the two ending points of the polyline are displayed at all zoom-levels. I really don&#8217;t see a reason to set this to anything but true.</p>
<p>I myself tend to use the default settings since they provide a good result. </p>
<h4>Encoding the points</h4>
<p>The <code>$encoded_polyline = polylineEncoder->dpEncode()</code> method returns an associative array with the following keys. </p>
<ul>
<li><strong>Points</strong><br />
A string containing the encoded points</li>
<li><strong>Levels</strong><br />
A string containing the encoded levels</li>
<li><strong>ZoomFactor</strong><br />
The applied Zoom Factor (Same as passed to the constructor)</li>
<li><strong>NumLevels</strong><br />
The applied NumLevels (Same as passed to the constructor)</li>
</ul>
<p>A complete call to the EncodePolyline could look something like this.</p>
<pre name="code" class="php">
// Include the file containing the class
include("PolylineEncoder.php");

// Create a nested array containing the coordinates
$points = array(
	array(
		59.6919,
		17.8582
	),
	array(
		59.3030,
		18.0395
	),
	array(
		58.9789,
		17.5341
	)
);

// Create a new instance of PolylineEncoder and supply the array
// as an argument to the constructor
$polylineEncoder = new PolylineEncoder($point);

// Encode the coordinates by calling dpEncode(), it returns an array containing the
// encoded coordinates and levels.
$encoded_points = $polylineEncoder->dpEncode();

// The resulting output
$encoded_points["Points"]; // "kqikJw|~kBr}jAclb@rh~@xuaB"
$encoded_points["Levels"]; // "PMP
$encoded_points["ZoomFactor"]; // 2
$encoded_points["NumLevels"]; // 18
</pre>
<p class="note"><strong>Note:</strong> To learn more about how to use the optional settings for tweaking the encoded polyline, read <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/description.html">A description of Google&#8217;s encoded polylines</a> and <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/algorithm.html">The encoding algorithm for the levels string</a>.</p>
<h4>Download the class</h4>
<p>The PolylineEncoder class is released under <acronym title="GNU General Public License">GPL</acronym> and may be used and changed freely.</p>
<p><a href="http://www.svennerberg.com/examples/polylines/PolylineEncoder.php.txt">Download PolylineEncoder.php.txt</a></p>
<h3>Making use of the encoded polyline</h3>
<p>Now that we have an encoded polyline its time to make good use of it in Google Maps. To create a GPolyline from the encoded coordinates you use the method <code>GPolyline.fromEncoded()</code>. </p>
<pre name="code" class="js">
// Creating an encoded GPolyline
GPolyline.fromEncoded({
    color: string,
    weight: number,
    opacity: number,
    points: string,
    levels: string,
    numLevels: number,
    zoomFactor: number
});
</pre>
<p>As you can see it takes an object literal as an argument. The first three keys are purely for how the polyline will be styled. The keys <code>points</code> and <code>levels</code> are the ones that will be fed with the encoded polyline. The last two keys, <code>numLevels</code> and <code>zoomFactor</code> should match the settings you used when encoding the coordinates. If they don&#8217;t match, the polyline will not be rendered correctly.</p>
<div class="note">
<h4>Documentation alert</h4>
<p>The <a href="http://code.google.com/apis/maps/documentation/reference.html#GPolyline">documentation</a> doesn&#8217;t seem to be quite up to date on this, since it specifies the method to be used like this:</p>
<p><code>GPolyline.fromEncoded(color?, weight?, opacity?, latlngs, zoomFactor, levels, numLevels)</code></p>
<p class="last">Stay clear from this use since it&#8217;s deprecated and probably won&#8217;t work or eventually will stop working.</p>
</div>
<h4>Adding it to the map</h4>
<p>So adding an encoded polyline to your map is very much like adding a normal polyline to it. The only difference is that instead of creating the polyline with the constructor of GPolyline(), you call the <code>GPolyline.fromEncoded()</code> method and pass the encoded points and levels to it.</p>
<pre name="code" class="js">
// Instanciate a new map
var map = new GMap2(document.getElementById('map'));
map.setCenter(new GLatLng(59.3219, 17.6165), 8);

// Create the polyline from the encoded points
var polyline = GPolyline.fromEncoded({
    color: '#FF0000',
    weight: 6,
    opacity: 0.6,
    points: 'kqikJw|~kBr}jAclb@rh~@xuaB',
    levels: 'PMP',
    numLevels: 18,
    zoomFactor: 2
});

// Add the polyline to the map
map.addOverlay(polyline);
</pre>
<p><a href="http://www.svennerberg.com/examples/polylines/polylines_encoded_server_side.html">Watch the live example</a>.</p>
<h3>Even better performance</h3>
<p>To get even better performance you have to use a pre-encode polyline to serve directly to the Javascript. This way you save the time the <acronym title="Pre-Hypertext Processing">PHP</acronym>-script takes to execute the encoding. In many cases this might not be possible, but if it is, it delivers the best performance.</p>
<p><a href="http://www.svennerberg.com/examples/polylines/polylines_pre-encoded.html">Watch the pre-encoded example</a>.</p>
<p>The improved load-time is pretty big. When I compare this example with <a href="http://www.svennerberg.com/examples/polylines/polylines_encoded.html">the one encoding the polyline in the browser</a> using Javascript, I get load times that&#8217;s range from 2 seconds (Safari) to over 20 seconds faster (<acronym title="Internet Explorer">IE</acronym>). </p>
<h3>All test scenarios</h3>
<p>Here&#8217;s all the tested cases, from both this and <a href="http://www.svennerberg.com/2008/10/polylines-in-google-maps/" title="Polylines in Google Maps [Part 1]">the previous article</a>.</p>
<ul>
<li><a href="http://www.svennerberg.com/examples/polylines/polylines.html">Simple unencoded polyline</a></li>
<li><a href="http://www.svennerberg.com/examples/polylines/polylines_big.html">Complex unencoded polylines</a></li>
<li><a href="http://www.svennerberg.com/examples/polylines/polylines_encoded.html">Complex encoded polylines, encoding done in browser with Javascript</a></li>
<li><a href="http://www.svennerberg.com/examples/polylines/polylines_encoded_server_side.html">Complex encoded polylines, encoding done dynamically on server</a></li>
<li><a href="http://www.svennerberg.com/examples/polylines/polylines_pre-encoded.html">Complex pre-encoded polylines</a></li>
</ul>
<h3>Other resources</h3>
<p>There are several server-side classes in different languages for encoding polylines, including <acronym title="Practical Extraction and Report Language">Perl</acronym>, Java and Ruby, available at <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/">Encoding polylines for Google Maps</a>, a website by Mark McClure.</p>
<p>I have yet to find a class written in C#. If you find one or has written one yourself, I would be more than happy if you could tell me about it.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/444567141" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/11/polylines-in-google-maps-part-2/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/11/polylines-in-google-maps-part-2/</feedburner:origLink></item>
		<item>
		<title>Shopping for groceries in style</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/443296068/</link>
		<comments>http://www.svennerberg.com/2008/11/shopping-for-groceries-in-style/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 14:44:57 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Interaction design]]></category>

		<category><![CDATA[UX]]></category>

		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=725</guid>
		<description><![CDATA[Conchango is developing a shopping system for the British grocery store Tesco. It&#8217;s supposed to help customers when buying/ordering food and has a graphically rich interface. 
I&#8217;m for one hate shopping for groceries. If I could have a system like this that remembers what groceries I normally buy and suggests a shopping list according to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/11/yogurt.jpg" alt="" class="alignright border" /><a href="http://www.conchango.com/">Conchango</a> is developing a shopping system for the British grocery store <a href="http://www.tesco.com/">Tesco</a>. It&#8217;s supposed to help customers when buying/ordering food and has a graphically rich interface. </p>
<p>I&#8217;m for one hate shopping for groceries. If I could have a system like this that remembers what groceries I normally buy and suggests a shopping list according to my dinner plans, I would be more than delighted. In fact, if I didn&#8217;t even had to physically go to the grocery store, I would be even more delighted.</p>
<p><span id="more-725"></span></p>
<h3>The UI</h3>
<p>From what I can tell from the video it&#8217;s very much inspired by the iPhone interface. It&#8217;s probably the touchscreen and visual effects that gives that impression. The user interface looks really cool, but it do seem to lag and respond a little slow. </p>
<p>The UI has a lot of 3d effects. One pretty cool thing is that you can choose a product and then rotate it to read the text on the package. I&#8217;m not sure though, if that&#8217;s the optimal way to display that sort of information, but it sure looks cool.</p>
<h3>Technology</h3>
<p>Apparently it&#8217;s built with Microsoft&#8217;s <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation" title="Windows Presentation Foundation">WPF</a> technology, the same technology that Silverlight is built upon. I haven&#8217;t seen much built with this technology so it&#8217;s nice to a example of what you can do with it.</p>
<p>In the video Paul Dawson and Matthew Adams demonstrates and explains how it&#8217;s all supposed to work. They also tell some about how they built it. </p>
<p>Right now it&#8217;s an early beta, but they&#8217;re soon going to perform trials with customer.</p>
<p><iframe style="float: none; margin: 1em 0;" src="http://channel9.msdn.com/shows/Continuum/440408/player/" frameborder="0" height="325" scrolling="no" width="320"></iframe></p>
<p>Read more about <a href="http://channel9.msdn.com/shows/Continuum/ConchangoTescoProject/">Conchango and the Tesco project</a> on <acronym title="Microsoft Developer Network">MSDN</acronym>.</p>
<p>Thanks Peter, for showing me this.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/443296068" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/11/shopping-for-groceries-in-style/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/11/shopping-for-groceries-in-style/</feedburner:origLink></item>
		<item>
		<title>Bounding Box in Google Maps</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/440212263/</link>
		<comments>http://www.svennerberg.com/2008/11/bounding-box-in-google-maps/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 19:20:02 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Mashups]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Google Maps]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=640</guid>
		<description><![CDATA[Normally when you initialize a new Google map you set the coordinates for the center of the map and manually specifies the initial zoom level. Sometimes, however, there&#8217;s a need to dynamically calculate the center point and zoom level for certain content to fit into the viewport.

Let&#8217;s say that you have a number of markers [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/10/maps_logo_small_blue.png" alt="" class="alignright" />Normally when you initialize a new Google map you set the coordinates for the center of the map and manually specifies the initial zoom level. Sometimes, however, there&#8217;s a need to dynamically calculate the center point and zoom level for certain content to fit into the viewport.</p>
<p><span id="more-640"></span></p>
<p>Let&#8217;s say that you have a number of markers on a map and you want the map to be displayed so that they all fit inside the viewport. You could of course experiment with center point and zoom levels to get it right. But what if the markers are put there dynamically so you don&#8217;t know beforehand where they&#8217;ll show up?</p>
<p>That&#8217;s where this trick will come in handy. </p>
<h3>Using a Bounding Box</h3>
<p>First you have to calculate the <strong>bounding box</strong>. That is, the coordinate for the <strong>south-west</strong> and <strong>north-east</strong> corners. In this case the coordinates for the marker that&#8217;s most south and the marker that&#8217;s most west provides the coordinates for the south-west corner. And vice versa for the north-east corner.</p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/10/map_boundingbox.png" alt="" class="alignnone" /></p>
<p>Now that you know the coordinates you just have to create a <code><a href="http://code.google.com/apis/maps/documentation/reference.html#GLatLngBounds">GLatLngBounds</a></code> object, define it&#8217;s coordinates and serve it to <code>GMap2.setCenter()</code>.</p>
<p><code>GLatLngBounds</code> takes two optional arguments. A <code>GLatLng</code> for the south-west corner and a <code>GLatLng</code> for the north-east corner.</p>
<p><code>GMap2.getBoundsZoomLevel()</code> calculates the appropriate zoom level to fit the bounding box in the available viewport. It also adds some extra padding around the box.</p>
<pre name="code" class="js">
map = new GMap2(document.getElementById("map"));

// Define the two corners of the bounding box
var sw = new GLatLng(59.0, 13.12);
var ne = new GLatLng(60.35, 16.90);

// Create a bounding box
var bounds = new GLatLngBounds(sw, ne);

// Center map in the center of the bounding box
// and calculate the appropriate zoom level
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
</pre>
<p><a href="http://www.svennerberg.com/examples/bounding_box/">Watch the live demo</a></p>
<p>I was shown this technique by my good friend Fredrik Jonsson, who writes about programming on <a href="http://www.freddes.se/">freddes.se</a>.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/440212263" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/11/bounding-box-in-google-maps/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/11/bounding-box-in-google-maps/</feedburner:origLink></item>
		<item>
		<title>Polylines in Google Maps [Part 1]</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/434616977/</link>
		<comments>http://www.svennerberg.com/2008/10/polylines-in-google-maps/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 11:32:38 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Mashups]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Google Maps]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=546</guid>
		<description><![CDATA[Polylines are used to mark out roads, borders and other things that are made of lines in maps. The Google Maps API offers a class for drawing these lines on a Google Map called GPolyline. In this article I will show you how to use these and how to deal with potential performance issues when [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/10/maps_logo_small_blue.png" alt="" class="alignright" />Polylines are used to mark out roads, borders and other things that are made of lines in maps. The Google Maps <acronym title="Application Programming Interface">API</acronym> offers a class for drawing these lines on a Google Map called <code>GPolyline</code>. In this article I will show you how to use these and how to deal with potential performance issues when the polylines gets more complex.</p>
<p><span id="more-546"></span></p>
<h3>A basic polyline</h3>
<p>Polylines consists of several points forming a line. Like for example a road on a map.  </p>
<p>Normally you create a <a href="http://code.google.com/apis/maps/documentation/reference.html#GPolyline"><code>GPolyline</code></a> and add it to the map using <code>GMap2.addOverlay()</code>.</p>
<pre name="code" class="js">
// Create an instance of Google map
var map = new GMap2(document.getElementById("map"));

// Tell the map where to start
map.setCenter(new GLatLng(59.3324, 17.8857), 9);

// Create an array with points
var points = [
   new GLatLng(59.6919, 17.8582),
   new GLatLng(59.3030, 18.0395),
   new GLatLng(58.9789, 17.5341)
];

// Create a new polyline
var polyline = new GPolyline(points, '#ff0000', 5, 0.7);

// Add the polyline to the map using map.addOverlay()
map.addOverlay(polyline);
</pre>
<p>As you can see <code>GPolyline</code> takes four arguments. The first one is the only required one, and it&#8217;s the coordinates for the polyline. The other ones are optional and are settings for how the polyline will appear. They are, from left to right, the color, the thickness and the opacity of the polyline.</p>
<p><a href="http://svennerberg.com/examples/polylines/polylines.html">Watch the small polyline example</a>.</p>
<p>This works fine as long as the polyline doesn&#8217;t consist of too many coordinates. However when the polyline is more complex the rendering becomes really slow. </p>
<h3>More complex polylines</h3>
<p>Here&#8217;s an example of five polylines with a total of 7841 coordinates which are added to the map the same way as the previous example. You&#8217;ll notice that the performance is really starting to degrade. The load time is longer and when you zoom in or out on the map you&#8217;ll notice a significant delay. </p>
<p><a href="http://www.svennerberg.com/examples/polylines/polylines_big.html">Watch the complex polylines example</a>  (Warning: The loading time can be long)</p>
<p>The performance vary from browser to browser. So if you try the example with Internet Explorer it&#8217;s really slow, but with Safari or Google Chrome it&#8217;s still pretty fast.</p>
<h4>Data format</h4>
<p>In the example the coordinates are fetched through an <acronym title="Asynchronous JavaScript and XML">AJAX</acronym> call to a file containing the coordinates in JSON format. The data structure looks like this:</p>
<pre name="code" class="js">
[{
    "Name":"Section 1",
    "Geom":[[59.1949,17.6596],[59.1942,17.6591],[59.1941,17.659]]
},
{
    "Name":"Section 2",
    "Geom":[[59.3819,18.0088],[59.3819,18.0089],[59.3818,18.0091]]
},
</pre>
<p>I only show three points per Section here but in the used file there a total of five Sections with thousands of points each. </p>
<h3>Better performance</h3>
<h4>Decrease the number of coordinates</h4>
<p>One easy way to make it faster is to try to limit the number of coordinates that you serve to the map. You gain some performance but loose accuracy, especially when you zoom in on the page. </p>
<h4>Encoded polylines on the fly</h4>
<p>A far better solution is to encode the polylines. It provides much better performance than just decreasing the number of coordinates plus you get better accuracy. The algorithm that encodes the coordinates removes some coordinates but more importantly decreases the number of coordinates when you zoom out, and increase them when zooming in.</p>
<p>Here&#8217;s how it&#8217;s done.</p>
<p>Instead of just feeding the map with coordinates you first encode them. An excellent encoder is Mark McClure&#8217;s PolylineEncoder class. It&#8217;s available from <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/">Encoding polylines for Google Maps</a>. You can also download <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/PolylineEncoder.js">PolylineEncoder.js</a> from there.</p>
<p>The encoder doesn&#8217;t make a very big difference on the loading time of the page, but when you start zooming and panning, the difference is huge.</p>
<h4>Encoding the coordinates</h4>
<p>Put all your coordinates in an array and feed it to <code>dpEncodeToGPolyline()</code> in the <code>polylineEncoder</code> class. The coordinates should be in the <a href="http://code.google.com/apis/maps/documentation/reference.html#GLatLng">GLatLng</a> format. </p>
<p>As you may notice <code>dpEncodeToGPolyline()</code> takes exactly the same arguments as <code>GPolyline()</code> and returns a <code>GPolyline</code>. So basically you just call <code>dpEncodeToGPolyline()</code> instead of <code>GPolyline()</code> and then add it to the map with <code>addOverlay()</code>, just like you did with the regular polyline.</p>
<pre name="code" class="js">
// Create an array that will hold the coordinates
var points = [];

// Loop through the coordinates.
// In this case the coordinates are in a JSON object
for(var j = 0; j < json[i].Geom.length; j++) {
    var coords = json[i].Geom[j];
    //Convert the coordinates to GLatLng and insert into the array
    points.push(new GLatLng(parseFloat(coords[0]), parseFloat(coords[1])));
}

// Create a new instance of PolylineEncoder
var polylineEncoder = new PolylineEncoder();

// Assign the array to dpEncodeToGPolyline  to get an encoded polyline
var polyline = polylineEncoder.dpEncodeToGPolyline(points, '#ff0000', 5, 0.7);

// Add the returned polyline to the map with map.addOverlay()
map.addOverlay(polyline);
</pre>
<p>The performance boost with this technique is enormous. The loading time can still be quite long but interacting with the map is a totally different experience. <a href="http://svennerberg.com/examples/polylines/polylines_encoded.html">Watch the encoded polylines example</a> to see what I mean.</p>
<div class="note">
<h4>About the encoding algorithm</h4>
<p>The encoding algorithm is basically a reduction of unnecessary coordinates at different zoom-levels. The more you zoom-in, the more detail is revealed and the opposite around when you zoom-out.</p>
<p>For an in-depth explanation of how the algorithm works, check out Mark McClure&#8217;s excellent articles on the subject: <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/description.html">Description of encoded polylines</a> and <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/algorithm.html">An explanation of the algorithm</a>. Also read <a href="http://code.google.com/apis/maps/documentation/polylinealgorithm.html">Encoded Polyline Algorithm Format</a> on Google.
</div>
<h4>Encode polylines on the server</h4>
<p>Loading time could still be too long, especially in Internet Explorer which has a a notoriously slow Javascript engine. To improve on that you should perform the encoding server side. In the <a href="http://www.svennerberg.com/2008/11/polylines-in-google-maps-part-2/" title="Polylines in Google maps [Part 2]">second part</a> of this article I describe how to do just that using <acronym title="Pre-Hypertext Processing">PHP</acronym>, to get dramatically shorter load-times.</p>
<h3>Further reading</h3>
<p>Mark MacClure, as I&#8217;ve already mentioned, has written a lot on the subject and also provides several examples, so don&#8217;t miss checking <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/">Encoding polylines for Google Maps</a> out.</p>
<p>Peter Chng has written an article about encoded polylines, <a href="http://unitstep.net/blog/2008/05/11/playing-with-google-maps-and-encoded-polylines/">Playing with Google Maps and encoded polylines</a>,  that helped clear a lot of my confusion.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/434616977" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/10/polylines-in-google-maps/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/10/polylines-in-google-maps/</feedburner:origLink></item>
		<item>
		<title>ASP.NET MVC and JSON</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/428963210/</link>
		<comments>http://www.svennerberg.com/2008/10/aspnet-mvc-and-json/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 21:19:39 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[JSON]]></category>

		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=550</guid>
		<description><![CDATA[In the AJAX community, JSON have become the preferred way of sending and receiving data. That&#8217;s not surprising since it&#8217;s lightweight, fast and easy to understand. Also, since it&#8217;s a subset of Javascript, it&#8217;s familiar territory for Javascript coders.
In the ASP.NET MVC Framework, passing JSON from the server to the client script is almost too [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/aspnetlogo_200.gif" alt="" class="alignright" />In the <acronym title="Asynchronous JavaScript and XML">AJAX</acronym> community, <a href="http://json.org/" title="JavaScript Object Notation">JSON</a> have become the preferred way of sending and receiving data. That&#8217;s not surprising since it&#8217;s lightweight, fast and easy to understand. Also, since it&#8217;s a subset of Javascript, it&#8217;s familiar territory for Javascript coders.</p>
<p>In the <a href="http://www.asp.net/mvc/"><acronym title="Active Server Pages">ASP</acronym>.NET MVC Framework</a>, passing JSON from the server to the client script is almost too easy. In this article I will walk you through the code required to make it work.</p>
<p><span id="more-550"></span></p>
<h3>The back end</h3>
<p>Suppose we have a class named <code>Cars</code> like the one below. We want to feed our web page with a list of cars that we want to display <acronym title="Asynchronous JavaScript and XML">AJAX</acronym> style, preferably by sending the list as a JSON object.</p>
<pre name="code" class="c#">
public class Car {
	public string Name { get; set; }
	public string Color { get; set; }
}
</pre>
<p>With the <acronym title="Active Server Pages">ASP</acronym>.NET MVC Framework it&#8217;s a breeze. In your Controller you simply create a method of the type <code>JsonResult</code> which returns a JSON object. You then use the <code>Json()</code> method to transform the class to JSON.</p>
<pre name="code" class="c#">
public class CarsController : Controller
{
	public JsonResult GetCars()
	{
		List&lt;Car&gt; cars = Cars.GetCars();
		return this.Json(cars);
	}
}
</pre>
<p>Calling this method will return JSON that looks something like this: </p>
<pre name="code" class="js">
[{&quot;Name&quot;:&quot;Saab&quot;,&quot;Color&quot;:&quot;Red&quot;},{&quot;Name&quot;:&quot;Volvo&quot;,&quot;Color&quot;:&quot;Blue&quot;}]
</pre>
<h3>Making the <acronym title="Asynchronous JavaScript and XML">AJAX</acronym> call</h3>
<p>To get the list of cars on the client side, you want to make an <acronym title="Asynchronous JavaScript and XML">AJAX</acronym> call to the Controller method <code>GetCars()</code>. This is done by calling the <acronym title="Uniform Resource Locator">URL</acronym> <code>/Cars/GetCars/</code>. </p>
<p>First I&#8217;ll walk you through how to do it with pure Javascript. Then I&#8217;ll show you how to do it with the jQuery library.</p>
<h4>The Classic Javascript way</h4>
<p>First of all you have to create an instance of the <code>XMLHttpRequest </code>object. It&#8217;s through this object that you communicate with the back end. Since <acronym title="Internet Explorer">IE</acronym> 6 doesn&#8217;t support this object but do have support for an ActiveX object that essentially does the same thing, we initially have to do some checking to make sure that we use the correct object. I&#8217;ve created a wrapper function that with the help of object detection determines which object to use and then returns it.</p>
<pre name="code" class="js">
function getRequestObject() {
	var req = false;
	if(window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		req = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
	}
	return req;
}
</pre>
<p>I use the <code>getRequestObject</code> function to get the correct Request Object and then gets on with setting up the request. </p>
<pre name="code" class="js">
var request = getRequestObject();
request.onreadystatechange = handleResponse;
request.open('GET', '/Cars/GetCars', true);
request.send(null);
</pre>
<p class="note"><strong>Note:</strong> If you&#8217;re unfamiliar with <acronym title="Asynchronous JavaScript and XML">AJAX</acronym> and find this code really strange, I recommend that you read <a href="https://developer.mozilla.org/en/AJAX/Getting_Started">getting started with <acronym title="Asynchronous JavaScript and XML">AJAX</acronym></a> from Mozilla Developer Center.</p>
<p>Ok, so the <acronym title="Asynchronous JavaScript and XML">AJAX</acronym> Call is all set up. The last thing to do is to create the function <code>handleResponse</code> that takes care of the request and the received data.</p>
<pre name="code" class="js">
function handleResponse() {
	if (request.readyState == 4) {
		var cars = eval('(' + request.responseText + ')');

		for each(car in cars) {
			alert(car.Name + ', ' + car.Color);
		}
	}
}
</pre>
<p>The object is received as JSON text through the <code>responseText</code> property of the request object. To convert it to a JSON object you can use the <code>Eval()</code> function. It will parse the text and produce an object structure. This is a fast and convenient way of doing it, but be aware of that it has potential security issues. Only use it if you know that you can trust the source. Otherwise you should use a more robust JSON parser.</p>
<p>The code in this example will throw an alert for each item in the JSON object and display it&#8217;s properties. This is done by looping through the received object. Notice how we can access the properties of the object through convenient dot notation. </p>
<h4>The jQuery way</h4>
<p>The client side scripting is even easier using <a href="http://jQuery.com/">jQuery</a>. All the Javascript code above can be replaced with this.</p>
<pre name="code" class="js">
$.getJSON(&quot;/Cars/GetCars&quot;, null, function(data) {
	$.each(data, function(index, car) {
		alert(car.Name, car.Color)
	});
});
</pre>
<p>jQuery handles everything that happens in the background, like instantiating the request object and parsing the received JSON object. So it does all the heavy lifting and leaves the fun stuff to you, like doing creative things with the received data.</p>
<p class="note"><strong>Note: </strong> For brevity I have excluded all error handling in this example. This should naturally always be considered in a live application.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/428963210" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/10/aspnet-mvc-and-json/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/10/aspnet-mvc-and-json/</feedburner:origLink></item>
		<item>
		<title>Effective Use of Custom Icons in Google Maps</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/421365858/</link>
		<comments>http://www.svennerberg.com/2008/10/effective-use-of-custom-icons-in-google-maps/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 08:36:58 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Mashups]]></category>

		<category><![CDATA[Google Maps]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=476</guid>
		<description><![CDATA[I&#8217;m currently developing a web application that uses Google Maps and have lots of markers with custom icons to mark different things on the map. To administer all these different icons is quite a chore and it took me some time to find an effective way of working with them. 

The problem
At first I coded [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/10/maps_logo_small_blue.png" alt="Google Maps" class="alignright" />I&#8217;m currently developing a web application that uses Google Maps and have lots of markers with custom icons to mark different things on the map. To administer all these different icons is quite a chore and it took me some time to find an effective way of working with them. </p>
<p><span id="more-476"></span></p>
<h3>The problem</h3>
<p>At first I coded each custom icon individually, creating massive amounts of code. I then had to have a huge If-else statement to determine which icon to use on each type of marker. This didn&#8217;t feel right and also made the application unnecessarily bloated and redundant, so I started looking for a better way of doing this. Eventually I stumbled upon this solution in one of <a href="http://econym.org.uk/gmap/" title="Google Maps API Tutorial">Mike Williams excellent Google Maps tutorials</a>.</p>
<h3>The solution</h3>
<p>The solution is all about storing the icons in an associative array that you later on call to get the correct icon.</p>
<h4>Defining the icon</h4>
<p>Start of by defining a &#8220;template&#8221;-icon that you base your other icons on. </p>
<pre>
<code>var custIcon = new GIcon(G_DEFAULT_ICON);
custIcon.iconSize = new GSize(16, 16);
custIcon.shadowSize = new GSize(0, 0);
custIcon.iconAnchor = new GPoint(0, 0);</code>
</pre>
<p>I&#8217;m using the optional copy argument in the GIcon constructor. You don&#8217;t have to do this but it&#8217;s convenient since all the properties of the icons are otherwise empty and you have to manually define them yourself.</p>
<p class="note"><strong>Note:</strong> To learn more about how markers and icons works in Google Maps read the <a href="http://code.google.com/apis/maps/documentation/overlays.html" title="Map Overlays - Google Maps API">section on overlays in the Google Maps <acronym title="Application Programming Interface">API</acronym> documentation</a>.</p>
<h4>Creating the array</h4>
<p>The next step is to define an array and start adding icons to it. Since it&#8217;s an associative array I use labels instead of numbers to identify each item.</p>
<p>Also notice that I add my template icon and a specific image for each individual icon in the GIcon constructor.</p>
<pre>
<code>var myIcons = [];
myIcons['house'] = new GIcon(custIcon, 'house.png');
myIcons['castle'] = new GIcon(custIcon, 'castle.png');</code>
</pre>
<h4>Putting the array to use</h4>
<p>Later on when you want to place a marker in the map and assign it one of your custom icons you just write this.</p>
<pre>
<code>var marker = new GMarker(point, { icon: myIcons['house']});</code>
</pre>
<p>In the application I&#8217;m currently building I give the array-items the same label as the <code>type</code> they represent. So instead of using a huge if-else statement to get the right icon, I just have to write one line of code where I insert my <code>type</code> as label for the array.</p>
<pre>
<code>var marker = new GMarker(point, { icon: myIcons[type]});</code>
</pre>
<p>Simple, effective and elegant.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/421365858" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/10/effective-use-of-custom-icons-in-google-maps/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/10/effective-use-of-custom-icons-in-google-maps/</feedburner:origLink></item>
		<item>
		<title>User Controls in ASP.NET MVC Preview Release 5</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/410326557/</link>
		<comments>http://www.svennerberg.com/2008/10/user-controls-in-aspnet-mvc-preview-release-5/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 15:14:42 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=479</guid>
		<description><![CDATA[I&#8217;ve had a little trouble finding out how to use User Controls in the ASP.NET MVC Framework and how to pass data to it. I haven&#8217;t been able to find a single article that clearly explains how to do this, so I thought I&#8217;ll do a little write up on the topic. 

Since Preview Release [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/aspnetlogo_200.gif" alt="" class="alignright" />I&#8217;ve had a little trouble finding out how to use User Controls in the <acronym title="Active Server Pages">ASP</acronym>.NET MVC Framework and how to pass data to it. I haven&#8217;t been able to find a single article that clearly explains how to do this, so I thought I&#8217;ll do a little write up on the topic. </p>
<p><span id="more-479"></span></p>
<p>Since Preview Release 5 of the <acronym title="Active Server Pages">ASP</acronym>.NET MVC Framework, the handling of User Controls have changed a bit. The helper method <code>RenderUserControl</code> have been replace by <code>RenderPartial</code>. A little annoying thing when a User Control is imported into a View is a tiny difference in how it&#8217;s coded that is easily overlooked. So if you get this cryptic error:</p>
<blockquote><p>CS1502: The best overloaded method match for &#8216;System.IO.TextWriter.Write(char)&#8217; has some invalid arguments</p></blockquote>
<p>It&#8217;s because you&#8217;ve been inserting the User Control with <code>&lt;%= RenderPartial("ViewName") %&gt;</code>, instead of <code>&lt;% RenderPartial("ViewName");  %&gt;</code>. (Note the equal sign before the method call and the semicolon after).</p>
<h3>Passing a Data Object from the Controller to the View</h3>
<p>Suppose you have a class called <code>Car</code> with the properties <code>Make </code>and <code>Color</code>, that you want to render using a User Control.</p>
<p>In order to pass data to the User Control, you first have to pass it from the Controller to the View. This is done by either sending the Data Object in the <code>Return</code> statement in a <code>ActionResult</code> method like this:</p>
<pre>
<code>public ActionResult List() 
{
	List&lt;Car&gt; cars = cars.GetCars();
	return View(cars);
}</code>
</pre>
<p>Or assign it explicitly to the <code>ViewData</code> object like this:</p>
<pre>
<code>public ActionResult List() 
{
	List&lt;Car&gt; cars = cars.GetCars();
	ViewData[&quot;Cars&quot;] = cars;

	return View();
}</code>
</pre>
<p>I often find it more convenient to do it the first way, but when you have several data objects that you want to pass, you&#8217;ll have to use the second way too.</p>
<h3>Passing DataObject to the User Control</h3>
<p>Like I mentioned earlier in this article, the MVC Framework has a useful helper method for inserting User Control into Views. It&#8217;s called <code>RenderPartial</code>. Before the Preview Release 5 it was called <code>RenderUserControl</code> and was used a little different. So don&#8217;t confuse the two.</p>
<p>It&#8217;s used like this:</p>
<pre>
<code>&lt;% Html.RenderPartial(&quot;~/Views/Cars/List.ascx&quot;); %&gt;</code>
</pre>
<p>To pass a list containing several instances of <code>Car</code> from the View to the User Control is easy. You just add it as the second parameter in the <code>RenderPartial</code> call like this:</p>
<pre>
<code>&lt;% Html.RenderPartial(&quot;~/Views/Cars/List.ascx&quot;, ViewDataModel); %&gt;</code>
</pre>
<p>or if you explicity assigned it to the ViewData object:</p>
<pre>
<code>&lt;% Html.RenderPartial(&quot;~/Views/Cars/List.ascx&quot;, ViewData["Cars"]); %&gt;</code>
</pre>
<h3>Displaying the data in the User Control</h3>
<p>In the User Control you have to first add a reference to the class <code>Car</code> in the CodeBehind. And since you want a list of it you have to use <code>List<></code> around it:</p>
<pre>
<code>public partial class List : System.Web.Mvc.ViewUserControl&lt;List&lt;Car&gt;&gt;
{
}</code>
</pre>
<p>In the <code>.ascx</code> you then access the data by referencing to the <code>ViewData.Model</code>, just like you would in a View. So rendering a simple list of cars would look something like this:</p>
<pre>
<code>&lt;ul&gt;
&lt;% foreach(Car car in ViewData.Model) { %&gt;
	&lt;li&gt;&lt;%= car.Make %&gt;, &lt;%= car.Color %&gt;&lt;/li&gt;
&lt;% } %&gt;
&lt;/ul&gt;</code>
</pre>
<h3>What&#8217;s up with the name?</h3>
<p>I find it a little confusing that the Helper method is called <code>RenderPartial</code> when it&#8217;s actually a User Control that you render. Wouldn&#8217;t it be more logical to call the User Control, Partial View or something instead? Or have I missed something?</p>
<p>To read more about the <acronym title="Active Server Pages">ASP</acronym>.NET MVC Framework and how to pass data objects, check out Scott Guthries excellent blog post, <a href="http://weblogs.asp.net/scottgu/archive/2007/12/06/asp-net-mvc-framework-part-3-passing-viewdata-from-controllers-to-views.aspx"><acronym title="Active Server Pages">ASP</acronym>.NET MVC Framework (Part 3): Passing ViewData from Controllers to Views</a>. It&#8217;s on an older release but most of it still applies.</p>
<p>Happy coding!</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/410326557" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/10/user-controls-in-aspnet-mvc-preview-release-5/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/10/user-controls-in-aspnet-mvc-preview-release-5/</feedburner:origLink></item>
		<item>
		<title>jQuery + ASP.NET = true</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/407993355/</link>
		<comments>http://www.svennerberg.com/2008/10/jquery-aspnet-true/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 07:01:58 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=466</guid>
		<description><![CDATA[jQuery is going to be a part of Visual Studio. This is a great, and I must say, an unexpected development of things.
For me personally, who&#8217;s already using jQuery along with ASP.NET, the main difference will be the intellisense annotation support for jQuery. This will be a welcomed enhancement of my development environment. Needless to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/jquery-logo.gif" alt="" class="alignright" />jQuery is going to be a part of Visual Studio. This is a great, and I must say, an unexpected development of things.</p>
<p>For me personally, who&#8217;s already using jQuery along with <acronym title="Active Server Pages">ASP</acronym>.NET, the main difference will be the intellisense annotation support for jQuery. This will be a welcomed enhancement of my development environment. Needless to say the asp.net team at Microsoft will also build ready-to-use controls in the <acronym title="Active Server Pages">ASP</acronym>.NET <acronym title="Asynchronous JavaScript and XML">AJAX</acronym> Control Toolkit that builds upon jQuery.</p>
<p>According to Scott Guthrie there will be a free download with the jQuery Intellisense support in a few weeks. The <acronym title="Active Server Pages">ASP</acronym>.NET MVC download will also contain it and the jQuery library.</p>
<p>Read more about it on <a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx">Scott Guthrie&#8217;s blog</a> and in <a href="http://jquery.com/blog/2008/09/28/jquery-microsoft-nokia/">John Reisig&#8217;s blog post</a> on jQuery.com.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/407993355" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/10/jquery-aspnet-true/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/10/jquery-aspnet-true/</feedburner:origLink></item>
		<item>
		<title>Visualizing the age of content</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/406482778/</link>
		<comments>http://www.svennerberg.com/2008/09/visualizing-the-age-of-content/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 18:09:06 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Definitions]]></category>

		<category><![CDATA[Interaction design]]></category>

		<category><![CDATA[UX]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=415</guid>
		<description><![CDATA[How do one visualize the age dimension of content?
In the real world it&#8217;s not a problem. Physical objects, like paper, clearly wears the mark of time. Paper turns yellow and get torn. Other things get scratched or changes it&#8217;s appearance in some other way that makes it obvious that it&#8217;s not new. 

The digital world
There [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/09/clock.jpg" title="The age of time" rel="lightbox[imageset]"><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/clock-150x150.jpg" alt="" class="alignright" /></a>How do one visualize the age dimension of content?</p>
<p>In the real world it&#8217;s not a problem. Physical objects, like paper, clearly wears the mark of time. Paper turns yellow and get torn. Other things get scratched or changes it&#8217;s appearance in some other way that makes it obvious that it&#8217;s not new. </p>
<p><span id="more-415"></span></p>
<h3>The digital world</h3>
<p>There are a few pretty common ways of displaying the age of content on web pages. These are primarily date stamps, telling when something was created or last edited. There&#8217;s also different color on visited links, that in a sense also is a way of telling that content is older. At least you know that you&#8217;ve already visited the page.</p>
<p>But that&#8217;s about it. And often, even those cues aren&#8217;t used.</p>
<h3>New ideas</h3>
<p>Robert Hoekman Jr. has written some about in the book, Designing the Obvious and in the article <a href="http://rhjr.net/theblog/2007/01/17/design-stories-sorted-link-lists-using-ambient-signifiers/">Design Stories: Sorted link-lists using “ambient signifiers”</a> on rhjr.net. His idea is to show the age of links by displaying them in different colors. The older they are, the lighter the color.</p>
<p>The term to describe this is <em>ambient signifiers</em>. It&#8217;s not restricted to just illustrate the age of content but is the concept of giving subtle cues, to help people interpret context. </p>
<p>Ross Howard has written about this in the article <a href="http://www.boxesandarrows.com/view/ambient_signifi" title="Ambient Signifiers - How I Learned to Stop Getting Lost and Love Tokyo Rail">Ambient Signifiers</a> on Boxes and Arrows which, I think, is where the term got coined. He describes his experiences with the Tokyo subway system, where a unique chime is played on each station, giving a subtle cue for the frequent commuter of where he currently is. This gave him the idea of ambient signifiers in digital media. </p>
<p>Currently there are some use of ambient signifiers in the applications we use. In Firefox for example, the address bar turns yellow when you enter a secure site. On sites the current status is often visualized in some way, like if you&#8217;re logged in to a site or not.</p>
<h3>Aurora - Mozilla Concept Browser</h3>
<p>Adaptive Path and Mozilla Labs has developed a concept of a future browser with lot of new ways of interacting with data. It&#8217;s kind of a zooming interface where you can browse your content in a 3d view where the z-axe represents time. They visualize the age of content in two ways. First of all the farther away the content the older it is. Secondly the content fades with time. I think that is a very natural way of visualizing it and a great illustration of how ambient signifiers can be used.</p>
<p>Watch the concept in action in this video from Adaptive Path.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="225" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=1450211&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="225" src="http://vimeo.com/moogaloop.swf?clip_id=1450211&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object><br />
<a href="http://vimeo.com/1450211?pg=embed&amp;sec=1450211">Aurora (Part 1)</a> from <a href="http://vimeo.com/user524591?pg=embed&amp;sec=1450211">Adaptive Path</a> on <a href="http://vimeo.com?pg=embed&amp;sec=1450211">Vimeo</a>.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/406482778" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/09/visualizing-the-age-of-content/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/09/visualizing-the-age-of-content/</feedburner:origLink></item>
		<item>
		<title>Where’s me back button?</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/402543055/</link>
		<comments>http://www.svennerberg.com/2008/09/wheres-me-back-button/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 07:00:36 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Browsers]]></category>

		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=426</guid>
		<description><![CDATA[My Firefox installation got upgraded to 3.0.2 today. And to my surprise the back and forward buttons is gone!

At first I thought that this was a either a major bug that slipped in the new release, or maybe some clever enhancement a´la the Awesome bar. But after checking with a coworker, who&#8217;s also got the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/06/firefox-logo1.png" alt="" class="alignright" />My Firefox installation got upgraded to 3.0.2 today. And to my surprise the back and forward buttons is gone!</p>
<p><span id="more-426"></span></p>
<p>At first I thought that this was a either a major bug that slipped in the new release, or maybe some clever enhancement a´la the <a href="http://mozillalinks.org/wp/2007/11/firefox-3-location-bar-just-became-almighty/">Awesome bar</a>. But after checking with a coworker, who&#8217;s also got the new version but still has the buttons, I suspect that this might be something strange happening on my computer. </p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/09/firefox_back_button_missing.png" rel="lightbox[imageset]" title="Where's me back button gone?"><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/firefox_back_button_missing-409x308.png" alt="" /></a></p>
<p>I don&#8217;t think Jakob Nielsen will take lightly on this as he says that according to his research, <a href="http://www.useit.com/alertbox/990530.html">the back button is the second most used navigation feature</a>. <img src='http://www.svennerberg.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> The back button indeed act as sort of an undo function. Enabling the user to back out from unwanted pages.</p>
<p>I&#8217;ve tried to restart Firefox but that didn&#8217;t help. Maybe rebooting the computer can fix it?</p>
<p>Does anyone else experience the same problem?</p>
<div class="note">
<p><strong>Update:</strong> While looking in to this a little further I&#8217;ve managed to get my back button back again. By right-clicking the menubar and select &#8220;Customize&#8221; from the context menu, I found my missing buttons and could easily drag them back where they belong.</p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/09/customize.png" rel="lightbox[imageset] title="The customize dialog in Firefox 3"><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/customize-410x299.png" alt="" /></a></p>
<p>The question is what made them disappear in the first place.
</p></div><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/402543055" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/09/wheres-me-back-button/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/09/wheres-me-back-button/</feedburner:origLink></item>
		<item>
		<title>The use of buttons in web forms</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/399180819/</link>
		<comments>http://www.svennerberg.com/2008/09/the-use-of-buttons-in-web-forms/#comments</comments>
		<pubDate>Sun, 21 Sep 2008 21:01:47 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=327</guid>
		<description><![CDATA[Action buttons exists at the bottom of almost every web form. They&#8217;re so common that we often doesn&#8217;t even reflect on how to actually design them. By gathering information from a few of the great minds in the field of web usability and also from my own experiences, I&#8217;ve tried to come up with a [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/puff.gif" alt="" class="alignright" />Action buttons exists at the bottom of almost every web form. They&#8217;re so common that we often doesn&#8217;t even reflect on how to actually design them. By gathering information from a few of the great minds in the field of web usability and also from my own experiences, I&#8217;ve tried to come up with a set of best practices on how to design them efficiently. </p>
<p><span id="more-327"></span></p>
<h3>Position</h3>
<p>According to <strong>Jakob Nielsen</strong>, the order of the buttons doesn&#8217;t matter that much. Both positions has it&#8217;s pros and cons. The important thing is to be consistent and if possible follow platform <acronym title="Graphical User Interface">GUI</acronym> standards [<a href="#ref_1">1</a>]. </p>
<p>Outside the web world there are <acronym title="Graphical User Interface">GUI</acronym> standard. The problem is that they are different on different platforms. On the Windows platform the <acronym title="Graphical User Interface">GUI</acronym> guidelines state that OK should be positioned to the left and Cancel to the right. On the Apple platform it&#8217;s the other way around.</p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/09/win_xp.png" rel="lightbox[imageset]" title="Form from Windows XP"><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/xp-buttons.png" alt="" class="alignleft" /><a href="http://www.svennerberg.com/wp-content/uploads/2008/09/mac_os.png" rel="lightbox[imageset]" title="Form from Max OS X"><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/mac_os_buttons.png" alt="" class="alignleft" /></a></p>
<p class="clear">On the Web there really is no standard on how to do this, so we have to try to find out which position is the smartest on our own.</p>
<p><strong>Luke Wroblewski</strong> elaborates on this topic in his article <a href="http://www.lukew.com/resources/articles/web_forms.html">Web Application Form Design</a> [<a href="#ref_2">2</a>]. His recommendation is to position the Primary action (OK) aligned to the left part of the form and the Secondary action (Cancel) to the right.</p>
<p>He elaborates even further on this topic in the book <a href="http://www.svennerberg.com/2008/09/web-form-design-book-review/">Web Form Design</a> [<a href="#ref_3">3</a>], where he presents the finding from a usability test performed on a form with different designs. What the test showed is that having the Primary action left-aligned and the Secondary action to the right of it makes for the fastest performance.</p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/form.png" alt="" /></p>
<p><strong>Robert Hoekman, jr.</strong> has also thought a lot about this and presents his thoughts in the book <a href="http://www.svennerberg.com/2008/06/book-review-designing-the-moment/">Designing the Moment</a> [<a href="#ref_4">4</a>].</p>
<p>He agrees with Luke Wroblewski that the Primary action should be left-aligned with the form. The reason for this is that this forms a nice line for the eye to follow, working it’s way down the form, thereby making it easy to scan. Another reason is that if the user is navigating the form with the tab-key, the Primary action comes before the Secondary action in the tab order.</p>
<h3>Labeling the actions</h3>
<p>Robert Hoekman, jr. also have some thoughts about the labeling of buttons. Instead of just labeling the buttons OK and Cancel it’s better to label them after what they actually do [<a href="#ref_4">4</a>]. If it’s to save a note, then why not label the OK-button “Save note” instead. Jakob Nielsen also recommends using a label that explains what it does instead of just a generic label [<a href="#ref_1">1</a>]. By doing this the user is more confident using the form since he knows what to expect when he pushes that button.</p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/buttons_2.png" alt="" /></p>
<h3>Visual distinction</h3>
<p>One other thing Robert Hoekman, jr. discusses is to visually distinguish the actions making it easier for the user to pick the right one.</p>
<p>Luke Wroblewski also concludes that making the Primary action stand out more than the Secondary action is a good thing. In the findings of the usability test, he finds that it takes the user a little more time to complete the form if the Primary and Secondary action has a different design. But on the other hand it makes the user more confident and less prone to choose the wrong one. He suggest making the buttons in different colors or making the Secondary action a plain link. </p>
<p>A simple way to visually distinguish the two that I sometimes do, is to use a bold font weight on the Primary action and a normal font weight on the Secondary.</p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/buttons_3.png" alt="" /></p>
<p>Robert Hoekman, jr. recommends using a plain link for the Secondary action [<a href="#ref_4">4</a>]. He’s arguments for this is that it makes it clear which one is the most prominent. But it also applies to Fitt’s Law, which suggest that the distance and the size of a target determines how long it takes to reach it and click it. The bigger the target the faster. The Primary action should therefor be bigger than the Secondary action.</p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/form_finished.png" alt="" /></p>
<p>In user tests that I’ve conducted I&#8217;ve found that some users can get a little confused by a plain link “acting as a button”. I think that this might be because of never having encountered it in a form before. But as this practice gets more common in both web- and windows applications, I think that this is probably not a persistent problem.</p>
<h3>The Reset button</h3>
<p>The Reset button is used to reset an entire form. It was pretty common in the early days of the web but is rarely seen nowadays. Nevertheless I thought I would say a few words about this button too since when it appears in a form, it&#8217;s usually paired with the Primary action.</p>
<p>In most situations it&#8217;s best not to use this button at all. All to often users click the Reset button by mistake thereby deleting everything they&#8217;ve entered. (I did it as I wrote in <a href="http://www.svennerberg.com/2007/09/confusing-northface-contact-form/">Confusing Northface contact form</a>) And seriously, how often do you want to reset an entire form, and if you do, how hard is it? </p>
<p>The risk with this button is simply to big compared to the possible benefit of it. Plus in most cases it just adds more clutter to the form.</p>
<p>Or as Jakob Nielsen put it in his alertbox column <a href="http://www.useit.com/alertbox/20000416.html">Reset and Cancel Buttons</a> [<a href="#ref_5">5</a>]:</p>
<blockquote cite="http://www.useit.com/alertbox/20000416.html"><p>
The Web would be a happier place if virtually all Reset buttons were removed. This button almost never helps users, but often hurts them.
</p></blockquote>
<p>Possibly the only time when a Reset button is called for, is when a form is used repeatedly by the same user and the information entered differs from each use.</p>
<p>Luke Wroblewski has an idea about the Reset button [<a href="#ref_3">3</a>]. He thinks that if you provide one you should also provide an undo for it. By changing the Reset button into an Undo after being clicked the user can restore the form. This means that you have to temporarily store the form data, but that’s a small price to pay for the convenience of the user.</p>
<h3>Best practices</h3>
<p>Taking all of the opinions above in consideration, plus my own experience in using and designing web forms, I&#8217;ve come up with these best practices.</p>
<ul>
<li>
<h4>Position the Primary action to the left</h4>
<p>Having the buttons aligned with the left side of the form makes a clear path for the eye to follow. By putting the Primary action to the left of the Secondary action it&#8217;s  also positioned first in the tab order.</li>
<li>
<h4>Label the actions in a natural language</h4>
<p>By describing what the action actually does, the user feels more comfortable using it since he know what to expect.</li>
<li>
<h4>Make the Primary action stand out</h4>
<p>This makes it easier for the user to choose the option that&#8217;s most likely without making it harder to find the other option.</li>
<li>
<h4>(Almost) Never use a Reset button</h4>
<p>Reset buttons often hurts user more than it helps them. The only time it&#8217;s called for is in a form that the same user uses over and over again with different input. If you use a Reset, also try to provide an undo function.</li>
</ul>
<p>Do you agree with my conclusions or do you have a different opinion about this? Please share!</p>
<h3>References</h3>
<ol>
<li id="ref_1"><a href="http://www.useit.com/alertbox/ok-cancel.html">OK–Cancel or Cancel–OK?, Jakob Nielsen 2008</a></li>
<li id="ref_2"><a href="http://www.lukew.com/resources/articles/web_forms.html">Web Application Form Design</a></li>
<li id="ref_3"><a href="http://www.rosenfeldmedia.com/books/webforms/">Web Form Design, Chapter 6, Luke Wroblewski 2008</a></li>
<li id="ref_4"><a href="http://www.amazon.com/Designing-Moment-Interface-Design-Concepts/dp/0321535081">Designing the Moment, Chapter 13, Robert Hoekman, jr. 2008</a></li>
<li id="ref_5"><a href="http://www.useit.com/alertbox/20000416.html">Reset and Cancel Buttons, Jakob Nielsen 2000</a></li>
</ol><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/399180819" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/09/the-use-of-buttons-in-web-forms/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/09/the-use-of-buttons-in-web-forms/</feedburner:origLink></item>
		<item>
		<title>Web Form Design (Book review)</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/392387021/</link>
		<comments>http://www.svennerberg.com/2008/09/web-form-design-book-review/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 15:49:12 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Book reviews]]></category>

		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=208</guid>
		<description><![CDATA[This book has a very narrow scope. It&#8217;s all about how to design web forms. And when you think about it, why not. Most interactions with websites and web application happens through the use of web forms so why not make sure to design them as effectively as possible.
Studies have shown that completion rates of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/08/webformdesign.png" rel="lightbox[imageset]" title="Web Form Design - Filling in the Blanks"><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/webformdesign_small.png" alt="" class="alignright" /></a>This book has a very narrow scope. It&#8217;s all about how to design web forms. And when you think about it, why not. Most interactions with websites and web application happens through the use of web forms so why not make sure to design them as effectively as possible.</p>
<p>Studies have shown that completion rates of forms can be increased by 10-40 percent by designing them using best practices. If the form is the check-out form on an e-commerce site you can easily see that this potentially can be a good investment.</p>
<p>Luke makes the observation that most forms suck. Therefor it should be every designers mission to make them suck less. Exactly how to do this is explained in great detail throughout the book. </p>
<p><span id="more-208"></span></p>
<h3>The structure of the book</h3>
<p>The book is divided into three sections, each penetrating a different aspect of web form design:</p>
<ul>
<li>
<h4>Form Structure</h4>
<p>This section focus on why form desing matters and the basic principles of good form design.
</li>
<li>
<h4>Form Elements</h4>
<p>The use of different form elements is thoroughly investigated in this section. The question of which element to use in different situations is discussed.
</li>
<li>
<h4>Form Interactions</h4>
<p>This part is about the process of filling out forms, how to handle form validation, giving proper feedback and help the user fill out the form.
</li>
</ul>
<p>Each chapter ends with a list of best practices on that particular topic.</p>
<p>On several places in the book there are small articles called &#8220;Perspectives&#8221; that give a guest writers view on a particular topic. These a written by experienced professionals and authors in the industry. </p>
<p>The book is written in an easy to read style with lots of pictures showing examples and illustrating the points being made. This makes it easy to follow and easy to grasp the different concepts. All images and illustrations in the book can be found on <a href="http://www.flickr.com/photos/rosenfeldmedia/sets/72157604272550634/">Flickr</a>.</p>
<h3>User tests</h3>
<p>Some of the recommendations in the book are backed up with user tests. By using eye tracking studies, interviews and evaluation of performance of different tasks different approaches have been tested to come up with a set of recommendations. One example of a test is where the best place to put buttons in a form are. Another is where it&#8217;s most effective to place the label to a form element.</p>
<p>You can read about some of the conclusions Luke comes up with in the article <a href="http://www.lukew.com/resources/articles/web_forms.html">Web application form design</a> and in <a href="http://www.lukew.com/ff/entry.asp?155">Web Application Form Design Expanded</a> on his personal web site, <a href="http://www.lukew.com/">www.lukew.com</a>.</p>
<h3>Summary</h3>
<p>I think it&#8217;s admirable that someone has actually made a book on such a narrow but still important topic as web form design. I don&#8217;t know of any other book, making this one a must-read if you&#8217;re serious about designing excellent web sites and/or web applications. </p>
<p>The book contains lots of good tips, insights and best practices on how to design effective web forms that work with, instead of against the user. And I myself have found that I&#8217;m already making good use of several of the proposed solutions in my work.</p>
<p><strong>Title:</strong> <a href="http://rosenfeldmedia.com/books/webforms/">Web Form Design - Filling in the blanks</a><br />
<strong>Author:</strong> Luke Wroblewski<br />
<strong>Publisher:</strong> Rosenfeld Media, 2008<br />
<strong>ISBN:</strong> 1-933820-24-1<br />
<strong>ISBN-13:</strong> 978-1-933820-24-8</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/392387021" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/09/web-form-design-book-review/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/09/web-form-design-book-review/</feedburner:origLink></item>
		<item>
		<title>Gradual Engagement</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/382066467/</link>
		<comments>http://www.svennerberg.com/2008/09/gradual-engagement/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 06:35:15 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Definitions]]></category>

		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=282</guid>
		<description><![CDATA[I wrote about it in my blogpost Easiest sign up ever one and a half year ago, where I described the sign-up process of Geni, a site about building your own family tree. I didn&#8217;t know the name of the concept then, but after reading Luke Wroblewski&#8217;s Web Form Design I certainly do. (A review [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote about it in my blogpost <a href="http://www.svennerberg.com/2007/04/easiest-sign-up-ever/">Easiest sign up ever</a> one and a half year ago, where I described the sign-up process of <a href="http://www.geni.com/">Geni</a>, a site about building your own family tree. I didn&#8217;t know the name of the concept then, but after reading Luke Wroblewski&#8217;s <a href="http://www.rosenfeldmedia.com/books/webforms/">Web Form Design</a> I certainly do. (A review of the book is coming up here soon)</p>
<p><em>Gradual Engagement</em> is simply the concept of not throwing a big fat sign-up form in the face of the first-time visitor before he has a chance to try out the site. A better approach is to try to get him engaged in what the site is all about before trying to get tons of information from him.</p>
<p><span id="more-282"></span></p>
<p><a href="http://www.lukew.com/">Luke Wroblewski</a> is also using Geni, among a few other sites, as an example of this concept.</p>
<h3>The Geni example</h3>
<p>In the Geni example it&#8217;s an almost transparent sign-up process since you immediately start to build your family tree, naturally starting with yourself, thereby entering your name and email-address. You&#8217;re instantly engaged in building your tree and are investing time and effort  in the web site. </p>
<p><a href="http://www.svennerberg.com/wp-content/uploads/2008/09/geni-signup.png" rel="lightbox[imageset]" title="The Geni Sign-up Page"><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/geni-signup-410x271.png" alt=""  /></a></p>
<p>An email is sent to you with a temporary password and a link back to the site where you can set a permanent password. Making it easy for you to get back to the site and continue where you left off.</p>
<h3>Conclusions</h3>
<p>This is still the best example I seen so far in getting the user to interact with the product right away. They sure have nailed the concept of <em>Gradual Engagement</em>, but also manages to clearly communicate what the site is all about in a single page.</p>
<p>It&#8217;s probably not a coincident that they&#8217;ve managed to get over 20 million profiles. Trying to remove as many barriers as possible in getting the user engaged is crucial for the success of web applications.</p>
<p>I think this is something we all can learn from, especially when it comes to social media and web applications. </p>
<p>Do you know of other examples of <em>Gradual Engagement</em>?</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/382066467" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/09/gradual-engagement/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/09/gradual-engagement/</feedburner:origLink></item>
		<item>
		<title>Imagemap rollover</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/380727805/</link>
		<comments>http://www.svennerberg.com/2008/09/imagemap-rollover/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 19:51:05 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=148</guid>
		<description><![CDATA[Imagemaps was very popular in the early days of webdesign but seem to have fallen out of grace. Probably due to accessibility problems and the rise of CSS based designs. I think that it still has it&#8217;s place when used properly and one being aware of it&#8217;s potential accessibility problems.
In a recent project I was [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/map_small.png" alt="" class="alignright" />Imagemaps was very popular in the early days of webdesign but seem to have fallen out of grace. Probably due to accessibility problems and the rise of <acronym title="Cascading Style Sheets">CSS</acronym> based designs. I think that it still has it&#8217;s place when used properly and one being aware of it&#8217;s potential accessibility problems.</p>
<p>In a recent project I was building a map where different regions of a map would highlight when you hover with the mouse over it. Using an imagemap in combination with <acronym title="Cascading Style Sheets">CSS</acronym> and Javascript seemed like the natural way to do it. </p>
<p>I thought that to actually code this solution would be pretty straightforward, but soon discovered some peculiar quirks. I also couldn&#8217;t find any information about this, so I thought that I&#8217;d share my experiences with you.</p>
<p><span id="more-148"></span></p>
<p>This is what I had in mind when I first started of.</p>
<ul>
<li>Use an image of a map.</li>
<li>Make it into an imagemap and define the clickable areas. </li>
<li>Do images of the different parts that is to be highlighted. </li>
<li>Position them with absolute positioning.</li>
<li>Use Javascript to show or hide them when the user hovers with the mouse over them.</li>
</ul>
<h3>The <acronym title="eXtensible HyperText Markup Language">XHTML</acronym></h3>
<p>I started of with a regular imagemap. (Some code is removed for brevity). I use a map over Scandinavia as the the image for the imagemap. </p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/scandinavia_small.png" alt="" /></p>
<pre>
<code>&lt;div id=&quot;map&quot;&gt;
	&lt;img src=&quot;img/scandinavia.png&quot; alt=&quot;&quot; usemap=&quot;#scandinavia_map&quot; /&gt;
	&lt;map name=&quot;scandinavia_map&quot; id=&quot;scandinavia_map&quot;&gt;
		&lt;area id=&quot;area_finland&quot; shape=&quot;poly&quot; coords=&quot;193,64,207,[...]&quot; alt=&quot;Finland&quot; href=&quot;finland.html&quot; /&gt;
		&lt;area id=&quot;area_sweden&quot; shape=&quot;poly&quot; coords=&quot;192,65,206,[...]&quot; alt=&quot;Sweden&quot; href=&quot;sweden.html&quot; /&gt;
		&lt;area id=&quot;area_norway&quot; shape=&quot;poly&quot; coords=&quot;187,64,194, [...]&quot; alt=&quot;Norway&quot; href=&quot;norway.html&quot; /&gt;
	&lt;/map&gt;
	&lt;ul&gt;
		&lt;li id=&quot;finland&quot;&gt;&lt;a href=&quot;finland.html&quot;&gt;Finland&lt;/a&gt;&lt;/li&gt;
		&lt;li id=&quot;norway&quot;&gt;&lt;a href=&quot;norway.html&quot;&gt;Norway&lt;/a&gt;&lt;/li&gt;
		&lt;li id=&quot;sweden&quot;&gt;&lt;a href=&quot;sweden.html&quot;&gt;Sweden&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;</code>
</pre>
<p>As you can see I also made a list with links. This list serves a dual purpose. First of all I&#8217;m using the list items as hooks for the &#8220;highlight images&#8221;. But they also serves as a backup, in case the user doesn&#8217;t have <acronym title="Cascading Style Sheets">CSS</acronym> and images turned on.</p>
<h3>The <acronym title="Cascading Style Sheets">CSS</acronym></h3>
<p>First of all I style the containing <code>&lt;div&gt;</code> with <code>position: relative</code>. This is necessary in order to later on position the different regions with absolute positioning. I&#8217;m also defining it&#8217;s width and height which is the same as the size of the map image. </p>
<pre>
<code>#map {
	position: relative;
	width: 340px;
	height: 438px;
}</code>
</pre>
<p>Then I style the unordered list. The important details here is to give the <code>&lt;li&gt;</code> an absolute positioning to be able to position them on the right spots, a <code>text-indent</code> so that the text won&#8217;t show and <code>display: none</code> to hide them. (They will later be displayed with the help of Javascript.)</p>
<pre>
<code>#map ul {
	list-style: none;
}
#map li {
	position: absolute;
	z-index: 20;
	text-indent: -1000em;
	display: none;
}</code>
</pre>
<p>Finally I style the different regions giving them the right image as a background, the right dimensions and the right position over the map. It can take some trial and error to get them in the right position. Temporarily set <code>display: block</code> while you position them.</p>
<p>Here are the images that I use as backgrounds on the elements I position over the map. (Well actually these are smaller version of the once I use)</p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/sweden_small.png" class="alignleft" alt="" /><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/finland_small.png" class="alignleft" alt="" /><img src="http://www.svennerberg.com/wp-content/uploads/2008/09/norway_small.png" class="alignleft" alt="" /></p>
<pre class="clear">
<code>#sweden {
	background: url(../img/sweden.png) no-repeat;
	width: 158px;
	height: 374px;
	<del datetime="2008-11-03T21:32:56+00:00">bottom: 0;</del>
	top: 64px; 
	left: 80px;
}
#finland {
	background: url(../img/finland.png) no-repeat;
	width: 148px;
	height: 283px;
	top: 27px;
	right: 0;
}
#norway {
	background: url(../img/norway.png) no-repeat;
	width: 292px;
	height: 362px;
	top: 0;
	left: 0;
}</code>
</pre>
<p>That sets the looks of the map. Now we just need some Javascript to make the rollover effects.</p>
<h3>The Javascript</h3>
<p>I use the <a href="http://www.domassistant.com/"><acronym title="Document Object Model">DOM</acronym> Assistant Javascript library</a> to help with the <acronym title="Document Object Model">DOM</acronym> manipulation. If you prefer you can just as easily use <a href="http://www.jquery.com">jQuery</a>, <a href="http://www.prototypejs.org">Prototype</a> or any other similar Javascript library to do the same thing. Still, to use this example, be sure to include a reference to <acronym title="Document Object Model">DOM</acronym> Assistant in the head of the <acronym title="HyperText Markup Language">HTML</acronym> document.</p>
<p>The script is pretty straightforward. What it basically does is that it loops through the list elements and assign mouseover, mouseout and click events to them. Review the comments in the code for a deeper explanation.</p>
<pre>
<code>// When the <acronym title="Document Object Model">DOM</acronym> is loaded, initilize initPage
DOMAssistant.DOMReady(initPage);

function initPage() {
	// Get a reference to the containing div with id='map'
 	var map = $$('map');

	// Check if map exists
	if(map) {

		// Get all the areas of the imagemap
		var country_list = map.getElementsByTagName('AREA');

		// Loop through all areas
		for(var i=0; i&lt;country_list.length; i++){
			$(country_list[i]).style.display = 'none';

			// Assign an action to the mouseover event
			$(country_list[i]).addEvent('mouseover', function(e) {
				// Get the id from the hovered area
				var country_id = this.id;

				// Extract the &quot;country&quot;-part of the id = the id of the list-item
				country_id = country_id.substring(country_id.indexOf('_')+1, country_id.length);

				// Set the &lt;li&gt; to &quot;display: inline&quot; = show it
				$$(country_id).setStyle('display', 'inline');
			});

			// Assign an action to the mouseout event
			$(country_list[i]).addEvent('mouseout', function(e) {
				// Get the id from the hovered area
				var country_id = this.id;

				// Extract the &quot;country&quot;-part of the id = the id of the list-item
				country_id = country_id.substring(country_id.indexOf('_')+1, country_id.length);

				// Set the &lt;li&gt; to &quot;display: none&quot; = hide it
				$$(country_id).setStyle('display', 'none');
			});

			$(country_list[i]).addEvent('click', function(e) {
				var country_id = this.id;
				country_id = country_id.substring(country_id.indexOf('_')+1, country_id.length);
				alert('You clicked ' + country_id)
				DOMAssistant.preventDefault(e);
			});
		}
	}
}</code>
</pre>
<p>This should do it one should think. But here&#8217;s where strange things starts to happen. The highlighted image flickers constantly as if the mouseOver and mouseOut events are triggered over and over again. <a href="http://www.svennerberg.com/examples/imagemap_rollover/broken.html">Watch it in action</a>. </p>
<h3>Solution to the flicker problem</h3>
<p>After some experimenting I came up with a solution where I use a transparent image as an overlay on the map image. I then assign the imagemap to the transparent image and voilà, the problem is solved.</p>
<pre>
<code>&lt;img src=&quot;img/transp.gif&quot; id=&quot;transparent_map&quot; alt=&quot;&quot; usemap=&quot;#scandinavia_map&quot; /&gt;</code>
</pre>
<p>It&#8217;s important to give the transparent image the same dimensions as the image of the map.</p>
<pre>
<code>#transparent_map {
	position: absolute;
	z-index: 30;
	width: 340px;
	height: 438px;
	border: none;
}</code>
</pre>
<p>With that fix the map works just fine. <a href="http://www.svennerberg.com/examples/imagemap_rollover/">View a live demo</a>.</p>
<h3>Accessibility</h3>
<p>My conclusion is that this solution, if not perfect, is still pretty accessible. With <acronym title="Cascading Style Sheets">CSS</acronym> turned off, the list is visible and even though the map isn&#8217;t clickable you can click the links in the list. With Javascript turned off, the different parts of the map doesn&#8217;t highlight but they are still clickable. </p>
<p>For those who uses the keyboard to navigate, it&#8217;s still usable, but I haven&#8217;t been able to find a way to highlight an area when it&#8217;s &#8220;active&#8221;. If anyone has an idea of how to do this, please tell me.</p>
<p>I found one other weakness and a more serious that is. If you browse with images turned off and <acronym title="Cascading Style Sheets">CSS</acronym> enabled, neither the map nor the list of links is visible thus you can&#8217;t use it. If you have a solution to this, please let me know!</p>
<h3>The files</h3>
<ul>
<li><a href="http://www.svennerberg.com/examples/imagemap_rollover/js/map.js">Download map.js</a></li>
<li><a href="http://www.svennerberg.com/examples/imagemap_rollover/css/map.css">Download map.css</a></li>
</ul><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/380727805" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/09/imagemap-rollover/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/09/imagemap-rollover/</feedburner:origLink></item>
		<item>
		<title>WebSlices, evolution of RSS?</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/375613314/</link>
		<comments>http://www.svennerberg.com/2008/08/webslices-evolution-of-rss/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 22:21:24 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Browsers]]></category>

		<category><![CDATA[Microformats]]></category>

		<category><![CDATA[Webslices]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=217</guid>
		<description><![CDATA[In the upcoming new version of Internet Explorer 8, which is in public Beta 1 right now, there&#8217;s support for a new technique called WebSlices. Is this yet another proprietary feature of Microsoft or is it a really useful evolution of RSS that will be adopted as a web standard? Since it follows the patterns [...]]]></description>
			<content:encoded><![CDATA[<p>In the upcoming new version of Internet Explorer 8, which is in public Beta 1 right now, there&#8217;s support for a new technique called WebSlices. Is this yet another proprietary feature of Microsoft or is it a really useful evolution of <acronym title="Really Simple Syndication">RSS</acronym> that will be adopted as a web standard? Since it follows the patterns of the Microformat <a href="http://microformats.org/wiki/hatom">hAtom</a>, which is an unobtrusive way of marking up content with standard <acronym title="HyperText Markup Language">HTML</acronym>, I think that it might actually be a pretty good innovation.</p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/ie8beta_logo.gif" alt="Internet Explorer 8 Beta" /></p>
<p><span id="more-217"></span></p>
<p>The basic concept is to allow users to subscribe to a part of a page. Similar to how you subscribe to <acronym title="Really Simple Syndication">RSS</acronym> feeds. This is done by making parts of a web page into WebSlices. For example if you interested in an object on eBay, you can subscribe to the information about that particular object if it&#8217;s marked up as a WebSlice.</p>
<p>Because it has the form of a Microformat it&#8217;s a very safe technique to use. If your browser is WebSlice enabled you will benefit from it, if it&#8217;s not you won&#8217;t notice anything unusual.</p>
<h3>The WebChunks add-on</h3>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/webchunks_logo.png" alt="" class="alignright" />There&#8217;s already an add-on for Firefox called <a href="https://addons.mozilla.org/en-US/firefox/addon/8494">WebChunks</a> that handles WebSlices in a similar way that IE8 does. I wouldn&#8217;t be surprised if the next version of Firefox also will handle this (and other Microformats) natively. </p>
<p>Actually Firefox has something similar which they call <a href="https://wiki.mozilla.org/Microsummaries">Microsummaries</a>. It works just about the same way but is trickier to implement, plus the feature is hidden deep inside the browser where no one, except geeks, will find it.</p>
<p>In this example I add a Suunto watch from an eBay auction to my WebChunk toolbar. You can try it yourself at <a href="http://ie8.ebay.com/">eBays WebSlice enhanced search page</a>. </p>
<p>When you put the mouse cursor over a WebSlice, a blue icon appears next to the content (in IE8 it&#8217;s purple).</p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/subscribe_to_a_webchunk_1.png" alt="" /></p>
<p>You store the Webslice by clicking on the icon.</p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/subscribe_to_a_webchunk_2.png" alt="" /></p>
<p>With WebChunks you get an extra toolbar in Firefox where your saved &#8220;chunks&#8221; appears, kind of the same way as Active bookmarks does. If the content has changed since you last looked at it, the text will be bold. You access the Webslice by clicking on it and are presented with just that part of the original web page, readily accessible regardless of what page your currently at. </p>
<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/webchunks-ebay.png" alt=""  /></p>
<p>Other pages you can try this on is <a href="http://en.wikipedia.org/wiki/Acid3">an article on Wikipedia about the Acid3 test</a> and <a href="http://www.stumbleupon.com/ie8/ie8_feed.php">Internet Buzz on StumbleUpon</a>. Of course you first have to install either <a href="http://www.microsoft.com/windows/products/winfamily/ie/ie8/getitnow.mspx">Internet Explorer 8 Beta 1 for Developers</a> or the<a href="https://addons.mozilla.org/en-US/firefox/addon/8494"> WebChunk Firefox Add-on</a>.</p>
<h3>How to code it</h3>
<p>Like all other Microformats, WebSlices relies on standard <acronym title="HyperText Markup Language">HTML</acronym> elements and attributes to mark up the content.</p>
<h4>WebSlice</h4>
<p>First of all the WebSlices must be contained inside a containing element with the attribute <code>class="hslice"</code>. This element must also have an unique id attribute.</p>
<h4>Entry Title</h4>
<p>It also have to have an <em>Entry Title</em>. This could for example be the name of an eBay object and could be contained in a <code>&lt;h3&gt;</code> with the attribute <code>class="entry-title"</code>. This is the same as the hAtom standard property. </p>
<h4>Entry Content</h4>
<p>There&#8217;s a third optional attribute that&#8217;s also important, and that&#8217;s <em>Entry Content</em>. It contains the content of the WebSlice and is marked up with the attribute <code>class="entry-content"</code>. Preferable inside a <code>&lt;div&gt;</code>.</p>
<p>This results in the very simple code below. It has all the ingredients of a nice WebSlice.</p>
<pre>
<code>&lt;div class="hslice" id="item-1"&gt;
	&lt;h3 class="entry-title"&gt;Suunto X-lander watch&lt;/h3&gt;
 	&lt;div class="entry-content"&gt;
		&lt;img src="x-lander.jpg" alt="" /&gt;
		&lt;p&gt;Nice wristop computer watch. Price: $229.99&lt;/p&gt;
	&lt;/div&gt;
&lt;/div&gt;</code>
</pre>
<p>Other optional attributes are: </p>
<h4>Expiration</h4>
<p>This optional attribute indicates the end time of an object. Like for example when an auction is finished. It&#8217;s expressed with the attribute <code>class="endtime"</code>.</p>
<pre>
<code>&lt;p&gt;End time: &lt;abbr class="endtime" title="2008-08-28T12:00:00-05:00"&gt; 6 hours&lt;/abbr&gt;&lt;/p&gt;</code>
</pre>
<h4>Bandwidth</h4>
<p>This optional attribute indicates how often the item is updated. It&#8217;s value must be an integer and expresses the number of minutes before update. It&#8217;s expressed with the attribute <code>class="ttl"</code>. (ttl=Time To Live)</p>
<pre>
<code>&lt;p&gt;This item updates every &lt;span class="ttl"&gt;15&lt;/span&gt; minutes.&lt;/p&gt;</code>
</pre>
<h4>Feed <acronym title="Uniform Resource Locator">URL</acronym></h4>
<p>This optional attribute indicates if there&#8217;s a different source to get updates from. It&#8217;s contained in an anchor element <code>&lt;a&gt;</code> with the attribute <code>rel="feedurl".</code></p>
<pre>
<code>&lt;a rel="feedurl" href="http://www.ebay.com/feed.xml"&gt;Subscribe to Feed&lt;/a&gt;</code>
</pre>
<p>If you&#8217;re familiar with the concept of Microformats, this is very straight forward and easy to code.</p>
<h3>Conclusions</h3>
<p>Will WebSlices catch on? Who knows? I think that because it builds on existing standards it might stand a chance. The beauty and simplicity of Microformats will make it easy for web developers to implement. But of course, in the end it&#8217;s up to the web surfers if they find this technique useful or not, that will ultimately determine it&#8217;s future.</p>
<p>Will it evolutionize <acronym title="Really Simple Syndication">RSS</acronym>? Personally I think that if WebSlices catch on, <acronym title="Really Simple Syndication">RSS</acronym> will probably coexist with it<br />
since it&#8217;s more lightweight presentation is more suitable for some types of content. </p>
<p>Anyway I think it&#8217;s nice to see that Microsoft is doing an effort in the same direction as the Microformat initiative, elevating existing standards instead of trying to do something completely propitiatory. I think that they are starting to play well with the rest of the web development community and that&#8217;s really nice to see.</p>
<h3>Further resources</h3>
<ul>
<li><a href="http://www.microsoft.com/windows/products/winfamily/ie/ie8/default.mspx">Internet Explorer 8</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/cc304073(VS.85).aspx">About Webslices on <acronym title="Microsoft Developer Network">MSDN</acronym></a></li>
<li><a href="http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=ie8whitepapers&#038;ReleaseId=567">Download whitepapers</a></li>
<li><a href="http://download.microsoft.com/download/B/D/2/BD294C35-7BBD-4AF5-9ECA-5D902116C260/ie8b1_webslices_overview.wmv">Demo Video: how to use Webslices in IE8 Beta 1</a></li>
</ul>
<p>Finally I&#8217;d like to thank <a href="http://www.freddes.se/">Fredde</a>, for showing me this technology and pointing me in the right direction.</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/375613314" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/08/webslices-evolution-of-rss/feed/</wfw:commentRss>
<enclosure url="http://download.microsoft.com/download/B/D/2/BD294C35-7BBD-4AF5-9ECA-5D902116C260/ie8b1_webslices_overview.wmv" length="5834411" type="video/x-ms-wmv" />
		<feedburner:origLink>http://www.svennerberg.com/2008/08/webslices-evolution-of-rss/</feedburner:origLink></item>
		<item>
		<title>Looping with jQuery</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/371040050/</link>
		<comments>http://www.svennerberg.com/2008/08/looping-with-jquery/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 15:52:27 +0000</pubDate>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.svennerberg.com/?p=174</guid>
		<description><![CDATA[I&#8217;ve started working with the Javascript framework jQuery lately and I must say that I find it very enjoyable! I have previously mostly used Prototype and DOMAssistant, and although they excel in some areas I somehow find jQuery more fun to code with.
Here&#8217;s a simple tip on how to loop through elements with jQuery that [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.svennerberg.com/wp-content/uploads/2008/08/jquery-logo.gif" alt="" class="alignright" />I&#8217;ve started working with the Javascript framework <a href="http://jquery.com/">jQuery</a> lately and I must say that I find it very enjoyable! I have previously mostly used <a href="http://www.prototypejs.org">Prototype</a> and <a href="http://www.domassistant.com/">DOMAssistant</a>, and although they excel in some areas I somehow find jQuery more fun to code with.</p>
<p>Here&#8217;s a simple tip on how to loop through elements with jQuery that I thought I&#8217;d share.</p>
<p><span id="more-174"></span></p>
<h3>An example</h3>
<p>We start with a simple unordered list.</p>
<pre>
<code>&lt;ul id=&quot;my_list&quot;&gt;
	&lt;li&gt;Item&lt;/li&gt;
	&lt;li&gt;Item&lt;/li&gt;
	&lt;li&gt;Item&lt;/li&gt;
&lt;/ul&gt;</code>
</pre>
<p>What we want to do now is to change the color of each list item to red. With regular <acronym title="Document Object Model">DOM</acronym> scripting this would probably take a few lines of code but with jQuery we need just one.</p>
<pre>
<code>$('#my_list li').css('color', 'red');</code>
</pre>
<p>This would result in:</p>
<ul>
<li style="color: red">Item</li>
<li style="color: red">Item</li>
<li style="color: red">Item</li>
</ul>
<p>If you want to do something a little more fancy, like something different with each item, you have to write a little more code, but not much. First you have to grab the the list elements like in the previous example by using selectors. By using the <code>each()</code> method, you are then able to loop through each item. By assigning an anonymous function to <code>each()</code> you get access to every individual item by using <code>$(this)</code>. </p>
<p>Notice that in the anonymous function there&#8217;s an attribute <code>i</code>. That&#8217;s the number of each item, just like in any normal array, starting from 0 and incrementing. </p>
<pre>
<code>$('#my_list li').each(function(i) {
	$(this).append(i.toString());
});</code>
</pre>
<p>The result is a list with the item number attached to the text inside the elements like this:</p>
<ul>
<li>Item0</li>
<li>Item1</li>
<li>Item2</li>
</ul>
<p>The really cool thing about this is that each iteration has it&#8217;s own function scoop. If you ever tried to do this with regular <acronym title="Document Object Model">DOM</acronym> scripting and a standard <code>for</code> loop you&#8217;ve most likely ran into some kind of scoop problem when dynamically assigning values to an object. They all end up getting the same value. jQuery elegantly solves this and makes you&#8217;re coding life a little bit easier.</p>
<p>Pretty cool don&#8217;t you think? Happy coding!</p><img src="http://feeds.feedburner.com/~r/InUsabilityWeTrust/~4/371040050" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.svennerberg.com/2008/08/looping-with-jquery/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.svennerberg.com/2008/08/looping-with-jquery/</feedburner:origLink></item>
		<item>
		<title>ASP.NET MVC Preview Release 4</title>
		<link>http://feeds.feedburner.com/~r/InUsabilityWeTrust/~3/362270588/</link>
		<comments>http://www.svennerberg.c