<?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>DallinJones.com &#187; Web Programming</title>
	<atom:link href="http://www.dallinjones.com/category/web-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dallinjones.com</link>
	<description>One more geek in the world.</description>
	<lastBuildDate>Fri, 09 Apr 2010 17:02:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to convert from pixels to millimeters</title>
		<link>http://www.dallinjones.com/2008/07/how-to-convert-from-pixels-to-millimeters/</link>
		<comments>http://www.dallinjones.com/2008/07/how-to-convert-from-pixels-to-millimeters/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 13:47:46 +0000</pubDate>
		<dc:creator>SlipStream</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.dallinjones.com/2008/07/02/how-to-convert-from-pixels-to-millimeters/</guid>
		<description><![CDATA[ I am working with PHP and FPDF to generate a PDF invoice. The designers have created a couple of very helpful documents, there are three total. The first is a mockup of the invoice. The second shows fonts, font sizes, and font colors. The last document show the positioning of all elements on the [...]]]></description>
			<content:encoded><![CDATA[<p> I am working with PHP and FPDF to generate a PDF invoice. The designers have created a couple of very helpful documents, there are three total. The first is a mockup of the invoice. The second shows fonts, font sizes, and font colors. The last document show the positioning of all elements on the invoice. My only problem, is that the document was made with pixels at a resolution of 300 DPI rather than in millimeters. Anyone that is familiar with FPDF will know that PDF&#8217;s created with FPDF can not be generated with pixels in mind. PDF documents in FPDF can only use point (pt), millimeteres (mm), centimeters (cm), or inches (in).<span id="more-65"></span>So I needed to come up with a way to convert things to what I needed them to be. Here is the solution I came up with. First, we need to discuss the conversion factors. My document had a DPI of 300, DPI stands for Dots Per Inch. This means that in every in there are 300 pixels. But we aren&#8217;t using inches for measurements on the document, we are using millimeters. Well, there are 25.4 millimeters in an inch. So, how do we go all the way from pixels to millimeters. Simple.</p>
<p>In chemistry, we studied something called dimensional analysis. Dimensional analysis is a method for converting from one unit to another. So first off we multiply the number of pixels by 1 over our DPI (in this case 300 DPI) then we multiply that by 25.4 by one inch (number of millimeters in an inch) Once everything cancels out we are left with a fairly nice, simple and easy to use formula.<br />
<code>mm = (pixels * 25.4) / dpi</code><br />
In order to convert back from millimeters to pixels we simply reverse the formula using simple algebra.<br />
<code>pixels = (mm * dpi) / 25.4</code><br />
There you have it. A very simple way to convert from pixels to millimeters. And then from millimeters back to pixels.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dallinjones.com/2008/07/how-to-convert-from-pixels-to-millimeters/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Rounding to the nearest half dollor (or quarter dollar)</title>
		<link>http://www.dallinjones.com/2008/06/rounding-to-the-nearest-half-dollor-or-quarter-dollar/</link>
		<comments>http://www.dallinjones.com/2008/06/rounding-to-the-nearest-half-dollor-or-quarter-dollar/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 14:35:09 +0000</pubDate>
		<dc:creator>SlipStream</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.dallinjones.com/2008/06/18/rounding-to-the-nearest-half-dollor-or-quarter-dollar/</guid>
		<description><![CDATA[One of my recent projects required that I round the price I was calculating to the nearest half dollar. This started out at a pain. Rounding to the floor, or to the ceiling, or normal rounding is quite easy. But I have never had to round to the nearest half dollar. (or quarter dollar) After [...]]]></description>
			<content:encoded><![CDATA[<p>One of my recent projects required that I round the price I was calculating to the nearest half dollar. This started out at a pain. Rounding to the floor, or to the ceiling, or normal rounding is quite easy. But I have never had to round to the nearest half dollar. (or quarter dollar) After a little bit of time thinking about it, I came up with a solution.<span id="more-63"></span>I first thought about the algorithm needed to round to the floor or to the ceiling. This was easy, since the project is a PHP project, I simply had to use the rounding functions. Rounding to the nearest half dollar was harder because we had to come up with a way to round evenly. So here is the algorithm I used:</p>
<p><code>$rounded = round(($initial_value / .5), 0) * .5</code></p>
<p>There you have it. A very simple (and quick way) of rounding to the nearest half dollar. To be able to round to the nearest quarter dollar, tenth of a dollar or anything else you feel like rounding to, simply change the .5 to .25 (for quarter dollar) or .1 (for tenth of a dollar) depending on what is needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dallinjones.com/2008/06/rounding-to-the-nearest-half-dollor-or-quarter-dollar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Microsoft AlphaImageLoader crashing IE 6</title>
		<link>http://www.dallinjones.com/2008/05/microsoft-alphaimageloader-crashing-ie-6/</link>
		<comments>http://www.dallinjones.com/2008/05/microsoft-alphaimageloader-crashing-ie-6/#comments</comments>
		<pubDate>Tue, 20 May 2008 20:37:52 +0000</pubDate>
		<dc:creator>SlipStream</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.dallinjones.com/2008/05/20/microsoft-alphaimageloader-crashing-ie-6/</guid>
		<description><![CDATA[I&#8217;ve been developing a website for a local group that supports the arts (www.scera.org). The client called my place of work and mentioned that some of their users were having difficulties with IE 6 locking up. After spending several hours on the issue, I discovered that Microsoft has a bug, that causes the filter to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been developing a website for a local group that supports the arts (<a href="http://www.scera.org" title="Scera Center for the Arts">www.scera.org</a>). The client called my place of work and mentioned that some of their users were having difficulties with IE 6 locking up. After spending several hours on the issue, I discovered that Microsoft has a bug, that causes the filter to no work properly when the images are preloaded. So to fix this issue I had to do the following:<span id="more-53"></span></p>
<p>First of I commented out all of the normal filter lines and replaced them with this</p>
<p>&lt;!&#8211;[if IE]&gt;<br />
&lt;style&gt;<br />
.top-content {<br />
background-image: none;<br />
/*filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8221;/img/content-top.png&#8221;, sizingMethod=&#8221;scale&#8221;);*/<br />
}<br />
.logo {<br />
background-image: none;<br />
/*filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8221;/img/scera-logo.png&#8221;, sizingMethod=&#8221;scale&#8221;);*/<br />
}<br />
.mdle-content {<br />
background-image: none;<br />
/*filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8221;/img/content-bg.png&#8221;, sizingMethod=&#8221;scale&#8221;);*/<br />
}<br />
.btm-content {<br />
background-image: none;<br />
/*filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8221;/img/content-btm.png&#8221;, sizingMethod=&#8221;scale&#8221;);*/<br />
}<br />
.side-nav-bg {<br />
background-image: none;<br />
/*filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8221;/img/side-nav-bg.png&#8221;, sizingMethod=&#8221;scale&#8221;);*/<br />
}<br />
.tickets {<br />
background-image: none;<br />
/*filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8221;/img/tickets.png&#8221;, sizingMethod=&#8221;scale&#8221;);*/<br />
}</p>
<p>&lt;/style&gt;<br />
&lt;![endif]&#8211;&gt;</p>
<p>Once I had done that, I wrote a pre-loader and called it in the &lt;body onload=&#8221;genesis()&#8221;&gt; of the website. The following is the code from the pre-loader:</p>
<p>&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
function vIE(){return (navigator.appName==&#8217;Microsoft Internet Explorer&#8217;)?parseFloat((new RegExp(&#8220;MSIE ([0-9]{1,}[.0-9]{0,})&#8221;)).exec(navigator.userAgent)[1]):-1;}</p>
<p>function genesis() {<br />
if (vIE() &lt; 7 &amp;&amp; vIE() &gt; 0) {<br />
var divs = document.getElementsByTagName(&#8216;img&#8217;);<br />
for (i = 0; i &lt; divs.length; i++) {<br />
var im = new Image;<br />
im.src = divs[i].src;<br />
}<br />
document.getElementById(&#8216;top-content&#8217;).style.filter =  &#8220;progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8217;/img/content-top.png&#8217;, sizingMethod=&#8217;scale&#8217;<br />
)&#8221;;<br />
document.getElementById(&#8216;logo&#8217;).style.filter =         &#8220;progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8217;/img/scera-logo.png&#8217;, sizingMethod=&#8217;scale&#8217;)<br />
&#8220;;<br />
document.getElementById(&#8216;mdle-content&#8217;).style.filter = &#8220;progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8217;/img/content-bg.png&#8217;, sizingMethod=&#8217;scale&#8217;<br />
)&#8221;;<br />
document.getElementById(&#8216;btm-content&#8217;).style.filter =  &#8220;progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8217;/img/content-btm.png&#8217;, sizingMethod=&#8217;scale&#8217;<br />
)&#8221;;<br />
document.getElementById(&#8217;side-nav-bg&#8217;).style.filter =  &#8220;progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8217;/img/side-nav-bg.png&#8217;, sizingMethod=&#8217;scale&#8217;<br />
)&#8221;;<br />
document.getElementById(&#8216;tickets&#8217;).style.filter =      &#8220;progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#8217;/img/tickets.png&#8217;, sizingMethod=&#8217;scale&#8217;)&#8221;;<br />
}<br />
}</p>
<p>&lt;/script&gt;</p>
<p>It isn&#8217;t the cleanest solution in the world, but it works (even if it is a little slow) granted, we ended up deciding that this solution was not the right one (needed to be faster when loading) so we changed it around a little, and now IE 6 uses get gifs rather than pngs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dallinjones.com/2008/05/microsoft-alphaimageloader-crashing-ie-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

