<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Microsonic Development</title>
	
	<link>http://microsonic.org</link>
	<description />
	<lastBuildDate>Mon, 12 Jul 2010 01:55:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Microsonic" /><feedburner:info uri="microsonic" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Check a Date Exists Within a Given Period</title>
		<link>http://feedproxy.google.com/~r/Microsonic/~3/2fmgzZ9U6cQ/</link>
		<comments>http://microsonic.org/2010/07/11/check-a-date-exists-within-a-given-period/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 01:55:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=225</guid>
		<description><![CDATA[So I recently was asked to solve a problem for someone trying to write a script to check if a birthday (presented in DATETIME M d, Y form) was present within a given period of days from the current date. Naturally, I feel inclined to give some assistance because I love working on these things. [...]]]></description>
			<content:encoded><![CDATA[<p>So I recently was asked to solve a problem for someone trying to write a script to check if a birthday (presented in DATETIME M d, Y form) was present within a given period of days from the current date. Naturally, I feel inclined to give some assistance because I love working on these things.</p>
<p>So, I am posting this because I found it interesting. I feel like this is a very useful code snippet for anyone looking how to do this. The code is fairly well-documented, so I am not going to go through and explain all the facets of the code. However, I will make special mention of the real challenge to this. You have to make sure to account for the coming year if the date is after December 21 in any given year. This is because the system won&#8217;t automatically rollover to the next year and as you approach January 1 of the coming year, no dates will match until January 1 is met. So you can take a look in the code to see how I personally accomplished this task although there are probably hundreds of other ways to tackle the issue.</p>
<blockquote><p><code>&lt;?php<br />
/**<br />
 * Birthday Script created by Dennis J. McWherter, Jr.<br />
 *<br />
 * (C) 2010 DENNIS J. MCWHERTER, JR. ALL RIGHTS RESERVED.<br />
 */<br />
class Node<br />
{<br />
	// For sake of keeping things similar to a usable environment<br />
	var $field_work_start = array();<br />
}</p>
<p>/**<br />
 * checkBirthday function<br />
 *<br />
 * The function will check a birth date<br />
 * and see if it is in the range of specified<br />
 * days.<br />
 *<br />
 * @param $birthday<br />
 *   Birth date parameter. Assumed to be in M d, Y form<br />
 * @param $days<br />
 *   The range of days to check where the birthday is<br />
 * @return int<br />
 *   0 if the birthday is _NOT_ within the proper range<br />
 *   1 if the birthday _IS_ within the proper range<br />
 */<br />
function checkBirthday($birthday,$days)<br />
{<br />
	// Parse out the year of the birthday<br />
	$pos      = strpos($birthday,",")+2; // Find the comma which separates the year<br />
	$today	  = strtotime(date("M, d")); // Check if day is &lt; Dec. 22. If not, we need to account for next year!</p>
<p>	// Check if the birthday is within the range and has not passed!<br />
	if($today &lt; strtotime("Dec 22")){<br />
		$birthday = substr_replace($birthday,date("Y"),$pos,4); // Replace the year with current year<br />
		if(strtotime($birthday) &lt;= strtotime("+".$days." days") &amp;&amp; strtotime($birthday) &gt;= time()){<br />
			return 1;<br />
		}<br />
	} else { // Less than 10 days left in our year.. check for January birthdays!<br />
		if(!strstr($birthday,"December")){<br />
			$birthday = substr_replace($birthday,date("Y")+1,$pos,4); // Replace the year with next year<br />
			$year = date("Y")+1;<br />
		} else { // Still December?<br />
			$birthday = substr_replace($birthday,date("Y"),$pos,4); // Replace the year with current year<br />
			$year = date("Y");<br />
		}<br />
		$day = (date("d")+10)-31; // 10 days from now is...</p>
<p>		if((strtotime($birthday) &lt;= strtotime("January ".$day.", ".$year)) &amp;&amp; strtotime($birthday) &gt;= strtotime("December 25, 2010")){<br />
			return 1;<br />
		}<br />
	}<br />
	return 0;<br />
}</p>
<p>$node[]  = new Node;</p>
<p>$node[0]-&gt;field_work_start[0]  = "January 1, 1970"; // First birthday is _NOT_ within range<br />
$node[1]-&gt;field_work_start[0] = "July 20, 1970"; // Second birthday _IS_ within range</p>
<p>for($i=0;$i&lt;count($node);$i++){<br />
	if(!checkBirthday($node[$i]-&gt;field_work_start[0],10)){<br />
		print $node[$i]-&gt;field_work_start[0]." is not within the 10 day range.&lt;br /&gt;&lt;br /&gt;";<br />
	} else {<br />
		print $node[$i]-&gt;field_work_start[0]." is within the 10 day range.&lt;br /&gt;&lt;br /&gt;";<br />
	}<br />
}</p>
<p>unset($node);</p>
<p>?&gt;</code></p></blockquote>
<p>Enjoy!</p>
<p>Regards,<br />
Dennis M.</p>
<p><a href='http://microsonic.org/wp-content/uploads/2010/07/Check_Date_Period.tar.gz'>Check_Date_Period.tar</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/mxxB4RytFof_tIoj03FtiJqjvIg/0/da"><img src="http://feedads.g.doubleclick.net/~a/mxxB4RytFof_tIoj03FtiJqjvIg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/mxxB4RytFof_tIoj03FtiJqjvIg/1/da"><img src="http://feedads.g.doubleclick.net/~a/mxxB4RytFof_tIoj03FtiJqjvIg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Microsonic/~4/2fmgzZ9U6cQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2010/07/11/check-a-date-exists-within-a-given-period/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://microsonic.org/2010/07/11/check-a-date-exists-within-a-given-period/</feedburner:origLink></item>
		<item>
		<title>Overloading Classes</title>
		<link>http://feedproxy.google.com/~r/Microsonic/~3/iMTX-dyfc0k/</link>
		<comments>http://microsonic.org/2010/05/29/overloading-classes/#comments</comments>
		<pubDate>Sun, 30 May 2010 03:11:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[overload]]></category>
		<category><![CDATA[overloading]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=217</guid>
		<description><![CDATA[In OOP, it is a good practice to sometimes &#8220;overload&#8221; classes if you need to bring in information from the outside. For instance, if you want to include configuration variables in another class, you can &#8220;overload&#8221; that class with those variables. In this tutorial, I will explain how to do that in both PHP and [...]]]></description>
			<content:encoded><![CDATA[<p>In OOP, it is a good practice to sometimes &#8220;overload&#8221; classes if you need to bring in information from the outside. For instance, if you want to include configuration variables in another class, you can &#8220;overload&#8221; that class with those variables. In this tutorial, I will explain how to do that in both PHP and C++.</p>
<p>Please note, before continuing, that I assume you are an intermediate to advanced C++/PHP programmer. Therefore, I will not go into great detail about how variables are set, etc. because you should already know how that works. We will jump right into the code now for an example as it&#8217;s usually the best way to explain these tasks.</p>
<p><strong>PHP</strong></p>
<blockquote><p><code>&lt;?php<br />
/**<br />
 * Class overloading tutorial<br />
 * by Dennis J. McWherter, Jr.<br />
 *<br />
 * (C) 2010 DENNIS J. MCWHERTER JR. All Rights Reserved.<br />
 *<br />
 */</p>
<p>// Create our simple class<br />
class OverloadMe<br />
{<br />
	/**<br />
	 * We would like a global var for the whole class<br />
	 */<br />
	var $var1;</p>
<p>	/**<br />
	 * Constructor<br />
	 */<br />
	function __construct($name){<br />
		$this-&gt;var1 = $name;<br />
	}</p>
<p>	/**<br />
	 * Name function<br />
	 */<br />
	function name(){<br />
		return $this-&gt;var1;<br />
	}<br />
}</p>
<p>// Define the name variable<br />
$yourname = "Dennis";</p>
<p>// We overload the function when we initialize it<br />
$overload = new OverloadMe($yourname);</p>
<p>// Now let's get the output<br />
print "Your name is ".$overload-&gt;name();<br />
?&gt;</code></p></blockquote>
<p>Now, the procedure is very similar in C++, just classes work differently as you already know. I&#8217;ll give the C++ code now and explain it all at the end!</p>
<p><strong>C++</strong><br />
<em>src/main.cpp</em></p>
<blockquote><p><code>/**<br />
 * Class overloading tutorial<br />
 * by Dennis J. McWherter, Jr.<br />
 *<br />
 * (C) 2010 DENNIS J. MCWHERTER JR. All Rights Reserved.<br />
 *<br />
 */</p>
<p>#include &lt;string&gt;<br />
#include "overload.h"</p>
<p>int main(int argc,char* argv[])<br />
{<br />
	std::string name = "Dennis";<br />
	OverloadMe overload(name.c_str());<br />
	overload.name();<br />
	return 0; // exit<br />
}</code></p></blockquote>
<p><em>src/overload.h</em></p>
<blockquote><p>/**<br />
 * Class overloading tutorial<br />
 * by Dennis J. McWherter, Jr.<br />
 *<br />
 * (C) 2010 DENNIS J. MCWHERTER JR. All Rights Reserved.<br />
 *<br />
 */</p>
<p>#ifndef Overload_H<br />
#define Overload_H</p>
<p>// Class definition</p>
<p>class OverloadMe<br />
{<br />
public:<br />
	// Constructor<br />
	OverloadMe(const char* namevar);</p>
<p>	// Name function<br />
	void name();<br />
private:<br />
	// A global var for the class<br />
	const char* var1;<br />
};<br />
#endif
</p></blockquote>
<p><em>src/overload.cpp</em></p>
<blockquote><p><code>/**<br />
 * Class overloading tutorial<br />
 * by Dennis J. McWherter, Jr.<br />
 *<br />
 * (C) 2010 DENNIS J. MCWHERTER JR. All Rights Reserved.<br />
 *<br />
 */</p>
<p>// Make the class work<br />
#include &lt;iostream&gt;<br />
#include &lt;stdio.h&gt;<br />
#include "overload.h"</p>
<p>using namespace std;</p>
<p>OverloadMe::OverloadMe(const char* namevar)<br />
: var1(namevar)<br />
{<br />
}</p>
<p>void OverloadMe::name()<br />
{<br />
	cout&lt;&lt; "Your name is " &lt;&lt; var1 &lt;&lt; endl &lt;&lt; endl &lt;&lt; "Please hit enter to exit" &lt;&lt; endl;<br />
	getchar();<br />
	return;<br />
}</code></p></blockquote>
<p>Now, for Windows users using MSVC++, this code will compile with a simple copy/paste. For *nix and BSD users, I&#8217;ve included a Makefile within the ZIP package for you to use when compiling. Basically, the compiler must compile each item as an object first, then it must compile the objects into the program file rather than compiling the .exe&#8217;s directly.</p>
<p>Well, I hope this is of some use to someone. The examples are fairly simple, but should explain the concept easily. As we can see in the C++ example, we initialize the class to a variable, and simply overload that variable at the time of initialization.</p>
<p>Regards,<br />
Dennis M.</p>
<p><a href='http://microsonic.org/wp-content/uploads/2010/05/Overload_Tutorial.zip'>Overload_Tutorial</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/fHORGK_CJIIZkGoxc0VqOAxKnEU/0/da"><img src="http://feedads.g.doubleclick.net/~a/fHORGK_CJIIZkGoxc0VqOAxKnEU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/fHORGK_CJIIZkGoxc0VqOAxKnEU/1/da"><img src="http://feedads.g.doubleclick.net/~a/fHORGK_CJIIZkGoxc0VqOAxKnEU/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Microsonic/~4/iMTX-dyfc0k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2010/05/29/overloading-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://microsonic.org/2010/05/29/overloading-classes/</feedburner:origLink></item>
		<item>
		<title>Using Reference Operators in Functions</title>
		<link>http://feedproxy.google.com/~r/Microsonic/~3/j6a4yuP8n34/</link>
		<comments>http://microsonic.org/2010/04/04/using-reference-operators-in-functions/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 02:03:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=214</guid>
		<description><![CDATA[Happy Easter everyone! I felt today, being a day off, would be a good day to write something up. I&#8217;ve had a lot of inquiries lately about the use and functionality of reference operators (&#038;) in variables. Well, basically, in common word, they replace the original variable. Of course, as usual, I have written up [...]]]></description>
			<content:encoded><![CDATA[<p>Happy Easter everyone!</p>
<p>I felt today, being a day off, would be a good day to write something up. I&#8217;ve had a lot of inquiries lately about the use and functionality of reference operators (&#038;) in variables. Well, basically, in common word, they replace the original variable. Of course, as usual, I have written up a sample code for you all to use, but first I&#8217;d like to explain a little bit more about these operators.</p>
<p>When defining a function, you always specify the format of function arguments. Take void test(int arg1,char* arg2); for instance. You have defined your function type &#8220;void,&#8221; the name &#8220;test,&#8221; and the arguments &#8220;int arg1&#8243; and &#8220;char* arg2.&#8221; Now, the way these functions are defined, the function will proceed with the values inserted into the function and the function will only apply end values of these variables specifically to this function (unless type other than &#8220;void&#8221; is defined and you return an output; however, this output would still need to be defined in another function to transfer).</p>
<p>However, if you define a function such as: void test(int&#038; arg1,char&#038; arg2); it actually will append the variables that were used to make the input (thus the &#8220;reference&#8221;). So let&#8217;s take a look at some code, shall we?</p>
<blockquote><p><code>/**<br />
 * Reference Operator Tutorial<br />
 *<br />
 * Author: Dennis J. McWherter, Jr.<br />
 * (C) 2010 DENNIS J. MCWHERTER, JR.<br />
 *<br />
 */</p>
<p>#include &lt;iostream&gt;<br />
#include &lt;cstdlib&gt;</p>
<p>using namespace std;</p>
<p>void deconstruct(float&amp; x,float&amp; y)<br />
{<br />
	x/=y;<br />
	y*=x;<br />
	return;<br />
}</p>
<p>void reconstruct(float&amp; x,float&amp; y)<br />
{<br />
	const float z=x;<br />
	x*=y/x;<br />
	y/=z;<br />
	return;<br />
}</p>
<p>int main(int argc,char* argv[])<br />
{<br />
	// Define our main variables we'll be using<br />
	// Allow users to input!<br />
	float a,b;</p>
<p>	cout&lt;&lt; "Enter your first number: ";<br />
	scanf("%f",&amp;a);<br />
	cout&lt;&lt; "Enter your second number: ";<br />
	scanf("%f",&amp;b);<br />
	cout&lt;&lt; endl &lt;&lt; "Output:" &lt;&lt; endl &lt;&lt; endl;</p>
<p>	const float a1=a,b1=b; // Define what our originals were! Please note that this is very recursive<br />
				// and can be done much easier with a function returning a value<br />
				// But that would ruin the entire point of this demonstration! <img src='http://microsonic.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>	// Now we will do our actual functioning<br />
	deconstruct(a,b);<br />
	printf("%f / %f = %f\n",a1,b1,a);<br />
	printf("%f x %f = %f\n\n",b1,a,b);</p>
<p>	// Define our "z" variable for here as well<br />
	const float z=a,w=b;</p>
<p>	// Alright, take everything back to original form<br />
	reconstruct(a,b);<br />
	printf("%f / %f = %f\n",w,z,b);<br />
	printf("%f x %f = %f\n\n",(a1/a1),w,a);<br />
	return 0;<br />
}</code></p></blockquote>
<p>Now, as you can see, the variables are originally defined by user input. However, when taken to each function their values are changed (as can be seen by the printf values). That is what the purpose of a reference operator is. Now to reconstruct, we can use the same variables with opposite operations. The &#8220;const&#8221; defined in front of some variables protect them from being &#8220;referenced&#8221; (precursed with &#038;) so their values will not change after they are defined. And as you can see in the final printf statement, (a1/a1) = 1 which is essentially what happens in the final steps of reconstruct().</p>
<p>As I mentioned, it is very recursive to do it this way (it would be best to simply print an output), but then that would defeat the purpose of this post. Also, for those of you wondering why I used printf(); instead of cout: there is no particular reason. Printf(); in this case (and honestly in most) is simply cleaner and quicker. The thing to remember, however, about printf(); is each function type (in this case %f) has a specific variable type that it can output. %f allows us to print float variables. For a more detailed list, visit http://www.cplusplus.com/reference/clibrary/cstdio/scanf/</p>
<p>Below, you can download the script and a compiled *nix version.</p>
<p>Regards,<br />
Dennis M.</p>
<p><a href='http://microsonic.org/wp-content/uploads/2010/04/reference_operators.tar.gz'>Reference Operators Script</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/H7Wsy45Ba-_A7dw9FsAR3WK71p4/0/da"><img src="http://feedads.g.doubleclick.net/~a/H7Wsy45Ba-_A7dw9FsAR3WK71p4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/H7Wsy45Ba-_A7dw9FsAR3WK71p4/1/da"><img src="http://feedads.g.doubleclick.net/~a/H7Wsy45Ba-_A7dw9FsAR3WK71p4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Microsonic/~4/j6a4yuP8n34" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2010/04/04/using-reference-operators-in-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://microsonic.org/2010/04/04/using-reference-operators-in-functions/</feedburner:origLink></item>
		<item>
		<title>Multi-Argument Parsing</title>
		<link>http://feedproxy.google.com/~r/Microsonic/~3/8XANeSom8Ds/</link>
		<comments>http://microsonic.org/2010/03/15/multi-argument-parsing/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 06:52:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[argc]]></category>
		<category><![CDATA[arguments]]></category>
		<category><![CDATA[argv]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=205</guid>
		<description><![CDATA[Well, it has been some time since my last post since I have been (and still am) very busy, but I felt I needed to update! I wrote a quick script for you guys to help in any programming endeavors you may be having parsing your command line arguments in any command line program. This [...]]]></description>
			<content:encoded><![CDATA[<p>Well, it has been some time since my last post since I have been (and still am) very busy, but I felt I needed to update! I wrote a quick script for you guys to help in any programming endeavors you may be having parsing your command line arguments in any command line program. This example merely shows how to simply print all the arguments given to a specified program, however, you can use this type of loop to do whatever you wish!</p>
<blockquote><p><code>/**<br />
 * Process Command Line Args<br />
 * Level: Easy<br />
 * Author: Dennis J. McWherter, Jr.<br />
 *<br />
 */</p>
<p>#include &lt;iostream&gt;</p>
<p>using namespace std; // I'll save myself some std::&lt;&gt; pain this time XD</p>
<p>void echo(char* str,int no)<br />
{<br />
	int x = strlen(str);<br />
	cout&lt;&lt; "Argument Number "&lt;&lt; no &lt;&lt; ": ";<br />
	for(int i=0;i&lt;x;i++){<br />
		cout&lt;&lt; str[i];<br />
	}<br />
	cout&lt;&lt; endl;<br />
}</p>
<p>int main(int argc,char* argv[])<br />
{<br />
	for(int i=1;i&lt;argc;i++){<br />
		echo(argv[i],i);<br />
	}<br />
	cout&lt;&lt; endl&lt;&lt; "Command line: "&lt;&lt; argv[0] &lt;&lt; endl;<br />
	return 0;<br />
}</code></p></blockquote>
<p>As you can see, the first function is a loop which is given a char* array (it loops through each array value to print out the full string) and an integer position. The int allows the script to know which argument number it is processing (not that it is imperative in this case). In the int main(); function, this void echo(); function is called in another for(); loop. This loop begins at array position 1 (the array starts at position 0, however, arguments begin at 1; 0 is the program/command line name). Therefore, for each argument listed the program loops until it reaches it has no further arguments to parse.</p>
<p>There is your quick lesson today in processing multiple arguments in the command line! This should help many of you looking for a quick and easy solution to do this! The example code is provided below for download.</p>
<p>Regards,<br />
Dennis M.</p>
<p><a href='http://microsonic.org/wp-content/uploads/2010/03/argument_parse.tar.gz'>Parse Multiple Arguments</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/x5tVck3wlwvYenp_iqcioha9tcI/0/da"><img src="http://feedads.g.doubleclick.net/~a/x5tVck3wlwvYenp_iqcioha9tcI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/x5tVck3wlwvYenp_iqcioha9tcI/1/da"><img src="http://feedads.g.doubleclick.net/~a/x5tVck3wlwvYenp_iqcioha9tcI/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Microsonic/~4/8XANeSom8Ds" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2010/03/15/multi-argument-parsing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://microsonic.org/2010/03/15/multi-argument-parsing/</feedburner:origLink></item>
		<item>
		<title>New Year – Lots of Work to be Done!</title>
		<link>http://feedproxy.google.com/~r/Microsonic/~3/5QJOQE5qyZ0/</link>
		<comments>http://microsonic.org/2010/01/21/new-year-lots-of-work-to-be-done/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 21:14:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=203</guid>
		<description><![CDATA[Hey everyone, The new year has brought a tremendous amount of work along with it and I want to thank all of you. I definitely prefer an abundance of work to a scarcity of work, and that is surely the situation I find myself in today. As soon as I finish these projects up, however, [...]]]></description>
			<content:encoded><![CDATA[<p>Hey everyone,</p>
<p>The new year has brought a tremendous amount of work along with it and I want to thank all of you. I definitely prefer an abundance of work to a scarcity of work, and that is surely the situation I find myself in today. As soon as I finish these projects up, however, I will be writing some new tutorials.</p>
<p>In the recent and current projects I&#8217;ve received I have encountered some tasks that I have found unusual and so took some time to figure out an efficient way to complete the task. Not that some of the things haven&#8217;t already been done, but since they are new to me I will try (being not far from the situation of the user seeking help since it was just days or weeks prior that I was in also in that situation) to explain them as thoroughly and simply as possible. </p>
<p>It seems the more familiar a topic becomes, the more difficult it is to relate to the issues of those just learning and that is why I try to write tutorials as soon as I have done something I find intriguing, but also familiarity (as you can see in the PHP/Salt tutorial) is not always a bad thing either because you can easily increase complexity and security. So more or less, it&#8217;s a give and take and I&#8217;m now beginning to ramble. </p>
<p>So in the meantime, hang tight, subscribe, and I will hopefully get these projects done quickly to write some more tutorials. Yes, I know I have been saying this for over a month, but the Holidays were very busy fortunately or unfortunately and work has to come first to tutorials since it&#8217;s a source of income as I&#8217;m sure it is for many of you (and so hopefully a bit easier to sympathize with my cause).</p>
<p>Regards,<br />
Dennis M.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/HjjHoOXA1DeXZxjoqHmukZHg4sA/0/da"><img src="http://feedads.g.doubleclick.net/~a/HjjHoOXA1DeXZxjoqHmukZHg4sA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/HjjHoOXA1DeXZxjoqHmukZHg4sA/1/da"><img src="http://feedads.g.doubleclick.net/~a/HjjHoOXA1DeXZxjoqHmukZHg4sA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Microsonic/~4/5QJOQE5qyZ0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2010/01/21/new-year-lots-of-work-to-be-done/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://microsonic.org/2010/01/21/new-year-lots-of-work-to-be-done/</feedburner:origLink></item>
		<item>
		<title>Happy Holidays to All!</title>
		<link>http://feedproxy.google.com/~r/Microsonic/~3/jK26zad9ywA/</link>
		<comments>http://microsonic.org/2009/12/15/happy-holidays-to-all/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 18:44:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[christmas]]></category>
		<category><![CDATA[happy]]></category>
		<category><![CDATA[merry]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[year]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=201</guid>
		<description><![CDATA[I would just like to thank every user for coming to the site! Unfortunately, my posts have been slow in the past few months (due to many out of town visits as well as the Holidays). Also, Merry Christmas and a Happy New Year to everyone as well! I hope it&#8217;s a wonderful holiday season [...]]]></description>
			<content:encoded><![CDATA[<p>I would just like to thank every user for coming to the site! Unfortunately, my posts have been slow in the past few months (due to many out of town visits as well as the Holidays). Also, Merry Christmas and a Happy New Year to everyone as well! I hope it&#8217;s a wonderful holiday season for you and your family.</p>
<p>Regards,<br />
Dennis M.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/GM6wPnBXuUc9NDUhpsmr0VBqUgE/0/da"><img src="http://feedads.g.doubleclick.net/~a/GM6wPnBXuUc9NDUhpsmr0VBqUgE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/GM6wPnBXuUc9NDUhpsmr0VBqUgE/1/da"><img src="http://feedads.g.doubleclick.net/~a/GM6wPnBXuUc9NDUhpsmr0VBqUgE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Microsonic/~4/jK26zad9ywA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2009/12/15/happy-holidays-to-all/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://microsonic.org/2009/12/15/happy-holidays-to-all/</feedburner:origLink></item>
		<item>
		<title>Why Not All Traffic Is Good Traffic</title>
		<link>http://feedproxy.google.com/~r/Microsonic/~3/Z3yFa8pW6iQ/</link>
		<comments>http://microsonic.org/2009/11/15/why-not-all-traffic-is-good-traffic/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 00:32:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[stats]]></category>
		<category><![CDATA[traffic]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=199</guid>
		<description><![CDATA[Web traffic; it&#8217;s the &#8220;money-maker&#8221; for many webmasters. But is all traffic really a good thing? Well, this is a topic that isn&#8217;t quite &#8220;black and white&#8221; so to speak. Traffic can have many affects on a site, both positive and negative. Ultimately, good traffic is defined as frequent visitors, or a visitor who buys [...]]]></description>
			<content:encoded><![CDATA[<p>Web traffic; it&#8217;s the &#8220;money-maker&#8221; for many webmasters. But is all traffic really a good thing? Well, this is a topic that isn&#8217;t quite &#8220;black and white&#8221; so to speak. Traffic can have many affects on a site, both positive and negative. Ultimately, good traffic is defined as frequent visitors, or a visitor who buys your product (if you&#8217;re selling something). Bad traffic, on the other hand, consists of mostly anything else: spam, abusers, web-surfers, etc.</p>
<p>We will begin by discussing the positive effects of all traffic. Having good traffic, obviously, cannot hurt you. There is no way that comes to mind that I can think of in which good traffic will hurt your site; be it resale value or otherwise (thus its name, &#8220;good&#8221; traffic). If you&#8217;re getting tons of good traffic, your site is booming, and if you ever want to sell it, that raises it&#8217;s value!</p>
<p>Now, bad traffic can also have some (temporarily) &#8220;positive&#8221; effects. If you&#8217;re running a site which does not worry about visitor comments spam hits and robots shouldn&#8217;t be much of a problem for you. In fact, they may make your stats look great at first glance, and you may even be able to catch a gullible buyer and convincing him or her (by not saying anything more than to look at the visitor count) that the traffic is great! However, for those serious domainers, etc. they will check those stats down to the IP&#8217;s of the visits. When they track back all those IP&#8217;s to public proxies, and known spam bots they will throw the name back in your face and your sale will fall through.</p>
<p>So in the end, all traffic does not quite turn into good traffic. It is indeed a great factor for any sale of a site, but visitor turn around is what really matters. So when analyzing your own traffic, check as if you were buying your site up and take steps to minimize spam traffic!</p>
<p>Regards,<br />
Dennis M.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/loBeW6XgVtNmI5dFx0jhvjhC_vA/0/da"><img src="http://feedads.g.doubleclick.net/~a/loBeW6XgVtNmI5dFx0jhvjhC_vA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/loBeW6XgVtNmI5dFx0jhvjhC_vA/1/da"><img src="http://feedads.g.doubleclick.net/~a/loBeW6XgVtNmI5dFx0jhvjhC_vA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Microsonic/~4/Z3yFa8pW6iQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2009/11/15/why-not-all-traffic-is-good-traffic/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://microsonic.org/2009/11/15/why-not-all-traffic-is-good-traffic/</feedburner:origLink></item>
		<item>
		<title>Thoughts or Comments: Re-opening the Hosting Branch</title>
		<link>http://feedproxy.google.com/~r/Microsonic/~3/a3_P9CIDTYI/</link>
		<comments>http://microsonic.org/2009/10/20/thoughts-or-comments-re-opening-the-hosting-branch/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 21:14:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[microsonic]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=197</guid>
		<description><![CDATA[Hey everyone! As many of you may or may not know, Microsonic used to be a hosting company. From 2005-2008 I ran the site as &#8220;Microsonic Hosting.&#8221; In 2009, however, I decided to make it a more specialized place consisting of my thoughts and sharing my skills with others. Today, however, an idea ran across [...]]]></description>
			<content:encoded><![CDATA[<p>Hey everyone!</p>
<p>As many of you may or may not know, Microsonic used to be a hosting company. From 2005-2008 I ran the site as &#8220;Microsonic Hosting.&#8221; In 2009, however, I decided to make it a more specialized place consisting of my thoughts and sharing my skills with others. Today, however, an idea ran across my head: re-open the hosting branch. So in this topic, I&#8217;ll take you through my head a bit more.</p>
<p>Well, what does this entail? The mere thought makes one wonder what would happen to the current site. Well, it would remain the same. As I mentioned, it would be a &#8220;branch&#8221; of Microsonic Development. I actually run &#8220;Microsonic Development&#8221; as a freelance programming company, so I may even revamp this to being much more than simply a blog! A hosting company that is not run by C/O&#8217;s who know very little about what they&#8217;re selling, but rather a professional selling services to another professional. Keeping in mind the reason I closed up shop in the first place, however, is also very important.</p>
<p>Due to lack of business and trying to keep prices low, costs built up and I ended up taking a loss on the whole project unfortunately. Not that I am in it to solely make a profit, but just like for everyone else, finances are tight. But then again, in retrospect it is important to think about what caused the collapse. My lack of advertising was the ultimate beast that did it in in the first place. All clients I had were extremely happy and very upset when I announced the initial closing of the company, however, had more people known about the satisfaction perhaps more members would have joined.</p>
<p>So now, as I continue to ponder my own thoughts, what are you personal thoughts? Perhaps I should specialize? Rather than web hosting, perhaps I will provide shell or VPS hosting? Let me know what you think! Your thoughts are, as usual, very helpful for me as they inspire my decisions about how to proceed in certain actions and what kinds of articles to write!</p>
<p>Regards,<br />
Dennis M.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/Re-dQ85b_ON0OKwyv8W2zWzxVvY/0/da"><img src="http://feedads.g.doubleclick.net/~a/Re-dQ85b_ON0OKwyv8W2zWzxVvY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Re-dQ85b_ON0OKwyv8W2zWzxVvY/1/da"><img src="http://feedads.g.doubleclick.net/~a/Re-dQ85b_ON0OKwyv8W2zWzxVvY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Microsonic/~4/a3_P9CIDTYI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2009/10/20/thoughts-or-comments-re-opening-the-hosting-branch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://microsonic.org/2009/10/20/thoughts-or-comments-re-opening-the-hosting-branch/</feedburner:origLink></item>
		<item>
		<title>Server Maintenance: A Necessary Frustration</title>
		<link>http://feedproxy.google.com/~r/Microsonic/~3/dX5xrP5vI9c/</link>
		<comments>http://microsonic.org/2009/10/10/server-maintenance-a-necessary-frustration/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 14:36:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[frustration]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[necessary]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[updates]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=195</guid>
		<description><![CDATA[I&#8217;d like to begin this post with an apology to all my subscribers. It has been over a month since I&#8217;ve posted anything! This is because I have been involved in a very large project which I should hopefully be finishing very soon (yes, I&#8217;m still not finished with it). And without further adieu: Server [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to begin this post with an apology to all my subscribers. It has been over a month since I&#8217;ve posted anything! This is because I have been involved in a very large project which I should hopefully be finishing very soon (yes, I&#8217;m still not finished with it). And without further adieu: </p>
<p>Server Maintenance. It&#8217;s a love-hate relationship really. One never knows how long it&#8217;s truly going to take, so you generally lose a lot of precious uptime due to it. On the other hand, it keeps the system running strong and fast so it can keep up with other servers.</p>
<p>This server even has some scheduled maintenance coming up very soon (I believe Sunday October, 11 at 9:00am CST, but I could be wrong). But it&#8217;s not always a thing to get angry about. In the time it takes to update the server, most people won&#8217;t lose any clients.</p>
<p>Most companies or users try to find a time (analyzing statistics) where their traffic is the lowest. During this time is when they normally try to schedule maintenance if it&#8217;s possible. This already minimizes the amount of clients lost. Also, maintenance normally lasts an hour or so (but I&#8217;ve had experiences with up to 24) and then you come back to a much faster working network.</p>
<p>So overall, this server maintenance thing is really a blessing in disguise. Although you will get some immediate frustration that you cannot access your site, you will be able to come back to a quick server. Not only quick (by way of RAM), but many times a quicker internet speed as well (a connection update!).</p>
<p>Regards,<br />
Dennis M.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/HkDZcWtH3t6G2hkSVkaPB8F195c/0/da"><img src="http://feedads.g.doubleclick.net/~a/HkDZcWtH3t6G2hkSVkaPB8F195c/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/HkDZcWtH3t6G2hkSVkaPB8F195c/1/da"><img src="http://feedads.g.doubleclick.net/~a/HkDZcWtH3t6G2hkSVkaPB8F195c/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Microsonic/~4/dX5xrP5vI9c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2009/10/10/server-maintenance-a-necessary-frustration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://microsonic.org/2009/10/10/server-maintenance-a-necessary-frustration/</feedburner:origLink></item>
		<item>
		<title>Windows Programming: Creating/Using DLL’s</title>
		<link>http://feedproxy.google.com/~r/Microsonic/~3/URRVNRCLuOI/</link>
		<comments>http://microsonic.org/2009/09/08/windows-programming-creatingusing-dlls/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 02:50:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Italiano]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[vc++]]></category>
		<category><![CDATA[vcpp]]></category>
		<category><![CDATA[visual]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=191</guid>
		<description><![CDATA[In the world of programming, there are MANY different types. Unfortunately, programming for some systems is different than others, but it&#8217;s things like that which keep the world turning. Today, we will discuss what exactly is a Dynamic Link Library (DLL) and how to use them to keep our programming easier and more organized. I [...]]]></description>
			<content:encoded><![CDATA[<p>In the world of programming, there are MANY different types. Unfortunately, programming for some systems is different than others, but it&#8217;s things like that which keep the world turning. Today, we will discuss what exactly is a Dynamic Link Library (DLL) and how to use them to keep our programming easier and more organized. I will also include an Italian translation of this tutorial in the download source below! (Un traduzione del questo tutorial è in il download link per richiesta)</p>
<p>We&#8217;ll begin with what a DLL is and what it&#8217;s purpose is. A DLL is a wonderful tool to keep your programs organized by creating a DLL per set of functions. Also, it helps developers keep their closed source functions closed source, but also allows (with proper documentation/instructions on doing so) other users to use their work. Below we will give a few simple examples on how it all works!</p>
<p>To create the DLL we will be using Microsoft&#8217;s Visual C++. This is a free IDE compiler. I use it for any sort of Windows programming that I may do and will include the solution file in the download. Of course, I prefer GNU&#8217;s GCC which is also free, but the Windows ports of the compiler are not as good as the standard linux version.</p>
<p>The first note that I want to make is that if you&#8217;re making this project on your own (and not using my solution file), be sure to go to Project->Your Project&#8217;s Properties->Configuration Properties->General->Configuration Type and change it to &#8220;Dynamic Library (.dll)&#8221; otherwise it will not compile correctly.</p>
<p>Now in this tutorial, I am assuming you already know how to write programs, so this first file is test_dll.cpp. It contains the actual definitions, etc. of our functions:</p>
<blockquote><p><code>/**<br />
 * Test Dynamic Library File<br />
 *<br />
 * (C) 2009 Dennis J. McWherter, Jr. All Rights Reserved.<br />
 *<br />
 */</p>
<p>#define WIN32_LEAN_AND_MEAN // No need for the extra stuff.<br />
							// Non includere i file cui non hanno un scopo<br />
#include &lt;windows.h&gt;<br />
#include &lt;iostream&gt;<br />
#include "test_dll.h" // Our header file<br />
					  // Il nostro header file</p>
<p>using namespace std;</p>
<p>// Initiate the DLL (For programs)<br />
// Iniziare il DLL (per i programmi)<br />
BOOL APIENTRY DllMain(HINSTANCE dllHinst, DWORD reason, LPVOID lpvReserved){<br />
	// Use a switch to tell the program how to cycle the processes<br />
	// Usare un switch per fare il programma funziona<br />
	switch(reason){<br />
		case DLL_PROCESS_ATTACH:<br />
		break;<br />
		case DLL_PROCESS_DETACH:<br />
		break;<br />
		case DLL_THREAD_ATTACH:<br />
		break;<br />
		case DLL_THREAD_DETACH:<br />
		break;<br />
	}<br />
	return true;<br />
}</p>
<p>// The functions of our class. These are defined in "test_dll.h"<br />
// Le funzioni del nostro class. Gli questi sono definire in "test_dll.h"</p>
<p>// Constructor<br />
test_dll::test_dll(){}</p>
<p>// Basically a pointless function just to see how we can make them work together XD<br />
// Una funziona senza la usa. è più di un demonstrazione.<br />
char test_dll::func1(char lang){<br />
	return lang;<br />
}</p>
<p>int test_dll::func2(float x,float y,char op){<br />
	// Simple math function!<br />
	// Semplice funziona della matematica<br />
	switch(op){<br />
		case 'a':<br />
			cout&lt;&lt; x &lt;&lt; "+" &lt;&lt; y &lt;&lt; "=" &lt;&lt; x+y;<br />
			return 0;<br />
		break;<br />
		case 's':<br />
			cout&lt;&lt; x &lt;&lt; "-" &lt;&lt; y &lt;&lt; "=" &lt;&lt; x-y;<br />
			return 0;<br />
		break;<br />
		case 'd':<br />
			cout&lt;&lt; x &lt;&lt; "/" &lt;&lt; y &lt;&lt; "=" &lt;&lt; x/y;<br />
			return 0;<br />
		break;<br />
		default:<br />
			cout&lt;&lt; x &lt;&lt; "*" &lt;&lt; y &lt;&lt; "=" &lt;&lt; x*y;<br />
			return 0;<br />
		break;<br />
	}<br />
	return 0;<br />
}<br />
</code></p></blockquote>
<p>Again, a fairly straightforward example. What you do have to notice in this that is different from most programs is that fact that we&#8217;re not really calling a &#8220;Main&#8221; function to be run. We call BOOL WINAPI <strong>DllMain</strong> instead. This next file is the header file. A rather important file overall as it let&#8217;s us know what to export.</p>
<blockquote><p><code><br />
 /**<br />
 * Test Dynamic Library File<br />
 *<br />
 * (C) 2009 Dennis J. McWherter, Jr. All Rights Reserved.<br />
 *<br />
 */</p>
<p>#ifndef HEADER<br />
#define HEADER<br />
	// To keep the code clean we'll define this with a macro but this tells the processor<br />
		// to export whichever function/class it preceeds.<br />
	// Ci definiamo il questo con un macro ma ci vedremmo come lo funziona in più ritardo<br />
#define EXPORT_DLL __declspec(dllexport)</p>
<p>// Now our class - If you export a class, all its functions come with! <img src='http://microsonic.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  else do each function<br />
// Adesso il nostro class! Se exporti un class poi i tutti funzione di lo sono exportare.<br />
	// se individuale ti exporti poi si deve __declspec(dllexport) per ogni<br />
class EXPORT_DLL test_dll{ // = class __declspec(dllexport) test_dll{<br />
public:<br />
	test_dll(); // Constructor/Costruttore<br />
	char func1(char lang); // First function definition/La definizione della prima funziona<br />
	int func2(float x,float y,char op);<br />
};</p>
<p>#endif<br />
</code></p></blockquote>
<p>The comments explain it, but it&#8217;s really worth going over again. EXPORT_DLL is defined just for the purpose that we could potentially have more than a single class to export. This goes both ways for the dllexport and dllimport options, so really, EXPORT_DLL just translates to __declspec(dllexport) which would also work if you replaced EXPORT_DLL. Now, compile that code and VC++ should provide you with a .dll file and a .lib file with whatever name you gave the project (in our case: &#8220;DLL_Tutorial.lib/.dll&#8221;).</p>
<p>Now, you cannot run DLL files by themselves; you need a client program (.exe) which is what we&#8217;re getting to now. For the sake of brevity, we will just make this a simple console program which runs the proper functions. Now, create a new project and make sure you copy the &#8220;DLL_Tutorial.lib&#8221; file into the source directory. You need the .lib file to compile the client program, but you only need the .dll to run the program.</p>
<p>So here is the client main file. A console program of course to keep things simple <img src='http://microsonic.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  We&#8217;ll call this test_client.cpp</p>
<blockquote><p><code>/**<br />
 * Test Dynamic Library File<br />
 *<br />
 * (C) 2009 Dennis J. McWherter, Jr. All Rights Reserved.<br />
 *<br />
 */</p>
<p>#include &lt;iostream&gt;<br />
#include &lt;string&gt;<br />
#include "test_client.h"</p>
<p>using namespace std;</p>
<p>int main(){<br />
	// Create object to class<br />
	// Creare l'oggetto a class<br />
	test_dll test;</p>
<p>	// Init var<br />
	string num1,num2,addition,subtraction,division,multiplication,ans,operation;<br />
	float x,y;<br />
	char choice[5], op[5]; // Allow more chars just in case - otherwise we'll break the script <img src='http://microsonic.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
						   // Permettere dei più caratteri così non ci romperiamo il script! <img src='http://microsonic.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
	cout&lt;&lt; "Please select a language\r\n\r\nEnglish - en\r\nItaliano - it\r\n \r\nSelect: ";<br />
	cin&gt;&gt;choice;<br />
	switch(test.func1(choice[0])){<br />
		case 'i':<br />
			num1 = "Numero 1: ";<br />
			num2 = "Numero 2: ";<br />
			addition = "Per piacere selezi i tuoi numeri per aggiungiere";<br />
			subtraction = "Per piacere selezi i tuoi numeri per sottrarre";<br />
			division = "Per piacere selezi i tuoi numeri per dividere";<br />
			multiplication = "Per piacere selezi i tuoi numeri per moltiplicare";<br />
			ans = "La tua risposta: ";<br />
			operation = "\r\nPer piacere selezi il tuo operazione:\r\na - Aggiungiere\r\ns - Sottrarre\r\nd - Divisione\r\nm - Moltiplicazione\r\n\r\nSelection: ";<br />
		break;<br />
		default:<br />
			num1 = "Number 1: ";<br />
			num2 = "Number 2: ";<br />
			addition = "Please select your numbers to add";<br />
			subtraction = "Please select your numbers to subtract";<br />
			division = "Please select your numbers to divide";<br />
			multiplication = "Please select your numbers to multiply";<br />
			ans = "Your answer: ";<br />
			operation = "\r\nPlease select your option:\r\na - Addition\r\ns - subtraction\r\nd - Division\r\nm - Multiplication\r\n\r\nSelection: ";<br />
		break;<br />
	}</p>
<p>	cout&lt;&lt; operation;<br />
	cin&gt;&gt;op;<br />
	cout&lt;&lt; endl &lt;&lt; endl &lt;&lt; num1;<br />
	cin&gt;&gt;x;<br />
	cout&lt;&lt; endl &lt;&lt; num2;<br />
	cin&gt;&gt;y;</p>
<p>	test.func2(x,y,op[0]);</p>
<p>	cout&lt;&lt; endl &lt;&lt; endl &lt;&lt; "Type in anything to exit...";<br />
	cin&gt;&gt;op;</p>
<p>	return 0;<br />
}</code></p></blockquote>
<p>Naturally, the header file that follows is test_client.h</p>
<blockquote><p><code>/**<br />
 * Test Dynamic Library File<br />
 *<br />
 * (C) 2009 Dennis J. McWherter, Jr. All Rights Reserved.<br />
 *<br />
 */</p>
<p>#ifndef TEST_HEADER<br />
#define TEST_HEADER<br />
#define DLL_IMPORT __declspec(dllimport) // Same concept as export<br />
									     // Il stesso concepto come export</p>
<p>// Define the class</p>
<p>// What is the purpose of redefining? That's all you need to do is redefine structure <img src='http://microsonic.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
	// and not function <img src='http://microsonic.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
// Perchè ti deve ridefinire la class? Perché solo lo struttura si deve essere definire!<br />
	// e no funziona <img src='http://microsonic.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
class DLL_IMPORT test_dll{<br />
public:<br />
	test_dll(); // Constructor/Costruttore<br />
	char func1(char lang); // First function definition/La definizione della prima funziona<br />
	int func2(float x,float y,char op);<br />
};</p>
<p>#endif</code></p></blockquote>
<p>Within these two files, they are essentially creating a calculator. Since I wrote this program in dual languages, I added SIMPLE (meaning hard-coded) dual language support into the program. Also, this gives a reason for the first function, just to see how one can use multiple functions from a DLL just as if they were in the source.</p>
<p>If anyone has further questions or is receiving errors, feel free to let me know and I will be glad to help! Now make sure, however, that everything is set right as well. I ran into an error compiling the client the first time because my project subsystem (found in project properties->linker->System) was set to WINDOWS rather than CONSOLE so it was looking for the WINMAIN where there was none. So just a word of caution to anyone trying this without my source and you are receiving a WINMAIN compilation error.</p>
<p>So the land of DLL&#8217;s really aren&#8217;t as complex as it seems. It&#8217;s simply a closed source utility which helps other developers in WINDOWS programs.</p>
<p>Regards,<br />
Dennis M.</p>
<p><a href='http://microsonic.org/2009/09/08/windows-programming-creatingusing-dlls/dll_tutorial/' rel='attachment wp-att-192'>DLL Tutorial Source Code and Binaries</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/soLACD2i8mlh1oJ8oA941fZtFlw/0/da"><img src="http://feedads.g.doubleclick.net/~a/soLACD2i8mlh1oJ8oA941fZtFlw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/soLACD2i8mlh1oJ8oA941fZtFlw/1/da"><img src="http://feedads.g.doubleclick.net/~a/soLACD2i8mlh1oJ8oA941fZtFlw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Microsonic/~4/URRVNRCLuOI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2009/09/08/windows-programming-creatingusing-dlls/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://microsonic.org/2009/09/08/windows-programming-creatingusing-dlls/</feedburner:origLink></item>
	</channel>
</rss>
