<?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>Custom Software and Web Development - Madison WI - Two Miles Solutions, LLC &#187; Programming</title>
	<atom:link href="http://www.twomilessolutions.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.twomilessolutions.com</link>
	<description>Software Solutions That Go the Extra Mile!</description>
	<lastBuildDate>Sun, 01 Aug 2010 05:22:43 +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>.NET Style Properties (Getters/Setters) in PHP</title>
		<link>http://www.twomilessolutions.com/2010/02/22/net-style-properties-getterssetters-in-php/</link>
		<comments>http://www.twomilessolutions.com/2010/02/22/net-style-properties-getterssetters-in-php/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 14:00:00 +0000</pubDate>
		<dc:creator>Jeff Miles</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Random Thoughts]]></category>
		<category><![CDATA[C# .NET]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Visual Basic .NET]]></category>

		<guid isPermaLink="false">http://www.twomilessolutions.com/2010/02/22/net-style-properties-getterssetters-in-php/</guid>
		<description><![CDATA[On any given day, I can be programming in one of many languages (C# .NET, PHP, JavaScript, CSS, &#38; HTML [I know I may be pushing it calling CSS &#38; HTML languages], and soon Visual Basic .NET because of a collaborative project).&#160; Don’t get me wrong, I love that part of my job.&#160; It keeps [...]


Related posts:<ol><li><a href='http://www.twomilessolutions.com/2009/11/05/php-coding-chmod-my-new-best-friend/' rel='bookmark' title='Permanent Link: PHP Coding: chmod() my new best friend'>PHP Coding: chmod() my new best friend</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px 10px; display: inline; border-top: 0px; border-right: 0px" title="DSC01202" border="0" alt="DSC01202" align="right" src="http://www.twomilessolutions.com/wp-content/uploads/2010/02/DSC01202.jpg" width="244" height="184" /> On any given day, I can be programming in one of many languages (C# .NET, PHP, JavaScript, CSS, &amp; HTML [I know I may be pushing it calling CSS &amp; HTML languages], and soon Visual Basic .NET because of a collaborative project).&#160; Don’t get me wrong, I love that part of my job.&#160; It keeps me sharp.&#160; Sure there is the occasional mishap where I forget that the . is the member accessor in the .NET languages, but it is the concatenation operator in PHP and I will throw the occasional $ into my C# code…</p>
<p>Another thing to know is that I am an object oriented programmer to the core…I am currently cleaning up after another developer who was not an object oriented guy…grr…there is data access code everywhere and he didn’t know the definition of object…finally I just took the functionality down because it was so bug ridden that whenever I would fix one bug, it would expose another.&#160; One thing that has constantly bugged me since I started coding in PHP that I didn’t like its method of using __get and __set for getters and setters (mainly because I still use a modified version of Hungarian notation, but that is a discussion for another blog post, so I didn’t like what the getters and setters would look like).</p>
<p>Then, tonight, as I was coding, I had an epiphany, I could use PHP’s optional operator syntax for a function to get something close to what I would want.&#160; So, where I would have coded this before:</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span>&lt;?php</pre>
<pre><span class="lnum">   2:  </span>&#160;</pre>
<pre><span class="lnum">   3:  </span><span class="kwrd">class</span> Test {</pre>
<pre><span class="lnum">   4:  </span>&#160;</pre>
<pre><span class="lnum">   5:  </span><span class="kwrd">private</span> $m_intId;</pre>
<pre><span class="lnum">   6:  </span>&#160;</pre>
<pre><span class="lnum">   7:  </span><span class="kwrd">public</span> function setId($<span class="kwrd">value</span>) {</pre>
<pre><span class="lnum">   8:  </span>&#160;</pre>
<pre><span class="lnum">   9:  </span>$<span class="kwrd">this</span>-&gt;m_intId = $<span class="kwrd">value</span>;</pre>
<pre><span class="lnum">  10:  </span>&#160;</pre>
<pre><span class="lnum">  11:  </span>}</pre>
<pre><span class="lnum">  12:  </span>&#160;</pre>
<pre><span class="lnum">  13:  </span><span class="kwrd">public</span> function getId() {</pre>
<pre><span class="lnum">  14:  </span>&#160;</pre>
<pre><span class="lnum">  15:  </span><span class="kwrd">return</span> $<span class="kwrd">this</span>-&gt;m_intId();</pre>
<pre><span class="lnum">  16:  </span>&#160;</pre>
<pre><span class="lnum">  17:  </span>}</pre>
<pre><span class="lnum">  18:  </span>&#160;</pre>
<pre><span class="lnum">  19:  </span>}</pre>
<pre><span class="lnum">  20:  </span>&#160;</pre>
<pre><span class="lnum">  21:  </span>?&gt;</pre>
</div>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>where I would do the following to access it $objTest-&gt;setId(1); or $intId = $objTest-&gt;getId(); (I would have to explicitly call the getter or setter)</p>
<p>Tonight I realized, I could code it this way:</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span>&lt;?php</pre>
<pre><span class="lnum">   2:  </span>&#160;</pre>
<pre><span class="lnum">   3:  </span><span class="kwrd">class</span> Test {</pre>
<pre><span class="lnum">   4:  </span>&#160;</pre>
<pre><span class="lnum">   5:  </span><span class="kwrd">private</span> $m_intId;</pre>
<pre><span class="lnum">   6:  </span>&#160;</pre>
<pre><span class="lnum">   7:  </span><span class="kwrd">public</span> function Id($<span class="kwrd">value</span> = 0) {</pre>
<pre><span class="lnum">   8:  </span>&#160;</pre>
<pre><span class="lnum">   9:  </span><span class="kwrd">if</span>($<span class="kwrd">value</span> != 0) {</pre>
<pre><span class="lnum">  10:  </span>&#160;</pre>
<pre><span class="lnum">  11:  </span>$<span class="kwrd">this</span>-&gt;m_intId = $<span class="kwrd">value</span>;</pre>
<pre><span class="lnum">  12:  </span>&#160;</pre>
<pre><span class="lnum">  13:  </span>} <span class="kwrd">else</span> {</pre>
<pre><span class="lnum">  14:  </span>&#160;</pre>
<pre><span class="lnum">  15:  </span><span class="kwrd">return</span> $<span class="kwrd">this</span>-&gt;m_intId;</pre>
<pre><span class="lnum">  16:  </span>&#160;</pre>
<pre><span class="lnum">  17:  </span>}</pre>
<pre><span class="lnum">  18:  </span>&#160;</pre>
<pre><span class="lnum">  19:  </span>}</pre>
<pre><span class="lnum">  20:  </span>&#160;</pre>
<pre><span class="lnum">  21:  </span>?&gt;</pre>
</div>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Now, I can access the id by doing the following: $objTest-&gt;Id(5); or $intId = $objTest-&gt;Id();</p>
<p>What are your thoughts developers?</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.twomilessolutions.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>

<p>Related posts:<ol><li><a href='http://www.twomilessolutions.com/2009/11/05/php-coding-chmod-my-new-best-friend/' rel='bookmark' title='Permanent Link: PHP Coding: chmod() my new best friend'>PHP Coding: chmod() my new best friend</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.twomilessolutions.com/2010/02/22/net-style-properties-getterssetters-in-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>.NET: One line could save your 64-bit bacon!</title>
		<link>http://www.twomilessolutions.com/2009/11/05/net-one-line-could-save-your-64-bit-bacon/</link>
		<comments>http://www.twomilessolutions.com/2009/11/05/net-one-line-could-save-your-64-bit-bacon/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 05:44:13 +0000</pubDate>
		<dc:creator>Jeff Miles</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[64-bit]]></category>
		<category><![CDATA[C# .NET]]></category>
		<category><![CDATA[Microsoft Access]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://www.twomilessolutions.com/?p=286</guid>
		<description><![CDATA[I have a customer that recently had to purchase a new computer due to her previous computer finally biting the dust.  Knowing what programs she was running on her computer, I advised her that she should purchase a 32-bit version of Vista (then upgrade to the 32-bit version of Windows 7 when it came out). [...]


Related posts:<ol><li><a href='http://www.twomilessolutions.com/2009/10/28/whats-the-big-deal-about-windows-7/' rel='bookmark' title='Permanent Link: What&#8217;s the big deal about Windows 7'>What&#8217;s the big deal about Windows 7</a></li>
<li><a href='http://www.twomilessolutions.com/2009/09/30/madison-business-connection-robson-computer-technologies/' rel='bookmark' title='Permanent Link: Madison Business Connection: Robson Computer Technologies'>Madison Business Connection: Robson Computer Technologies</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have a customer that recently had to purchase a new computer due to her previous computer finally biting the dust.  Knowing what programs she was running on her computer, I advised her that she should purchase a 32-bit version of Vista (then upgrade to the 32-bit version of <a title="Amazon.com: Windows 7 Home Premium Upgrade" href="http://www.amazon.com/gp/product/B002DHLUWK?ie=UTF8&amp;tag=milestogofrom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002DHLUWK" target="_blank">Windows 7</a> when it came out).</p>
<p>She bought a 32-bit machine that was running Vista and everything seemed fine except the OS was corrupt.  So she took the computer back in to have it replaced and they gave her a shiny new <a title="Amazon.com: Windows 7 Home Premium Upgrade" href="http://www.amazon.com/gp/product/B002DHLUWK?ie=UTF8&amp;tag=milestogofrom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002DHLUWK" target="_blank">Windows 7</a> machine (she was only days away from the release of <a title="Amazon.com: Windows 7 Home Premium Upgrade" href="http://www.amazon.com/gp/product/B002DHLUWK?ie=UTF8&amp;tag=milestogofrom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002DHLUWK" target="_blank">Windows 7</a>) .  She asked them to give her the same computer, but they gave her a 64-bit version of <a title="Amazon.com: Windows 7 Home Premium Upgrade" href="http://www.amazon.com/gp/product/B002DHLUWK?ie=UTF8&amp;tag=milestogofrom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002DHLUWK" target="_blank">Windows 7</a> so when she went to install her programs she ran into a ton of problems because the programs were not written for the 64-bit versions of the operating system (a lot of legacy applications are not written for 64-bit operating systems, this isn&#8217;t Microsoft&#8217;s fault, this is a fault of the application programmers).</p>
<p>I have a <a title="UPurMEMORY - Memorization Software" href="http://www.twomilessolutions.com/upurmemory" target="_blank">small application that I wrote</a> that for ease of use and not having to install any other programs, I chose to use Microsoft Access as the database for the application (say what you will, it was a side project that turned into something I could sell), but there is no 64-bit JET driver for reading Access databases so for 64-bit operating systems, I was hosed, until I found out that one line could change everything.</p>
<p>In the csproj file of your C# .NET application, in the first property group, add this line:</p>
<pre>&lt;PlatformTarget&gt;x86&lt;/PlatformTarget&gt;</pre>
<p>So your property group should look something like this:</p>
<pre>&lt;PropertyGroup&gt;
&lt;PlatformTarget&gt;x86&lt;/PlatformTarget&gt;
&lt;Configuration Condition=" '$(Configuration)' == '' "&gt;Debug&lt;/Configuration&gt;
&lt;Platform Condition=" '$(Platform)' == '' "&gt;AnyCPU&lt;/Platform&gt;
&lt;ProductVersion&gt;8.0.50727&lt;/ProductVersion&gt;
&lt;SchemaVersion&gt;2.0&lt;/SchemaVersion&gt;
&lt;ProjectGuid&gt;{A16625F1-A4BA-46FA-BD05-737257A18EBD}&lt;/ProjectGuid&gt;
&lt;OutputType&gt;WinExe&lt;/OutputType&gt;
&lt;AppDesignerFolder&gt;Properties&lt;/AppDesignerFolder&gt;
&lt;RootNamespace&gt;UPurMEMORY&lt;/RootNamespace&gt;
&lt;AssemblyName&gt;UPurMEMORY&lt;/AssemblyName&gt;
&lt;ApplicationIcon&gt;UPurMEMORY.48.ico&lt;/ApplicationIcon&gt;
&lt;FileUpgradeFlags&gt;&lt;/FileUpgradeFlags&gt;
&lt;UpgradeBackupLocation&gt;&lt;/UpgradeBackupLocation&gt;
&lt;OldToolsVersion&gt;2.0&lt;/OldToolsVersion&gt;
&lt;/PropertyGroup&gt;</pre>
<p>That one little line saved my bacon and allows me to <a title="UPurMEMORY - Memorization Tool" href="http://www.twomilessolutions.com/upurmemory" target="_blank">sell that piece of software for $10</a> to anyone who runs a 64-bit operating system.  I&#8217;m not saying this will solve all of your problems, but it helped me.</p>
<p><strong>Related Links:</strong></p>
<p><strong>- </strong><a title="UPurMEMORY - Memorization Tool" href="http://www.twomilessolutions.com/upurmemory" target="_blank">UPurMEMORY</a> &#8211; memorization utility ($10.00 USD)<br />
- <a title="Amazon.com - Windows 7 Home Premium" href="http://www.amazon.com/gp/product/B002DHGMK0?ie=UTF8&amp;tag=milestogofrom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002DHGMK0" target="_blank">Windows 7 Home Premium</a> (<a title="Amazon.com - Windows 7 Home Premium Upgrade" href="http://www.amazon.com/gp/product/B002DHLUWK?ie=UTF8&amp;tag=milestogofrom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002DHLUWK" target="_blank">upgrade</a>)<br />
- <a title="Amazon.com - Windows 7 Professional" href="http://www.amazon.com/gp/product/B002DHLVII?ie=UTF8&amp;tag=milestogofrom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002DHLVII" target="_blank">Windows 7 Professional</a> (<a title="Amazon.com - Windows 7 Professional Upgrade" href="http://www.amazon.com/gp/product/B002DHGM50?ie=UTF8&amp;tag=milestogofrom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002DHGM50" target="_blank">upgrade</a>)<br />
- <a title="Amazon.com - Windows 7 Ultimate" href="http://www.amazon.com/gp/product/B002DHGMVY?ie=UTF8&amp;tag=milestogofrom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002DHGMVY" target="_blank">Windows 7 Ultimate</a> (<a title="Amazon.com - Windows 7 Ultimate Upgrade" href="http://www.amazon.com/gp/product/B002DHLV8S?ie=UTF8&amp;tag=milestogofrom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B002DHLV8S" target="_blank">upgrade</a>)</p>
<p><strong>Related Posts:</strong></p>
<p><strong>- </strong><a title="TMS Blog - What's the big deal about Windows 7?" href="http://www.twomilessolutions.com/2009/10/28/whats-the-big-deal-about-windows-7/" target="_blank">What&#8217;s the big deal about Windows 7?</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.twomilessolutions.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>

<p>Related posts:<ol><li><a href='http://www.twomilessolutions.com/2009/10/28/whats-the-big-deal-about-windows-7/' rel='bookmark' title='Permanent Link: What&#8217;s the big deal about Windows 7'>What&#8217;s the big deal about Windows 7</a></li>
<li><a href='http://www.twomilessolutions.com/2009/09/30/madison-business-connection-robson-computer-technologies/' rel='bookmark' title='Permanent Link: Madison Business Connection: Robson Computer Technologies'>Madison Business Connection: Robson Computer Technologies</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.twomilessolutions.com/2009/11/05/net-one-line-could-save-your-64-bit-bacon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Coding: chmod() my new best friend</title>
		<link>http://www.twomilessolutions.com/2009/11/05/php-coding-chmod-my-new-best-friend/</link>
		<comments>http://www.twomilessolutions.com/2009/11/05/php-coding-chmod-my-new-best-friend/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 09:18:13 +0000</pubDate>
		<dc:creator>Jeff Miles</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.twomilessolutions.com/?p=283</guid>
		<description><![CDATA[For all of you coders out there, I just found a new best friend, its name is chmod().  For those of you familiar with Unix/Linux this command will look familiar. Background: I was implementing an online store for a customer who already had an existing website, but wanted to be able to sell her goods [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-284" title="php" src="http://www.twomilessolutions.com/wp-content/uploads/2009/11/php-logo.gif" alt="php" width="170" height="102" />For all of you coders out there, I just found a new best friend, its name is chmod().  For those of you familiar with Unix/Linux this command will look familiar.</p>
<p><strong>Background:</strong> I was implementing an online store for a customer who already had an existing website, but wanted to be able to sell her goods online (I&#8217;m trying to keep things vague on purpose when describing the website).  I built her a custom content management system for her online store that allowed her to upload pictures of her goods and input pricing data.  My code would take the image she uploaded, save it, then copy it and resize the copy to make a thumbnail image.  For whatever reason though, her web host was locking down permissions on the first file.  This became problematic because it doesn&#8217;t do any good to have a file that you can&#8217;t read&#8230;</p>
<p><strong>Solution:</strong> After using the move_uploaded_file() command I used the chmod() command to reset the file permissions.</p>
<p>Here is the format of the chmod() function: chmod(<tt style="font-family: Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: italic;">$filename</tt> , <tt style="font-family: Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: italic;">$mode</tt> );</p>
<p>I also ran into a gotcha that I didn&#8217;t expect&#8230;when specifying the mode, do not specify it as a string, (ie. &#8220;755&#8243;), instead you specify it as a number (ie. 755), even further though, you have to throw in a leading zero (ie. 0755).</p>
<p>Hopefully, you found this post helpful, happy coding.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.twomilessolutions.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.twomilessolutions.com/2009/11/05/php-coding-chmod-my-new-best-friend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
