<?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>WordPress Website Development - Tulsa, OK - Two Miles Solutions, LLC &#187; C# .NET</title>
	<atom:link href="http://www.twomilessolutions.com/tag/c-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.twomilessolutions.com</link>
	<description>Better People, Better Code, Going the Extra Mile</description>
	<lastBuildDate>Sat, 28 Jan 2012 04:53:35 +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>.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='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 a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.twomilessolutions.com%2F2010%2F02%2F22%2Fnet-style-properties-getterssetters-in-php%2F&amp;title=.NET%20Style%20Properties%20%28Getters%2FSetters%29%20in%20PHP" id="wpa2a_2"><img src="http://www.twomilessolutions.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></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='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). [...]
No related posts.]]></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 a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.twomilessolutions.com%2F2009%2F11%2F05%2Fnet-one-line-could-save-your-64-bit-bacon%2F&amp;title=.NET%3A%20One%20line%20could%20save%20your%2064-bit%20bacon%21" id="wpa2a_4"><img src="http://www.twomilessolutions.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>No related posts.</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>
	</channel>
</rss>

