<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Peter Krantz &#187; Markup</title>
	<atom:link href="http://www.peterkrantz.com/category/markup/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peterkrantz.com</link>
	<description>A blog about technology, visualization, music and unmanned vehicle experiments</description>
	<lastBuildDate>Mon, 12 Jul 2010 14:47:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Stuff I learned over the weekend</title>
		<link>http://www.peterkrantz.com/2008/stuff-i-learned-over-the-weekend/</link>
		<comments>http://www.peterkrantz.com/2008/stuff-i-learned-over-the-weekend/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 21:57:59 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Markup]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/?p=229</guid>
		<description><![CDATA[1. Finding stuff in lists of dicts in Python If you have a list of dicts in Python like this: aXRlbXMgPSBbeyJpZCI6MSwgIm5hbWUiOiAiUmFzbXVzIn0sIHsiaWQiOiAyLCAibmFtZSI6ICJSaWNrIn1d &#8230;and want to check if there are any dict items with an id of a specific value (e.g. 2) I first came up with this: MiBpbiBtYXAobGFtYmRhIHg6IHhbJ2lkJ10sIGl0ZW1zKQ== The downside is that it will loop all [...]]]></description>
			<content:encoded><![CDATA[<h2>1. Finding stuff in lists of dicts in Python</h2>
<p>If you have a list of dicts in Python like this:</p>
<pre class="brush: plain;">aXRlbXMgPSBbeyJpZCI6MSwgIm5hbWUiOiAiUmFzbXVzIn0sIHsiaWQiOiAyLCAibmFtZSI6ICJSaWNrIn1d</pre>
<p>&#8230;and want to check if there are any dict items with an id of a specific value (e.g. 2) I first came up with this:</p>
<pre class="brush: plain;">MiBpbiBtYXAobGFtYmRhIHg6IHhbJ2lkJ10sIGl0ZW1zKQ==</pre>
<p>The downside is that it will loop all items which may be inefficient for larger lists. Niklas eventually pointed me at <a href="http://www.python.org/doc/2.5.2/lib/built-in-funcs.html">Python&#8217;s any() function</a> which I managed to miss while googling for other ways. Thus, a nicer version is:</p>
<pre class="brush: plain;">YW55KGl0ZW1bJ2lkJ10gPT0gMiBmb3IgaXRlbSBpbiBpdGVtcyk=</pre>
<p>Handy for checking stuff in Django object collections.</p>
<h2>2. YUI Grids looks difficult but is easy</h2>
<p>I decided to scrap the YAML based layout of a site I made a while ago when I discovered the licensing agreement (requires backlinks for the free version). I turned to <a href="http://developer.yahoo.com/yui/grids/">YUI Grids</a> which I had a look at a long time ago, but didn&#8217;t use because it looked too complex. Maybe it is just the layout of the YUI grids website (massive amounts of text), but it felt complicated at a first glance.</p>
<p>Coming back to YUI Grids this time I skipped the documentation and went straight for the <a href="http://developer.yahoo.com/yui/examples/grids/index.html">examples</a>. It is simple as soon as you understand grids (yui-g) and units (yui-u). I managed to get the basic layout going in an hour. <a href="http://www.wait-till-i.com/2008/10/04/webmaster-jam-session-hack-quickly-fixing-a-web-site-with-yui-grids/">Thank you YUI team!</a></p>
<h2>3. Django&#8217;s template language is heavily opinionated</h2>
<p>They really, really don&#8217;t want you to write anything but pure template code in there. Which is good, I guess. I only tried doing some basic addition. Sorry.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2008%2Fstuff-i-learned-over-the-weekend%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2008/stuff-i-learned-over-the-weekend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building your own Twitter client with Fluid and jQuery</title>
		<link>http://www.peterkrantz.com/2008/twitter-client-with-fluid-and-jquery/</link>
		<comments>http://www.peterkrantz.com/2008/twitter-client-with-fluid-and-jquery/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 23:50:28 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Markup]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/?p=169</guid>
		<description><![CDATA[Update: I have made some significant changes to Twoot and it now works well as my primary twitter client. Check out the TODO and README over at Github for more information on features etc. Like many before me, I was searching (unsuccessfully) for a decent twitter client. There are many, but most seem to be [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> I have made some significant changes to Twoot and it now works well as my primary twitter client. Check out the <a href="http://github.com/peterk/twoot/tree/master">TODO and README over at Github</a> for more information on features etc.</p>
<p>Like many before me, I was searching (unsuccessfully) for a decent twitter client. There are many, but most seem to be ad sponsored or based on a rather hefty framework like AIR (which by now, I guess, has been <a href="http://diveintomark.org/archives/2008/07/04/adobe-9">silently installed on my computer anyhow</a>).</p>
<p>Custom apps have major implications for usability so I decided to roll my own. I wanted to try out <a href="http://www.fluidapp.com/">Fluid</a>, the <a href="http://labs.mozilla.com/2007/10/prism/">Prism</a>-like app to contain web apps in their own process/window, to see if it is possible to build a complete open source ad-free twitter client in a single web page only using javascript and HTML.</p>
<p>So, I <a href="http://www.cuil.com/search?q=jquery%20twitter%20plugin&amp;sl=long">cuiled</a> for a <a href="http://jquery.com/">jQuery</a> twitter plugin but had to <a href="http://www.google.se/search?q=jquery+twitter+plugin">google</a> it to find it. Some minor modifications to the code by the fine folks at <a href="http://tweet.seaofclouds.com/">SeaOfClouds</a> and adding a method to post new status messages gave this native-looking OS X twitter client (HUD-style to the left, default style to the right and HUD avatars style below):</p>
<p><img style="float:left" src="http://www.peterkrantz.com/wp-content/uploads/2008/10/twoot-hud.png" alt="Twoot in HUD style" /></p>
<p><img src="http://www.peterkrantz.com/wp-content/uploads/2008/08/screenshot.gif" alt="Custom twitter client with Fluid and javascript" /></p>
<p><img src="http://www.peterkrantz.com/wp-content/uploads/2008/10/twoot-hud-black-avatars.jpg" alt="Twoot with avatars" /></p>
<p>Thank&#8217;s to the twitter json api it was trivial to query my own friend feed and display it in Safari. Then, I used Fluid to create a self contained OSX app that displays my static HTML page. Googling a <a href="http://www.iconarchive.com/show/dragon-soft-icons-by-artua/User-icon.html">nice application icon</a> makes it much better-looking in the taskbar. I decided to call it &#8220;Twoot&#8221;. Twoot consumes little memory and plays nice with embedded URLs (they open in a new Firefox tab).</p>
<p>Unfortunately, Fluid does not allow you to distribute the created app so you will have to roll your own by:</p>
<ol>
<li>Download and install <a href="http://fluidapp.com/">Fluid</a>.</li>
<li>Create a folder called &#8220;twoot&#8221; in your home directory.</li>
<li>Download the <a href="http://github.com/peterk/twoot/tree/master">twoot html, js and css files from github</a> and place in the twoot folder.</li>
<li><del>Edit twoot.js and set your twitter username and password.</del> (Enter credentials in the basic auth form when launching app the first time).</li>
<li>Open Fluid and create a new app by pointing to the twoot.htm file (e.g. file:///users/you/twoot/twoot.htm) and set a nice icon.</li>
<li>Save the app as &#8220;Twoot&#8221;.</li>
<li>Your new twitter client is ready! Run it and resize as required, set the window to floating, kill tabs etc. Change the twoot.css and html file to customize it further.</li>
</ol>
<p><strong>Simple API:s are wonderful for usability!</strong></p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2008%2Ftwitter-client-with-fluid-and-jquery%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2008/twitter-client-with-fluid-and-jquery/feed/</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
		<item>
		<title>RDF vs Microformats and the Semantic Web</title>
		<link>http://www.peterkrantz.com/2007/rdf-rdfa-and-microformats/</link>
		<comments>http://www.peterkrantz.com/2007/rdf-rdfa-and-microformats/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 11:22:04 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Markup]]></category>
		<category><![CDATA[RDF]]></category>
		<category><![CDATA[Semantic Web]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/rdf-rdfa-and-microformats/</guid>
		<description><![CDATA[James Simmons writes about some of the pros and cons of Microformats and RDF (but not RDFa?). Here are my thoughts on some of the items he mention.]]></description>
			<content:encoded><![CDATA[<p>James Simmons writes about some of the <a href="http://www.semanticfocus.com/blog/entry/title/microformats-vs-rdf-how-microformats-relate-to-the-semantic-web">pros and cons of Microformats and RDF</a> (with an <a href="http://www.infoq.com/news/2007/10/microformats-vs-rdf">extended discussion at InfoQ</a>). On the benefits of Microformats (with which he means <a href="http://microformats.org/wiki/">Microformats.org-style microformats</a>) he mentions:</p>
<blockquote>
<ul>
<li>Designed for humans first, machines second</li>
<li>Modularity / embeddability</li>
<li>Enables and encourages decentralized development, content, services</li>
<li>A design principle for formats</li>
<li>Adapted to current behaviors and usage patterns</li>
<li>Highly correlated with semantic XHTML</li>
</ul>
</blockquote>
<p>I am new to RDF and the semantic web (but have used microformats in previous web projects) but to me the advantages of RDF and <a href="http://www.w3.org/TR/xhtml-rdfa-primer/">RDFa</a> (<a href="http://www.w3.org/TR/xhtml-rdfa-primer/">the &#8220;sprinkling&#8221; framework</a>) are clear. Microformats may work for a limited set of use cases but I have not yet understood how to use microformats efficiently for the bulk of what I need. However, it is great that a lot of development is going on in the area of embedding machine readable data in documents. Without microformats the pace would probably have been much slower.</p>
<p>Here are my thoughts on the items that James mention:</p>
<p><q class="statement">Designed for humans first, machines second</q>: For me the HTML document that carries the information is for humans. With it we apply styling and markup to allow humans (and their assistive devices) to understand the content. The embedding of data is for machines primarily. Although advanced editors may be great at editing HTML, the fact is that most users are not.</p>
<p><q class="statement">Modularity / embeddability</q>: Embeddability is of course necessary. The problem is that the current versions of (X)HTML were not designed for embedding data. This means that Microformats have to rely on the attributes and elements available of which none were primarily designed for stuffing machine readable information in. RDFa, on the other hand, is making rapid progress. You can <a href="http://www.w3.org/MarkUp/2007/ED-xhtml-rdfa-20070402/">use XHTML 1.1 with RDFa right now</a> and validate it with the <a href="http://validator.w3.org/">W3C validator</a>. </p>
<p><q class="statement">Enables and encourages decentralized development, content, services</q>: I am not sure I understand this one, at least not for the development of vocabularies. Microformats encourages a centralized way of storing vocabularies on their web site in a format that isn&#8217;t machine readable. The power of RDF is that vocabularies can be stored anywhere in a machine readable way. The world is big and the web has been built to support interaction in a <a href="http://www.w3.org/People/Berners-Lee/UU.html">decentralised way</a>. Development of a vocabulary is a local thing for me.</p>
<p><q class="statement">A design principle for formats</q>: See above. Why have a design principle for all? Everyone has different needs and resources and I would prefer to adopt the vocabulary design process to each business case. The Microformats.org website lists <a href="http://microformats.org/wiki/Main_Page#Design_Patterns">design patterns</a> to use when sprinkling a document with embedded data. Instead of calling them design patterns you could say &#8220;seeing how far we can go in interpreting the current HTML specification&#8221;.</p>
<p><q class="statement">Adapted to current behaviors and usage patterns</q>: Sure, if you limit yourself to a few HTML-adept bloggers. I would venture to guess that there are more people publishing information on the web that know little to nothing about markup than people who do. And they shouldn&#8217;t need to. Peple working with information need tools. Tools should help out with the actual markup and embedding of data.  </p>
<p><q class="statement">Highly correlated with semantic XHTML</q>: And this is good. But it contradicts the previous statement. Current behaviour is to not use semantic XHTML. It is only a limited number of websites that use valid markup. Both RDFa and Microformats will hopefully help in raising awareness of semantic markup.</p>
<p>What do you think?</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2007%2Frdf-rdfa-and-microformats%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/rdf-rdfa-and-microformats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SimpleCrawler for your everyday web crawling needs</title>
		<link>http://www.peterkrantz.com/2007/ruby-web-crawler/</link>
		<comments>http://www.peterkrantz.com/2007/ruby-web-crawler/#comments</comments>
		<pubDate>Mon, 27 Aug 2007 19:22:43 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Markup]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/ruby-web-crawler/</guid>
		<description><![CDATA[<img src='http://www.peterkrantz.com/wp-content/uploads/2007/08/simplecrawler.gif' alt='' class="illustration" />Over at the <a href="http://www.standards-schmandards.com/">standards-schmandards blog</a> I often test websites to gather statistics on specific HTML use, accessibility and other things. Each time I have written a web crawler to collect the data. In Python and Ruby this is a simple task but last time it was like a déjà vu and I decided to create a Ruby library that I could use in the future.]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.peterkrantz.com/wp-content/uploads/2007/08/simplecrawler.gif' alt='' class="illustration" />Over at the <a href="http://www.standards-schmandards.com/">standards-schmandards blog</a> I often test websites to gather statistics on specific HTML use, accessibility and other things. Each time I have written a web crawler to collect the data. In Python and Ruby this is a simple task but last time it was like a déjà vu and I decided to create a Ruby library that I could use in the future.</p>
<p><a href="http://www.peterkrantz.com/simplecrawler/wiki/">SimpleCrawler</a> is a Ruby gem that covers basic web crawling needs. Coupled with Raakt and Ruport it can be used to create a <a href="http://www.peterkrantz.com/simplecrawler/wiki/examples/accessibility-report">basic accessibility report</a> for a website. </p>
<p>A minimal example:</p>
<p>require &#8216;simplecrawler&#8217;</p>
<p># Set up a new crawler<br />
sc = SimpleCrawler::Crawler.new(&#8220;http://www.peterkrantz.com/&#8221;)</p>
<p>sc.crawl { |document|<br />
   # output the crawled uri<br />
   puts document.uri<br />
}</p>
<p>For more details and examples see the <a href="http://www.peterkrantz.com/simplecrawler/wiki/">SimpleCrawler wiki</a>.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2007%2Fruby-web-crawler%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/ruby-web-crawler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySpace Layouts and Markup Quality</title>
		<link>http://www.peterkrantz.com/2007/myspace-markup-quality/</link>
		<comments>http://www.peterkrantz.com/2007/myspace-markup-quality/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 16:25:15 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Markup]]></category>
		<category><![CDATA[Trends]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/myspace-markup-quality/</guid>
		<description><![CDATA[I have received an increasing number of advertising inquiries from MySpace layout sites. Apparently the term "MySpace layouts" is a very popular search term these days. Looking at the default MySpace layouts one can unserstand why. I am confident that they didn't hire a designer to create the default <a href="http://www.myspace.com/">MySpace</a> look and feel. Looking at the <a href="http://peterkrantz.com/bacc/?url=http://www.myspace.com/">MySpace HTML</a>, they certainly didn't hire a GUI developer.]]></description>
			<content:encoded><![CDATA[<p>I have received an increasing number of advertising inquiries from MySpace layout sites. Apparently the term &#8220;MySpace layouts&#8221; is a very popular search term these days. Looking at the default MySpace layouts one can unserstand why. I am confident that they didn&#8217;t hire a designer to create the default <a href="http://www.myspace.com/">MySpace</a> look and feel. Looking at the <a href="http://peterkrantz.com/bacc/?url=http://www.myspace.com/">MySpace HTML</a>, they certainly didn&#8217;t hire a GUI developer. The markup looks like it was ripped from a teenage fan site from the early nineties:</p>
<ul>
<li>There is no doctype declaration. Not that it would have mattered anyway&#8230;</li>
<li>The markup starts out nicely with divs and spans and then freaks out with some classic table layout. I though that went away in the nineties&#8230;</li>
<li>Inline styles are used all over the place.</li>
<li>Headings start at level 5. And continues to level 4&#8230;</li>
<li>Images are missing an alt attribute.</li>
</ul>
<p>This contributes to making MySpace an inaccessible mess. What does it prove? That you can be successful with a crappy site? Maybe the laugh is on me. </p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2007%2Fmyspace-markup-quality%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/myspace-markup-quality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What happened to plain old HTTP redirects?</title>
		<link>http://www.peterkrantz.com/2007/html-redirects/</link>
		<comments>http://www.peterkrantz.com/2007/html-redirects/#comments</comments>
		<pubDate>Tue, 05 Jun 2007 13:17:34 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Markup]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/html-redirects/</guid>
		<description><![CDATA[So, I was looking for an offer on IP telephony and thus decided to point my browser to one of the larger ISP:s. I get a blank page back (blank as in &#8220;all white&#8221;). A couple of years ago, this wasn&#8217;t uncommon if you were brave enough to use a non-mainstream browser. But today it [...]]]></description>
			<content:encoded><![CDATA[<p><img class="illustration" src="http://www.peterkrantz.com/wp-content/uploads/2007/06/bredbandsbolaget.gif" alt="Broken redirect from bredbandbolaget.se">So, I was looking for an offer on IP telephony and thus decided to point my browser to one of the larger ISP:s. I get a blank page back (blank as in &#8220;all white&#8221;). A couple of years ago, this wasn&#8217;t uncommon if you were brave enough to use a non-mainstream browser. But today it is 2007.</p>
<p>A brief look at the HTML source gives:</p>
<p><meta http-equiv="refresh" content="0;URL=/portal/redirect" /></p>
<p>&#8230;which safari doesn&#8217;t follow. Interestingly, search engines won&#8217;t be following that either. What happened to the plain old HTTP redirect header? There can&#8217;t be a single programming language for the web today that doesn&#8217;t support output of HTTP headers. Or are there still web developers that don&#8217;t know about HTTP? Apparently so.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2007%2Fhtml-redirects%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/html-redirects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
