<?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>jclement.ca</title>
	<atom:link href="http://jclement.ca/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://jclement.ca/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 09 Aug 2010 22:29:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Sandpaper Organizer</title>
		<link>http://jclement.ca/blog/2010/08/07/sand-paper-organizer/</link>
		<comments>http://jclement.ca/blog/2010/08/07/sand-paper-organizer/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 03:55:48 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Woodworking]]></category>

		<guid isPermaLink="false">http://jclement.ca/blog/?p=867</guid>
		<description><![CDATA[My solution for storing sandpaper for my various sanders.]]></description>
			<content:encoded><![CDATA[<p>My solution for storing sandpaper for my various sanders.</p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/08/IMG_8449-2010-08-07-at-21-24-46.jpg"><img src="http://jclement.ca/blog/wp-content/uploads/2010/08/IMG_8449-2010-08-07-at-21-24-46-1024x682.jpg" alt="" title="IMG_8449 - 2010-08-07 at 21-24-46" width="1024" height="682" class="aligncenter size-large wp-image-868" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jclement.ca/blog/2010/08/07/sand-paper-organizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic Garage Door Closer</title>
		<link>http://jclement.ca/blog/2010/08/07/automatic-garage-door-closer/</link>
		<comments>http://jclement.ca/blog/2010/08/07/automatic-garage-door-closer/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 03:54:18 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jclement.ca/blog/?p=857</guid>
		<description><![CDATA[Inspired by something that Kyle told me about seeing on the Internet and constantly fearful I&#8217;ve left the house with the garage door open I made an automatic door closer this evening. I walked into Active Electronics with a schematic more or less like this. They must have thought I was an idiot but they [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by something that Kyle told me about seeing on the Internet and constantly fearful I&#8217;ve left the house with the garage door open I made an automatic door closer this evening.</p>
<p>I walked into Active Electronics with a schematic more or less like this. They must have thought I was an idiot but they helped me pick out the right relay non-the-less.</p>
<p>The basic idea is to piggy back off the garage opener light. When the garage opener opens the door it turns on the light for about 5 minutes. I just hook into that and try and close the door when the light goes out.</p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/08/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://jclement.ca/blog/wp-content/uploads/2010/08/image_thumb.png" width="327" height="490" /></a> </p>
<p>The hardest part was the door switch. I only want my circuit to work when the door is up. I don&#8217;t want to have it open up the door when closed by accident. I&#8217;m still not particularly happy with what I created here but it seems to work. I made to coat hanger probes that bump into a metal peace on the door when the door is up all the way. When the door goes down the circuit is open.</p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/08/IMG_8442-2010-08-07-at-21-24-01.jpg"><img class="alignleft size-medium wp-image-860" title="IMG_8442 - 2010-08-07 at 21-24-01" alt="" src="http://jclement.ca/blog/wp-content/uploads/2010/08/IMG_8442-2010-08-07-at-21-24-01-300x200.jpg" width="300" height="200" /></a></p>
<p>Here is the inside of the opener. I just tucked the relay inside and hooked with wires into the outlet for the lightbulb.</p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/08/IMG_8450-2010-08-07-at-21-25-34.jpg"><img class="alignleft size-medium wp-image-861" title="IMG_8450 - 2010-08-07 at 21-25-34" alt="" src="http://jclement.ca/blog/wp-content/uploads/2010/08/IMG_8450-2010-08-07-at-21-25-34-300x200.jpg" width="300" height="200" /></a></p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/08/IMG_8443-2010-08-07-at-21-24-17.jpg"><img class="alignleft size-medium wp-image-862" title="IMG_8443 - 2010-08-07 at 21-24-17" alt="" src="http://jclement.ca/blog/wp-content/uploads/2010/08/IMG_8443-2010-08-07-at-21-24-17-300x200.jpg" width="300" height="200" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jclement.ca/blog/2010/08/07/automatic-garage-door-closer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Trouble with Tabs</title>
		<link>http://jclement.ca/blog/2010/07/15/the-trouble-with-tabs/</link>
		<comments>http://jclement.ca/blog/2010/07/15/the-trouble-with-tabs/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 14:54:00 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jclement.ca/blog/2010/07/15/the-trouble-with-tabs/</guid>
		<description><![CDATA[It seems that by the end of the day I end up with more tabs than are useful in Chrome.]]></description>
			<content:encoded><![CDATA[<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/07/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://jclement.ca/blog/wp-content/uploads/2010/07/image_thumb.png" width="774" height="70" /></a> </p>
<p>It seems that by the end of the day I end up with more tabs than are useful in Chrome.</p>
]]></content:encoded>
			<wfw:commentRss>http://jclement.ca/blog/2010/07/15/the-trouble-with-tabs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Anaglyphs</title>
		<link>http://jclement.ca/blog/2010/05/25/creating-anaglyphs/</link>
		<comments>http://jclement.ca/blog/2010/05/25/creating-anaglyphs/#comments</comments>
		<pubDate>Tue, 25 May 2010 14:41:35 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://jclement.ca/blog/2010/05/25/creating-anaglyphs/</guid>
		<description><![CDATA[For an upcoming meeting I bought 20 pairs of red-cyan 3D glasses from Deal Extreme (these ones here).&#160; I figured since 3D is the big thing in the theatres it should be in our sprint reviews too. There is an excellent free application called Anaglyph Maker that can combine two images into a single red-cyan [...]]]></description>
			<content:encoded><![CDATA[<p>For an upcoming meeting I bought 20 pairs of red-cyan 3D glasses from Deal Extreme (<a href="http://www.dealextreme.com/details.dx/sku.23113">these ones here</a>).&#160; I figured since 3D is the big thing in the theatres it should be in our sprint reviews too.</p>
<p>There is an excellent free application called <a href="http://www.stereoeye.jp/software/index_e.html">Anaglyph Maker</a> that can combine two images into a single red-cyan 3D anaglyph.&#160; Hand holding the camera and moving it over about 4” between shots ended up with a surprisingly descent 3D image.</p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/05/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://jclement.ca/blog/wp-content/uploads/2010/05/image_thumb1.png" width="523" height="362" /></a></p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/05/P1010775.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="P1010775" border="0" alt="P1010775" src="http://jclement.ca/blog/wp-content/uploads/2010/05/P1010775_thumb.jpg" width="244" height="184" /></a> <a href="http://jclement.ca/blog/wp-content/uploads/2010/05/P1010774.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="P1010774" border="0" alt="P1010774" src="http://jclement.ca/blog/wp-content/uploads/2010/05/P1010774_thumb.jpg" width="244" height="184" /></a><a href="http://jclement.ca/blog/wp-content/uploads/2010/05/mika3d.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="mika3d" border="0" alt="mika3d" src="http://jclement.ca/blog/wp-content/uploads/2010/05/mika3d_thumb.jpg" width="254" height="183" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jclement.ca/blog/2010/05/25/creating-anaglyphs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nike+ Website&#8230; Grumble&#8230;</title>
		<link>http://jclement.ca/blog/2010/05/12/nike-website-grumble/</link>
		<comments>http://jclement.ca/blog/2010/05/12/nike-website-grumble/#comments</comments>
		<pubDate>Wed, 12 May 2010 16:27:16 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Running]]></category>

		<guid isPermaLink="false">http://jclement.ca/blog/2010/05/12/nike-website-grumble/</guid>
		<description><![CDATA[I started running as an excuse to play with the nifty Nike+ stuff built into my iPod.&#160; It turns out I really quite like the running.&#160; It also turns out that every time I look at the Nike+ website I’m offended by how bad it is.&#160; It’s completely flash based and effectively prevents me from [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/05/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://jclement.ca/blog/wp-content/uploads/2010/05/image_thumb.png" width="602" height="251" /></a></p>
<p>I started running as an excuse to play with the nifty Nike+ stuff built into my iPod.&#160; It turns out I really quite like the running.&#160; It also turns out that every time I look at the Nike+ website I’m offended by how bad it is.&#160; </p>
<p>It’s completely flash based and effectively prevents me from getting at any of my raw data.&#160; That annoys me but if the site itself was good that wouldn’t really be a big deal.</p>
<p>The problem is that the site does a horrendous job of representing data.&#160; The above graph is typical.&#160; Here we can see that I started off slow, got faster, got slower, got faster, etc.&#160; How fast?&#160; How slow?&#160; Well you aren’t going to find out because apparently the good people at Nike didn’t pay attention in science class where you were told how to create graphs with correctly labeled axis.&#160; Distance is a little better because you can&#160; hold your mouse over the somewhat arbitrary white circles and it will give the distance of that circle.</p>
<p>It’s such a neat gadget and has the potential to be so cool.&#160; It’s a shame they produced such a lack luster front-end for it..</p>
]]></content:encoded>
			<wfw:commentRss>http://jclement.ca/blog/2010/05/12/nike-website-grumble/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chrome Tab Pinning</title>
		<link>http://jclement.ca/blog/2010/04/21/chrome-tab-pinning/</link>
		<comments>http://jclement.ca/blog/2010/04/21/chrome-tab-pinning/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 16:25:27 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://jclement.ca/blog/2010/04/21/chrome-tab-pinning/</guid>
		<description><![CDATA[I’m a little late switching over but I’m really starting to like Chrome.&#160; It’s just so fast! I generally leave a browser open for days on end with a number of sites (gmail, google cal, facebook, etc) open all the time.&#160; These make for a very busy tab strip. Today I was thrilled to find [...]]]></description>
			<content:encoded><![CDATA[<p>I’m a little late switching over but I’m really starting to like Chrome.&#160; It’s just so fast!</p>
<p>I generally leave a browser open for days on end with a number of sites (gmail, google cal, facebook, etc) open all the time.&#160; These make for a very busy tab strip. </p>
<p>Today I was thrilled to find that if you right-click on a tab you can pin it so that it moves over the the left and shrinks to just the favicon. </p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/04/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://jclement.ca/blog/wp-content/uploads/2010/04/image_thumb4.png" width="478" height="96" /></a> </p>
<p>I wish there were a nice way to persist my pinned tabs but I’ll take it.</p>
]]></content:encoded>
			<wfw:commentRss>http://jclement.ca/blog/2010/04/21/chrome-tab-pinning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cheap and Easy Attaching Nike +</title>
		<link>http://jclement.ca/blog/2010/04/11/cheap-and-easy-attaching-nike/</link>
		<comments>http://jclement.ca/blog/2010/04/11/cheap-and-easy-attaching-nike/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 16:24:54 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Running]]></category>

		<guid isPermaLink="false">http://jclement.ca/blog/?p=824</guid>
		<description><![CDATA[I decided to start running (for strictly technical reasons). It turns out my iPod touch has built in support for the Nike+ wireless pedometer thingy. The results from that, in turn, get sync&#8217;d with the Nike+ website where you can watch progress over time. This sounded geeky enough I figured I needed to try it. [...]]]></description>
			<content:encoded><![CDATA[<table border=0>
<tr>
<td valign=top>
<a href="http://jclement.ca/blog/wp-content/uploads/2010/04/IMG_3682.jpg"><img src="http://jclement.ca/blog/wp-content/uploads/2010/04/IMG_3682-300x225.jpg" alt="" title="IMG_3682" width="300" height="225" class="aligncenter size-medium wp-image-830" /></a></p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/04/IMG_3680.jpg"><img src="http://jclement.ca/blog/wp-content/uploads/2010/04/IMG_3680-300x225.jpg" alt="" title="IMG_3680" width="300" height="225" class="aligncenter size-medium wp-image-832" /></a>
</td>
<td valign="top">
I decided to start running (for strictly technical reasons).  It turns out my iPod touch has built in support for the Nike+ wireless pedometer thingy.  The results from that, in turn, get sync&#8217;d with the Nike+ website where you can watch progress over time.  This sounded geeky enough I figured I needed to try it.  </p>
<p>However, since I don&#8217;t really &#8220;run&#8221; my shoes were Walmart&#8217;s cheapest and didn&#8217;t have the fancy receptacle for storing the Nike+ sensor.  Running stores offer a little pouch thing for $10 that would attach the sensor to the laces but it&#8217;s large, ugly and expensive.  </p>
<p>So I settled on using Velcro.</p>
<p>I attached a small piece of Velcro to the top of my shoe and the mating piece to the bottom of the sensor.  This arrangement keeps the sensor roughly flat on the shoe (which is the orientation it&#8217;s intended for).</p>
<p>The Velco I used is adhesive backed and seems to be holding on to the shoe fine (for now) and the Velcro itself has more than enough holding power to keep the lightweight Nike+ sensor in place for a road run. This obviously won&#8217;t be appropriate for trail running where something could actually snag on the sensor.
</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jclement.ca/blog/2010/04/11/cheap-and-easy-attaching-nike/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Key Lock Box Problem</title>
		<link>http://jclement.ca/blog/2010/04/07/817/</link>
		<comments>http://jclement.ca/blog/2010/04/07/817/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 16:49:41 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jclement.ca/blog/?p=817</guid>
		<description><![CDATA[The Daily WTF posted this neat Key Lock Box problem. This was actually the first time I had ever seen a key lock box. Essentially, they&#8217;re small steel boxes that contain a key and are often affixed near a keyhole (eg., the door handle). Some feature a set of dials that must be aligned with [...]]]></description>
			<content:encoded><![CDATA[<p>The<a href="http://thedailywtf.com/"> Daily WTF</a> posted this neat <a href="http://thedailywtf.com/Articles/The-Key-Lock-Box.aspx">Key Lock Box problem</a>.</p>
<blockquote><p>
This was actually the first time I had ever seen a key lock box. Essentially, they&#8217;re small steel boxes that contain a key and are often affixed near a keyhole (eg., the door handle). Some feature a set of dials that must be aligned with the right code, while others (such as the one pictured) use a pushbutton system to enter the combination.</p>
<p>Being that they&#8217;re such low-tech contraptions, the pushbutton key lock boxes don&#8217;t quite work like you might expect. For example, one popular brand will unlock if the four-digit code is entered in sequence, regardless of what or how many digits preceded it. That is, if the code is 2-3-4-5, pressing 1-2-3-4-5 will open the box. Taking it a step further, the sequence 4-8-2-9-5-1-4-5 would cover the codes 4-8-2-9 8-2-9-5 9-5-1-4 and 5-1-4-5.</p>
<p>Your exercise for the day: write a function that outputs a sequence numbers which cover all combinations within the sequence.</p>
<p>Input: two variables: an integer that represents the combination code length, and the number of buttons on Output: The output should be a valid sequence that covers all combinations
</p></blockquote>
<p>My solution is the 10,124 character long string:</p>
<blockquote><p>000000010002000300040005000600070008000900110012001300140015<br />
001600170018001900210022002300240025002600270028002900310032<br />
003300340035003600370038003900410042004300440045004600470048<br />
004900510052005300540055005600570058005900610062006300640065<br />
006600670068006900710072007300740075007600770078007900810082<br />
008300840085008600870088008900910092009300940095009600970098<br />
009901010102010301040105010601070108010901110112011301140115<br />
011601170118011901210122012301240125012601270128012901310132<br />
013301340135013601370138013901410142014301440145014601470148<br />
014901510152015301540155015601570158015901610162016301640165<br />
016601670168016901710172017301740175017601770178017901810182<br />
018301840185018601870188018901910192019301940195019601970198<br />
019902020203020402050206020702080209021102120213021402150216<br />
021702180219022102220223022402250226022702280229023102320233<br />
023402350236023702380239024102420243024402450246024702480249<br />
025102520253025402550256025702580259026102620263026402650266<br />
026702680269027102720273027402750276027702780279028102820283<br />
028402850286028702880289029102920293029402950296029702980299<br />
030303040305030603070308030903110312031303140315031603170318<br />
031903210322032303240325032603270328032903310332033303340335<br />
033603370338033903410342034303440345034603470348034903510352<br />
035303540355035603570358035903610362036303640365036603670368<br />
036903710372037303740375037603770378037903810382038303840385<br />
038603870388038903910392039303940395039603970398039904040405<br />
040604070408040904110412041304140415041604170418041904210422<br />
042304240425042604270428042904310432043304340435043604370438<br />
043904410442044304440445044604470448044904510452045304540455<br />
045604570458045904610462046304640465046604670468046904710472<br />
047304740475047604770478047904810482048304840485048604870488<br />
048904910492049304940495049604970498049905050506050705080509<br />
051105120513051405150516051705180519052105220523052405250526<br />
052705280529053105320533053405350536053705380539054105420543<br />
054405450546054705480549055105520553055405550556055705580559<br />
056105620563056405650566056705680569057105720573057405750576<br />
057705780579058105820583058405850586058705880589059105920593<br />
059405950596059705980599060606070608060906110612061306140615<br />
061606170618061906210622062306240625062606270628062906310632<br />
063306340635063606370638063906410642064306440645064606470648<br />
064906510652065306540655065606570658065906610662066306640665<br />
066606670668066906710672067306740675067606770678067906810682<br />
068306840685068606870688068906910692069306940695069606970698<br />
069907070708070907110712071307140715071607170718071907210722<br />
072307240725072607270728072907310732073307340735073607370738<br />
073907410742074307440745074607470748074907510752075307540755<br />
075607570758075907610762076307640765076607670768076907710772<br />
077307740775077607770778077907810782078307840785078607870788<br />
078907910792079307940795079607970798079908080809081108120813<br />
081408150816081708180819082108220823082408250826082708280829<br />
083108320833083408350836083708380839084108420843084408450846<br />
084708480849085108520853085408550856085708580859086108620863<br />
086408650866086708680869087108720873087408750876087708780879<br />
088108820883088408850886088708880889089108920893089408950896<br />
089708980899090909110912091309140915091609170918091909210922<br />
092309240925092609270928092909310932093309340935093609370938<br />
093909410942094309440945094609470948094909510952095309540955<br />
095609570958095909610962096309640965096609670968096909710972<br />
097309740975097609770978097909810982098309840985098609870988<br />
098909910992099309940995099609970998099911111112111311141115<br />
111611171118111911221123112411251126112711281129113211331134<br />
113511361137113811391142114311441145114611471148114911521153<br />
115411551156115711581159116211631164116511661167116811691172<br />
117311741175117611771178117911821183118411851186118711881189<br />
119211931194119511961197119811991212121312141215121612171218<br />
121912221223122412251226122712281229123212331234123512361237<br />
123812391242124312441245124612471248124912521253125412551256<br />
125712581259126212631264126512661267126812691272127312741275<br />
127612771278127912821283128412851286128712881289129212931294<br />
129512961297129812991313131413151316131713181319132213231324<br />
132513261327132813291332133313341335133613371338133913421343<br />
134413451346134713481349135213531354135513561357135813591362<br />
136313641365136613671368136913721373137413751376137713781379<br />
138213831384138513861387138813891392139313941395139613971398<br />
139914141415141614171418141914221423142414251426142714281429<br />
143214331434143514361437143814391442144314441445144614471448<br />
144914521453145414551456145714581459146214631464146514661467<br />
146814691472147314741475147614771478147914821483148414851486<br />
148714881489149214931494149514961497149814991515151615171518<br />
151915221523152415251526152715281529153215331534153515361537<br />
153815391542154315441545154615471548154915521553155415551556<br />
155715581559156215631564156515661567156815691572157315741575<br />
157615771578157915821583158415851586158715881589159215931594<br />
159515961597159815991616161716181619162216231624162516261627<br />
162816291632163316341635163616371638163916421643164416451646<br />
164716481649165216531654165516561657165816591662166316641665<br />
166616671668166916721673167416751676167716781679168216831684<br />
168516861687168816891692169316941695169616971698169917171718<br />
171917221723172417251726172717281729173217331734173517361737<br />
173817391742174317441745174617471748174917521753175417551756<br />
175717581759176217631764176517661767176817691772177317741775<br />
177617771778177917821783178417851786178717881789179217931794<br />
179517961797179817991818181918221823182418251826182718281829<br />
183218331834183518361837183818391842184318441845184618471848<br />
184918521853185418551856185718581859186218631864186518661867<br />
186818691872187318741875187618771878187918821883188418851886<br />
188718881889189218931894189518961897189818991919192219231924<br />
192519261927192819291932193319341935193619371938193919421943<br />
194419451946194719481949195219531954195519561957195819591962<br />
196319641965196619671968196919721973197419751976197719781979<br />
198219831984198519861987198819891992199319941995199619971998<br />
199922222223222422252226222722282229223322342235223622372238<br />
223922432244224522462247224822492253225422552256225722582259<br />
226322642265226622672268226922732274227522762277227822792283<br />
228422852286228722882289229322942295229622972298229923232324<br />
232523262327232823292333233423352336233723382339234323442345<br />
234623472348234923532354235523562357235823592363236423652366<br />
236723682369237323742375237623772378237923832384238523862387<br />
238823892393239423952396239723982399242424252426242724282429<br />
243324342435243624372438243924432444244524462447244824492453<br />
245424552456245724582459246324642465246624672468246924732474<br />
247524762477247824792483248424852486248724882489249324942495<br />
249624972498249925252526252725282529253325342535253625372538<br />
253925432544254525462547254825492553255425552556255725582559<br />
256325642565256625672568256925732574257525762577257825792583<br />
258425852586258725882589259325942595259625972598259926262627<br />
262826292633263426352636263726382639264326442645264626472648<br />
264926532654265526562657265826592663266426652666266726682669<br />
267326742675267626772678267926832684268526862687268826892693<br />
269426952696269726982699272727282729273327342735273627372738<br />
273927432744274527462747274827492753275427552756275727582759<br />
276327642765276627672768276927732774277527762777277827792783<br />
278427852786278727882789279327942795279627972798279928282829<br />
283328342835283628372838283928432844284528462847284828492853<br />
285428552856285728582859286328642865286628672868286928732874<br />
287528762877287828792883288428852886288728882889289328942895<br />
289628972898289929292933293429352936293729382939294329442945<br />
294629472948294929532954295529562957295829592963296429652966<br />
296729682969297329742975297629772978297929832984298529862987<br />
298829892993299429952996299729982999333333343335333633373338<br />
333933443345334633473348334933543355335633573358335933643365<br />
336633673368336933743375337633773378337933843385338633873388<br />
338933943395339633973398339934343435343634373438343934443445<br />
344634473448344934543455345634573458345934643465346634673468<br />
346934743475347634773478347934843485348634873488348934943495<br />
349634973498349935353536353735383539354435453546354735483549<br />
355435553556355735583559356435653566356735683569357435753576<br />
357735783579358435853586358735883589359435953596359735983599<br />
363636373638363936443645364636473648364936543655365636573658<br />
365936643665366636673668366936743675367636773678367936843685<br />
368636873688368936943695369636973698369937373738373937443745<br />
374637473748374937543755375637573758375937643765376637673768<br />
376937743775377637773778377937843785378637873788378937943795<br />
379637973798379938383839384438453846384738483849385438553856<br />
385738583859386438653866386738683869387438753876387738783879<br />
388438853886388738883889389438953896389738983899393939443945<br />
394639473948394939543955395639573958395939643965396639673968<br />
396939743975397639773978397939843985398639873988398939943995<br />
399639973998399944444445444644474448444944554456445744584459<br />
446544664467446844694475447644774478447944854486448744884489<br />
449544964497449844994545454645474548454945554556455745584559<br />
456545664567456845694575457645774578457945854586458745884589<br />
459545964597459845994646464746484649465546564657465846594665<br />
466646674668466946754676467746784679468546864687468846894695<br />
469646974698469947474748474947554756475747584759476547664767<br />
476847694775477647774778477947854786478747884789479547964797<br />
479847994848484948554856485748584859486548664867486848694875<br />
487648774878487948854886488748884889489548964897489848994949<br />
495549564957495849594965496649674968496949754976497749784979<br />
498549864987498849894995499649974998499955555556555755585559<br />
556655675568556955765577557855795586558755885589559655975598<br />
559956565657565856595666566756685669567656775678567956865687<br />
568856895696569756985699575757585759576657675768576957765777<br />
577857795786578757885789579657975798579958585859586658675868<br />
586958765877587858795886588758885889589658975898589959595966<br />
596759685969597659775978597959865987598859895996599759985999<br />
666666676668666966776678667966876688668966976698669967676768<br />
676967776778677967876788678967976798679968686869687768786879<br />
688768886889689768986899696969776978697969876988698969976998<br />
699977777778777977887789779877997878787978887889789878997979<br />
79887989799879998888888988988899898989999000</p></blockquote>
<p>I have the codes in 8889 and 9888 in there twice so it&#8217;s a tad longer than it needs to be.  I think the optimal solution is the <a href="http://en.wikipedia.org/wiki/De_Bruijn_sequence">De Bruijn Sequence</a> but that involves math I don&#8217;t understand.</p>
<p>My solution was written in Python.</p>
<pre class="brush: python">
def permutations(values, size):
    if size == 0: return [[]]
    out = []
    for v in values:
        for perm in permutations(values, size-1):
            out.append([v] + perm)
    return out

def combinationString(permutations):
    out = &#039;&#039;
    for permutation in permutations:
        tmp = &#039;&#039;.join([str(num) for num in permutation])
        if out.find(tmp) == -1:
            out += tmp
    return out;

def verify(permutations, combinationString):
    for permutation in permutations:
        tmp = &#039;&#039;.join([str(num) for num in permutation])
        m = combinationString.split(tmp)
        if len(m) == 1: print (&quot;[ERROR]&quot;, tmp, &quot;is missing&quot;)
        if len(m) &gt; 2: print (&quot;[WARN]&quot;, tmp, &quot;is duplicated&quot;)

v = [0,1,2,3,4,5,6,7,8,9]
s = 4
p = permutations(v, s)
c = combinationString(p)
verify(p, c)

print(&quot;Combination String:&quot;, c)
print(len(c))
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jclement.ca/blog/2010/04/07/817/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Too Many Temp Files!</title>
		<link>http://jclement.ca/blog/2010/04/05/too-many-temp-files/</link>
		<comments>http://jclement.ca/blog/2010/04/05/too-many-temp-files/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 20:21:18 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[.Net]]></category>

		<guid isPermaLink="false">http://jclement.ca/blog/2010/04/05/too-many-temp-files/</guid>
		<description><![CDATA[Today my work computer started behaving badly… &#160; and SQL Server Management Console… Nice error… “The file exists.”&#160; Fortunately the details were actually helpful… Calls to “GetTempFileName “ are failing and the word on the Intertubes is that will happen if you end up with &#62; 65,000 files in your temp folder. Which, apparently, I [...]]]></description>
			<content:encoded><![CDATA[<p>Today my work computer started behaving badly…</p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/04/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://jclement.ca/blog/wp-content/uploads/2010/04/image_thumb.png" width="478" height="307" /></a>&#160; </p>
<p>and SQL Server Management Console…</p>
</p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/04/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://jclement.ca/blog/wp-content/uploads/2010/04/image_thumb1.png" width="466" height="196" /></a> </p>
<p>Nice error… “<em>The file exists.</em>”&#160; Fortunately the details were actually helpful…</p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/04/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://jclement.ca/blog/wp-content/uploads/2010/04/image_thumb2.png" width="466" height="358" /></a> </p>
<p>Calls to “GetTempFileName “ are failing and the word on the Intertubes is that will happen if you end up with &gt; 65,000 files in your temp folder.</p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/04/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://jclement.ca/blog/wp-content/uploads/2010/04/image_thumb3.png" width="478" height="227" /></a>     </p>
<p>Which, apparently, I have accumulated.&#160; Cleaning those out and everything works wonderfully again.</p>
<p>FAIL to all the developers of the software I use that are leaving all these files here… </p>
]]></content:encoded>
			<wfw:commentRss>http://jclement.ca/blog/2010/04/05/too-many-temp-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Estimating Probability of Collisions&#8230;</title>
		<link>http://jclement.ca/blog/2010/03/11/estimating-probability-of-collisions/</link>
		<comments>http://jclement.ca/blog/2010/03/11/estimating-probability-of-collisions/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 22:08:05 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://jclement.ca/blog/2010/03/11/estimating-probability-of-collisions/</guid>
		<description><![CDATA[We’re working on redesigning our licensing code and part of that involved generating a unique installation ID for each installation of our software.&#160; The goal is for this identifier to be absolutely unique for each client while still being small enough that it would be feasible for them to read it over the phone to [...]]]></description>
			<content:encoded><![CDATA[<p>We’re working on redesigning our licensing code and part of that involved generating a unique installation ID for each installation of our software.&#160; The goal is for this identifier to be absolutely unique for each client while still being small enough that it would be feasible for them to read it over the phone to us.&#160; </p>
<p>The identifier is generated from hashing together a lot of system data and converting that into a N digit code, where N is large enough to be unique but small enough not to be cumbersome.</p>
<p>That got us thinking…</p>
<p>For various identifier lengths, how many identifiers could we generate before we had, say, a 1% chance of a collision?</p>
<p>This is an implementation of the <a href="http://en.wikipedia.org/wiki/Birthday_problem">birthday paradox</a> (ie. what are the chances two students in a class of 30 share the same birthday).&#160; </p>
<p>It turns out that the math to solve this problem produces some absolutely ginormous numbers.&#160; Excel gave up rather quickly as did Python’s built-in numeric types but fortunately the add-on <a href="http://code.google.com/p/mpmath/">mpmath</a> library can handle such ridiculous numbers with ease.</p>
<p>A lunch hour of poking at it yielded the following chart.</p>
<p><a href="http://jclement.ca/blog/wp-content/uploads/2010/03/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://jclement.ca/blog/wp-content/uploads/2010/03/image_thumb.png" width="478" height="385" /></a> </p>
<p>From this you can see that with a key size of only 10 digits and only a few thousand identifiers you are risking a collision while for&#160; a 12 digit key one can safely handle 100,000 + identifiers.&#160; Moving to 15 or 20 digit identifiers makes the chance of collision insignificant unless we are dealing with enormous numbers of identifiers (which we are not).</p>
<p>I’ve created an <a href="http://jclement.ca/fun/birthday_paradox.py">online calculator for the birthday paradox here</a>.</p>
<pre class="brush: python">
from mpmath import *
def collisionProbability(nKeys, nEntities):
    t1 = mpf(1)
    for i in range(nKeys-nEntities+1, nKeys+1):
        t1 *= i
    return 1 - t1 * power(mpf(1)/nKeys,nEntities)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jclement.ca/blog/2010/03/11/estimating-probability-of-collisions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
