<?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>HAPPY RIDE</title>
	<atom:link href="http://www.dmack.ca/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dmack.ca/blog</link>
	<description>Duncan MacKenzie's blog</description>
	<lastBuildDate>Sun, 25 Mar 2012 02:55:42 +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>Batch processing with PNGOUT</title>
		<link>http://www.dmack.ca/blog/2012/03/batch-processing-with-pngout/</link>
		<comments>http://www.dmack.ca/blog/2012/03/batch-processing-with-pngout/#comments</comments>
		<pubDate>Sun, 25 Mar 2012 02:55:42 +0000</pubDate>
		<dc:creator>DMack</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[pngout]]></category>

		<guid isPermaLink="false">http://www.dmack.ca/blog/?p=259</guid>
		<description><![CDATA[This post describes how to create a Windows BAT file to batch-process entire folders with Ken Silverman&#8217;s pngout utility, but the same basic stuff is applicable to any other program or command. I use pngout a lot at work by &#8230; <a href="http://www.dmack.ca/blog/2012/03/batch-processing-with-pngout/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>This post describes how to create a Windows BAT file to batch-process entire folders with <a href="http://advsys.net/ken/utils.htm">Ken Silverman&#8217;s pngout utility</a>, but the same basic stuff is applicable to any other program or command.<br />
</em></p>
<p>I use pngout a lot at work by dragging and dropping PNG files onto a desktop shortcut to optimize the image automatically, but I often want to optimize an entire folder at once. Unfortunately, you can&#8217;t drag and drop a folder onto pngout so you need an external program to facilitate that.</p>
<p>There&#8217;s a program called pngoutwin, which is a Windows GUI for pngout that lets you process folders, but it costs money. In my experience, you can accomplish anything without spending money if you&#8217;re willing to use your brain and/or do a bit of work. Lucky for us, there&#8217;s very little work required.  With a simple batch file and a loop construct, we can save twenty bucks, and get some job-well-done satisfaction.</p>
<p>Create a batch file and put in this single line of code:<br />
<code>for %%p in ("%~1\*.png") do "C:\path\to\pngout.exe" "%%p"</code></p>
<p>Add a <code>pause</code> on the next line to make testing easier. You can place this file (or a shortcut) anywhere, and drag/drop folders onto it to optimize all of the pngs inside with pngout.</p>
<p>This script is a simple &#8220;for&#8221; loop: for every png file in the folder, do pngout. <code>%%p</code> is the PNG file in this case (two percent signs because it&#8217;s in a bat file, you&#8217;d only use one on the command line). <code>%~1</code> is the first (and only) parameter you passed the script, in this case it&#8217;s the path to a folder with PNGs inside.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmack.ca/blog/2012/03/batch-processing-with-pngout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to disable the built-in inspector in Firefox 10</title>
		<link>http://www.dmack.ca/blog/2012/02/how-to-disable-the-built-in-inspector-in-firefox-10/</link>
		<comments>http://www.dmack.ca/blog/2012/02/how-to-disable-the-built-in-inspector-in-firefox-10/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 06:04:28 +0000</pubDate>
		<dc:creator>DMack</dc:creator>
				<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.dmack.ca/blog/?p=252</guid>
		<description><![CDATA[The newer versions of Firefox have a built in DOM element inspector. If you care about this, chances are you&#8217;ve already got Firebug installed. The built-in &#8220;Inspect Element (Q)&#8221; functionality looks slick, but it lacks almost all of the features &#8230; <a href="http://www.dmack.ca/blog/2012/02/how-to-disable-the-built-in-inspector-in-firefox-10/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The newer versions of Firefox have a built in DOM element inspector. If you care about this, chances are you&#8217;ve already got Firebug installed. <img class="alignright size-full wp-image-255" title="Two inspector options in Firefox's context menu" src="http://www.dmack.ca/blog/wp-content/uploads/2012/02/double-inspector-options.png" alt="Two inspector options in Firefox's context menu" width="258" height="83" />The built-in &#8220;Inspect Element (Q)&#8221; functionality looks slick, but it lacks almost all of the features found in Firebug. If you don&#8217;t want to use it, or you just don&#8217;t want the option showing up in the context menu when you right click, you can disable the inspector in Firefox.</p>
<p>Disabling it is easy:</p>
<ol>
<li>Go to about:config</li>
<li>Search for &#8220;inspector&#8221; to locate the preference key <strong>devtools.inspector.enabled</strong></li>
<li>double click to change the value to &#8220;false&#8221;</li>
</ol>
<p>It&#8217;s as simple as that. Disabling that option will hide Firefox&#8217;s native inspector from your context menus.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmack.ca/blog/2012/02/how-to-disable-the-built-in-inspector-in-firefox-10/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[How to] disable the Windows Boot Manager after installing Vista</title>
		<link>http://www.dmack.ca/blog/2008/12/how-to-disable-the-windows-boot-manager-after-installing-vista/</link>
		<comments>http://www.dmack.ca/blog/2008/12/how-to-disable-the-windows-boot-manager-after-installing-vista/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 22:19:49 +0000</pubDate>
		<dc:creator>DMack</dc:creator>
				<category><![CDATA[how to]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.dmack.ca/blog/?p=128</guid>
		<description><![CDATA[I recently upgraded my mom&#8217;s PC from XP to Vista. As far as I can tell, the Vista installer copies your old XP files into a folder called Windows.old, and you can&#8217;t boot into XP once Vista is installed in &#8230; <a href="http://www.dmack.ca/blog/2008/12/how-to-disable-the-windows-boot-manager-after-installing-vista/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded my mom&#8217;s PC from XP to Vista. As far as I can tell, the Vista installer copies your old XP files into a folder called Windows.old, and you can&#8217;t boot into XP once Vista is installed in that partition&#8230; but for some reason, every time I&#8217;ve installed Windows Vista the computer boots into a &#8220;Windows Boot Manager&#8221; where you can pick whether to boot into your Vista installation or an &#8220;Earlier version of Windows&#8221;. This screen comes up even if you got rid of your &#8220;earlier version&#8221;.</p>
<p>By default, there&#8217;s a 30-second countdown before it boots into your default (Vista) installation. Naturally, we want to skip this menu entirely and boot straight into Vista. Here&#8217;s how to disable the Windows Boot Manager and boot straight into Vista:</p>
<ul>
<li><strong>Don&#8217;t</strong> try to change anything in msconfig, it only lets you reduce the countdown to a minimum of 3 seconds.</li>
<li>This setting can be changed easily from within Vista, so <strong>don&#8217;t</strong> download any programs, especially those that cost six dollars.</li>
</ul>
<ol>
<li>Bring up the &#8220;<strong>System</strong>&#8221; information window by pressing <strong>Windows Key + Pause/Break</strong> (or: Control Panel -&gt; System, or right click My Computer -&gt; Properties).</li>
<li>In the left sidebar, click <strong>Advanced system settings</strong> to bring up the <strong>System Properties</strong> window.</li>
<li>In the <strong>Advanced</strong> tab, under <strong>Startup and Recovery</strong>, click the <strong>Settings&#8230;</strong> button.</li>
<li><strong>Uncheck </strong>the box next to &#8220;Time to display list of operating systems:&#8221;, and make sure Vista is selected as your <strong>Default Operating System</strong>.</li>
</ol>
<p>The next time your system boots, it will boot Vista instantly instead of showing the boot manager.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmack.ca/blog/2008/12/how-to-disable-the-windows-boot-manager-after-installing-vista/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>[How to] round corners on images with JavaScript</title>
		<link>http://www.dmack.ca/blog/2008/04/how-to-round-corners-on-images-with-javascript/</link>
		<comments>http://www.dmack.ca/blog/2008/04/how-to-round-corners-on-images-with-javascript/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 05:42:00 +0000</pubDate>
		<dc:creator>DMack</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.dmack.ca/blog/2008/04/how-to-round-images-on-corners-with-javascript/</guid>
		<description><![CDATA[Something I&#8217;ve come to love about the JQuery JavaScript library is that, no matter what client-side scripting challenges arise these days, my first thought is &#8220;I bet there&#8217;s an easy way to do this with JQuery!&#8221;. I recently worked on &#8230; <a href="http://www.dmack.ca/blog/2008/04/how-to-round-corners-on-images-with-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Something I&#8217;ve come to love about the <a href="http://jquery.com/">JQuery</a> JavaScript library is that, no matter what client-side scripting challenges arise these days, my first thought is &#8220;I bet there&#8217;s an easy way to do this with JQuery!&#8221;.  I recently worked on a website where the client wanted rounded corners on a lot of the site&#8217;s elements, including images.  A quick Google search found this <a href="http://www.methvin.com/jquery/jq-corner-demo.html"><span style="font-weight: bold;">jquery.corner</span></a> plugin; which was, as most JQuery plugins are, extremely simple to implement and adapt for my own project.</p>
<p>The corner plugin has a bunch of ways to add corner effects to div elements, but unfortunately you can&#8217;t apply it directly to an image.  Back to Google, I found <a href="http://www.malsup.com/jquery/corner/image.html">a way to make it work with images</a>: wrap it in a div and apply the corner code to the div element. This is good, but not best for our purposes. We still have to apply styles to make the divs match the size of their child image elements.</p>
<p>Objective:<br />
To loop through all divs of a certain class, and automatically resize them to match their child image elements.</p>
<p>We&#8217;ll put this code inside our $(document).ready(function(){ &#8230; }) block so it runs as soon as the document is ready to run code.</p>
<p>We want to apply this code to all divs of a certain class, we&#8217;ll say class=&#8221;round-corners&#8221; in this example. To loop through every div of this class and run code on it, we use the wonderful JQuery.each function.</p>
<p>First, select images with a parent div element of this class (&#8220;round-corners&#8221;):<br />
$(&#8216;div.round-corners &gt; img&#8217;)<br />
and run the JQuery.each function to loop through:<br />
$(&#8216;div.round-corners &gt; img&#8217;).each(function(id){ &#8230; })</p>
<p>Within this loop we want to select the image, and set the height and width of its parent div element. An easy way to do this is with the .height and .width functions.  These functions are both accessors and modifiers, as is the case with many functions in JQuery.<br />
Select the parent element of the selected image:<br />
$(this).parent(&#8216;div.round-corners&#8217;)<br />
get the height of the image we&#8217;ve selected:<br />
$(this).height()<br />
so the whole line to set the height will look like this:<br />
$(this).parent(&#8216;div.round-corners&#8217;).height( $(this).height() );<br />
Repeat for the width property with the .width function.</p>
<p>That should do it. Let&#8217;s take a look at the source for the whole page:</p>
<pre>&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;&lt;script type="text/javascript" src="jquery.corner.js"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;$(document).ready(function(){ $('div.round-corners &gt; img').each(function(id){     $(this).parent('div.round-corners').height( $(this).height() ).width( $(this).width() ); })$('.round-corners').corner();})&lt;/script&gt;&lt;div class="round-corners"&gt;&lt;img src="P3040004.JPG" alt="P3040004.JPG" /&gt;&lt;/div&gt;

&lt;div style="height: 130px; background-color: rgb(255, 0, 0);" class="round-corners"&gt;This is just a regular div with no image inside, but it will have round corners too!&lt;/div&gt;

&lt;div class="round-corners"&gt;&lt;img src="bluehills.jpg" alt="bluehills.jpg" /&gt;&lt;/div&gt;</pre>
<p>An idea for improving this script would be to use the <a href="http://docs.jquery.com/Manipulation/wrap">.wrap function</a> to automatically wrap the images in divs</p>
<p>Have fun rounding corners, and please use them responsibly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmack.ca/blog/2008/04/how-to-round-corners-on-images-with-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>I finally found a &#8216;linkify&#8217; bookmarklet!</title>
		<link>http://www.dmack.ca/blog/2007/04/i-finally-found-a-linkify-bookmarklet/</link>
		<comments>http://www.dmack.ca/blog/2007/04/i-finally-found-a-linkify-bookmarklet/#comments</comments>
		<pubDate>Tue, 24 Apr 2007 03:08:00 +0000</pubDate>
		<dc:creator>DMack</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.dmack.ca/blog/2007/04/i-finally-found-a-linkify-bookmarklet/</guid>
		<description><![CDATA[Updated Dec. 2008, Looks like moving from Blogger to WordPress broke this post quite a bit I&#8217;ve been looking for a bookmarklet that would turn plain-text URLs into clickable links for a while, because it got tedious opening big blocks &#8230; <a href="http://www.dmack.ca/blog/2007/04/i-finally-found-a-linkify-bookmarklet/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>Updated Dec. 2008, Looks like moving from Blogger to WordPress broke this post quite a bit <img src='http://www.dmack.ca/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
<p>I&#8217;ve been looking for a bookmarklet that would turn plain-text URLs into clickable links for a while, because it got tedious opening big blocks of plain-text links in Google Reader or in torrent trackers.  I had it on my to-do list to write one, but I happened upon one that had already been written at squarefree.com&#8217;s <a href="http://www.squarefree.com/bookmarklets/">bookmarklets site</a>. ..I just wouldn&#8217;t have guessed the name.</p>
<p>To make this worthwhile, here are my 3 favorite bookmarklets:</p>
<ol>
<li><a href="javascript:(function(){var D=document; D.body.normalize(); F(D.body); function F(n){var u,A,M,R,c,x; if(n.nodeType==3){ u=n.data.search(/https?\:\/\/[^\s]*[^.,;'&quot;&gt;\s\)\]]/); if(u&gt;=0) { M=n.splitText(u); R=M.splitText(RegExp.lastMatch.length); A=document.createElement(&quot;A&quot;); A.href=M.data; A.appendChild(M); R.parentNode.insertBefore(A,R); } }else if(n.tagName!=&quot;STYLE&quot; &amp;&amp; n.tagName!=&quot;SCRIPT&quot; &amp;&amp; n.tagName!=&quot;A&quot;)for(c=0;x=n.childNodes[c];++c)F(x); } })();">Linkify</a> &#8211; Turns plain text URLs into clickable links. Try it out here if you want: http://www.dmack.ca</li>
<li><a href="javascript:(function(){var newSS, styles=':visited {display: none}'; if(document.createStyleSheet) { document.createStyleSheet(&quot;javascript:'&quot;+styles+&quot;'&quot;); } else { newSS=document.createElement('link'); newSS.rel='stylesheet'; newSS.href='data:text/css,'+escape(styles); document.getElementsByTagName(&quot;head&quot;)[0].appendChild(newSS); } })();">Hide visited links</a> &#8211; makes visited links invisible (in real time, even). Try them on the above url once you make it a link.</li>
<li><a href="javascript:(function(){var k,x,t,i,j,p; for(k=0;x=document.links[k];k++){t=x.href.replace(/[%]3A/ig,':').replace(/[%]2f/ig,'/');i=t.lastIndexOf('http');if(i&gt;0){ t=t.substring(i); j=t.indexOf('&amp;'); if(j&gt;0)t=t.substring(0,j); p=/https?\:\/\/[^\s]*[^.,;'&quot;&gt;\s\)\]]/.exec(unescape(t)); if(p) x.href=p[0]; } else if (x.onmouseover&amp;&amp;x.onmouseout){x.onmouseover(); if (window.status &amp;&amp; window.status.indexOf('://')!=-1)x.href=window.status; x.onmouseout(); } x.onmouseover=null; x.onmouseout=null; }})();">Remove redirects</a> &#8211; a good way to get around a lot of interstitial ads. Removes redirect scripts from urls in this format: <a href="http://www.example.com/out.php?url=http://www.example.org/">http://www.example.com/out.php?url=http://www.example.org/</a></li>
</ol>
<p>Post your favorite bookmarklets in the comments section!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmack.ca/blog/2007/04/i-finally-found-a-linkify-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

