<?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>Bram.us &#187; Discovery Of The Day</title>
	<atom:link href="http://www.bram.us/category/discovery-of-the-day/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bram.us</link>
	<description>A rather geeky/technical weblog by Bram(us) Van Damme</description>
	<lastBuildDate>Tue, 07 Feb 2012 23:13:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Firebug 1.2 vs Firefox 2 : Fixing the &#039;console is not defined&#039; error</title>
		<link>http://www.bram.us/2008/08/29/firebug-12-vs-firefox-2-fixing-the-console-is-not-defined-error/</link>
		<comments>http://www.bram.us/2008/08/29/firebug-12-vs-firefox-2-fixing-the-console-is-not-defined-error/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 08:38:41 +0000</pubDate>
		<dc:creator>Bramus!</dc:creator>
				<category><![CDATA[Discovery Of The Day]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<guid isPermaLink="false">http://www.bram.us/?p=1787</guid>
		<description><![CDATA[Getting some &#8216;console is not defined&#8216; errors in Firefox 2 with Firebug 1.2.0? Don&#8217;t worry, as it turns out that&#8217;s by design. The trick is to issue a window.loadFirebugConsole(); in your Javascript before using the console. Thanks for mentioning it &#8230; <a href="http://www.bram.us/2008/08/29/firebug-12-vs-firefox-2-fixing-the-console-is-not-defined-error/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bram.us/wordpress/wp-content/uploads/2008/08/firebug.jpg" alt="" title="firebug" width="80" height="80" class="alignnone size-full wp-image-1788" style="display: block; float: left; margin: 0 10px 10px 0;" />Getting some &#8216;<code>console is not defined</code>&#8216; errors in Firefox 2 with Firebug 1.2.0? Don&#8217;t worry, as it turns out that&#8217;s <em>by design</em>. The trick is to issue a <code>window.loadFirebugConsole();</code> in your Javascript before using the console. Thanks for mentioning it on the list, <a href="http://groups.google.com/group/firebug/browse_thread/thread/d7734e0142ce4b4c?hl=en">John</a>! <img src='http://www.bram.us/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <br style="clear: both;" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bram.us/2008/08/29/firebug-12-vs-firefox-2-fixing-the-console-is-not-defined-error/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to find the original Flickr Photo URL and User from a Static Flickr Image URL/Permalink (My priceless Flickr Tip)</title>
		<link>http://www.bram.us/2008/01/12/my-priceless-flickr-tip-how-to-find-the-original-flickr-photo-url-and-user-from-a-static-flickr-image-url/</link>
		<comments>http://www.bram.us/2008/01/12/my-priceless-flickr-tip-how-to-find-the-original-flickr-photo-url-and-user-from-a-static-flickr-image-url/#comments</comments>
		<pubDate>Fri, 11 Jan 2008 23:09:05 +0000</pubDate>
		<dc:creator>Bramus!</dc:creator>
				<category><![CDATA[Another Dailie]]></category>
		<category><![CDATA[Bramus!]]></category>
		<category><![CDATA[Discovery Of The Day]]></category>
		<guid isPermaLink="false">http://www.bram.us/2008/01/12/my-priceless-flickr-tip-how-to-find-the-original-flickr-photo-url-and-user-from-a-static-flickr-image-url/</guid>
		<description><![CDATA[Got a link like http://farm3.static.flickr.com/2085/2177060015_258bcfaff9_m.jpg and want to find out which user posted it, more images by that user, see the full-size version, etc? Seek no longer, the answer is very simple! From the URL you&#8217;ve got take extract the &#8230; <a href="http://www.bram.us/2008/01/12/my-priceless-flickr-tip-how-to-find-the-original-flickr-photo-url-and-user-from-a-static-flickr-image-url/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.bram.us/wordpress/wp-content/uploads/2008/01/flickr.jpg' alt='flickr.jpg' style='display: block; float: left; margin: 0 10px 0 0;' />Got a link like <em><a href="http://farm3.static.flickr.com/2085/2177060015_258bcfaff9_m.jpg">http://farm3.static.flickr.com/2085/2177060015_258bcfaff9_m.jpg</a></em> and want to find out which user posted it, more images by that user, see the full-size version, etc? Seek no longer, the answer is very simple!<br style="clear: both;" /></p>
<p><span id="more-1370"></span></p>
<p><img src="http://farm3.static.flickr.com/2085/2177060015_258bcfaff9_t.jpg" title="The image we found" alt="The image we found" style="display: block; float: right; margin: 5px 0 10px 10px;" /></p>
<p>From the URL you&#8217;ve got take extract the image name (<code>2177060015_258bcfaff9_m.jpg</code>) and split it on the <em>underscore</em>. The first part is the <code>photoID</code>, the second part is the <code>hash</code>/<code>salt</code> and (if there) the third part the <code>size</code> (Full format: <strong><code>photoId</code>_<code>hash</code>_<code>size</code>.jpg</strong>).</p>
<p>Now append that <code>photoId</code> to <em>http://flickr.com/photo.gne?id=</em> and <strong>*MAGIC*</strong> there you have it, the Original Flickr Photo URL (and the user) <img src='http://www.bram.us/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The example above would be transformed to <a href="http://flickr.com/photo.gne?id=2177060015">http://flickr.com/photo.gne?id=2177060015</a></p>
<p>Cheers!</p>
<p>B!</p>
<p><strong>UPDATE 2008.01.18</strong> &#8211; In related matter these might be of interest too: <a href="http://digitalphotography.weblogsinc.com/2005/08/01/flickr-hack-all-sizes-for-all-pics/">Flickr Hack &#8211; All sizes for all pics</a> &amp; <a href="http://interestingby.isaias.com.mx/pm.php?id=90729030@N00">My most interesting (best viewed) Flickr pics</a> (<em>replace that ID with <a href="http://idgettr.com/">your own Flickr ID</a> to watch yours <img src='http://www.bram.us/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </em>)</p>
<p><strong>UPDATE 2010.11.07</strong> &#8211; Bram.us visitor <a href="http://robinsenior.com/">Robin Senior</a> created a handy bookmarklet which does the job <em>automagically</em>. Drag this link to your bookmarks toolbar and click it whenever you have a static Flickr image URL open: <a href="javascript:if%20(document.domain.indexOf(%22static.flickr.com%22)%20!=%20-1){var%20id%20=%20document.title.split(%22_%22);var%20url%20=%20%22http://flickr.com/photo.gne?id=%22%20+%20id[0];window.location%20=%20url;}else{alert(%22Sorry,%20this%20is%20not%20a%20Flickr%20static%20image.%22);}" class="button" onclick="alert('Drag this to your bookmarks bar'); return false;">Flickr Photo Page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bram.us/2008/01/12/my-priceless-flickr-tip-how-to-find-the-original-flickr-photo-url-and-user-from-a-static-flickr-image-url/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>My Google Test</title>
		<link>http://www.bram.us/2007/12/05/my-google-test/</link>
		<comments>http://www.bram.us/2007/12/05/my-google-test/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 23:12:33 +0000</pubDate>
		<dc:creator>Bramus!</dc:creator>
				<category><![CDATA[Another Dailie]]></category>
		<category><![CDATA[Bramus!]]></category>
		<category><![CDATA[Discovery Of The Day]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<guid isPermaLink="false">http://www.bram.us/2007/12/05/my-google-test-how-long-does-it-take-to-get-indexed/</guid>
		<description><![CDATA[About half an hour ago I created a new post here on Bram.us entitled 098f6bcd4621d373cade4e832627b4f6 (FYI: that&#8217;s the MD5 of &#8220;test&#8221;). Main reason was to see how high Google would rank me. Secondary reason was to see how long it &#8230; <a href="http://www.bram.us/2007/12/05/my-google-test/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.bram.us/wordpress/wp-content/uploads/2007/12/google.gif' alt='google.gif' style="display: block; float: left; margin: 0 10px 10px 0;" />About half an hour ago I created a new post here on Bram.us entitled <a href="http://www.bram.us/2007/12/04/098f6bcd4621d373cade4e832627b4f6/">098f6bcd4621d373cade4e832627b4f6</a> (FYI: that&#8217;s the MD5 of &ldquo;test&rdquo;). Main reason was to see how high Google would rank me. Secondary reason was to see how long it would take Google to index me. The answer to both is quite simple: <a href="http://www.flickr.com/photos/90729030@N00/2086972039">very high and blazin&#8217; fast</a>.<br style="clear: both;" /></p>
<p>The high ranking is simple: <code>098f6bcd4621d373cade4e832627b4f6</code> is pretty unique. The fast part: lucky of just catching an update cycle or not? <a href="#comments">Discuss away!</a> (<em>edit: this post also made it onto Google within half an hour</em>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bram.us/2007/12/05/my-google-test/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>My inc.functions.php &#8211; Part 4 : Unshifting elements on an array and preserving keys</title>
		<link>http://www.bram.us/2007/11/19/my-incfunctionsphp-part-4-unshifting-elements-on-an-array-and-preserving-keys/</link>
		<comments>http://www.bram.us/2007/11/19/my-incfunctionsphp-part-4-unshifting-elements-on-an-array-and-preserving-keys/#comments</comments>
		<pubDate>Mon, 19 Nov 2007 21:42:16 +0000</pubDate>
		<dc:creator>Bramus!</dc:creator>
				<category><![CDATA[Discovery Of The Day]]></category>
		<category><![CDATA[PHP Willow Tree]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<guid isPermaLink="false">http://www.bram.us/2007/11/19/my-incfunctionsphp-part-4-unshifting-elements-on-an-array-and-preserving-keys/</guid>
		<description><![CDATA[The fourth part of this series of handy little PHP functions only contains a little tip when one needs to add an element to the beginning of an array (viz. prepend, unshift) but has to preserve the (numerical) keys. Prerequisites &#8230; <a href="http://www.bram.us/2007/11/19/my-incfunctionsphp-part-4-unshifting-elements-on-an-array-and-preserving-keys/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img id="image315" src="http://www.bram.us/wordpress/wp-content/uploads/2006/11/php_willowtree.jpg" alt="PHP Willow Tree" title="PHP Willow Tree" style="margin: 5px 10px 2px 0px; display: block; float: left;" />The fourth part of <a href="http://www.bram.us/category/php-willow-tree/">this series of handy little PHP functions</a> only contains a little tip when one needs to add an element to the beginning of an array (viz. prepend, unshift) but has to preserve the (numerical) keys.<br style="clear: both;" /></p>
<p><span id="more-1255"></span></p>
<h2>Prerequisites</h2>
<div class="BramusBlock">
<p>Imagine you have an array of zipcodes as keys and names of cities as values:</p>
<pre class="brush: php; title: ; notranslate">$zipcodes = array(
	'9800' =&gt; 'Deinze',
	'8460' =&gt; 'Ettelgem',
	'9000' =&gt; 'Gent',
	'8400' =&gt; 'Oostende'
);</pre>
<p>Now, if I were to place those into a dropdown, I&#8217;d run that array to a function like so:</p>
<pre class="brush: php; title: ; notranslate">function createDropdown($ddName, $arValues) {
	$toReturn = &quot;&lt;select name=\&quot;$ddName\&quot; id=\&quot;$ddName\&quot;&gt;\n&quot;;
	foreach ($arValues as $key =&gt; $value) {
		$toReturn .= &quot;\t&lt;option value=\&quot;$key\&quot;&gt;$value&lt;/option&gt;\n&quot;;
	}
	$toReturn .= &quot;&lt;/select&gt;&quot;;
	return $toReturn;
}</pre>
<p>Running the array above through that function would result in the following HTML:</p>
<pre class="brush: xml; title: ; notranslate">&lt;!-- output of echo createDropdown(&quot;test&quot;, $zipcodes); --&gt;
&lt;select name=&quot;test&quot; id=&quot;test&quot;&gt;
	&lt;option value=&quot;9800&quot;&gt;Deinze&lt;/option&gt;
	&lt;option value=&quot;8460&quot;&gt;Ettelgem&lt;/option&gt;
	&lt;option value=&quot;9000&quot;&gt;Gent&lt;/option&gt;
	&lt;option value=&quot;8400&quot;&gt;Oostende&lt;/option&gt;
&lt;/select&gt;</pre>
<p>Quite obvious, not?</p>
</div>
<h2 style="margin-top: 12px;">The problem</h2>
<div class="BramusBlock">
<p>Now, I don&#8217;t want to have &ldquo;Deinze&rdquo; show up in the dropdown as the first item, but I want to show &ldquo;Please choose your city&rdquo; as the first item (with a value of 0). A quick peek at the PHP docs tell me that I need to use <code><a href="http://www.php.net/array_unshift">array_unshift</a></code> to &ldquo;<em>prepend one or more elements to the beginning of an array</em>&rdquo;</p>
<pre class="brush: plain; title: ; notranslate">array_unshift($zipcodes, &quot;Please Choose a City&quot;);</pre>
<p>Running the code above would float my boat, right? Wrong! The note at the phpdocs that &ldquo;<em>All numerical array keys will be modified to start counting from zero while literal keys won&#8217;t be touched</em>&rdquo;. After having run <code>array_unshift</code> on <code>$zipcodes</code> it indeed looks like this:</p>
<pre class="brush: plain; title: ; notranslate">Array
(
    [0] =&gt; Please Choose a City
    [1] =&gt; Deinze
    [2] =&gt; Ettelgem
    [3] =&gt; Gent
    [4] =&gt; Oostende
)</pre>
</div>
<h2 style="margin-top: 12px;">The solution</h2>
<div class="BramusBlock">
<p>The solution is to create a second array with only one item (index: &ldquo;0&rdquo;, value: &ldquo;Please choose a city&rdquo; and then merge them together, but not using the <code><a href="http://www.php.net/array_merge">array_merge</a></code> function as the function looses numerical keys too!</p>
<p>So what does one need to use then? Well, it might sound <a href="http://www.google.com/search?q=define%3A+noobcake">noobcake</a>-ish to you but this one I didn&#8217;t know: <strong>one can actually join 2 arrays in PHP by using the mathematical + operator</strong>! Now this is something I did not expect (it looks so not-PHP-alike, not?)!</p>
<pre class="brush: php; title: ; notranslate">$zipcodes = array(&quot;0&quot; =&gt; &quot;Please Choose a City&quot;) + $zipcodes;</pre>
<p>And yes, the array now looks like:</p>
<pre class="brush: plain; title: ; notranslate">Array
(
    [0] =&gt; Please Choose a City
    [9800] =&gt; Deinze
    [8460] =&gt; Ettelgem
    [9000] =&gt; Gent
    [8400] =&gt; Oostende
)</pre>
<p>And the HTML output after running the array through the <code>createDropdown</code> function looks like:</p>
<pre class="brush: xml; title: ; notranslate">&lt;select name=&quot;test&quot; id=&quot;test&quot;&gt;
	&lt;option value=&quot;0&quot;&gt;Please Choose a City&lt;/option&gt;
	&lt;option value=&quot;9800&quot;&gt;Deinze&lt;/option&gt;
	&lt;option value=&quot;8460&quot;&gt;Ettelgem&lt;/option&gt;
	&lt;option value=&quot;9000&quot;&gt;Gent&lt;/option&gt;
	&lt;option value=&quot;8400&quot;&gt;Oostende&lt;/option&gt;
&lt;/select&gt;</pre>
</div>
<h2 style="margin-top: 12px;">Wrapping up</h2>
<div class="BramusBlock">
<p>To finalize, one could wrap this little trick into a function and presto, but since it would take more code to join 2 arrays through a custom built function (which only uses a + operator) it&#8217;s way more easy to &ldquo;<em>just</em>&rdquo; remember this little trick <img src='http://www.bram.us/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bram.us/2007/11/19/my-incfunctionsphp-part-4-unshifting-elements-on-an-array-and-preserving-keys/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My Quest: In search of the ultimate windows Twitter client</title>
		<link>http://www.bram.us/2007/10/18/my-quest-in-search-of-the-ultimate-windows-twitter-client/</link>
		<comments>http://www.bram.us/2007/10/18/my-quest-in-search-of-the-ultimate-windows-twitter-client/#comments</comments>
		<pubDate>Thu, 18 Oct 2007 11:25:08 +0000</pubDate>
		<dc:creator>Bramus!</dc:creator>
				<category><![CDATA[Another Dailie]]></category>
		<category><![CDATA[Bramus!]]></category>
		<category><![CDATA[Discovery Of The Day]]></category>
		<guid isPermaLink="false">http://www.bram.us/2007/10/18/my-quest-in-search-of-the-ultimate-windows-twitter-client/</guid>
		<description><![CDATA[After having tried nearly every Windows Twitter Client, only Twitterlicious comes close to Twitteriffic. It&#8217;s a great app, but I found myself restarting the program every 2 hours, as it sometimes would just hang. So the quest continued &#8230; Yesterday &#8230; <a href="http://www.bram.us/2007/10/18/my-quest-in-search-of-the-ultimate-windows-twitter-client/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.bram.us/wordpress/wp-content/uploads/2007/10/twitbin.gif' alt='Twitbin' title='TwitBin' style="display: block; float: left; margin: 0 10px 10px 0;" />After having tried nearly every <a href="http://twitter.pbwiki.com/Apps">Windows Twitter Client</a>, only <a href="http://www.ejecutive.co.uk/projects/twitterlicious">Twitterlicious</a> comes close to <a href="http://iconfactory.com/software/twitterrific">Twitteriffic</a>. It&#8217;s a great app, but I found myself restarting the program every 2 hours, as it sometimes would just hang. So the quest continued &#8230; <br style="clear: both;" /></p>
<p><span id="more-1199"></span></p>
<p><a href="http://twitter.com/bramus/statuses/342059102">Yesterday</a> I stumbled upon <a href="http://www.twitbin.com/">TwitBin</a>, a Firefox Extension which adds a Twitter sidebar to Firefox, and I must say that &rdquo;<em>it just works</em>&rdquo;: <del datetime="2007-11-27T09:09:49+00:00">No timeouts, no errors, no nothing that goes wrong</del> <ins datetime="2007-11-27T09:09:49+00:00">See update below for new info</ins>. Only feature I&#8217;d like to see added is to detach the sidebar to a new window (as FireBug can do) and to have inline alerts (cfr. when a download completes). Other than that this client is <strong><del datetime="2007-11-27T09:09:49+00:00">perfect</del></strong>!</p>
<p style="text-align: center; font-size: smaller;"><img src='http://www.bram.us/wordpress/wp-content/uploads/2007/10/twitbin-sidebar.jpg' alt='TwitBin Sidebar' title='TwitBin Sidebar' /><br />The TwitBin Firefox Sidebar</p>
<p>I can hear you thinking that you have to have Firefox open all the time. True, but for me that&#8217;s no problem since Firefox is always open whenever I&#8217;m working on the PC <img src='http://www.bram.us/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Already noticed <a href="http://twitter.com/dextro/">Dextro</a> and <a href="http://twitter.com/donardonio/">Don Ardonio</a> using TwitBin &#8230; who&#8217;s next?</p>
<p>Happy tweeting! <del datetime="2007-11-27T09:09:49+00:00">TwitBin ftw!</del></p>
<p>B!</p>
<h2>Update!</h2>
<p>Twitbin seemed great, but after a few days (<em>when it started getting popular?</em>) I noticed that the darn thing gave timeouts, didn&#8217;t remember the credentials, froze up, didn&#8217;t load (FYI: Twitbin (the extension) merely loads the twitbin.com/beta/ URL into your sidebar). Then, <a href="http://twitter.com/dextro/">Dextro</a> came on with <a href="http://www.naan.net/trac/wiki/TwitterFox">TwitterFox</a>. Been using TwitterFox for quite a while now (3 weeks?) and must say that I like it and above all just works (if the Twitter API ain&#8217;t down, but that&#8217;s not TwitterFox&#8217; fault).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bram.us/2007/10/18/my-quest-in-search-of-the-ultimate-windows-twitter-client/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>His priceless Mac-Windows2003-Samba tip : fixing &quot;The alias could not be opened, because the original item cannot be found.&quot;-error</title>
		<link>http://www.bram.us/2007/09/10/his-priceless-mac-windows2003-samba-tip-fixing-the-alias-could-not-be-opened-because-the-original-item-cannot-be-found-error/</link>
		<comments>http://www.bram.us/2007/09/10/his-priceless-mac-windows2003-samba-tip-fixing-the-alias-could-not-be-opened-because-the-original-item-cannot-be-found-error/#comments</comments>
		<pubDate>Mon, 10 Sep 2007 19:04:37 +0000</pubDate>
		<dc:creator>Bramus!</dc:creator>
				<category><![CDATA[Another Dailie]]></category>
		<category><![CDATA[Discovery Of The Day]]></category>
		<guid isPermaLink="false">http://www.bram.us/2007/09/10/his-priceless-mac-windows2003-samba-tip-fixing-the-alias-could-not-be-opened-because-the-original-item-cannot-be-found-error/</guid>
		<description><![CDATA[Although it&#8217;s been a while since I&#8217;ve found a method to fixing the issue but a recent post on the students forum ict-blue (which I co-administered during my studies) popped this one of the stack of &#8220;tips and tricks&#8221;. What &#8230; <a href="http://www.bram.us/2007/09/10/his-priceless-mac-windows2003-samba-tip-fixing-the-alias-could-not-be-opened-because-the-original-item-cannot-be-found-error/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.bram.us/wordpress/wp-content/uploads/2007/09/samba.jpg' alt="" style="display: block; float: left; margin: 0 10px 10px 0;" />Although it&#8217;s been a while since I&#8217;ve found a method to fixing the issue but <a href="http://www.ict-blue.be/forum/viewtopic.php?t=15799">a recent post on the students forum ict-blue</a> (<em>which I co-administered during my studies</em>) popped this one of the stack of &ldquo;tips and tricks&rdquo;. What issue? The one where you can not connect your Mac to your Windows2003 server shares and get a &ldquo;<em>The alias could not be opened, because the original item cannot be found.</em>&rdquo; error message.</p>
<p><span id="more-1096"></span></p>
<h3>The scenario</h3>
<p>The scenario goes like this: you have a Windows 2003 server (with AD services) and have made some shares on it. You &#8211; evidently &#8211; have created some users with access to those shares. When you try to access the files from your Mac you open Finder, hit <code>CMD+K</code>, enter <code>smb://ip-op-your-server</code> and hit <code>connect</code>.</p>
<p style="text-align: center;"><img src='http://www.bram.us/wordpress/wp-content/uploads/2007/09/sambaconnect.jpg' alt='' /></p>
<p>You then get a screen asking for login credentials, you enter them, hit <code>OK</code> and then &#8230; you get a &ldquo;<em><strong>The alias could not be opened, because the original item cannot be found.</strong></em>&rdquo; error message. <img src='http://www.bram.us/wordpress/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p style="text-align: center;"><img src='http://www.bram.us/wordpress/wp-content/uploads/2007/09/sambalogin.jpg' alt='' /></p>
<h3>And now? Google!</h3>
<p>After having found myself lost (<em>pun intended</em>) on Google and having read lots of crappy solutions <a href="http://allinthehead.com/retro/218/accessing-a-windows-2003-share-from-os-x">a problem description and solution was found</a> over at <a href="http://allinthehead.com/">Drew McLellan</a>&#8216;s site.</p>
<h3>The Problem</h3>
<blockquote><p>In a nutshell, the cause of the problem is the default security policy on Windows 2003 Server being set to <em>always</em> encrypt network connections under all circumstances. Whilst this is fine for most clients (especially Windows clients, understandably), the version of SMB that Panther uses doesnâ€™t support encrypted connections. Apparently this support exists in Samba 3, but not on the version OS X uses. The solution is to change the security policy to use encryption <em>when itâ€™s available</em> and not otherwise.</p>
</blockquote>
<h3>The fix/solution</h3>
<blockquote><ul>
<li>From <code>Administrative Tools</code>, open <code>Domain Controller Security Settings</code>.</li>
<li>Go to <code>Local Policies</code> then <code>Security Options</code>.</li>
<li>Scroll down to find the entry <code>Microsoft network server: Digitally sign communications (always)</code>. Set this to <code>Disabled</code>.</li>
<li>The only thing left to do is to reload the security policy, as changes donâ€™t otherwise take effect for some time. Open up a command window and type: <code>gpupdate</code></li>
</ul>
</blockquote>
<p>Hope this one helps you out as much as it helped me out <img src='http://www.bram.us/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bram.us/2007/09/10/his-priceless-mac-windows2003-samba-tip-fixing-the-alias-could-not-be-opened-because-the-original-item-cannot-be-found-error/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>My Musical DOTD : Okkervil River</title>
		<link>http://www.bram.us/2007/08/28/my-musical-dotd-okkervil-river/</link>
		<comments>http://www.bram.us/2007/08/28/my-musical-dotd-okkervil-river/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 10:24:29 +0000</pubDate>
		<dc:creator>Bramus!</dc:creator>
				<category><![CDATA[Bramus!]]></category>
		<category><![CDATA[Discovery Of The Day]]></category>
		<category><![CDATA[Music]]></category>
		<guid isPermaLink="false">http://www.bram.us/2007/08/28/my-musical-dotd-okkervil-river/</guid>
		<description><![CDATA[Thanks to this post over at DoCopenhagen I made a nice musical discovery just a few minutes ago: Okkervil River. Be sure to check their website to hear some tunes, watch some movies and (especially for the geeks) check out &#8230; <a href="http://www.bram.us/2007/08/28/my-musical-dotd-okkervil-river/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img id="image1047" src="http://www.bram.us/wordpress/wp-content/uploads/2007/08/okkervil.jpg" alt="Okkervil River" style="display: block; float: left; margin: 0 10px 10px 0;" />Thanks to <a href="http://docopenhagen.blogspot.com/2007/08/okkervil-river-loppen.html">this post over at DoCopenhagen</a> I made a nice musical discovery just a few minutes ago: <a href="http://okkervilriver.com/">Okkervil River</a>. Be sure to check <a href="http://okkervilriver.com/">their website</a> to hear some tunes, watch some movies and (<em>especially for the geeks</em>) check out their Ajax-usage <img src='http://www.bram.us/wordpress/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  And ooh, <a href="http://www.abconcerts.be/concerts/concertinfo.html?c=101776">they&#8217;ll be hitting the ABClub on December 11</a>.<br style="clear: both;" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bram.us/2007/08/28/my-musical-dotd-okkervil-river/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My DOTD : MS SQL Check for empty String</title>
		<link>http://www.bram.us/2007/07/05/my-dotd-ms-sql-check-for-empty-string/</link>
		<comments>http://www.bram.us/2007/07/05/my-dotd-ms-sql-check-for-empty-string/#comments</comments>
		<pubDate>Thu, 05 Jul 2007 11:59:27 +0000</pubDate>
		<dc:creator>Bramus!</dc:creator>
				<category><![CDATA[Another Dailie]]></category>
		<category><![CDATA[Bramus!]]></category>
		<category><![CDATA[Discovery Of The Day]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<guid isPermaLink="false">http://www.bram.us/2007/07/05/my-dotd-ms-sql-check-for-empty-string/</guid>
		<description><![CDATA[As a MySQL adept, it&#8217;s quite a change to query an MS SQL Server. Today I wanted to select all items from a table where a field wasn&#8217;t an empty string (really empty string as in &#8221;, not as in &#8230; <a href="http://www.bram.us/2007/07/05/my-dotd-ms-sql-check-for-empty-string/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img id="image872b" src="http://www.bram.us/wordpress/wp-content/uploads/2007/07/sql_server.jpg" alt="SQL Server" style="display: block; float: left; margin: 0 10px 10px 0;" />As a MySQL adept, it&#8217;s quite a change to query an MS SQL Server. Today I wanted to select all items from a table where a field wasn&#8217;t an empty string (really empty string as in &#8221;, not as in being <code>NULL</code>). Merely a <code>SELECT * FROM myTable WHERE myField != ''</code> right? <strong>Wrong!</strong><br style="clear: both;" /></p>
<p><span id="more-874"></span></p>
<p>The differences between querying a MySQL and MS SQL Server are not that hard, if you know them: There is no <a href="http://be2.php.net/manual/en/function.mysql-insert-id.php"><code>mysql_last_insert_id</code></a> alike function for MS SQL, you have to work with <a href="http://www.sqlteam.com/article/understanding-identity-columns">identity columns</a> and fire an extra query at the server to get the last inserted id; Instead of adding a <code>LIMIT 0, 10</code> to a query one has to select the <code>TOP 10</code>; etc. </p>
<p>Back to the empty string checking &#8230; in MS SQL one cannot use the <code><> ''</code> on <code>text</code>, <code>ntext</code> and <code>varchar</code> data types. Instead of selecting (in human lanugage) <em>where the value differs from an empty string</em> one has to select (again, human language) <em>where the string is like a sequence of characters</em></p>
<pre class="brush: sql; title: ; notranslate">SELECT * FROM myTable WHERE myField LIKE '_%'</pre>
<p>Yep, that&#8217;s right, the logic is a straight 180&deg; (a U-turn) that the logic used in MySQL &#8230; or am I still an MS SQL n00b and overlooking something?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bram.us/2007/07/05/my-dotd-ms-sql-check-for-empty-string/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>My DOTD : MS SQL vs. PHP : 4096 is the (default) limit</title>
		<link>http://www.bram.us/2007/07/05/my-dotd-ms-sql-vs-php-4096-is-the-default-limit/</link>
		<comments>http://www.bram.us/2007/07/05/my-dotd-ms-sql-vs-php-4096-is-the-default-limit/#comments</comments>
		<pubDate>Thu, 05 Jul 2007 08:59:57 +0000</pubDate>
		<dc:creator>Bramus!</dc:creator>
				<category><![CDATA[Another Dailie]]></category>
		<category><![CDATA[Bramus!]]></category>
		<category><![CDATA[Discovery Of The Day]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<guid isPermaLink="false">http://www.bram.us/2007/07/05/my-dotd-ms-sql-vs-php-4096-is-the-default-limit/</guid>
		<description><![CDATA[Small tip: when getting data from a MS SQL Database through PHP you&#8217;ll notice that your data gets chopped. First thought that the datatypes of the fields weren&#8217;t sufficient enough to hold the data, but the text datatype can hold &#8230; <a href="http://www.bram.us/2007/07/05/my-dotd-ms-sql-vs-php-4096-is-the-default-limit/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img id="image872" src="http://www.bram.us/wordpress/wp-content/uploads/2007/07/sql_server.jpg" alt="SQL Server" style="display: block; float: left; margin: 0 10px 10px 0;" />Small tip: when getting data from a MS SQL Database through PHP you&#8217;ll notice that your data gets chopped. First thought that the datatypes of the fields weren&#8217;t sufficient enough to hold the data, but <a href="http://msdn2.microsoft.com/en-us/library/ms187993.aspx">the <code>text</code> datatype can hold up to <code>2&circ;31 - 1</code> characters</a> and the data was stored correctly in the database &#8230;<br style="clear: both;" /></p>
<p><span id="more-871"></span></p>
<p>After a little investigation I found that the data got chopped at 4096 characters, which is a bit too familiar as it&#8217;s the outcome of <code>2&circ;12</code>. Digging a bit deeper it turns out that the problem lies within <code>php.ini</code> as it defaults to only returning 4096 characters. The settings controlling these are <code>mssql.textlimit</code> and <code>mssql.textsize</code>.</p>
<p>Since 4096 is way too little, I&#8217;ve changed it to 1048576 (which is <code>2&circ;20</code>) which should be more than enough.</p>
<pre class="brush: plain; title: ; notranslate">; Valid range 0 - 2147483647.  Default = 4096.
mssql.textlimit = 1048576
; Valid range 0 - 2147483647.  Default = 4096.
mssql.textsize = 1048576</pre>
<p>Hope this saves you some research and hassle <img src='http://www.bram.us/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bram.us/2007/07/05/my-dotd-ms-sql-vs-php-4096-is-the-default-limit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My DOTD : Duplicating/Copying rows/records with (My)SQL</title>
		<link>http://www.bram.us/2007/06/12/my-dotd-duplicatingcopying-rowsrecords-with-mysql/</link>
		<comments>http://www.bram.us/2007/06/12/my-dotd-duplicatingcopying-rowsrecords-with-mysql/#comments</comments>
		<pubDate>Tue, 12 Jun 2007 19:01:10 +0000</pubDate>
		<dc:creator>Bramus!</dc:creator>
				<category><![CDATA[Another Dailie]]></category>
		<category><![CDATA[Discovery Of The Day]]></category>
		<category><![CDATA[Elsewhere]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[link]]></category>
		<guid isPermaLink="false">http://www.bram.us/2007/06/12/my-dotd-duplicatingcopying-rowsrecords-with-mysql/</guid>
		<description><![CDATA[Ever ran into a situation where you had to copy quite a few records within the same table? Last week I ran into such a situation for a webapp I&#8217;m writing. In the webapp one can manage groups of users. &#8230; <a href="http://www.bram.us/2007/06/12/my-dotd-duplicatingcopying-rowsrecords-with-mysql/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img id="image779" src="http://www.bram.us/wordpress/wp-content/uploads/2007/06/mysql_logo.jpg" alt="MySQL Copy Records" style="display: block; float: left; margin: 0 10px 10px 0;" />Ever ran into a situation where you had to copy quite a few records within the same table? Last week I ran into such a situation for a webapp I&#8217;m writing. In the webapp one can manage groups of users. From those users one can create a selection (based on a <code>LIKE</code> search) and then perform an action on that selection: be it move, copy or delete.</p>
<p><span id="more-778"></span></p>
<h3>From action to SQL statement</h3>
<div class="BramusBlock">
<p>The moving of a heap of users can be done easily with a simple <code>UPDATE</code>-query and a delete of course with a simple <code>DELETE</code>-query. But how to copy a bunch of users?</p>
<p>One option is to select all users from the table (based on the criteria) and then (via a serverside script) either build one big <code>INSERT</code>-query with multiple values and perform that query, or perform a large amount (equal to the size of the selection) of <code>INSERT</code>-queries.</p>
<p>When thinking over that idea I immediately threw it off the table as it&#8217;s pretty intensive and I was pretty sure MySQL would support some sort of <code>COPY</code> command, to <strong>duplicate the rows in one single query</strong>.</p>
</div>
<h3>MySQL.Manual.to.the.rescue!</h3>
<div class="BramusBlock">
<p>As the <a href="http://dev.mysql.com/doc/#manual">MySQL Manual</a> helps me out quite a lot I started searching there but didn&#8217;t find anything when looking for a few simple terms such as &ldquo;<em>copy</em>&rdquo;, &ldquo;<em>duplicate</em>&rdquo;, etc.. Via Google I finally ended up on a page linking to the <a href="http://dev.mysql.com/doc/refman/5.0/en/insert-select.html"><code>INSERT ... SELECT</code> Syntax page in the online MySQL Manual</a>. The page talks about copying records from one table to an other, but one can also use that to duplicate records within the same table.</p>
</div>
<h3>Query Syntax</h3>
<div class="BramusBlock">
<p>The syntax to use this type of query is really easy as it&#8217;s a combination of 2 types of queries (hence its name <code>INSERT ... SELECT</code>):</p>
<ul>
<li>Construct your insert as you would normally do:
<pre class="brush: sql; title: ; notranslate">INSERT INTO table (column1, column2, column3) VALUES (value1, value2, value3)</pre>
</li>
<li>Replace the part starting from the values with the SELECT you would make to select the rows you want to duplicate:
<pre class="brush: sql; title: ; notranslate">INSERT INTO table (field1, field2, field3) SELECT FROM table (field1, field2, field3)</pre>
</li>
</ul>
</div>
<h3>Back to the webapp</h3>
<div class="BramusBlock">
<p>Now, in the webapp I had to copy a bunch of users (with a userid, username, useremail, groupid, etc) to a new set of records with a different userid and different groupid.</p>
<p>Leaving out the userid in both the <code>SELECT</code> and <code>INSERT</code> fixes the first issue, as the <code>AUTO_INCREMENT</code> on the userid column will automatically number them.</p>
<p>To fix the second issue a trick has to be applied: &ldquo;<em>select the new values <code>AS</code> the columname</em>&rdquo;</p>
<p>Finally I ended up with something like this:</p>
<pre class="brush: sql; title: ; notranslate">INSERT INTO users (u_id, g_id, u_name, u_email) VALUES
SELECT u_id, '6' AS g_id, u_name, u_email FROM USERS WHERE g_id = 5</pre>
<p>In laymen&#8217;s terms: <em>copy all users from the group with g_id 5 to the group with g_id 6</em></p>
</div>
<p>To come think of it: why hadn&#8217;t I discovered this functionality before? I mean, this is like one of the most basic actions one can perform next to insert, delete and update.</p>
<p>Hope you&#8217;ve learned something.</p>
<p>B!</p>
<p class="alert" style="display: none;">And yes, I know Ryan Campbell of Particletree <a href="http://particletree.com/notebook/duplicating-records-with-sql/">wrote a likewise article just today</a>, however mine was <a href="http://www.2hufters.be/archives/81">in draft for a week</a> <img src='http://www.bram.us/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bram.us/2007/06/12/my-dotd-duplicatingcopying-rowsrecords-with-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

