<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Programming Brain Teaser</title>
	<link>http://hackademix.net/2008/07/10/programming-brain-teaser/</link>
	<description>Giorgio Maone's answers to the Web, the Universe, and Everything</description>
	<pubDate>Tue, 02 Dec 2008 11:40:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>

	<item>
		<title>By: piju</title>
		<link>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8924</link>
		<dc:creator>piju</dc:creator>
		<pubDate>Tue, 05 Aug 2008 22:41:38 +0000</pubDate>
		<guid>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8924</guid>
		<description>cool,
i am not a programmer,
so i dont know what is this,
but, 
what i see about you is
you are such a great guy
u own an IT company,
u wrote great stuff
and the most is,
u are italian!

;)

bytheway,
i love pizza</description>
		<content:encoded><![CDATA[<p>cool,<br />
i am not a programmer,<br />
so i dont know what is this,<br />
but,<br />
what i see about you is<br />
you are such a great guy<br />
u own an IT company,<br />
u wrote great stuff<br />
and the most is,<br />
u are italian!</p>
<p>;)</p>
<p>bytheway,<br />
i love pizza</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio</title>
		<link>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8671</link>
		<dc:creator>Giorgio</dc:creator>
		<pubDate>Tue, 15 Jul 2008 09:59:09 +0000</pubDate>
		<guid>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8671</guid>
		<description>@&lt;b&gt;therube&lt;/b&gt;:
My script has no output per se.
If you want it to show a result, add this line:
&lt;code&gt;
alert(won);
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>@<b>therube</b>:<br />
My script has no output per se.<br />
If you want it to show a result, add this line:<br />
<code><br />
alert(won);<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: therube</title>
		<link>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8660</link>
		<dc:creator>therube</dc:creator>
		<pubDate>Tue, 15 Jul 2008 04:28:04 +0000</pubDate>
		<guid>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8660</guid>
		<description>For whatever reason, I am not able to get your bookmarklet to work?
No matter how I've tried it, I end up with an empty box at the top of the screen?

If I copy/paste into the URL line (prefaced by javascript: ), I correctly get &#34;true&#34;.

I had this bookmarklet (which I picked up somewhere?) that I called 'Execute HTML'.  If I recall, I would use it from time to time to execute HTML snippets.  But when I try it on on the script, again I end up with a blank page &#38; no &#34;true&#34;.

&lt;code&gt;
javascript:(function(){var sel;function getText(w){if(w.getSelection){return w.getSelection();}if(w.document.getSelection){return w.document.getSelection();}return w.document.selection.createRange().text;}function getSel(w){try{sel=getText(w);if(sel)return;for(var i=0;F=w.frames[i];i++){getSel(F);if(sel)return;}}catch(e){}}getSel(window);if(!sel)alert('Select some text.');else{w=open();w.document.write(sel);w.document.close();}})()
&lt;/code&gt;

Nothing here either, http://www.javascriptwindow.com/ ?</description>
		<content:encoded><![CDATA[<p>For whatever reason, I am not able to get your bookmarklet to work?<br />
No matter how I&#8217;ve tried it, I end up with an empty box at the top of the screen?</p>
<p>If I copy/paste into the URL line (prefaced by javascript: ), I correctly get &quot;true&quot;.</p>
<p>I had this bookmarklet (which I picked up somewhere?) that I called &#8216;Execute HTML&#8217;.  If I recall, I would use it from time to time to execute HTML snippets.  But when I try it on on the script, again I end up with a blank page &amp; no &quot;true&quot;.</p>
<p><code><br />
javascript:(function(){var sel;function getText(w){if(w.getSelection){return w.getSelection();}if(w.document.getSelection){return w.document.getSelection();}return w.document.selection.createRange().text;}function getSel(w){try{sel=getText(w);if(sel)return;for(var i=0;F=w.frames[i];i++){getSel(F);if(sel)return;}}catch(e){}}getSel(window);if(!sel)alert('Select some text.');else{w=open();w.document.write(sel);w.document.close();}})()<br />
</code></p>
<p>Nothing here either, <a href="http://www.javascriptwindow.com/" rel="nofollow">http://www.javascriptwindow.com/</a> ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: john</title>
		<link>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8619</link>
		<dc:creator>john</dc:creator>
		<pubDate>Sat, 12 Jul 2008 04:12:39 +0000</pubDate>
		<guid>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8619</guid>
		<description>pls apologize my stupidity.. but what will this expression do?</description>
		<content:encoded><![CDATA[<p>pls apologize my stupidity.. but what will this expression do?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Hasler</title>
		<link>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8611</link>
		<dc:creator>Sam Hasler</dc:creator>
		<pubDate>Thu, 10 Jul 2008 22:59:09 +0000</pubDate>
		<guid>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8611</guid>
		<description>Thanks</description>
		<content:encoded><![CDATA[<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul O'Shannessy</title>
		<link>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8610</link>
		<dc:creator>Paul O'Shannessy</dc:creator>
		<pubDate>Thu, 10 Jul 2008 22:51:15 +0000</pubDate>
		<guid>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8610</guid>
		<description>I like it. Clever use of regular expressions.</description>
		<content:encoded><![CDATA[<p>I like it. Clever use of regular expressions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio</title>
		<link>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8604</link>
		<dc:creator>Giorgio</dc:creator>
		<pubDate>Thu, 10 Jul 2008 17:12:36 +0000</pubDate>
		<guid>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8604</guid>
		<description>@&lt;b&gt;Sam Hasler&lt;/b&gt;:
You need to enter all in one line (unless you store variables in a window object, e.g. using "top.arr") and end the script with an expression but &lt;em&gt;not&lt;/em&gt; an assignment, e.g.:
&lt;blockquote&gt;
var arr = [&apos;a&apos;, &apos;b&apos;, &apos;c&apos;, &apos;c&apos;, &apos;d&apos;,&apos;e&apos;, &apos;e&apos;,&apos;e&apos;, &apos;e&apos;, &apos;e&apos;, &apos;f&apos;, &apos;e&apos;, &apos;f&apos;, &apos;e&apos;, &apos;f&apos;, &apos;a&apos;, &apos;a&apos;, &apos;a&apos;, &apos;f&apos;, &apos;f&apos;, &apos;f&apos;]; var solution=&apos;a b c c d e e &#60;span&#62;e e e&#60;/span&#62; f e f e f a a &#60;span&#62;a&#60;/span&#62; f f &#60;span&#62;f&#60;/span&#62;&apos;; arr.join(&apos; &apos;).replace(/((\w)\s\2\s)((?:\2\s?)+)(?=\s&#124;$)/g, &apos;$1&#60;span&#62;$3&#60;/span&#62;&apos;) == solution;
&lt;/blockquote&gt;
(in one line) will give "true" as its output.

A portable, concise bookmarklet to quickly test multiline JS is the following:
&lt;code&gt;javascript:document.body.innerHTML=&#34;&#60;textarea onchange=&apos;eval(this.value)&apos; cols=80 rows=6/&#62;&#34;;void(0)&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>@<b>Sam Hasler</b>:<br />
You need to enter all in one line (unless you store variables in a window object, e.g. using &#8220;top.arr&#8221;) and end the script with an expression but <em>not</em> an assignment, e.g.:</p>
<blockquote><p>
var arr = [&apos;a&apos;, &apos;b&apos;, &apos;c&apos;, &apos;c&apos;, &apos;d&apos;,&apos;e&apos;, &apos;e&apos;,&apos;e&apos;, &apos;e&apos;, &apos;e&apos;, &apos;f&apos;, &apos;e&apos;, &apos;f&apos;, &apos;e&apos;, &apos;f&apos;, &apos;a&apos;, &apos;a&apos;, &apos;a&apos;, &apos;f&apos;, &apos;f&apos;, &apos;f&apos;]; var solution=&apos;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;&apos;; arr.join(&apos; &apos;).replace(/((\w)\s\2\s)((?:\2\s?)+)(?=\s|$)/g, &apos;$1&lt;span&gt;$3&lt;/span&gt;&apos;) == solution;
</p></blockquote>
<p>(in one line) will give &#8220;true&#8221; as its output.</p>
<p>A portable, concise bookmarklet to quickly test multiline JS is the following:<br />
<code>javascript:document.body.innerHTML=&quot;&lt;textarea onchange=&apos;eval(this.value)&apos; cols=80 rows=6/&gt;&quot;;void(0)</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Hasler</title>
		<link>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8602</link>
		<dc:creator>Sam Hasler</dc:creator>
		<pubDate>Thu, 10 Jul 2008 14:46:03 +0000</pubDate>
		<guid>http://hackademix.net/2008/07/10/programming-brain-teaser/#comment-8602</guid>
		<description>How did you use the Error console? That would be a useful trick to learn. I tired pasting your code into it and clicking on Evaluate but it didn't do anything.</description>
		<content:encoded><![CDATA[<p>How did you use the Error console? That would be a useful trick to learn. I tired pasting your code into it and clicking on Evaluate but it didn&#8217;t do anything.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
