<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><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:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">

<channel>
	<title>Dustin Diaz</title>
	
	<link>http://www.dustindiaz.com</link>
	<description>Web Standards with Imagination</description>
	<pubDate>Fri, 24 Jul 2009 07:00:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/WSwI" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="wswi" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><media:thumbnail url="http://www.dustindiaz.com/img/wswi-podcast-logo.jpg" /><media:keywords>web,design,webdesign,development,webstandards,javascript,dom,css,xhtml,yahoo,yui</media:keywords><media:category scheme="http://www.itunes.com/dtds/podcast-1.0.dtd">Technology/Podcasting</media:category><itunes:owner><itunes:email>polvero@gmail.com</itunes:email><itunes:name>Dustin Diaz</itunes:name></itunes:owner><itunes:author>Dustin Diaz</itunes:author><itunes:explicit>no</itunes:explicit><itunes:image href="http://www.dustindiaz.com/img/wswi-podcast-logo.jpg" /><itunes:keywords>web,design,webdesign,development,webstandards,javascript,dom,css,xhtml,yahoo,yui</itunes:keywords><itunes:subtitle>A JavaScript, CSS, (X)HTML web log focusing on usability and accessibility. Podcasts include Dustin Diaz with ocassional co-hosts and interviews.</itunes:subtitle><itunes:summary>A JavaScript, CSS, (X)HTML web log focusing on usability and accessibility. Podcasts include Dustin Diaz with ocassional co-hosts and interviews.</itunes:summary><itunes:category text="Technology"><itunes:category text="Podcasting" /></itunes:category><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FWSwI" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FWSwI" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FWSwI" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FWSwI" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FWSwI" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://odeo.com/listen/subscribe?feed=http%3A%2F%2Ffeeds.feedburner.com%2FWSwI" src="http://odeo.com/img/badge-channel-black.gif">Subscribe with ODEO</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.podnova.com/add.srf?url=http%3A%2F%2Ffeeds.feedburner.com%2FWSwI" src="http://www.podnova.com/img_chicklet_podnova.gif">Subscribe with Podnova</feedburner:feedFlare><item>
		<title>Unofficial Twitter Widget Documentation</title>
		<link>http://www.dustindiaz.com/twitter-widget-doc/</link>
		<comments>http://www.dustindiaz.com/twitter-widget-doc/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 07:00:49 +0000</pubDate>
		<dc:creator>polvero@gmail.com (Dustin Diaz)</dc:creator>
		
		<category><![CDATA[Featured]]></category>

		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.dustindiaz.com/?p=346</guid>
		<description><![CDATA[So, the <a href="http://twitter.com/goodies/widget_search">Twitter Search Widget</a> has officially launched. And the installation is fairly self-explanatory (as a matter of fact, I don't think we even explained it at all??). But nonetheless, if you haven't checked it out, it's worth <a href="http://twitter.com/goodies/widget_search">doing that now</a>. The new widgets are hot! Ok. On with this.]]></description>
			<content:encoded><![CDATA[<p>So, the <a href="http://twitter.com/goodies/widget_search">Twitter Search Widget</a> has officially launched. And the installation is fairly self-explanatory (as a matter of fact, I don&#8217;t think we even explained it at all??). But nonetheless, if you haven&#8217;t checked it out, it&#8217;s worth <a href="http://twitter.com/goodies/widget_search">doing that now</a>. The new widgets are hot! Ok. On with this.</p>
<h3>So, what&#8217;s this do?</h3>
<p>The Twitter Search Widget allows you to track any topic, live, in real-time. You can even use our <a href="http://search.twitter.com/operators">advanced search operators</a> which dogfoods straight into our own <a href="http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search">search API</a>.</p>
<h3>So what are these other features?</h3>
<p>Well, for the advanced JavaScripters; or actually, I should say, ANYONE who can read JavaScript should be able to try some of these things out on your own. Which brings us to <strong>the hidden undocumented features</strong></p>
<h3>But first&#8230;</h3>
<p>Let&#8217;s look at the base widget code to start off with.</p>
<h3 class="code">base twitter widget code</h3>
<pre><code>&lt;div id=&quot;twtr-search-widget&quot;&gt;&lt;/div&gt;
&lt;script src=&quot;http://widgets.twimg.com/j/1/widget.js&quot;&gt;&lt;/script&gt;
&lt;link href=&quot;http://widgets.twimg.com/j/1/widget.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
new TWTR.Widget({
  search: &#39;my search query&#39;,
  id: &#39;twtr-search-widget&#39;,
  loop: true,
  title: &#39;what people say about...&#39;,
  subject: &#39;stuff and things&#39;,
  width: 250,
  height: 300,
  theme: {
    shell: {
      background: &#39;#111&#39;,
      color: &#39;#000000&#39;
    },
    tweets: {
      background: &#39;#000000&#39;,
      color: &#39;#ffffff&#39;,
      links: &#39;#f59f00&#39;
    }
  }
}).render().start();
&lt;/script&gt;</code></pre>
<p>What this does is load our base functionality and stylesheet. It then instantiates a new Widget object, and points to an id representing an HTML element. What this tells you already is that you could technically have multiple widgets on a page by simply instantiating new objects, populating existing <code>&lt;div&gt;</code> elements. Hey, you could create your own web version of tweet deck this way by stacking a few of them into columns :)</p>
<h4>The features object</h4>
<p>So there is a features object that you can pass into your constructor. There are currently <em>four</em> of these features.</p>
<h3 class="code">the features object</h3>
<pre><code>new TWTR.Widget({
  id: 'my-element-id',
  .
  .
  .
  features: {
    hashtags: true,
    timestamp: true,
    avatars: true,
    fullscreen: false
  }
}).render().start();</code></pre>
<p>Albeit mostly self explanatory, they each do this:</p>
<ul>
<li><strong>hashtags</strong>: defaults to true. setting to false will hide them.</li>
<li><strong>timestamp</strong>: defaults to true. setting to false will hide them.</li>
<li><strong>avatars</strong>: defaults to true for search. and false for profile widget. setting to false will hide them.</li>
<li><strong>fullscreen</strong>: (I love this feature!) defaults to false. setting to true will give you a full viewport sized widget, perfect for displaying on large screens at events, conferences, etc.
<li>
</ul>
<p>Overall, these features are pretty great. I especially love the hashtag and fullscreen features since they are perfect for pairing.</p>
<p>Let&#8217;s say for instance you&#8217;re running a conference like <a href="http://sxsw.com">SxSW</a> — you could search for &#8220;#sxsw OR #sxsw09&#8243; — and in the results, hide the hashtags so it doesn&#8217;t distract the readability of all the searches. Neat, eh?</p>
<h3>Some examples</h3>
<p>I went ahead and installed the widget on my own site — And here&#8217;s a few examples:</p>
<ul>
<li>fullscreen, hidden hashtag search for <a href="http://www.dustindiaz.com/search/?q=%23iranelection&#038;hashtags=false">#iranelection</a></li>
<li>fullscreen <a href="http://www.dustindiaz.com/search/?q=iphone%20to:apple">iphone to:apple</a> (hey, we all do it)</li>
<li>Or sometimes you just want to know what <a href="http://www.dustindiaz.com/search/?q=from:evan">Evan Weaver is doing</a></li>
</ul>
<h3>That&#8217;s it for now</h3>
<p>This will all undoubtedly be on our FAQ website soon enough, but it&#8217;s enough to have a play.</p>
<p>Happy Twidget Searching!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dustindiaz.com/twitter-widget-doc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Twita@talinkahashify your tweets</title>
		<link>http://www.dustindiaz.com/linkified-tweets/</link>
		<comments>http://www.dustindiaz.com/linkified-tweets/#comments</comments>
		<pubDate>Mon, 25 May 2009 19:48:44 +0000</pubDate>
		<dc:creator>polvero@gmail.com (Dustin Diaz)</dc:creator>
		
		<category><![CDATA[D.O.M.]]></category>

		<category><![CDATA[Featured]]></category>

		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.dustindiaz.com/?p=342</guid>
		<description><![CDATA[Well hello everyone. I had previously <a href="http://twitter.com/ded/status/1823235355">tweeted</a> about this a few weeks ago... but sometimes I forget more folks follow this blog than my Twitter.

If any of you use our <a href="http://apiwiki.twitter.com/">Twitter API</a> to embed your latest statuses on your website, here is a simple little script that will do a few niceties for you. This includes linkafying, hashtagifying, and of course the most important, atify (aka: "at replies").

Hit the jump to find out more on how to use it.]]></description>
			<content:encoded><![CDATA[<p>Well hello everyone. I had previously <a href="http://twitter.com/ded/status/1823235355">tweeted</a> about this a few weeks ago&#8230; but sometimes I forget more folks follow this blog than my Twitter.</p>
<p>If any of you use our <a href="http://apiwiki.twitter.com/">Twitter API</a> to embed your latest statuses on your website, here is a simple little script that will do a few niceties for you. This includes linkafying, hashtagifying, and of course the most important, atify (aka: &#8220;at replies&#8221;). <a href="http://www.dustindiaz.com/basement/ify.html">check out the source</a>, and use it as such:</p>
<h3 class="code">tweet code</h3>
<pre><code>ify.clean('your tweet text');</code></pre>
<p>Thus making transforming a tweet such as the following:</p>
<h3 class="code">Before and After</h3>
<pre><code><strong>Bfore</strong>
Hey @ded. You should #stfu! and use http://canon.com #rant.
kthxbye @erin http://www.google.com/search?q=canon+rules

<strong>After</strong>
Hey @&lt;a href=&quot;http://twitter.com/ded&quot;&gt;ded&lt;/a&gt;.
You should #&lt;a href=&quot;http://search.twitter.com/search?q=%23stfu&quot;&gt;stfu&lt;/a&gt;!
and use &lt;a href=&quot;http://canon.com&quot;&gt;http://canon.com&lt;/a&gt;
#&lt;a href=&quot;http://search.twitter.com/search?q=%23rant&quot;&gt;rant&lt;/a&gt;.
kthxbye @&lt;a href=&quot;http://twitter.com/erin&quot;&gt;erin&lt;/a&gt;
&lt;a href=&quot;http://www.google.com/search?q=canon rules&quot;&gt;
http://www.google.com/se...&lt;/a&gt;</code></pre>
<p>Download: <a href="http://www.dustindiaz.com/basement/js/ify.js">source</a> | <a href="http://www.dustindiaz.com/basement/js/ify.min.js">minified</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dustindiaz.com/linkified-tweets/feed/</wfw:commentRss>
		<enclosure url="http://www.dustindiaz.com/basement/js/ify.js" length="1025" type="application/javascript" /><media:content url="http://www.dustindiaz.com/basement/js/ify.js" fileSize="1025" type="application/javascript" /><itunes:explicit>no</itunes:explicit><itunes:subtitle>Well hello everyone. I had previously tweeted about this a few weeks ago... but sometimes I forget more folks follow this blog than my Twitter. If any of you use our Twitter API to embed your latest statuses on your website, here is a simple little script</itunes:subtitle><itunes:author>Dustin Diaz</itunes:author><itunes:summary>Well hello everyone. I had previously tweeted about this a few weeks ago... but sometimes I forget more folks follow this blog than my Twitter. If any of you use our Twitter API to embed your latest statuses on your website, here is a simple little script that will do a few niceties for you. This includes linkafying, hashtagifying, and of course the most important, atify (aka: "at replies"). Hit the jump to find out more on how to use it.</itunes:summary><itunes:keywords>web,design,webdesign,development,webstandards,javascript,dom,css,xhtml,yahoo,yui</itunes:keywords></item>
		<item>
		<title>Me on Photography and JavaScript</title>
		<link>http://www.dustindiaz.com/me-on-photography-and-javascript/</link>
		<comments>http://www.dustindiaz.com/me-on-photography-and-javascript/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 19:08:34 +0000</pubDate>
		<dc:creator>polvero@gmail.com (Dustin Diaz)</dc:creator>
		
		<category><![CDATA[Featured]]></category>

		<category><![CDATA[Humor]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Life]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[photography]]></category>

		<guid isPermaLink="false">http://www.dustindiaz.com/?p=340</guid>
		<description><![CDATA[I figured the only way I can keep someone's attention on this blog while talking about Photography is to <em>also</em> talk about JavaScript. Since I have a vested interest in both, and with very good reason, they make a good pair. As some of you might have remembered, I wrote a post not too long back on <a href="http://dustindiaz.com/photography">Photography</a> where I discussed some of the basics and also a brief comparison of JavaScript and Photography.

With that said, if you like one and not the other, this should still at least be entertaining and educational. If you like both, then you're in for a treat of nerdy euphemisms and theories.]]></description>
			<content:encoded><![CDATA[<p>I figured the only way I can keep someone&#8217;s attention on this blog while talking about Photography is to <em>also</em> talk about JavaScript. Since I have a vested interest in both, and with very good reason, they make a good pair. As some of you might have remembered, I wrote a post not too long back on <a href="http://dustindiaz.com/photography">Photography</a> where I discussed some of the basics and also a brief comparison of JavaScript and Photography.</p>
<p>With that said, if you like one and not the other, this should still at least be entertaining and educational. If you like both, then you&#8217;re in for a treat of nerdy euphemisms and theories.</p>
<h3>Hold on a sec&#8230; Photography? Really?</h3>
<p>Yes, really. If you haven&#8217;t noticed, I&#8217;ve started my very own <a href="http://photography.dustindiaz.com">365 Project</a> where I take at least one photo a day, and post it there. There&#8217;s even a handy <a href="http://feedproxy.google.com/ded-365">RSS feed</a> you can drop into your favorite Reader. Anyway&#8230;</p>
<h3>Photography and JavaScript are similar because&#8230;</h3>
<ul>
<li><strong>They are expressive</strong>: This is almost a no-brainer. Since the beginning of having the ability to take a picture of something, the expression &#8220;a picture says a thousand words&#8221; has held true to this day. This also great for people who aren&#8217;t fantastic with words. This spills into JavaScript because it is one of the smallest object oriented languages on the planet and allows you to express behavior and action in a variety of ways. The mere fact that we have such a plethora of JavaScript libraries these days is testament to how expressive it really is, especially since most of them pretty much do the asme thing! Just <em>differently</em>.</li>
<li><strong>They can be as simple or as complicated as you make them</strong>: I&#8217;ve always said that JavaScript is the closest thing we have to a ninja, but in written lexical structure. As previously mentioned, it&#8217;s a small language. But it can be very, very complicated at times, especially when you dive into <a href="http://jsdesignpatterns.com/">JavaScript Design Patterns</a> and begin to learn about subclassing, information hiding, prototypal inheritance, and all that other fun good stuff. Same holds true for photography in that the scientific break-thru of capturing light (onto film or a digital sensor), and modifying it by means of shutter speed and aperture, is <em>so simple</em> that anyone can get started taking pictures on a manual camera. On the flip side, you can turn it into a really complicated and complex hobby (or profession) by introducing flash, wireless remote systems, then umbrellas, soft boxes, snoots, grid spots, gobos&#8230; there&#8217;s also a giant pile of lenses you could buy; macros, telephotos, wide-angles, primes, zooms&#8230; the list can go on. There&#8217;s a reason why there are dedicated camera stores like <a href="http://www.bhphotovideo.com/">B&amp;H Photo</a>, <a href="http://www.calumetphoto.com/">Calumet Photo</a>, unfortunately there aren&#8217;t exactly stores like this for JavaScript ;) &mdash; I guess that&#8217;s what <a href="http://www.apress.com/">Apress</a> and <a href="http://oreilly.com/">O&#8217;Reilly</a> are for (which sells both photography and JavaScript books :)</li>
<li><strong>they are both object oriented and subject driven</strong>: Clearly, JavaScript is object oriented, there&#8217;s no argument on that (seriously, don&#8217;t get us started), but often the subject of what we&#8217;re programming for drives how we use the language. When you&#8217;re building a library, you&#8217;ll most likely use the languages object oriented features. When you&#8217;re implementing interfaces and dealing with simple tasks, you&#8217;ll use more functional JavaScript. Same goes for photography where the subjects should drive the type of photos you&#8217;ll take. When I&#8217;m going to shoot a small plant, I&#8217;m not going to pull out my wide angle, I&#8217;ll pull out a macro or telephoto. When I&#8217;m doing portraits, I&#8217;ll grab my prime 85mm. For more serious work, I can begin to create my own light with strobes. Maybe even two or three of them. And of course the real reason photography is object oriented, is because it evolves around taking pictures of objects. Of course don&#8217;t call people objects (which is slightly inappropriate), they are more or less subjects.</li>
</ul>
<h3>And so the list goes on</h3>
<p>I could probably continue on, but I&#8217;m pretty sure most of the point has been proven. This stuff is fun for a reason, and I&#8217;ve always known that in one way or another, the two have been connected. Something about my brain latches on to <strong>simplicity with the ability to evolve</strong>. Kind of like <a href="http://gmail.com">Gmail</a> (but this is not the forum for that). Cheers everyone, and happy Friday!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dustindiaz.com/me-on-photography-and-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RegEx Brain Teaser Part II</title>
		<link>http://www.dustindiaz.com/regex-brain-teaser-part-ii/</link>
		<comments>http://www.dustindiaz.com/regex-brain-teaser-part-ii/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 02:32:09 +0000</pubDate>
		<dc:creator>polvero@gmail.com (Dustin Diaz)</dc:creator>
		
		<category><![CDATA[Featured]]></category>

		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.dustindiaz.com/?p=338</guid>
		<description><![CDATA[In July I published a post <a href="http://www.dustindiaz.com/programming-brain-teaser/">calling out puzzle enthusiasts</a> to solve a programming brain teaser that involved grouping duplicates. Some solved it with a hefty amount of code, others used a savvy regular expression.

Now I'd like to invite you to yet another brain teaser, except this time your answer <strong>must</strong> require a regular expression. If you solve it, I would urge you to <a href="http://store.xkcd.com/#RegularExpressionsShirt">buy yourself a t-shirt</a> ;)]]></description>
			<content:encoded><![CDATA[<p>In July I published a post <a href="http://www.dustindiaz.com/programming-brain-teaser/">calling out puzzle enthusiasts</a> to solve a programming brain teaser that involved grouping duplicates. Some solved it with a hefty amount of code, others used a savvy regular expression.</p>
<p>Now I&#8217;d like to invite you to yet another brain teaser, except this time your answer <strong>must</strong> require a regular expression. If you solve it, I would urge you to <a href="http://store.xkcd.com/#RegularExpressionsShirt">buy yourself a t-shirt</a> ;)</p>
<h3>The Problem</h3>
<p>Write a function that takes a text input (first argument), and an integer specifying the amount of duplicates (second argument) to begin the grouping. View the following code as our skeleton:</p>
<h3 class="code">empty function</h3>
<pre><code>function bookend(text, start) {
  // return modified text
}
var example = 'a a a a a a a a a bb bb c c c c d a dd dd dd dd dd dd';

var result = bookend(example, 3);
// result is '<em>a a a</em> (a a a a a a) bb bb <em>c c c</em> (c) d a <em>dd dd dd</em> (dd dd dd)'

var result2 = bookend(example, 4);
// result2 is '<em>a a a a</em> (a a a a a) bb bb c c c c d a <em>dd dd dd dd</em> (dd dd)'</code></pre>
<h3>In English</h3>
<p><strong>Bookend all duplicates that begin after the specific amount of minimum duplicates</strong>. Therefore if you specify the offset of &#8216;4&#8242; as your argument, and there are six duplicates in a row, then bookend the final two. Also take <em>special note of the spaces</em> in the examples.</p>
<h3>Assumptions</h3>
<p>You can assume your text input will only be a mix of letters (eg: &#8220;\w+&#8221;), and that nothing is separated by more than a single space.</p>
<h3>Sharing</h3>
<p>If you come up with a solution, post them offsite. I&#8217;d recommend <a href="http://pastie.org/pastes/new">Pastie.org</a>.<br />
Happy RegExing!<br />
<strong>Cheers!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dustindiaz.com/regex-brain-teaser-part-ii/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Get your Gmail Stickers</title>
		<link>http://www.dustindiaz.com/get-your-gmail-stickers/</link>
		<comments>http://www.dustindiaz.com/get-your-gmail-stickers/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 23:36:29 +0000</pubDate>
		<dc:creator>polvero@gmail.com (Dustin Diaz)</dc:creator>
		
		<category><![CDATA[Duely Noted]]></category>

		<category><![CDATA[Featured]]></category>

		<category><![CDATA[Humor]]></category>

		<category><![CDATA[Life]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[photography]]></category>

		<guid isPermaLink="false">http://www.dustindiaz.com/?p=336</guid>
		<description><![CDATA[Yeah. <a href="http://gmailblog.blogspot.com/2008/12/get-your-gmail-stickers.html">Really</a>. Send us a snail-mail with a 42 cent stamp, and we'll give you some stickers! Also, this is the first showcase of any of my photos on behalf of Google :)
Cheers!]]></description>
			<content:encoded><![CDATA[<p>Yeah. <a href="http://gmailblog.blogspot.com/2008/12/get-your-gmail-stickers.html">Really</a>. Send us a snail-mail with a 42 cent stamp, and we&#8217;ll give you some stickers! Also, this is the first showcase of any of my photos on behalf of Google :)<br />
Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dustindiaz.com/get-your-gmail-stickers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Parenthetical back matching in regular expressions</title>
		<link>http://www.dustindiaz.com/regular-expression-back-matching/</link>
		<comments>http://www.dustindiaz.com/regular-expression-back-matching/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 01:01:57 +0000</pubDate>
		<dc:creator>polvero@gmail.com (Dustin Diaz)</dc:creator>
		
		<category><![CDATA[Featured]]></category>

		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.dustindiaz.com/?p=329</guid>
		<description><![CDATA[Let me <a href="http://www.dustindiaz.com/regular-expressions-the-love-hate-relationship/">repeat</a>, I still don't like the taste of <del>vegetables</del> regular expressions. But despite their bitterness, my mind has grown stronger having eaten so many lately.

So anyway, I ran into this problem lately with back references within the body of regular expression matches. Trust me, I've scoured the <a href="http://www.regular-expressions.info/">penultimate of documentation websites for regular expressions</a>, and still found no clear answer, so I thought I'd share my findings through trial and error.]]></description>
			<content:encoded><![CDATA[<p>Let me <a href="http://www.dustindiaz.com/regular-expressions-the-love-hate-relationship/">repeat</a>, I still don&#8217;t like the taste of <del>vegetables</del> regular expressions. But despite their bitterness, my mind has grown stronger having eaten so many lately.</p>
<p>So anyway, I ran into this problem lately with back references within the body of regular expression matches. Trust me, I&#8217;ve scoured the <a href="http://www.regular-expressions.info/">penultimate of documentation websites for regular expressions</a>, and still found no clear answer, so I thought I&#8217;d share my findings through trial and error.</p>
<h3>First, what am I talking about?</h3>
<p>Within the body of a regular expression, you can callback a previous match by using &#8220;\1&#8243; or &#8220;\2&#8243; (up to &#8220;\9&#8243; (in JavaScript, of course)). These will reference the &#8220;<strong>appropriate grouping to the left of the back reference</strong>&#8221; (so says websites that document this feature). This is true, however, what does that mean? </p>
<h3>A quick example before we complicate things</h3>
<p>What this basically means, using the most common example on nearly every website that explains this feature is this. Let&#8217;s say we want to replace all duplicated words in a paragraph. We would do so as follows:</p>
<h3 class="code">replacing duplicate words</h3>
<pre><code>var str = "welcome to <em>the the</em> jungle <em>baby baby</em>";
str = str.replace(/<em>(\w+)</em> \1/g, "$1");
// str === "welcome to the jungle baby"</code></pre>
<p>Notice that <strong>\1</strong> <em>recalls</em> what it found in the (parenthesis) match. Ok great, most already know this, good onya.</p>
<p>Now, let&#8217;s put it to a confusing test. We&#8217;ll start with the following string:</p>
<h3 class="code">hello world</h3>
<pre><code>var str = 'hello hello hello world hello world world';</code></pre>
<p>Take a good look at the string, then compare it against the following matches:</p>
<h3 class="code">various back reference matches</h3>
<pre><code>/(((hello) (world)) \1)/
/(((hello) (world)) \2)/
/(((hello) (world)) \3)/
/(((hello) (world)) \4)/</code></pre>
<h3>Stop effing with me</h3>
<p>In the above four scenarios, what in the world does &#8220;<strong>appropriate grouping to the left of the back reference</strong>&#8221; mean? Clearly we have parenthesis madness everywhere (<strong>four in total</strong>), but through trial and error, they simply match the following:</p>
<h3 class="code">back reference matches</h3>
<pre><code>/(((hello) (world)) \x)/
when "x" matches
1 = "hello world " (note the space at the end)
2 = "hello world hello world"
3 = "hello world hello"
4 = "hello world world"
</code></pre>
<p>If that bit of text doesn&#8217;t help, here&#8217;s a graphic I made to help understand it a little better:</p>
<p><img src="http://www.dustindiaz.com/img/articles/regex-back-matching.gif" /></p>
<p>Therefore, what this tell us is that it works from left-to-right (as mentioned) starting from outside to the inside. Take <strong>special note</strong> that if we tried to reference a match before the set of parenthesis exists yet, it is a null value. So if we tried to reference &#8220;\4&#8243; below:</p>
<h3 class="code">null reference to non-existing match</h3>
<pre><code>/(((hello) \4 (world)))/</code></pre>
<p>It doesn&#8217;t work. But &#8220;\3&#8243; would :)</p>
<h3 class="code">null reference to non-existing match</h3>
<pre><code>/(((hello) \3 (world)))/</code></pre>
<p>The above &#8220;\3&#8243; would look for &#8220;hello&#8221; - thus making the entire match &#8220;hello hello world&#8221;, which is in fact, a found match. And that, my friends, concludes todays oddities in back matching for regular expressions. Happy Thanksgiving! Cheers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dustindiaz.com/regular-expression-back-matching/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Skinny on Doctypes</title>
		<link>http://www.dustindiaz.com/skinny-on-doctypes/</link>
		<comments>http://www.dustindiaz.com/skinny-on-doctypes/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 02:21:38 +0000</pubDate>
		<dc:creator>polvero@gmail.com (Dustin Diaz)</dc:creator>
		
		<category><![CDATA[Accessibility]]></category>

		<category><![CDATA[Featured]]></category>

		<category><![CDATA[Web Standards]]></category>

		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://www.dustindiaz.com/?p=327</guid>
		<description><![CDATA[Doctypes have long been in standardista discussions circles. Why to use them. Which one to use. Which one is best. These are all &#60;sarcasm&#62;<strong>really fun details</strong>&#60;/sarcasm&#62; to get into, but the most important aspect of any doctype is simply <em>having one</em>, since without one, you're stuck in the lovely world of "quirks mode". If you're interested in understanding the <a href="http://webdesign.about.com/od/dtds/qt/tipdoctype.htm" title="Actually helpful article on what all those parts in a doctype mean">anatomy of a doctype</a>, then by all means, dive in.]]></description>
			<content:encoded><![CDATA[<div class="updated">
<p><strong>Update</strong>: For the record, this is the standard <em>forward compatible</em> <a href="http://dev.w3.org/html5/spec/Overview.html#the-doctype">HTML 5 doctype</a>. This should <em>always</em> work.</p>
</div>
<p>Doctypes have long been in standardista discussions circles. Why to use them. Which one to use. Which one is best. These are all &lt;sarcasm&gt;<strong>really fun details</strong>&lt;/sarcasm&gt; to get into, but the most important aspect of any doctype is simply <em>having one</em>, since without one, you&#8217;re stuck in the lovely world of &#8220;quirks mode&#8221;. If you&#8217;re interested in understanding the <a href="http://webdesign.about.com/od/dtds/qt/tipdoctype.htm" title="Actually helpful article on what all those parts in a doctype mean">anatomy of a doctype</a>, then by all means, dive in.</p>
<p>At Google, we have this obsession with byte size. And by byte size, any &#8220;lack-therof&#8221; the better. Therefore the doctype you will find on <em>most</em> Google webpages while still triggering the browser into &#8220;standards mode&#8221; is as simple as you see below:</p>
<h3 class="code">The skinny doctype</h3>
<pre class="code"><code>&lt;!doctype html&gt;</code></pre>
<p>There is really, absolutely no reason you need the rest of the doctype in your declaration unless you&#8217;re validating code. Furthermore, it <strong>does not mean</strong> that your page is even invalid. In the end, it puts your webpages into standards mode, which is what really matters. (Plus it&#8217;s easy to memorize ;)</p>
<p>Try it out. It will fix your box model in IE6 and clobber all those other funny gotchas when you&#8217;re in quirks mode. Cheers.</p>
<div class="updated">
<p><strong>Update:</strong> David was kind enough to share <a href="http://themaingate.net/dev/html/all-you-need-is-doctype-html">his results</a> using the skinny doctype on his blog. The results, as expected, keep your browser tame.
</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.dustindiaz.com/skinny-on-doctypes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Regular Expressions, the Love-Hate Relationship</title>
		<link>http://www.dustindiaz.com/regular-expressions-the-love-hate-relationship/</link>
		<comments>http://www.dustindiaz.com/regular-expressions-the-love-hate-relationship/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 17:59:56 +0000</pubDate>
		<dc:creator>polvero@gmail.com (Dustin Diaz)</dc:creator>
		
		<category><![CDATA[Featured]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Life]]></category>

		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://www.dustindiaz.com/?p=325</guid>
		<description><![CDATA[There are few things in life that I outright hate, but always come back to; and vegetables come close. Without seasonings, oils, and creams, I can easily excuse this food group. What I'm actually talking about here is regular expressions. Similar to vegetables, they can be yucky but good for you. And no matter how old you grow to be, they're always there taunting you. There is absolutely no way you can live as a programmer and not have to swallow a few.]]></description>
			<content:encoded><![CDATA[<p>There are few things in life that I outright hate, but always come back to; and vegetables come close. Without seasonings, oils, and creams, I can easily excuse this food group. What I&#8217;m actually talking about here is regular expressions. Similar to vegetables, they can be yucky but good for you. And no matter how old you grow to be, they&#8217;re always there taunting you. There is absolutely no way you can live as a programmer and not have to swallow a few.</p>
<p>Nevertheless, just the other day I found my problem with Regular Expressions. My process is wrong. Similar to eating vegetables, I try and skip the chewing, and simply eat them whole. With vegetables, this is a little bit easier. But with regular expressions, it prolongs the pain. Let&#8217;s take for example some of my most favorite foods I enjoy like dessert wine, and Filet Mignon. Each having tastes to savor and slowly enjoy, putting a cheery happy smile on my face. Talk to anyone who is good at regular expressions, and you&#8217;ll notice they often enjoy them just a little more than your average person.</p>
<p>Carefully note the differences between enjoying your food slowly versus trying to swallow it whole. The same goes for regular expressions. Cut them up into pieces, and take small bites. Match smaller portions, the rest isn&#8217;t going to leave your plate any time soon.</p>
<h3>Why do I say all this?</h3>
<p>I mean, aren&#8217;t all Google employees required to how to crack a CIA database? Kidding aside, even to this day I have continued to avoid using regular expressions when I know how useful they could be. So therefore I am now saying all this today to announce my early 2009 programmers resolution to eat more regular expressions. Upon this declaration I will be reading the highly recommended <a href="http://www.amazon.com/exec/obidos/ASIN/0596528124/bookstorenow600-20">Mastering Regular Expressions</a> by Jeffrey Friedl.</p>
<h3>Also, where have I been?</h3>
<p>Good question. I&#8217;ve been working on <a href="http://gmail.com">Gmail</a> since last February building high fidelity prototypes to test new ideas. I&#8217;ve also been taking several photos and getting much heavier into photography than ever before. There is still rarely a day that goes by where my camera isn&#8217;t by my side. Feel free to have a gander at my <a href="http://dustindiaz.com/sandbox/flickr.php">featured photos</a>. Other than that, Happy Upcoming Turkey Day. Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dustindiaz.com/regular-expressions-the-love-hate-relationship/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Firefox 3.1 brings good stuff</title>
		<link>http://www.dustindiaz.com/firefox-31-brings-good-stuff/</link>
		<comments>http://www.dustindiaz.com/firefox-31-brings-good-stuff/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 22:32:14 +0000</pubDate>
		<dc:creator>polvero@gmail.com (Dustin Diaz)</dc:creator>
		
		<category><![CDATA[D.O.M.]]></category>

		<category><![CDATA[Featured]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Usability]]></category>

		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://www.dustindiaz.com/firefox-31-brings-good-stuff/</guid>
		<description><![CDATA[The latest <a href="http://developer.mozilla.org/devnews/index.php/2008/07/28/firefox-31-alpha-1-now-available-for-download/">alpha release of Firefox</a> came out today and they come bearing good fruit. First and foremost, they followed in the wonderful <a href="http://webkit.org/blog/156/queryselector-and-queryselectorall/">footsteps of Webkit</a> and implemented <a href="http://dev.w3.org/2006/webapi/selectors-api/">querySelector and querySelectorAll</a>. This means you can do native CSS queries. I'd likely wrap mine up in a simple $$ function as so:]]></description>
			<content:encoded><![CDATA[<p>The latest <a href="http://developer.mozilla.org/devnews/index.php/2008/07/28/firefox-31-alpha-1-now-available-for-download/">alpha release of Firefox</a> came out today and they come bearing good fruit. First and foremost, they followed in the wonderful <a href="http://webkit.org/blog/156/queryselector-and-queryselectorall/">footsteps of Webkit</a> and implemented <a href="http://dev.w3.org/2006/webapi/selectors-api/">querySelector and querySelectorAll</a>. This means you can do native CSS queries. I&#8217;d likely wrap mine up in a simple $$ function as so:</p>
<h3 class="code">JS native querySelector</h3>
<pre><code>var $$ = function(q, b) {
  if (b) {
    return document.querySelector(q);
  } else {
    return document.querySelectorAll(q);
  }
};</code></pre>
<p>This allows you to pass in a second optional boolean parameter that denotes the function to only return the first matched result as a single node. Otherwise a standard nodeList is returned. Nevertheless a problem still remains is that you still get returned something that is &#8220;array-like&#8221; but not a real array. So we&#8217;re still stuck with classic array conversion hacks:</p>
<h3 class="code">Converting to an array</h3>
<pre><code>[].slice.call($$('<b>ul > li:not(".selected"):hover</b>'), 0).forEach(function(el) {
  el.style.color = 'red';
});</code></pre>
<h3>Border images</h3>
<p><a href="http://dev.w3.org/csswg/css3-background/#the-border-image">Border images</a> can be fun if you need them. Although, the rounded corner craze seems to be dying down a bit. This would have been useful five years ago.</p>
<h3>A better URL bar</h3>
<p><strong>Yes!</strong> A better, smarter <a href="http://ed.agadak.net/2008/07/firefox-31-restricts-matches-keywords">URL bar</a>, that enables you to make it behave like the old one. Check out these preferences in <a href="http://kb.mozillazine.org/About:config">about:config</a>.</p>
<p><img src="http://www.dustindiaz.com/img/articles/firefox-default-urlbar.png" alt="Default url bar config" /></p>
<p>Notice how you can finally turn off title matching (albeit others think this is cool to leave it as the default setting).</p>
<h3>Tabs!?!</h3>
<p>I&#8217;m not sure whether tabs got better, or worse. First of all the introduced a tab switching overlay pane that behaves similar to app switching in OS&#8217;s. Now when you hit ctrl + tab you get this overlay. I personally find it annoying when just trying to switch tabs&#8230; others&#8230; might like it. The only problem is, it breaks the tab switching model. ctrl + tab moves right; ctrl + shft + tab moves left. <strong>NOT SO</strong> in this case. Now when you move one over with ctrl + tab, then hit it again, it takes you back to the last one you were on rather than continuing to move to the right. (<a href="http://www.flickr.com/photos/polvero/2718154394/">I took a small screencast to illustrate what I&#8217;m saying</a>) <strong>This is bad</strong>. But, whatever. As long as there is a way to eventually turn this off.</p>
<h3>And of course, Better support for &#8220;Web Standards&#8221;</h3>
<p>I&#8217;m not really sure what this means. I didn&#8217;t scour the release notes to see if this meant anything actually useful. Since they rewrote a large core of their layout engine, they are going through regressions, so this could just mean they fixed things that were already working, but broke with the latest public release of Firefox 3.</p>
<h3>Overall</h3>
<p>Things are looking good and I&#8217;m glad Mozilla has overcame leaps and bounds throughout the years from a once dominated by IE6 world. My current site statistics show Firefox at 63% over a 28% IE. Indeed, times are good.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dustindiaz.com/firefox-31-brings-good-stuff/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Programming Brain Teaser</title>
		<link>http://www.dustindiaz.com/programming-brain-teaser/</link>
		<comments>http://www.dustindiaz.com/programming-brain-teaser/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 06:01:40 +0000</pubDate>
		<dc:creator>polvero@gmail.com (Dustin Diaz)</dc:creator>
		
		<category><![CDATA[D.O.M.]]></category>

		<category><![CDATA[Featured]]></category>

		<category><![CDATA[Humor]]></category>

		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.dustindiaz.com/programming-brain-teaser/</guid>
		<description><![CDATA[I've titled this post as a "Programming" brain teaser because ideally you could solve it in any language. For the sake of the exercise, I'm going to show sample code in JavaScript, but feel free to use your language of choice. 
But first and foremost, the reason I'm writing about this is because I ran into a logic problem last week which I thought I would be able to solve in two seconds. Sadly it wasn't the case so I'd like to share that same problem (in obfuscated form) with you, the readers. I know what you're thinking. You're at work, and you've got a few minutes to whip up a simple answer. Cool then, go for it. Be sure to share your answer with the rest of us by linking to it offsite, but do not share code in the comments directly as others will most likely want to solve it themselves. ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve titled this post as a &#8220;Programming&#8221; brain teaser because ideally you could solve it in any language. For the sake of the exercise, I&#8217;m going to show sample code in JavaScript, but feel free to use your language of choice.<br />
But first and foremost, the reason I&#8217;m writing about this is because I ran into a logic problem last week which I thought I would be able to solve in two seconds. Sadly it wasn&#8217;t the case so I&#8217;d like to share that same problem (in obfuscated form) with you, the readers. I know what you&#8217;re thinking. You&#8217;re at work, and you&#8217;ve got a few minutes to whip up a simple answer. Cool then, go for it. Be sure to share your answer with the rest of us by linking to it offsite, but do not share code in the comments directly as others will most likely want to solve it themselves. </p>
<h3>The problem is simple</h3>
<p>First, you have an array. It looks like this:</p>
<h3 class="code">The array</h3>
<pre><code>
var arr = ['a', 'b', 'c', 'c', 'd','e', 'e',
'e', 'e', 'e', 'f', 'e', 'f', 'e',
'f', 'a', 'a', 'a', 'f', 'f', 'f'];
</code></pre>
<p>Be sure to use the array above in your example. You can iterate through an array easily with a batch function like forEach.</p>
<h3 class="code">using forEach</h3>
<pre><code>arr.forEach(funciton(item, index, ar) {
  // do stuff here
});</code></pre>
<p>In the end, we&#8217;d like to have an output that looks like the following:</p>
<h3 class="code">The final output</h3>
<pre><code>
a b c c d e e &lt;span&gt;e e e&lt;/span&gt; f e f e f a a &lt;span&gt;a&lt;/span&gt; f f &lt;span&gt;f&lt;/span&gt;</code></pre>
<p>You can use basic string concatenation while looping through the items to build your final output. Be sure to test and compare your output results with the actual results. And last but not least, the rule.</p>
<h3>So the rule is this</h3>
<p>In English: <strong>Group together all duplicate items that occur anytime beyond twice by wrapping them with a tag, naturally &#8220;bookending&#8221; them.</strong><br />
Simple, right? No, really. Tease your brain for a few minutes, you can fix that bug after lunch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dustindiaz.com/programming-brain-teaser/feed/</wfw:commentRss>
		</item>
	<media:credit role="author">Dustin Diaz</media:credit><media:rating>nonadult</media:rating></channel>
</rss><!-- Dynamic Page Served (once) in 1.892 seconds -->
