<?xml version='1.0' encoding='utf-8'?>
<rss version='2.0'>
   <channel>
      <title>Programming and Web Development Tutorials</title>
      <link>http://tutorials.dreamincode.net</link>
      <description>Web Development, Programming, and Coding Community. Browse forums, snippets, and tutorials to get you on the right track. Experts in C++, PHP, VisualBasic, HTML, JavaScript, ColdFusion, and more!</description>
         <item>
            <link>http://forums.dreamincode.net/showtopic139298.htm</link>
            <title>Installing the LAMP Server on Ubuntu in Linux Tutorials</title>
            <description>In this tutorial we are going to install the LAMP server on Ubuntu.  I will be installing this on a fairly recent install of Ubuntu 8.04 LTS&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The first thing we want to do is install apache2.&lt;br /&gt;&lt;br /&gt;Open your terminal and type:&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;sudo apt-get install apache2&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;You will probably be prompted for a password to install as root, enter it and then press &amp;quot;y&amp;quot; to proceed with the install. After everything installs, the following commands will give you the ability to start and stop apache2.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt; sudo /etc/init.d/apache2 start&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt; sudo /etc/init.d/apache2 stop&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Once installed point your browser to &lt;a href=&quot;http://localhost&quot; target=&quot;_blank&quot;&gt;http://localhost&lt;/a&gt; - there you should see a message claiming it worked.  &lt;br /&gt;&lt;br /&gt;[attachmentid=14895]&lt;br /&gt;&lt;br /&gt;The directory you will be working out of is /var/www/&lt;br /&gt;&lt;br /&gt;[attachmentid=14897]&lt;br /&gt;&lt;br /&gt;That&amp;#39;s it time to install PHP.&lt;br /&gt;&lt;br /&gt;Open your terminal and type: &lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;sudo apt-get install php5 libapache2-mod-php5&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Once the process completes, restart apache by typing into the terminal:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;sudo /etc/init.d/apache2 restart&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;To test our install of php open up gedit or your favorite text editor and create a file called test.php &lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;phpinfo&amp;#40;&amp;#41;;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;make sure you save it in the /var/www/ directory, open your browser and type &lt;a href=&quot;http://localhost/test.php&quot; target=&quot;_blank&quot;&gt;http://localhost/test.php&lt;/a&gt; to ensure the phpinfo file we created appears and our install was successful. &lt;br /&gt;&lt;br /&gt;[attachmentid=14896]&lt;br /&gt;&lt;br /&gt;*** When doing this step, my permissions weren&amp;#39;t enabled to write/delete files because I wasn&amp;#39;t logged in as root.  So lets do a change ownership of the directory.  There are lots of ways to do this step, but for now just type into your terminal.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;sudo chown nykc /var/www/&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;be sure to change the [username] with your username...&lt;br /&gt;&lt;br /&gt;Ok we are now 2/3 of the way there, all that is left is MySQL.&lt;br /&gt;&lt;br /&gt;To install MySQL:&lt;br /&gt;&lt;br /&gt;Open up the terminal and type:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;sudo apt-get install mysql-server&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;you will be advised to create a root password for MySQL - go ahead and create that and continue with the install.&lt;br /&gt;&lt;br /&gt;MySQL should now be installed.&lt;br /&gt;&lt;br /&gt;Open up the terminal and type the following:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;this will install a program called phpMyAdmin which is a nice graphical tool used to edit your database.  Make sure you select apache2 when prompted then continue with the install.&lt;br /&gt;&lt;br /&gt;[attachmentid=14898]&lt;br /&gt;&lt;br /&gt;Now to get php working with myqsl type the following into the terminal.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;gksudo gedit /etc/php5/apache2/php.ini&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;find the following commented line in the document.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extension=mysql.so&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;remove the &amp;quot;;&amp;quot; so the line now reads&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;extension=mysql.so&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;now let&amp;#39;s restart apache2 again...&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;sudo /etc/init.d/apache2 restart&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;open up your terminal type: &lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;mysql -uname -p&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;replace -uname with your -u username enter your newly created password and you are ready to configure.&lt;br /&gt;&lt;br /&gt;[attachmentid=14899]</description>
			<pubDate>Sun, 15 Nov 2009 19:56:36 -0600</pubDate>
			<category>Linux Tutorials</category>
			<author>Nykc</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic138978.htm</link>
            <title>Using Recaptcha to your registration form in PHP Tutorials</title>
            <description>Have you seen website registration page lately? See that image where there are texts, words, alphanumeric or phrase that you need to type? That is what we called CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart). Before, if you want to incorporate captcha into your page, you have to make some functions in php to convert your string into an image. And you have to enable image functions of PHP to generate the image. Not this time&amp;#33; No more hassle. Just use reCAPTCHA.&lt;br /&gt;&lt;br /&gt;reCAPTCHA is a free, secure and accessible CAPTCHA implementation. Today let us talk on how to incorporate reCAPTCHA to your registration page. I assume that you already know how to make a registration form and that the current task that you are going to do right now is just to integrate reCAPTCHA.&lt;br /&gt;&lt;br /&gt;To start with, you have to create a reCAPTCHA account. Follow this link. Once you have created your account, type the domain name. You can choose the “Enable this key on all domains (global key)” if you will be using the key for several domain/websites.&lt;br /&gt;&lt;br /&gt;Click the CREATE KEY button. You have to remember your public and private key because you will be using that one in your code. Before we will go back to your code, download this recaptcha library.&lt;br /&gt;&lt;br /&gt;Now back to your code. Supposing you have&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&amp;#60;form name=”form1&amp;#8243; method=”post” action=”testformsave.php”&amp;#62;&lt;br /&gt;First name&amp;#58; &amp;#60;input type=”text” name=”firstname” id=”firstname”&amp;#62;&lt;br /&gt;Last name&amp;#58; &amp;#60;input type=”text” name=”lastname” id=”lastname” /&amp;#62;&lt;br /&gt;&amp;#60;input type=”submit” name=”cmbsubmit” id=”cmbsubmit” value=”Submit”&amp;#62;&lt;br /&gt;&amp;#60;/form&amp;#62;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Insert this code after the Last Name line&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&amp;#60;?php&lt;br /&gt;require_once&amp;#40;’recaptchalib.php’&amp;#41;;&lt;br /&gt;&amp;#036;publickey = “”;&lt;br /&gt;echo recaptcha_get_html&amp;#40;&amp;#036;publickey&amp;#41;;&lt;br /&gt;?&amp;#62;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;See to it that the library is on the same path as your registration page. The &amp;#036;publickey should contain the key that you have from reCAPTCHA.&lt;br /&gt;&lt;br /&gt;Once that is done, go to your page that handles the form submitted. Let us say you have all ready the script that will save registrant’s data to your database. You can see my other tutorial here.  All you have to do is to inject on the top the&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&amp;#60;?php&lt;br /&gt;require_once&amp;#40;’recaptchalib.php’&amp;#41;;&lt;br /&gt;&amp;#036;privatekey = ” “;&lt;br /&gt;&amp;#036;resp = recaptcha_check_answer &amp;#40;&amp;#036;privatekey,&amp;#036;_SERVER&amp;#91;&amp;#34;REMOTE_ADDR&amp;#34;&amp;#93;,&amp;#036;_POST&amp;#91;&amp;#34;recaptcha_challenge_field&amp;#34;&amp;#93;,&lt;br /&gt;&amp;#036;_POST&amp;#91;&amp;#34;recaptcha_response_field&amp;#34;&amp;#93;&amp;#41;;&lt;br /&gt;&lt;br /&gt;if &amp;#40;&amp;#33;&amp;#036;resp-&amp;#62;is_valid&amp;#41;&lt;br /&gt;{&lt;br /&gt;die &amp;#40;”The reCAPTCHA wasn’t entered correctly. Go back and try it again.” . “&amp;#40;reCAPTCHA said&amp;#58; ” . &amp;#036;resp-&amp;#62;error . “&amp;#41;”&amp;#41;;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;put your code here.&lt;br /&gt;}&lt;br /&gt;?&amp;#62;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;The &amp;#036;privatekey variable should contain the key given to you by reCAPTCHA. Thats it&amp;#33; You have made your registration page as spam-free as possible.&lt;br /&gt;&lt;br /&gt;Happy coding&lt;br /&gt;</description>
			<pubDate>Sat, 14 Nov 2009 04:46:01 -0600</pubDate>
			<category>PHP Tutorials</category>
			<author>felixtgomezjr</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic137858.htm</link>
            <title>File IO with Numberic Data in C++ Tutorials</title>
            <description>This tutorial will demonstrate how to read a file line by line, then show how to manipulate the lines: convert to number, store in vectors, and even tokenize&lt;br /&gt;&lt;br /&gt;How do i open a file?&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;#include &amp;#60;iostream&amp;#62;&lt;br /&gt;#include &amp;#60;fstream&amp;#62; // needed for file functions&lt;br /&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;int main&amp;#40;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ifstream in&amp;#40;&amp;#34;yourFile.txt&amp;#34;&amp;#41;; // open file for reading&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;#40;&amp;#33;in.is_open&amp;#40;&amp;#41;&amp;#41; // if file is not open - exit&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit&amp;#40;1&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;in.close&amp;#40;&amp;#41;; // close file&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//pause window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cin.ignore&amp;#40;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cin.get&amp;#40;&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;simple right?&lt;br /&gt;&lt;br /&gt;But how do I read the file?&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;#include &amp;#60;iostream&amp;#62;&lt;br /&gt;#include &amp;#60;fstream&amp;#62; &lt;br /&gt;#include &amp;#60;string&amp;#62; // used for getline and string&lt;br /&gt;using namespace std;&lt;br /&gt;int main&amp;#40;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ifstream in&amp;#40;&amp;#34;yourFile.txt&amp;#34;&amp;#41;; &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;#40;&amp;#33;in.is_open&amp;#40;&amp;#41;&amp;#41; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit&amp;#40;1&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;string line = &amp;#34;&amp;#34;; // The file will buffer every line into this string&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while&amp;#40;getline&amp;#40;in,line&amp;#41;&amp;#41; // loop through the file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cout&amp;#60;&amp;#60;line&amp;#60;&amp;#60;endl; // output every line to the screen&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;in.close&amp;#40;&amp;#41;; &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//pause window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cin.ignore&amp;#40;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cin.get&amp;#40;&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Getline will loop through every line in the file and it will store that line temporarly in the string&lt;br /&gt;&lt;br /&gt;So now you can read a file right? But what if you want to do data operations that involve actual numbers?&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;#include &amp;#60;iostream&amp;#62;&lt;br /&gt;#include &amp;#60;fstream&amp;#62; &lt;br /&gt;#include &amp;#60;string&amp;#62; &lt;br /&gt;#include &amp;#60;vector&amp;#62;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;int main&amp;#40;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ifstream in&amp;#40;&amp;#34;yourFile.txt&amp;#34;&amp;#41;; &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;#40;&amp;#33;in.is_open&amp;#40;&amp;#41;&amp;#41; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit&amp;#40;1&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;string line = &amp;#34;&amp;#34;; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;vector&amp;#60;double&amp;#62;numbers&amp;#40;0&amp;#41;; // This vector will be used to store all of the data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while&amp;#40;getline&amp;#40;in,line&amp;#41;&amp;#41; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;numbers.push_back&amp;#40;atoi&amp;#40;line.c_str&amp;#40;&amp;#41;&amp;#41;&amp;#41;; //atoi expects a const char so you must convert&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// you now have all of the lines stored in the vector as doubles&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// lets output the vector&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for&amp;#40;int i=0; i&amp;#60;numbers.size&amp;#40;&amp;#41;; i++&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cout&amp;#60;&amp;#60;numbers&amp;#91;i&amp;#93;&amp;#60;&amp;#60;endl; // output to screen&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;in.close&amp;#40;&amp;#41;; &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//pause window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cin.ignore&amp;#40;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cin.get&amp;#40;&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;This method works fine if your file is in the following format&lt;br /&gt;&lt;!--quoteo--&gt;&lt;div class='quotetop'&gt;QUOTE&lt;/div&gt;&lt;div class='quotemain'&gt;&lt;!--quotec--&gt;&lt;br /&gt;12345&lt;br /&gt;12345&lt;br /&gt;12345&lt;br /&gt;12345&lt;br /&gt;&lt;!--QuoteEnd--&gt;&lt;/div&gt;&lt;!--QuoteEEnd--&gt;&lt;br /&gt;But sometimes our data is stored like this in our file&lt;br /&gt;&lt;!--quoteo--&gt;&lt;div class='quotetop'&gt;QUOTE&lt;/div&gt;&lt;div class='quotemain'&gt;&lt;!--quotec--&gt;&lt;br /&gt;12345 12345 12345 12345&lt;br /&gt;12345 12345 12345 12345&lt;br /&gt;&lt;!--QuoteEnd--&gt;&lt;/div&gt;&lt;!--QuoteEEnd--&gt;&lt;br /&gt;well how do we store the individual numbers? ... by tokenizing&lt;br /&gt;&lt;br /&gt;example:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;#include &amp;#60;iostream&amp;#62;&lt;br /&gt;#include &amp;#60;fstream&amp;#62; &lt;br /&gt;#include &amp;#60;string&amp;#62; &lt;br /&gt;#include &amp;#60;vector&amp;#62;&lt;br /&gt;#include &amp;#60;sstream&amp;#62;// used for istringstream&lt;br /&gt;using namespace std;&lt;br /&gt; // this function takes a string pointer and pushes numbers into a&lt;br /&gt;// vector by tokenizing the string at spaces &amp;#39; &amp;#39;&lt;br /&gt;void parse&amp;#40;string *ext, vector&amp;#60;int&amp;#62;&amp;amp;types&amp;#41;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;istringstream iss&amp;#40;*ext&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;string token;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// you can replace &amp;#39; &amp;#39; with whatever you&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// would like to parse at&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while&amp;#40;getline&amp;#40;iss,token,&amp;#39; &amp;#39;&amp;#41;&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;types.push_back&amp;#40;atoi&amp;#40;token.c_str&amp;#40;&amp;#41;&amp;#41;&amp;#41;; // push numbers into vector&lt;br /&gt;}&lt;br /&gt;int main&amp;#40;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ifstream in&amp;#40;&amp;#34;yourFile.txt&amp;#34;&amp;#41;; &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;#40;&amp;#33;in.is_open&amp;#40;&amp;#41;&amp;#41; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit&amp;#40;1&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;string line = &amp;#34;&amp;#34;; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;vector&amp;#60;int&amp;#62;numbers&amp;#40;0&amp;#41;; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while&amp;#40;getline&amp;#40;in,line&amp;#41;&amp;#41; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// call our function&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parse&amp;#40;&amp;amp;line,numbers&amp;#41;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for&amp;#40;int i=0; i&amp;#60;numbers.size&amp;#40;&amp;#41;; i++&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cout&amp;#60;&amp;#60;numbers&amp;#91;i&amp;#93;&amp;#60;&amp;#60;endl; // output to screen&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;in.close&amp;#40;&amp;#41;; &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//pause window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cin.ignore&amp;#40;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cin.get&amp;#40;&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;I hope this left you with a farther understand of file IO and using IO for numberic data&lt;br /&gt;&lt;br /&gt;</description>
			<pubDate>Mon, 09 Nov 2009 16:11:19 -0600</pubDate>
			<category>C++ Tutorials</category>
			<author>ImaSexy</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic137293.htm</link>
            <title>Networking tutorial in C++ Tutorials</title>
            <description>Well Done.  &lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/icon_up.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;:^:&quot; border=&quot;0&quot; alt=&quot;icon_up.gif&quot; /&gt;</description>
			<pubDate>Sat, 14 Nov 2009 00:40:00 -0600</pubDate>
			<category>C++ Tutorials</category>
			<author>born2c0de</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic137121.htm</link>
            <title>Bash Scripting Basics in Linux Tutorials</title>
            <description>Hi, In this tutorial we are going to learn how to write bash scripts to do some useful stuff you may need in daily use.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Creating The Script File&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;fire up your favorite text editor (vim for me) and create a file with no extension, for example, I use &amp;quot;mybackup&amp;quot;. So I must write this in the Terminal: &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;vim mybackup&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;Ok, now we created the file itself, what next? here we go...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Writing A Simple Script&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;In every bash script you write, you must define where your bash interpreter is located. But how can one find where it is? just do this in Terminal: &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;which bash&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;for me, output is: &lt;i&gt;/bin/bash&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Now, at first line of your script file (for me it is &amp;quot;mybackup&amp;quot;) write the following:&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;#&amp;#33;/bin/bash&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;Simply, it&amp;#39;s a &amp;quot;#&amp;#33;&amp;quot; and right after it, the location of your bash interpreter you got with issuing the command &lt;i&gt;&amp;quot;which bash&amp;quot;&lt;/i&gt;. This was all need to be done in the first line. After it, we are going to actually put our own commands to be executed. The script I want to write is going to be used backup my home directory which contains my personal files and (Top Secret&amp;#33;) projects I do daily.&lt;br /&gt;&lt;br /&gt;Ok, in the line after the &lt;i&gt;&amp;quot;#&amp;#33;/bin/bash&amp;quot;&lt;/i&gt; in the script, we have to add the command which does the backup process, which is going to be a simple &lt;i&gt;&amp;quot;tar&amp;quot;&lt;/i&gt; command to store user&amp;#39;s home directory in a single tar file.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;#&amp;#33;/bin/bash&lt;br /&gt;tar -cvf backup.tar /home/kian/&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;What this command says is: create the tar file &amp;quot;backup.tar&amp;quot; and store the contents of folder &amp;quot;/home/kian&amp;quot; which is my home directory. The &amp;quot;-v&amp;quot; option tells the tar command to print detailed info while executing.&lt;br /&gt;&lt;br /&gt;Ok, now I want to show you how to print sentences from your script, you just have to use the command &amp;quot;echo&amp;quot; and give it a sentence to print on screen.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;#&amp;#33;/bin/bash&lt;br /&gt;tar -cvf backup.tar /home/kian/&lt;br /&gt;echo &amp;#34;Backup Created Successfully&amp;#33;&amp;#33;&amp;#33; &amp;#58;D&amp;#34;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;Don&amp;#39;t forget to put your text between quotes&amp;#33;&lt;br /&gt;&lt;br /&gt;Is there a way to put comments so that the script will be more readable by users? Yes&amp;#33; you just have to put a &amp;quot;#&amp;quot; mark at the first of the line you want it to be commented. Don&amp;#39;t mix it with the &amp;quot;&amp;#33;#&amp;quot; we have at the first line, that one is not for commenting. Here, the completed script looks like this:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;#&amp;#33;/bin/bash&lt;br /&gt;#Creating Tar File - Backing Up User&amp;#39;s Directory&lt;br /&gt;tar -cvf backup.tar /home/kian/&lt;br /&gt;#Printing A Sentence On Screen Using Echo&lt;br /&gt;echo &amp;#34;Backup Created Successfully&amp;#33;&amp;#33;&amp;#33; &amp;#58;D&amp;#34;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Finishing It Up&amp;#33;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;Now that our script is finished, save the file and issue the following command in Terminal to make the script file executable:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;chmod ugo+x mybackup&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;To execute the code, write this in Terminal:&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;/path/to/script/file/mybackup&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Now our script is ready to be used&amp;#33;  &lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/cool.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;B)&quot; border=&quot;0&quot; alt=&quot;cool.gif&quot; /&gt; &lt;br /&gt;&lt;br /&gt;Hope this tutorial helped you get started with bash scripting.</description>
			<pubDate>Fri, 06 Nov 2009 12:34:38 -0600</pubDate>
			<category>Linux Tutorials</category>
			<author>Anarion</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic136884.htm</link>
            <title>Remove System Beep in Linux Tutorials</title>
            <description>Some people (including myself) hate that nasty beep, when it starts to sound, I start to get a headache. Is there a way to remove it? Yes and it&amp;#39;s quite easy. Just to the following:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;(you can use gedit or any editor of your choice instead of vim)&lt;/i&gt;&lt;br /&gt;&lt;b&gt;1. if you want to disable the beep temporarily&lt;/b&gt; (until the next startup)&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;sudo rmmod pcspkr&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;Go and check, it is gone&amp;#33;&amp;#33;&amp;#33;  &lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/biggrin.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;:D&quot; border=&quot;0&quot; alt=&quot;biggrin.gif&quot; /&gt; &lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. if you want to disable it forever&lt;/b&gt; (until you enable it again)&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;sudo vim /etc/modprobe.d/blacklist&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;then add this line in the file:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;blacklist pcspkr&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;now save the file and from the next reboot, you won&amp;#39;t hear it again.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3. another way to disable it forever&lt;/b&gt; (until enabling it again)&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;sudo vim /etc/inputrc&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;now, look for the line where it says &amp;quot;set bell-style audible&amp;quot;, change it to one of these:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;set bell-style visible&lt;br /&gt;#or&lt;br /&gt;set bell-style none&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;save and reboot and &lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/biggrin.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;:D&quot; border=&quot;0&quot; alt=&quot;biggrin.gif&quot; /&gt; it is gone.&lt;br /&gt;&lt;br /&gt;Hope this tutorial helped you get free of the annoying beep when you work with system.  &lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/wink2.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;;)&quot; border=&quot;0&quot; alt=&quot;wink2.gif&quot; /&gt;</description>
			<pubDate>Thu, 05 Nov 2009 16:34:37 -0600</pubDate>
			<category>Linux Tutorials</category>
			<author>Anarion</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic136277.htm</link>
            <title>Hash Table and It&#39;s Usage in C++ Tutorials</title>
            <description>&lt;blockquote&gt;Hi&amp;#33; this is my first tutorial and I&amp;#39;m going to explain how hashing and hash table works and how to use it. OK, but what is &lt;b&gt;Hash Table&lt;/b&gt; actually and how can it benefit us? well, a Hash Table is a type of table in which we can use each record&amp;#39;s id to retrieve the it&amp;#39;s data easily. So, each record must have a unique id, which is going to be an int higher than or equal to 1. And another thing to mention, we use a value of &lt;b&gt;-1&lt;/b&gt; for id for each empty record&amp;#39;s id.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Hash Function&lt;/b&gt;&lt;br /&gt;For this tutorial, I used the following simple function to hash a given id:&lt;br /&gt;&lt;blockquote&gt;&lt;b&gt;hash(id) = id%size;&lt;/b&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;blockquote&gt;size is the length of our table, which has to be a prime number. I used 51 in this tutorial. The reason why it needs to be prime is that, if we don&amp;#39;t use a prime number, the resulting hashed value will be zero for each id divideable by size. But if we use a prime number for size, then we decrease the chance of id being divideable by size.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Collisions&lt;/b&gt;&lt;br /&gt;&lt;blockquote&gt;When inserting items into a hash table, it sometimes happens that an item to be inserted in table has a hash value that points to an already existing location in table. The new item typically is inserted somewhere else, though we must be sure that there is still a way to look up the item.&lt;/blockquote&gt;&lt;br /&gt;One of the simplest ways to overcome collisions is to use a rehash function:&lt;br /&gt;&lt;blockquote&gt;&lt;b&gt;rehash(id) = (id+1)%size;&lt;/b&gt;&lt;/blockquote&gt;&lt;br /&gt;Note: When we hash an id and check and see that it is already taken, we give the hashed id to rehash function.&lt;br /&gt;&lt;br /&gt;OK, now here&amp;#39;s an example program I wrote to implement a hash table and function. It&amp;#39;s quite straight forward but I commented it too:&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;#include &amp;#60;iostream&amp;#62;&lt;br /&gt;#include &amp;#60;string&amp;#62;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;//data structure to hold id and data, our data-structure we want to use&lt;br /&gt;struct data {&lt;br /&gt;public&amp;#58;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int id; //to hold a unique id for each element&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int data; //the data for each element, I used a simple int&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;class hasher {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;data dt&amp;#91;51&amp;#93;; //the table to hold hashed data structs&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int numel; //number of elements in table, to check if it&amp;#39;s full&lt;br /&gt;public&amp;#58;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hasher&amp;#40;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int hash&amp;#40;int &amp;amp;id&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int rehash&amp;#40;int &amp;amp;id&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int add&amp;#40;data &amp;amp;d&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int remove&amp;#40;data &amp;amp;d&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;void output&amp;#40;&amp;#41;;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;/*this is the function to give hashed id, it&amp;#39;s a simple one...&lt;br /&gt;It&amp;#39;s better that we use a prime number for our length, thats why I used 11&lt;br /&gt;and the bigger possible, it&amp;#39;s better because we reduce our collisions*/&lt;br /&gt;int hasher&amp;#58;&amp;#58;hash&amp;#40;int &amp;amp;id&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return &amp;#40;id%51&amp;#41;;&lt;br /&gt;}&lt;br /&gt;/*in case of ay collision&amp;#40;a hashed value which is already occupied before&amp;#41;&lt;br /&gt;we use rehash function instead of hash*/&lt;br /&gt;int hasher&amp;#58;&amp;#58;rehash&amp;#40;int &amp;amp;id&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return &amp;#40;&amp;#40;id+1&amp;#41;%51&amp;#41;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;hasher&amp;#58;&amp;#58;hasher&amp;#40;&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//create an array of data structure&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for&amp;#40;i=0;i&amp;#60;=50;i++&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt&amp;#91;i&amp;#93;.id = -1; //set all ids to -1 to show they&amp;#39;re empty&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt&amp;#91;i&amp;#93;.data = 0; //set all data values to 0, which is default&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;numel = 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int hasher&amp;#58;&amp;#58;add&amp;#40;data &amp;amp;d&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;#40;numel &amp;#60; 51&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//table has empty places...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int hashed = hash&amp;#40;d.id&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;#40;hashed &amp;#62;= 0 &amp;amp;&amp;amp; hashed &amp;#60;= 50 &amp;amp;&amp;amp; dt&amp;#91;hashed&amp;#93;.id == -1&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//slot is empty, assign new data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt&amp;#91;hashed&amp;#93;.id = d.id;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt&amp;#91;hashed&amp;#93;.data = d.data;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//we need to rehash the id&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int i=0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//try every place in table to find an empty place&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while&amp;#40;i&amp;#60;=50&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hashed = rehash&amp;#40;hashed&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;#40;dt&amp;#91;hashed&amp;#93;.id == -1&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt&amp;#91;hashed&amp;#93;.id = d.id;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt&amp;#91;hashed&amp;#93;.data = d.data;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else if&amp;#40;i==50&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//we couldn&amp;#39;t find the empty place&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return -1; //terminate function with error&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i++; //update value of i&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//table is full&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return &amp;#40;-1&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int hasher&amp;#58;&amp;#58;remove&amp;#40;data &amp;amp;d&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int hashed = hash&amp;#40;d.id&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;#40;dt&amp;#91;hashed&amp;#93;.id == d.id&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//this is the right one to delete&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt&amp;#91;hashed&amp;#93;.id = -1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;numel -= 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//we need a rehash to find the one&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int i=0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while&amp;#40;i&amp;#60;=50&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hashed = rehash&amp;#40;hashed&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;#40;dt&amp;#91;hashed&amp;#93;.id == d.id&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt&amp;#91;hashed&amp;#93;.id = -1; //set the id to -1 because it is going to be empty&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;numel -= 1; //decrease 1 from number of elements&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0; //success&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else if&amp;#40;i==50&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return -1; //terminate function&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i++; //update the value of i&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void hasher&amp;#58;&amp;#58;output&amp;#40;&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for&amp;#40;i=0;i&amp;#60;51;i++&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cout&amp;#60;&amp;#60;i&amp;#60;&amp;#60;&amp;#34; -&amp;#62;&amp;nbsp;&amp;nbsp;&amp;#34;&amp;#60;&amp;#60;dt&amp;#91;i&amp;#93;.id&amp;#60;&amp;#60;&amp;#34;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#34;&amp;#60;&amp;#60;dt&amp;#91;i&amp;#93;.data&amp;#60;&amp;#60;endl;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main&amp;#40;&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int id=45; //first id&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int ret;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;data d;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d.data = 52005; //a value for all records, simply&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hasher h1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while&amp;#40;ret &amp;#33;= -1&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d.id=id;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ret = h1.add&amp;#40;d&amp;#41;; //add this record to table&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;id += &amp;#40;id/5&amp;#41;; //update the id, I wanted to show how different ids are put in table, look at output&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d.id = 271861; //set to one of the ids we added to table in above loop&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;h1.remove&amp;#40;d&amp;#41;; //remove that record from table&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;h1.output&amp;#40;&amp;#41;; //see the output, notice there is one empty record, in index number 33, that was the record with id of 271861&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0;&lt;br /&gt;}&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Final Thoughts&lt;/b&gt;&lt;br /&gt;&lt;blockquote&gt;In this tutorial, I used a simple hash function which was good enough for working with integer values, but what if we want to hash strings ? Yup we need a more advanced function to do that. There are many ways to do that which is beyond this tutorial&amp;#39;s goals. But at least you are now familiar with the way hashing works. Hope this tutorial helped you&amp;#33; &lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/biggrin.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;:D&quot; border=&quot;0&quot; alt=&quot;biggrin.gif&quot; /&gt;&lt;/blockquote&gt;</description>
			<pubDate>Tue, 03 Nov 2009 02:58:43 -0600</pubDate>
			<category>C++ Tutorials</category>
			<author>Anarion</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic135692.htm</link>
            <title>wxWidgets: Threading and using the Clipboard in C++ Tutorials</title>
            <description>&lt;!--sizeo:3--&gt;&lt;span style=&quot;font-size:12pt;line-height:100%&quot;&gt;&lt;!--/sizeo--&gt;wxWidgets: Threading, and using the Clipboard&lt;!--sizec--&gt;&lt;/span&gt;&lt;!--/sizec--&gt;&lt;br /&gt;&lt;br /&gt;Two for one in this tutorial. We&amp;#39;re going to create a thread using wxWidgets, and make it monitor the clipboard for text. Then, if we detect a change, we&amp;#39;re going to add the new contents to a list.&lt;br /&gt;&lt;br /&gt;It&amp;#39;s a relatively simple process, but unfortunately wxWidgets isn&amp;#39;t the most documented GUI toolkit out there.&lt;br /&gt;&lt;br /&gt;So, let&amp;#39;s get started. I&amp;#39;m gonna pile all the code into a single file instead of breaking my classes up into seperate files, just for ease of navigation in this tutorial. The code is relatively short anyway, with only 62 lines.&lt;br /&gt;&lt;br /&gt;First off, as with any other program, we&amp;#39;re going to want to get our includes done. We&amp;#39;ll be needing three: The standard wx header, the clipboard header, and the thread header. &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;#include &amp;#60;wx/wx.h&amp;#62; // standard wx header&lt;br /&gt;#include &amp;#60;wx/clipbrd.h&amp;#62; // clipboard - we&amp;#39;ll monitor the clipboard for text&lt;br /&gt;#include &amp;#60;wx/thread.h&amp;#62; // include threads&amp;#33;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;The next thing we need to do is declare our [il]ClipLogger[/il] class - this will inherit wxThread, and have two variables: One to hold the most recent text that we got from the clipboard, and one which is a pointer to a [il]wxListBox[/il] object -- the object on the main window which we&amp;#39;ll be updating. &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;class ClipLogger &amp;#58; public wxThread {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;#58;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ClipLogger&amp;#40;wxListBox*&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&amp;#58;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;void* Entry&amp;#40;&amp;#41;; // the entry point to the thread&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxString LatestText; // store the last text so we can check for changes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxListBox* list; // the list to update on a text change&lt;br /&gt;};&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;The constructor is &lt;i&gt;very&lt;/i&gt; simple. All it does is take a wxListBox*, and assign it to a variable stored by the class - this is the list that we want to update on clipboard text changes. &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;ClipLogger&amp;#58;&amp;#58;ClipLogger&amp;#40;wxListBox* l&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this-&amp;#62;list = l;&lt;br /&gt;}&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Next up is the main part of this tutorial. When we create a thread, we need to override the [il]Entry()[/il] method of the class, like so: &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;void* ClipLogger&amp;#58;&amp;#58;Entry&amp;#40;&amp;#41; {&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;To save time and memory, rather than creating a variable every time we loop, we&amp;#39;ll create it before and simply overwrite it inside the loop. &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;wxTextDataObject temp;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;wxTextDataObject is the type of object that the clipboard will store.&lt;br /&gt;Next, since our thread is a constant &amp;quot;monitor&amp;quot; for the clipboard, we want it to loop. &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;while &amp;#40;true&amp;#41; {&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Then, we need to think about how we can help our application not be CPU-hungry. The simple solution is to make the thread sleep each time it loops. We can do this with [il]wxSleep(int time)[/il], where time is the length of time to sleep in &lt;b&gt;seconds&lt;/b&gt;. &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;wxSleep&amp;#40;1&amp;#41;;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;The rest of the loop is the clipboard. It&amp;#39;s very simple, so rather than break it up line-by-line, I&amp;#39;ve added comments along the way. We basically need to do the following:&lt;br /&gt; - Open the clipboard&lt;br /&gt; - If the clipboard is text, get it into our [il]temp[/il] variable&lt;br /&gt; - Update the list and remember this is the most recent (so as not to constantly add the same data to the list)&lt;br /&gt; - Close the clipboard&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;wxTheClipboard-&amp;#62;Open&amp;#40;&amp;#41;&amp;#41; { // try to open the clipboard&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;wxTheClipboard-&amp;#62;IsSupported&amp;#40;wxDF_TEXT&amp;#41;&amp;#41; { // if the clipboard contains text&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxTheClipboard-&amp;#62;GetData&amp;#40;temp&amp;#41;; // get the data from the clipboard&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;this-&amp;#62;LatestText &amp;#33;= temp.GetText&amp;#40;&amp;#41;&amp;#41; { // if it&amp;#39;s changed, we want to update&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;temp.GetText&amp;#40;&amp;#41; &amp;#33;= wxT&amp;#40;&amp;#34;&amp;#34;&amp;#41;&amp;#41; { // if it&amp;#39;s not an empty string&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this-&amp;#62;LatestText = temp.GetText&amp;#40;&amp;#41;;&amp;nbsp;&amp;nbsp;// update the &amp;#34;LatestText&amp;#34;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this-&amp;#62;list-&amp;#62;Append&amp;#40;temp.GetText&amp;#40;&amp;#41;&amp;#41;; // append to the list&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxTheClipboard-&amp;#62;Close&amp;#40;&amp;#41;; // close the clipboard&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;The last thing left to do in the thread is simply close it off, and close off the loop. &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Simple, huh? &lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/smile.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;:)&quot; border=&quot;0&quot; alt=&quot;smile.gif&quot; /&gt;&lt;br /&gt;&lt;br /&gt;And that&amp;#39;s our thread defined. Now all we need to do is create the app itself, which is a simple process. I hope that you already know how to do it, so we can blitz through the majority of it. If not, you may want to review &lt;a href=&quot;http://www.dreamincode.net/forums/showtopic66948.htm&quot; target=&quot;_blank&quot;&gt;this tutorial&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Create the app: &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;class threaded_app &amp;#58; public wxApp {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;#58;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bool OnInit&amp;#40;void&amp;#41;;&lt;br /&gt;};&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;The beginning of the [il]OnInit()[/il] should be nothing new at this point either. &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;bool threaded_app&amp;#58;&amp;#58;OnInit&amp;#40;void&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// quickly create a wxFrame to display a window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxFrame* f = new wxFrame&amp;#40;NULL, wxID_ANY, wxT&amp;#40;&amp;#34;Threaded App&amp;#33;&amp;#34;&amp;#41;&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// add a list to the frame we created&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxListBox* list = new wxListBox&amp;#40;f, wxID_ANY&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// display the frame&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;f-&amp;#62;Show&amp;#40;true&amp;#41;;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;The last part of [il]OnInit()[/il] that we need to do is actually create an instance of our thread and run it, like so: &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// pass the list to the clipboard monitor so it knows what to update&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ClipLogger* cl = new ClipLogger&amp;#40;list&amp;#41;; // construct our thread&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cl-&amp;#62;Create&amp;#40;&amp;#41;; // we have to create a thread before we can run it&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cl-&amp;#62;Run&amp;#40;&amp;#41;; // run our thread&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;And we can simply finish off the [il]OnInit()[/il] and IMPLEMENT_APP: &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return true;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;IMPLEMENT_APP&amp;#40;threaded_app&amp;#41;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;And that&amp;#39;s all there is to threading and using the clipboard in wxWidgets&amp;#33;&lt;br /&gt;&lt;br /&gt;Here&amp;#39;s the complete code: &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;#include &amp;#60;wx/wx.h&amp;#62; // standard wx header&lt;br /&gt;#include &amp;#60;wx/clipbrd.h&amp;#62; // clipboard - we&amp;#39;ll monitor the clipboard for text&lt;br /&gt;#include &amp;#60;wx/thread.h&amp;#62; // include threads&amp;#33;&lt;br /&gt;&lt;br /&gt;class ClipLogger &amp;#58; public wxThread {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;#58;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ClipLogger&amp;#40;wxListBox*&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&amp;#58;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;void* Entry&amp;#40;&amp;#41;; // the entry point to the thread&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxString LatestText; // store the last text so we can check for changes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxListBox* list; // the list to update on a text change&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;ClipLogger&amp;#58;&amp;#58;ClipLogger&amp;#40;wxListBox* l&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this-&amp;#62;list = l;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void* ClipLogger&amp;#58;&amp;#58;Entry&amp;#40;&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxTextDataObject temp; // create a &amp;#34;wxTextDataObject&amp;#34; to get the info from the clipboard&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while &amp;#40;true&amp;#41; { // our thread will loop&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxSleep&amp;#40;1&amp;#41;; // sleep for 1 second, make the thread less cpu-hungry&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;wxTheClipboard-&amp;#62;Open&amp;#40;&amp;#41;&amp;#41; { // try to open the clipboard&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;wxTheClipboard-&amp;#62;IsSupported&amp;#40;wxDF_TEXT&amp;#41;&amp;#41; { // if the clipboard contains text&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxTheClipboard-&amp;#62;GetData&amp;#40;temp&amp;#41;; // get the data from the clipboard&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;this-&amp;#62;LatestText &amp;#33;= temp.GetText&amp;#40;&amp;#41;&amp;#41; { // if it&amp;#39;s changed, we want to update&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;temp.GetText&amp;#40;&amp;#41; &amp;#33;= wxT&amp;#40;&amp;#34;&amp;#34;&amp;#41;&amp;#41; { // if it&amp;#39;s not an empty string&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this-&amp;#62;LatestText = temp.GetText&amp;#40;&amp;#41;;&amp;nbsp;&amp;nbsp;// update the &amp;#34;LatestText&amp;#34;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this-&amp;#62;list-&amp;#62;Append&amp;#40;temp.GetText&amp;#40;&amp;#41;&amp;#41;; // append to the list&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxTheClipboard-&amp;#62;Close&amp;#40;&amp;#41;; // close the clipboard&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class threaded_app &amp;#58; public wxApp {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;#58;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bool OnInit&amp;#40;void&amp;#41;;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;bool threaded_app&amp;#58;&amp;#58;OnInit&amp;#40;void&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// quickly create a wxFrame to display a window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxFrame* f = new wxFrame&amp;#40;NULL, wxID_ANY, wxT&amp;#40;&amp;#34;Threaded App&amp;#33;&amp;#34;&amp;#41;&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// add a list to the frame we created&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wxListBox* list = new wxListBox&amp;#40;f, wxID_ANY&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// display the frame&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;f-&amp;#62;Show&amp;#40;true&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// pass the list to the clipboard monitor so it knows what to update&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ClipLogger* cl = new ClipLogger&amp;#40;list&amp;#41;; // construct our thread&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cl-&amp;#62;Create&amp;#40;&amp;#41;; // we have to create a thread before we can run it&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cl-&amp;#62;Run&amp;#40;&amp;#41;; // run our thread&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return true;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;IMPLEMENT_APP&amp;#40;threaded_app&amp;#41;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Happy coding&amp;#33; &lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/smile.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;:)&quot; border=&quot;0&quot; alt=&quot;smile.gif&quot; /&gt;</description>
			<pubDate>Sat, 31 Oct 2009 12:05:58 -0500</pubDate>
			<category>C++ Tutorials</category>
			<author>gabehabe</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic134917.htm</link>
            <title>Intro Generics in Java Tutorials</title>
            <description>This tutorial shows some uses of generics.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Generics and Collections&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;A non-generic collection can hold any kind of object. Hence, the methods that get objects out of the collection are of the type java.lang.Object.&lt;br /&gt;&lt;br /&gt;Suppose you intend to have a list of String’s objects.&lt;br /&gt;Without generics:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;List l = new ArrayList&amp;#40;&amp;#41;;&lt;br /&gt;l.add&amp;#40;“Dream”&amp;#41;;&lt;br /&gt;l.add&amp;#40;“in”&amp;#41;;&lt;br /&gt;l.add&amp;#40;“Code”&amp;#41;;&lt;br /&gt;l.add&amp;#40;10&amp;#41;; // It compiles fine *&lt;br /&gt;&lt;br /&gt;// Getting the length of all strings in this list&lt;br /&gt;Iterator i = l.iterator&amp;#40;&amp;#41;;&lt;br /&gt;while&amp;#40;i.hasNext&amp;#40;&amp;#41;&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;String s = &amp;#40;String&amp;#41;i.next&amp;#40;&amp;#41;; // cast is needed&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println&amp;#40;s.length&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt;}&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;* Pay attention here. I said that compiles fine, but this is true only for Java 5 or above. Java 5 introduced the autoboxing and unboxing features. What the code really does is to insert an Integer object which has the value 10.&lt;br /&gt;&lt;br /&gt;This code runs fine, until it tries to cast an Integer to String. So an exception is through at runtime:&lt;br /&gt;Exception in thread &amp;quot;main&amp;quot; java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String&lt;br /&gt;&lt;br /&gt;Two great things about generics are that it ensures the type of objects that the collection can have and also eliminates the need to cast. The problem with cast is that it can fails at runtime time. Using generics, this error is caught at compile time.&lt;br /&gt;&lt;br /&gt;Now the same code using generics:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;// With generics&lt;br /&gt;List&amp;#60;String&amp;#62; l = new ArrayList&amp;#60;String&amp;#62;&amp;#40;&amp;#41;;&lt;br /&gt;l.add&amp;#40;&amp;#34;Dream&amp;#34;&amp;#41;;&lt;br /&gt;l.add&amp;#40;&amp;#34;in&amp;#34;&amp;#41;;&lt;br /&gt;l.add&amp;#40;&amp;#34;Code&amp;#34;&amp;#41;;&lt;br /&gt;/*l.add&amp;#40;10&amp;#41;; /* It won&amp;#39;t compile.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Error&amp;#58; generics&amp;#092;Test1.java&amp;#58;33&amp;#58; cannot find symbol&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;symbol&amp;nbsp;&amp;nbsp;&amp;#58; method add&amp;#40;int&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;#58; interface java.util.List&amp;#60;java.lang.String&amp;#62;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;l.add&amp;#40;10&amp;#41;; // Won&amp;#39;t compile. Error&amp;#58;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;br /&gt;&lt;br /&gt;// Getting the length of all strings in this list&lt;br /&gt;for&amp;#40;String s&amp;#58;l&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println&amp;#40;s.length&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt;}&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Remove the “/*” before l.add(10); to generate the compile error. &lt;br /&gt;&lt;br /&gt;You can easily use generics for parameter and return types. The following examples illustrate this.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;public List&amp;#60;String&amp;#62; getList&amp;#40;&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return new ArrayList&amp;#60;String&amp;#62;&amp;#40;&amp;#41;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void setList&amp;#40;List&amp;#60;String&amp;#62; list&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myList = list;&lt;br /&gt;}&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Ok. Those were the basic uses of generics. Let’s see other interesting things.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Legacy Code&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The following code will compile:&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;List&amp;#60;String&amp;#62; l2 = new ArrayList&amp;#60;String&amp;#62;&amp;#40;&amp;#41;;&lt;br /&gt;l2.add&amp;#40;&amp;#34;Dream&amp;#34;&amp;#41;;&lt;br /&gt;l2.add&amp;#40;&amp;#34;in&amp;#34;&amp;#41;;&lt;br /&gt;OldClass oc = new OldClass&amp;#40;&amp;#41;;&lt;br /&gt;oc.insert&amp;#40;l2&amp;#41;; // No compile error and no exception&lt;br /&gt;for&amp;#40;String s&amp;#58;l2&amp;#41; { // ClassCastException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println&amp;#40;s.length&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OldClass {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public void insert&amp;#40;List list&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;list.add&amp;#40;new Integer&amp;#40;10&amp;#41;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;In order to support legacy code, Java 5 and Java 6 allows your newer type safe code to make use of older code. So code above compiles, even passing an Integer object to a list of String. The exception only happens when you try to cast from Integer to String.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Polymorphism&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Polymorphism doesn’t apply for generics.&lt;br /&gt;Eg:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;class Animal {}&lt;br /&gt;class Dog extends Animal {}&lt;br /&gt;List&amp;#60;Animal&amp;#62; list = new ArrayList&amp;#60;Dog&amp;#62;&amp;#40;&amp;#41;;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Error:&lt;br /&gt;incompatible types&lt;br /&gt;found   : java.util.ArrayList&amp;lt;generics.Dog&amp;gt;&lt;br /&gt;required: java.util.List&amp;lt;generics.Animal&amp;gt;&lt;br /&gt;                List&amp;lt;Animal&amp;gt; pList = new ArrayList&amp;lt;Dog&amp;gt;();&lt;br /&gt;&lt;br /&gt;So, in the below method, the only thing you can pass as parameter is List&amp;lt;Animal&amp;gt;.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;public void add&amp;#40;List&amp;#60;Animal&amp;#62; animals&amp;#41; {}&lt;br /&gt;List&amp;#60;Dog&amp;#62; dogs = new ArrayList&amp;#60;Dog&amp;#62;&amp;#40;&amp;#41;;&lt;br /&gt;add&amp;#40;dogs&amp;#41;; // error&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;? wildcard&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;You can use the wildcard “?” to partially solve the above problem.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;public void add&amp;#40;List&amp;#60;? extends Animal&amp;#62; animals&amp;#41; {}&lt;br /&gt;List&amp;#60;Dog&amp;#62; dogs = new ArrayList&amp;#60;Dog&amp;#62;&amp;#40;&amp;#41;;&lt;br /&gt;add&amp;#40;dogs&amp;#41;; // OK&amp;#33;&amp;#33; &amp;#58;&amp;#41;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;But you can’t really add something to the list, not even an Animal.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;public void add&amp;#40;List&amp;#60;? extends Animal&amp;#62; animals&amp;#41; {&lt;br /&gt;animals.add&amp;#40;new Animal&amp;#40;&amp;#41;&amp;#41;; // very awkward error &amp;#58;&amp;#40;&lt;br /&gt;}&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;The extends keyword can also be used with interfaces (in this case&amp;#33;).&lt;br /&gt;public void add(List&amp;lt;? extends Runnable&amp;gt; list) {}&lt;br /&gt;&lt;br /&gt;Another Java keyword has a special meaning in generics: super.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;public void add&amp;#40;List&amp;#60;? super Dog&amp;#62; dogs&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dogs.add&amp;#40;new Dog&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt;}&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;It means that you can pass a Dog or a supertype of Dog. Note that you can only add a Dog&amp;#33;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Conclusion&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This was a simple introduction. I recommend you to make a search to learn some tricks and advanced techniques.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Reference&lt;/b&gt;&lt;br /&gt;Sierra, Katherine; Bates, Bert. SCJP Sun Certified Programmer for Java 6.&lt;br /&gt;&lt;a href=&quot;http://www.amazon.com/SCJP-Certified-Programmer-Java-310-065/dp/0071591060&quot; target=&quot;_blank&quot;&gt;http://www.amazon.com/SCJP-Certified-Progr...5/dp/0071591060&lt;/a&gt;&lt;br /&gt;It’s an AMZING BOOK&amp;#33;&amp;#33;&amp;#33;&lt;br /&gt;</description>
			<pubDate>Tue, 27 Oct 2009 23:37:36 -0500</pubDate>
			<category>Java Tutorials</category>
			<author>tivrfoa</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic134691.htm</link>
            <title>Highlight and search words in page in PHP Tutorials</title>
            <description>&lt;!--quoteo--&gt;&lt;div class='quotetop'&gt;QUOTE&lt;/div&gt;&lt;div class='quotemain'&gt;&lt;!--quotec--&gt;Excellent tutorial&amp;#33; Keep up the great work&lt;!--QuoteEnd--&gt;&lt;/div&gt;&lt;!--QuoteEEnd--&gt;&lt;br /&gt;Thanks &lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/smile.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;:)&quot; border=&quot;0&quot; alt=&quot;smile.gif&quot; /&gt;, I will try my best.</description>
			<pubDate>Sat, 31 Oct 2009 01:06:51 -0500</pubDate>
			<category>PHP Tutorials</category>
			<author>noorahmad</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic134432.htm</link>
            <title>Create own User control - Basic Steps. in Visual Basic Tutorials</title>
            <description>&lt;!--sizeo:4--&gt;&lt;span style=&quot;font-size:14pt;line-height:100%&quot;&gt;&lt;!--/sizeo--&gt;&lt;!--fonto:Times New Roman--&gt;&lt;span style=&quot;font-family:Times New Roman&quot;&gt;&lt;!--/fonto--&gt;Hello friends here , i made a simple and Basic steps to learn how to create your own controls.I think it is  very useful when you create your own controls.This post covers only basic steps to create a new control which will show images with their file id and if there is no image It will show No image. This is not a perfect one but it will help you to crate own controls with custom properties.&lt;br /&gt;&lt;!--fontc--&gt;&lt;/span&gt;&lt;!--/fontc--&gt;&lt;!--sizec--&gt;&lt;/span&gt;&lt;!--/sizec--&gt;&lt;br /&gt;First start a new project in vb then select Project Explorer , normally top of the properties.Right click on the Project 1 and select Add - User control.Here you can create new or open existing Controls. Now click new User-control.&lt;br /&gt;It is just like a vb form ,you can add buttons , labels , anything you need like a normal form.&lt;br /&gt;When you added a new user-control then you can see it in tools.&lt;br /&gt;To get your control then close the User-control then open the first form , now add your control form the tools.Please remember that it will not work if you open the User-control.Here i made normal References , nothing more ...&lt;br /&gt;&lt;!--sizeo:4--&gt;&lt;span style=&quot;font-size:14pt;line-height:100%&quot;&gt;&lt;!--/sizeo--&gt;&lt;u&gt;&lt;b&gt;Create Own User Control :&lt;/b&gt;&lt;/u&gt;&lt;!--sizec--&gt;&lt;/span&gt;&lt;!--/sizec--&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Close all forms and controls , open the new User-control ..&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Add one image control ,change its properties to :&lt;br /&gt;        Name       = img&lt;br /&gt;	Height      = 500&lt;br /&gt;	Width       = 2000&lt;br /&gt;        Stretch     = True&lt;br /&gt;Add one Label&lt;br /&gt;	Name        =lbl&lt;br /&gt;	Autosize   =false&lt;br /&gt;	BackStyle  =0-Transparent&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Changing name of user-control:&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;Just change the name property like a form.Set it to MyImage.If you add your controlto your form then it will appear like MyImage1.&lt;br /&gt;&lt;br /&gt;The first and important part of a user-control is its properties , events and Methods.It is easy to create all.But the first thing to change is its Initialize and Resize.To do this Double click on the user-control then in code add this :&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;Private Sub UserControl_Initialize&amp;#40;&amp;#41;&lt;br /&gt;UserControl.Height = 500&lt;br /&gt;UserControl.Width = 2000&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub UserControl_Resize&amp;#40;&amp;#41;&lt;br /&gt;img.Width = UserControl.Width&lt;br /&gt;img.Height = UserControl.Height&lt;br /&gt;lbl.Width = UserControl.Width&lt;br /&gt;lbl.Height = UserControl.Height&lt;br /&gt;End Sub&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Here Initialize is like form load.Every code in Initialize works on when you create a new user control.&lt;br /&gt;Resize will work when you change the size of user-control.Here i used code to adjust the height and width of image control and label control when the user change the size of the control.Else if the user change the size of the control then it will become a disorder.&lt;br /&gt;              After that you can set its properties.Properties are visible in the properties window , it will allow users to access any part of the control like setting the control enable or disable or changing the caption.You can access the property of a control in coding.&lt;br /&gt;&lt;br /&gt;To create a new Property :&lt;br /&gt;In code view In menu bar : Take tools and click Add Procedures , then select Property [ it will create a new property ] and type &amp;quot; Caption &amp;quot; in that box.&lt;br /&gt;Then you will get this&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;Public Property Get Caption&amp;#40;&amp;#41; As Variant&lt;br /&gt;&lt;br /&gt;End Property&lt;br /&gt;&lt;br /&gt;Public Property Let Caption&amp;#40;ByVal vNewValue As Variant&amp;#41;&lt;br /&gt;&lt;br /&gt;End Property&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Here it will set a Property called caption like Label caption.Using this property you can use it to do what you think.Here i am using this property to display the caption of the Label - lbl and load that image file id to the image control - img.&lt;br /&gt;For this add these lines :&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;Public Property Get Caption&amp;#40;&amp;#41; As Variant&lt;br /&gt;Caption = lbl.Caption&lt;br /&gt;End Property&lt;br /&gt;&lt;br /&gt;Public Property Let Caption&amp;#40;ByVal vNewValue As Variant&amp;#41;&lt;br /&gt;lbl.Caption = vNewValue&lt;br /&gt;PropertyChanged &amp;#34;Caption&amp;#34;&lt;br /&gt;End Property&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Here it will change the caption of the label when you typed a text in the caption property of the user control. [do it in form view , after closing the control]You can use the property like normal label : UserControl11.Caption = &amp;quot;Button Click&amp;quot;&lt;br /&gt;But the new property Caption is a temporary , if you run the program the caption will change back.To stop this just change the user-control &amp;#39;s &lt;b&gt;WriteProperties &amp;amp; ReadProperties&lt;/b&gt;.Now in code view add this :&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;Private Sub UserControl_WriteProperties&amp;#40;PropBag As PropertyBag&amp;#41;&lt;br /&gt;PropBag.WriteProperty &amp;#34;Caption&amp;#34;, lbl.Caption&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub UserControl_ReadProperties&amp;#40;PropBag As PropertyBag&amp;#41;&lt;br /&gt;lbl.Caption = PropBag.ReadProperty&amp;#40;&amp;#34;Caption&amp;#34;, lbl.Caption&amp;#41;&lt;br /&gt;End Sub&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Now the caption will become permanent.If you want to add image to your image control then Change the Caption and ReadProperties code to this&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;Public Property Get Caption&amp;#40;&amp;#41; As Variant&lt;br /&gt;Caption = lbl.Caption&lt;br /&gt;End Property&lt;br /&gt;&lt;br /&gt;Public Property Let Caption&amp;#40;ByVal vNewValue As Variant&amp;#41;&lt;br /&gt;On Error Resume Next&lt;br /&gt;lbl.Caption = vNewValue&lt;br /&gt;PropertyChanged &amp;#34;Caption&amp;#34;&lt;br /&gt;img.Picture = LoadPicture&amp;#40;lbl.Caption&amp;#41;&lt;br /&gt;End Property&lt;br /&gt;&lt;br /&gt;Private Sub UserControl_ReadProperties&amp;#40;PropBag As PropertyBag&amp;#41;&lt;br /&gt;On Error Resume Next&lt;br /&gt;lbl.Caption = PropBag.ReadProperty&amp;#40;&amp;#34;Caption&amp;#34;, lbl.Caption&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Set img.Picture = LoadPicture&amp;#40;lbl.Caption&amp;#41;&lt;br /&gt;End Sub&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Now it will load image when you give the file id to your caption.If it is a wrong file name then nothing will happen , for that i am used On Error Resume Next.Now you can change the image of the control at run time just call the Caption property and give a value.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Adding a method&lt;/u&gt;&lt;/b&gt; will help you to do more works in user-control in form or at run-time.If you want to add a new method then use this codes:&lt;br /&gt;Take tools and click Add Procedures , then select Sub [ it will create a new method ]Type &amp;quot; check &amp;quot; in that box.The result will be :&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;Public Sub check&amp;#40;&amp;#41;&lt;br /&gt;If img.Picture = False Then lbl.Caption = &amp;#34;No Image&amp;#34;&lt;br /&gt;End Sub&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Here i used a new method to check that the image contains any image or not.The real use of such methods appear when you need to check it at run time.For calling one method open form add a button and in code view just add one line like this :&lt;b&gt; UserControl11.check , the result will be &amp;quot; No Image &amp;quot; .&lt;/b&gt; When you run the program and click the button then it will call the method.&lt;br /&gt;&lt;u&gt;&lt;b&gt;Adding an event&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;Events appear when you double click them or selecting from a combo [ top side in the code view].Events are used to do action when the user did something. for example Click event , it will activate the code in that event when you click that control.Adding an event is like adding a new method .To Add a new event :&lt;br /&gt;Take tools and click Add Procedures , then select Event [ it will create a new method ]&lt;br /&gt;&lt;b&gt;Then you will get : Public Event Click()&lt;/b&gt;&lt;br /&gt;Add this to your code.It will call the click event when user clicks the label or control.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;Private Sub lbl_Click&amp;#40;&amp;#41;&lt;br /&gt;RaiseEvent imgClick&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub UserControl_Click&amp;#40;&amp;#41;&lt;br /&gt;RaiseEvent imgClick&lt;br /&gt;End Sub&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;To access the new event , close all forms and controls , open the first form, and add one new control and double click it then you can see the new event  imgClick.&lt;br /&gt;Like click you can add any event for your control.To make your control more useful it is necessary to create more properties like Enable , setting font ....&lt;b&gt;You can add any properties you like but the important thing is you must change it or add codes in ReadProperties &amp;amp; WriteProperties.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Enable &amp;#092; Disable : Allow you to make a control enable or disable.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;Public Property Get Enabled&amp;#40;&amp;#41; As Boolean&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Enabled = m_bEnabled &amp;#39;declare m_bEnabled before Private m_bEnabled As Boolean&lt;br /&gt;End Property&lt;br /&gt;Public Property Let Enabled&amp;#40;ByVal New_Enabled As Boolean&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m_bEnabled = New_Enabled&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UserControl.Enabled = m_bEnabled&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;PropertyChanged &amp;#34;Enabled&amp;#34;&lt;br /&gt;End Property&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;Font : will change the font of the caption.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;Public Property Get Font&amp;#40;&amp;#41; As StdFont&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Set Font = UserControl.Font&lt;br /&gt;End Property&lt;br /&gt;&lt;br /&gt;Public Property Set Font&amp;#40;ByVal New_Font As StdFont&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Set UserControl.Font = New_Font&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Set lbl.Font = New_Font&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Refresh&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;PropertyChanged &amp;#34;Font&amp;#34;&lt;br /&gt;End Property&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Change the ReadProperties &amp;amp; WriteProperties to make the property working.&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;Private Sub UserControl_ReadProperties&amp;#40;PropBag As PropertyBag&amp;#41;&lt;br /&gt;On Error Resume Next&lt;br /&gt;lbl.Caption = PropBag.ReadProperty&amp;#40;&amp;#34;Caption&amp;#34;, lbl.Caption&amp;#41;&lt;br /&gt;Set img.Picture = LoadPicture&amp;#40;lbl.Caption&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;With PropBag&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Set UserControl.Font = .ReadProperty&amp;#40;&amp;#34;Font&amp;#34;, Ambient.Font&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Set lbl.Font = .ReadProperty&amp;#40;&amp;#34;Font&amp;#34;, Ambient.Font&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m_bEnabled = .ReadProperty&amp;#40;&amp;#34;Enabled&amp;#34;, True&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UserControl.Enabled = m_bEnabled&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub UserControl_WriteProperties&amp;#40;PropBag As PropertyBag&amp;#41;&lt;br /&gt;PropBag.WriteProperty &amp;#34;Caption&amp;#34;, lbl.Caption&lt;br /&gt;PropBag.WriteProperty &amp;#34;Caption&amp;#34;, lbl.Caption&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;With PropBag&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.WriteProperty &amp;#34;Enabled&amp;#34;, m_bEnabled, True&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.WriteProperty &amp;#34;Font&amp;#34;, UserControl.Font, Ambient.Font&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End With&lt;br /&gt;End Sub&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;You can make the control enable or disable and change the font of the caption&lt;br /&gt;The full code i used to create this control is given.[attachmentid=14551]&lt;br /&gt;&lt;br /&gt;Best Of Luck ...</description>
			<pubDate>Mon, 26 Oct 2009 04:05:14 -0500</pubDate>
			<category>Visual Basic Tutorials</category>
			<author>Vineeth k</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic133327.htm</link>
            <title>Twitter Logo Remake In Photoshop [Regular + Halloween] in Graphic Design &amp; Photoshop Tutorials</title>
            <description>Here&amp;#39;s the final result of the logo we will be making today:&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://img195.imageshack.us/img195/6375/twitterlogow.png&quot; border=&quot;0&quot; alt=&quot;IPB Image&quot; /&gt;&lt;br /&gt;&lt;br /&gt;And here is my Halloween version:&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://img198.imageshack.us/img198/5865/twitterhalloween.png&quot; border=&quot;0&quot; alt=&quot;IPB Image&quot; /&gt;&lt;br /&gt;&lt;br /&gt;First off, you need to find a font that you would like to use. I generally use the font known as &amp;quot;Tondo&amp;quot; because it resembles the actual font of the twitter logo very closely.&lt;br /&gt;&lt;br /&gt;You can download Tondo here: &lt;a href=&quot;http://www.dafont.com/tondo.font&quot; target=&quot;_blank&quot;&gt;http://www.dafont.com/tondo.font&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Install it (or whatever font) on Windows XP by opening up Control Panel -&amp;gt; Fonts, and then dragging the font over into the Fonts folder. On vista, simply right-click the font and select &amp;quot;Install.&amp;quot;&lt;br /&gt;&lt;br /&gt;Once you have your font ready, open up Photoshop. Your document should be properly sized to fit the logo but not too big as to leave empty space. I will be using the size [inline]350x125[/inline] pixels. Resolution 72 pixels per inch. Color mode RGB, 8 bit. Background contents white (we will change this later). Just the default settings pretty much.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://img26.imageshack.us/img26/8621/photoshoptut1.png&quot; border=&quot;0&quot; alt=&quot;IPB Image&quot; /&gt;&lt;br /&gt;&lt;br /&gt;Now that we have our open document, let&amp;#39;s start off by unlocking the background layer (just in case). To do this, ALT+Double Click the name of the layer.&lt;br /&gt;&lt;br /&gt;Now, let&amp;#39;s create a new layer using the New Layer icon or by pressing CTRL+ALT+SHIFT+N.&lt;br /&gt;&lt;br /&gt;Go ahead and select the text tool, select the Tondo font (or whatever font you are using), set the size to about 72 points, and type out the word &amp;quot;twitter&amp;quot; (or whatever text you wish to type). Yes, leave the &amp;#39;t&amp;#39; lowercase.&lt;br /&gt;&lt;br /&gt;Your stage should now look like this:&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://img23.imageshack.us/img23/5366/photoshoptut2.png&quot; border=&quot;0&quot; alt=&quot;IPB Image&quot; /&gt;&lt;br /&gt;&lt;br /&gt;There is a small adjustment we need to make to the text&amp;#39;s character spacing. I&amp;#39;ve noticed the twitter logo seems to have the characters pretty close together. After some experimentation, I find that [inline]-60[/inline] character tracking works best for the font size 72 points.&lt;br /&gt;&lt;br /&gt;To change this, go to Window -&amp;gt; Character. On the window that pops up, find Character Tracking, and set it to -60. Character tracking is the text highlighted in the screenshot below. While your in the character panel, go ahead and change the text color to whatever you like. I will be using the twitter logo&amp;#39;s exact color which is hex code [inline]#33ccff[/inline].&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://img8.imageshack.us/img8/8108/photoshoptut3.png&quot; border=&quot;0&quot; alt=&quot;IPB Image&quot; /&gt;&lt;br /&gt;&lt;br /&gt;Now, select the background layer (the layer we unlocked earlier), set your foreground color to solid black by pressing the &amp;quot;D&amp;quot; key on your keyboard to restore default colors, or just clicking the foreground icon and changing it in the color panel. Now, press ALT+Backspace to fill the layer with black. We are doing this right now so that we can see the white stroke we are about to apply to the text.&lt;br /&gt;&lt;br /&gt;Your stage should now look like this:&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://img7.imageshack.us/img7/7545/photoshoptut4.png&quot; border=&quot;0&quot; alt=&quot;IPB Image&quot; /&gt;&lt;br /&gt;&lt;br /&gt;Alright, now select the layer with our text on it, and go to Layer-&amp;gt;Layer Style-&amp;gt;Blending Options. Check the box next to &amp;quot;Stroke&amp;quot;. Now, we need to find a decent size for our stroke. I find that for font size 72 point, the stroke size of [inline]8[/inline] works perfectly. Change the fill color to solid white (#FFFFFF).&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://img41.imageshack.us/img41/4107/photoshoptut5.png&quot; border=&quot;0&quot; alt=&quot;IPB Image&quot; /&gt;&lt;br /&gt;&lt;br /&gt;Now, your logo is almost done. This last step is optional, but I think it adds a bit more style to the logo.&lt;br /&gt;&lt;br /&gt;First, CTRL+Click the icon of the text layer. This will make a complete selection around the next. Next, create a new layer above the text layer. Select the elliptical marquee (you may have to click and hold down the rectangular marquee tool until a list pops up and the select the elliptical from the list). Hold SHIFT+ALT, click a bit off the stage in the top left hand corner, then hold and drag to off the stage a bit in the right hand corner. Let go of the mouse and you should have created a new, oval like selection at the top of the text.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://img198.imageshack.us/img198/9530/photoshoptut6.png&quot; border=&quot;0&quot; alt=&quot;IPB Image&quot; /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Select the gradient tool by clicking down and holding on the fill tool (the bucket) until a last comes down, then selecting the gradient. Change your foreground color to solid white (#FFFFFF) and change the gradient settings to Foreground to Transparent by clicking on the gradient in the upper left hand corner of the screen under the &amp;quot;Edit&amp;quot; and &amp;quot;Image&amp;quot; drop-down buttons, then selecting Foreground to Transparent from the list (the second icon on the list).&lt;br /&gt;&lt;br /&gt;Hold down SHIFT and click and hold a bit above the text. Drag your mouse down to a bit below the text and let go of the mouse. This will make a nice highlight on the text. You may need to experiment around with where you click and where you let go for best results. Now, if needed, drop the opacity of the new layer with the highlight on it down a bit. Sometimes I find 60% opcaity best, sometimes 40%, and sometimes I don&amp;#39;t change the opacity at all. It really depends on where you clicked and let go of the mouse during the gradient stage on how intense the gradient is and where it fades out.&lt;br /&gt;&lt;br /&gt;Here is what the stage should look like:&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://img195.imageshack.us/img195/8933/photoshoptut7.png&quot; border=&quot;0&quot; alt=&quot;IPB Image&quot; /&gt;&lt;br /&gt;&lt;br /&gt;Now, if you wish to have a transparent background, click the eyeball next to the background layer to turn it off. Thank you for reading my tutorial. I hope it gave you new insight into photoshop and helped you create a cool logo. You can change the text of the logo to whatever you like and experiment around with the colors and settings to create new and cool logos (like the Halloween version I created).&lt;br /&gt;&lt;br /&gt;Again, here is the final result of the logo:&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://img195.imageshack.us/img195/6375/twitterlogow.png&quot; border=&quot;0&quot; alt=&quot;IPB Image&quot; /&gt;</description>
			<pubDate>Tue, 20 Oct 2009 19:40:26 -0500</pubDate>
			<category>Graphic Design &amp; Photoshop Tutorials</category>
			<author>Master Jake</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic133300.htm</link>
            <title>Password Reset System Without Using A Database in PHP Tutorials</title>
            <description>NOTE: &amp;quot;Without Using A Database&amp;quot; means we aren&amp;#39;t going to be storing keys in the database, not that we won&amp;#39;t be using one period. We will need a database with user&amp;#39;s in them; otherwise, resetting passwords is pretty pointless.&lt;br /&gt;&lt;br /&gt;This tutorial is going to be on a password reset system to go with your registration/login systems. People forget their passwords often, so it is a good idea to create a system allowing them to reset their password when needed.&lt;br /&gt;&lt;br /&gt;Now, there are a couple ways to go about doing this. One is without the use of a database, and one is with the use of a database. Obviously, we are going to be going over the one without the use of a database today.&lt;br /&gt;&lt;br /&gt;The negative end of this is that each user&amp;#39;s unique password reset key will always be the same. This being the case, this key should be protected even more than the password itself. I recommend telling the user&amp;#39;s that when you e-mail them the key. If they are to give out their unique key to someone (as well as their e-mail address), anyone will be able to reset their account password at any time.&lt;br /&gt;&lt;br /&gt;The positive end of actually using a database is the exact opposite of the negative end of not using one. When using a database, you can also generate a unique key for each user which is only good for one password recovery. This is much more secure as even if a user does give out his/her key, the password can only be reset once using that key. If a user&amp;#39;s account is stolen, he/she can simply reset the password again which will send them a new unique key. They can use this new unique key to reset their password and then their account is safe again.&lt;br /&gt;&lt;br /&gt;However, as stated, we aren&amp;#39;t going to be using the database approach today.&lt;br /&gt;&lt;br /&gt;Now, there are a few things this password reset system depends on:&lt;br /&gt;&lt;br /&gt;1. PHP mail() function must be enabled&lt;br /&gt;2. You must have each user&amp;#39;s e-mail stored in a database in order for us to mail them their password&lt;br /&gt;&lt;br /&gt;If you are ready, let&amp;#39;s get started.&lt;br /&gt;&lt;br /&gt; &lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/smile.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;:)&quot; border=&quot;0&quot; alt=&quot;smile.gif&quot; /&gt; &lt;br /&gt;&lt;br /&gt;First of all, we will use 2 pages for this complete system. I will only be posting the important snippets of each page such as the form and PHP script. We&amp;#39;ll call these 2 pages &lt;b&gt;forgot_password.php&lt;/b&gt; and &lt;b&gt;reset_password.php&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Let&amp;#39;s start with forgot_password.php. We need to create a form which asks for the user&amp;#39;s e-mail. The action of the form will be &amp;#036;_SERVER[&amp;quot;PHP_SELF&amp;quot;] so that it returns to the same page the form is on to process the information. We will use PHP at the top of this page to process the form, create the unique user key, and then send it to them via e-mail.&lt;br /&gt;&lt;br /&gt;Let&amp;#39;s do the form first:&lt;br /&gt;forgot_password.php&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;form action=&amp;#34;&amp;#60;?php echo &amp;#036;_SERVER&amp;#91;&amp;#34;PHP_SELF&amp;#34;&amp;#93;; ?&amp;#62;&amp;#34; method=&amp;#34;post&amp;#34;&amp;#62;&lt;br /&gt;E-mail Address&amp;#58; &amp;#60;input type=&amp;#34;text&amp;#34; name=&amp;#34;email&amp;#34; size=&amp;#34;20&amp;#34; /&amp;#62; &amp;#60;input type=&amp;#34;submit&amp;#34; name=&amp;#34;ForgotPasswordForm&amp;#34; value=&amp;#34; Process &amp;#34; /&amp;#62;&lt;br /&gt;&amp;#60;/form&amp;#62;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Alright. We have a text field called &amp;quot;email&amp;quot; and a submit button called &amp;quot;ForgotPasswordForm.&amp;quot; The submit button is named so that we can check to see if the right form was submitted.&lt;br /&gt;&lt;br /&gt;Now let&amp;#39;s get onto the PHP code for this page:&lt;br /&gt;forgot_password.php&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// Connect to MySQL&lt;br /&gt;&amp;#036;c = mysql_connect&amp;#40;&amp;#34;localhost&amp;#34;, &amp;#34;root&amp;#34;, &amp;#34;&amp;#34;&amp;#41;;&lt;br /&gt;mysql_select_db&amp;#40;&amp;#34;main&amp;#34;, &amp;#036;c&amp;#41;;&lt;br /&gt;&lt;br /&gt;// Was the form submitted?&lt;br /&gt;if &amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;ForgotPasswordForm&amp;#34;&amp;#93;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Harvest submitted e-mail address&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;email = mysql_real_escape_string&amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;email&amp;#34;&amp;#93;&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Check to see if a user exists with this e-mail&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;userExists = mysql_fetch_assoc&amp;#40;mysql_query&amp;#40;&amp;#34;SELECT &amp;#96;email&amp;#96; FROM &amp;#96;users&amp;#96; WHERE &amp;#96;email&amp;#96; = &amp;#39;&amp;#036;email&amp;#39;&amp;#34;&amp;#41;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;&amp;#036;userExists&amp;#91;&amp;#34;email&amp;#34;&amp;#93;&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Create a unique salt. This will never leave PHP unencrypted.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;salt = &amp;#34;PiuwrO1#O0rl@+luH1&amp;#33;froe*l?8oEb&amp;#33;iu&amp;#41;_1Xaspi*&amp;#40;sw&amp;#40;^&amp;amp;.laBr~u3i&amp;#33;c?es-l651&amp;#34;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Create the unique user password reset key&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;password = md5&amp;#40;&amp;#036;salt . &amp;#036;userExists&amp;#91;&amp;#34;email&amp;#34;&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Create a url which we will direct them to reset their password&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;pwrurl = &amp;#34;www.yoursite.com/reset_password.php?q=&amp;#34; . &amp;#036;password;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Mail them their key&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;mailbody = &amp;#34;Dear user,&amp;#092;n&amp;#092;nIf this e-mail does not apply to you please ignore it. It appears that you have requested a password reset at our website www.yoursitehere.com&amp;#092;n&amp;#092;nTo reset your password, please click the link below. If you cannot click it, please paste it into your web browser&amp;#39;s address bar.&amp;#092;n&amp;#092;n&amp;#34; . &amp;#036;pwrurl . &amp;#34;&amp;#092;n&amp;#092;nThanks,&amp;#092;nThe Administration&amp;#34;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mail&amp;#40;&amp;#036;userExists&amp;#91;&amp;#34;email&amp;#34;&amp;#93;, &amp;#34;www.yoursitehere.com - Password Reset&amp;#34;, &amp;#036;mailbody&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo &amp;#34;Your password recovery key has been sent to your e-mail address.&amp;#34;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo &amp;#34;No user with that e-mail address exists.&amp;#34;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Quite a bit is going on here, so let&amp;#39;s break it down into sections and I&amp;#39;ll explain what each is doing.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// Connect to MySQL&lt;br /&gt;&amp;#036;c = mysql_connect&amp;#40;&amp;#34;localhost&amp;#34;, &amp;#34;root&amp;#34;, &amp;#34;&amp;#34;&amp;#41;;&lt;br /&gt;mysql_select_db&amp;#40;&amp;#34;main&amp;#34;, &amp;#036;c&amp;#41;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;We start by connecting to MySQL so that we can check to see if a user exists with the submitted e-mail, etc. The host, username, password, and database name may be different for your account. You should know your MySQL settings.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Was the form submitted?&lt;br /&gt;if &amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;ForgotPasswordForm&amp;#34;&amp;#93;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Here we are just checking to see if the form was submitted. If the post value of ForgotPasswordForm (the name of our form&amp;#39;s submit button) is true, then the form was submitted.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Harvest submitted e-mail address&lt;br /&gt;&amp;#036;email = mysql_real_escape_string&amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;email&amp;#34;&amp;#93;&amp;#41;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Here we are retrieving the e-mail submitted from the form and MySQL_Real escaping it. This is so that when we check it with the database, it won&amp;#39;t contain harmful characters which can be used for SQL Injection. &lt;!--coloro:#CC0000--&gt;&lt;span style=&quot;color:#CC0000&quot;&gt;&lt;!--/coloro--&gt;(Hackers are terrible people)&lt;!--colorc--&gt;&lt;/span&gt;&lt;!--/colorc--&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Check to see if a user exists with this e-mail&lt;br /&gt;&amp;#036;userExists = mysql_fetch_assoc&amp;#40;mysql_query&amp;#40;&amp;#34;SELECT &amp;#96;email&amp;#96; FROM &amp;#96;users&amp;#96; WHERE &amp;#96;email&amp;#96; = &amp;#39;&amp;#036;email&amp;#39;&amp;#34;&amp;#41;&amp;#41;;&lt;br /&gt;if &amp;#40;&amp;#036;userExists&amp;#91;&amp;#34;email&amp;#34;&amp;#93;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;These lines of code are interesting. We are creating a variable called &amp;quot;&amp;#036;userExists&amp;quot; which will actually become an associative array from mysql_fetch_assoc(). Basically, it is running a query saying, &amp;quot;Select the user&amp;#39;s e-mail address from the table &amp;#96;users&amp;#96; where their e-mail address is equal to the one submitted.&amp;quot;&lt;br /&gt;&lt;br /&gt;Why are we doing this exactly? Well, to check to see if the user really does exists, of course. The fields in the query will change depending on your database, but I&amp;#39;m sure you already knew that. The next if statement checks to see if [inline]&amp;#036;userExists[&amp;quot;email&amp;quot;][/inline] has a value. If it does, then we know the user exists (because the query returned a value into the variable).&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Create a unique salt. This will never leave PHP unencrypted.&lt;br /&gt;&amp;#036;salt = &amp;#34;PiuwrO1#O0rl@+luH1&amp;#33;froe*l?8oEb&amp;#33;iu&amp;#41;_1Xaspi*&amp;#40;sw&amp;#40;^&amp;amp;.laBr~u3i&amp;#33;c?es-l651&amp;#34;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;You may be wondering what this is. Well basically, it&amp;#39;s a SALT. Now what is a SALT? It&amp;#39;s a key of random letters, numbers, digits in general, characters, whatever you want to call it. It&amp;#39;s basically a key that never leaves your PHP code. You do not store your salt in a database, print it to the screen, or ANYTHING without it being encrypted. It also needs to be long and very random so that it is very difficult to figure out what the salt really is when it is encrypted.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Create the unique user password reset key&lt;br /&gt;&amp;#036;password = md5&amp;#40;&amp;#036;salt . &amp;#036;userExists&amp;#91;&amp;#34;email&amp;#34;&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;This line makes use of the SALT. Basically we are saying, add the SALT together with the user&amp;#39;s e-mail address and then hash it with MD5. If the user entered say &amp;quot;blahman@yahoo.com&amp;quot; for his e-mail address, the salt combined with that would become:&lt;br /&gt;&lt;br /&gt;[inline]PiuwrO1#O0rl@+luH1&amp;#33;froe*l?8oEb&amp;#33;iu)_1Xaspi*(sw(^&amp;amp;.laBr~u3i&amp;#33;c?es-l651blahman@yahoo.com[/inline]&lt;br /&gt;&lt;br /&gt;Now, when we hash this entire new combined string in MD5, it becomes secure. You will see later how we use this key to actually check and reset the password.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Create a url which we will direct them to reset their password&lt;br /&gt;&amp;#036;pwrurl = &amp;#34;http&amp;#58;//www.yoursite.com/reset_password.php?q=&amp;#34; . &amp;#036;password;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Here we are creating a url and storing it in the variable &amp;quot;&amp;#036;pwurl.&amp;quot; You don&amp;#39;t have to store it into a variable and can actually put in the mail string itself, but I did this so it would be easier to point out and explain.&lt;br /&gt;&lt;br /&gt;You basically need the URL to point your websites &amp;quot;reset_password.php&amp;quot; page that we talked about earlier in this tutorial. We are also adding &amp;quot;?q=&amp;quot; to the end of it and appending the user&amp;#39;s new password key onto it. This way, we can check the URL on the &amp;quot;reset_password.php&amp;quot; page to get the user&amp;#39;s key when they click the link from their e-mail.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Mail them their key&lt;br /&gt;&amp;#036;mailbody = &amp;#34;Dear user,&amp;#092;n&amp;#092;nIf this e-mail does not apply to you please ignore it. It appears that you have requested a password reset at our website www.yoursitehere.com&amp;#092;n&amp;#092;nTo reset your password, please click the link below. If you cannot click it, please paste it into your web browser&amp;#39;s address bar.&amp;#092;n&amp;#092;n&amp;#34; . &amp;#036;pwrurl . &amp;#34;&amp;#092;n&amp;#092;nThanks,&amp;#092;nThe Administration&amp;#34;;&lt;br /&gt;mail&amp;#40;&amp;#036;userExists&amp;#91;&amp;#34;email&amp;#34;&amp;#93;, &amp;#34;www.yoursitehere.com - Password Reset&amp;#34;, &amp;#036;mailbody&amp;#41;;&lt;br /&gt;echo &amp;#34;Your password recovery key has been sent to your e-mail address.&amp;#34;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Here is the long message stored in the variable &amp;quot;&amp;#036;mailbody&amp;quot; which basically tells the user, &amp;quot;hey, if this is you, then click this link and reset your password.&amp;quot; You will also see use of the &amp;quot;&amp;#036;pwrurl&amp;quot; variable inside the &amp;quot;&amp;#036;mailbody&amp;quot; string. That is the area where we are placing their password reset link we generated above. Finally, we are using mail() to actually send them the e-mail. We are using &amp;quot;www.yoursitehere.com - Password Reset&amp;quot; as the subject and the value of &amp;quot;&amp;#036;mailbody&amp;quot; as the body message.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo &amp;#34;No user with that e-mail address exists.&amp;#34;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Here we are just cleaning up. The else refers to the if statement regarding whether or not the user actually exists. The last curly bracket closes the if statement regarding whether or not the form was actually submitted.&lt;br /&gt;&lt;br /&gt;So, now we have created a page which asks the user for their e-mail address; and, if a user exists with that e-mail address, sends them an e-mail with a unique password recovery key for their account. Let&amp;#39;s move on to the &amp;quot;reset_password.php&amp;quot; page.&lt;br /&gt;&lt;br /&gt;This page is also going to have a form and some PHP code. First we will post the form which, once again, redirects to itself and then processes using PHP. In this form, we need the user to retype his/her e-mail address, new password, and confirm their new password. We also need to store the value of &amp;quot;?q=&amp;quot; from the URL into a hidden section of the form so we can carry it over into processing in post data.&lt;br /&gt;&lt;br /&gt;reset_password.php&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;form action=&amp;#34;&amp;#60;?php echo &amp;#036;_SERVER&amp;#91;&amp;#34;PHP_SELF&amp;#34;&amp;#93;; ?&amp;#62;&amp;#34; method=&amp;#34;post&amp;#34;&amp;#62;&lt;br /&gt;E-mail Address&amp;#58; &amp;#60;input type=&amp;#34;text&amp;#34; name=&amp;#34;email&amp;#34; size=&amp;#34;20&amp;#34; /&amp;#62;&amp;#60;br /&amp;#62;&lt;br /&gt;New Password&amp;#58; &amp;#60;input type=&amp;#34;password&amp;#34; name=&amp;#34;password&amp;#34; size=&amp;#34;20&amp;#34; /&amp;#62;&amp;#60;br /&amp;#62;&lt;br /&gt;Confirm Password&amp;#58; &amp;#60;input type=&amp;#34;password&amp;#34; name=&amp;#34;confirmpassword&amp;#34; size=&amp;#34;20&amp;#34; /&amp;#62;&amp;#60;br /&amp;#62;&lt;br /&gt;&amp;#60;input type=&amp;#34;hidden&amp;#34; name=&amp;#34;q&amp;#34; value=&amp;#34;&amp;#60;?php echo &amp;#036;_GET&amp;#91;&amp;#34;q&amp;#34;&amp;#93;; ?&amp;#62;&amp;#34; /&amp;#62;&amp;#60;input type=&amp;#34;submit&amp;#34; name=&amp;#34;ResetPasswordForm&amp;#34; value=&amp;#34; Reset Password &amp;#34; /&amp;#62;&lt;br /&gt;&amp;#60;/form&amp;#62;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Now that we have the form for the page, let&amp;#39;s move onto the PHP section.&lt;br /&gt;&lt;br /&gt;reset_password.php&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// Connect to MySQL&lt;br /&gt;&amp;#036;c = mysql_connect&amp;#40;&amp;#34;localhost&amp;#34;, &amp;#34;root&amp;#34;, &amp;#34;&amp;#34;&amp;#41;;&lt;br /&gt;mysql_select_db&amp;#40;&amp;#34;main&amp;#34;, &amp;#036;c&amp;#41;;&lt;br /&gt;&lt;br /&gt;// Was the form submitted?&lt;br /&gt;if &amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;ResetPasswordForm&amp;#34;&amp;#93;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Gather the post data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;email = mysql_real_escape_string&amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;email&amp;#34;&amp;#93;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;password = md5&amp;#40;mysql_real_escape_string&amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;password&amp;#34;&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;confirmpassword = md5&amp;#40;mysql_real_escape_string&amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;confirmpassword&amp;#34;&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;q = &amp;#036;_POST&amp;#91;&amp;#34;q&amp;#34;&amp;#93;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Use the same salt from the forgot_password.php file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;salt = &amp;#34;PiuwrO1#O0rl@+luH1&amp;#33;froe*l?8oEb&amp;#33;iu&amp;#41;_1Xaspi*&amp;#40;sw&amp;#40;^&amp;amp;.laBr~u3i&amp;#33;c?es-l651&amp;#34;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Generate the reset key&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#036;resetkey = md5&amp;#40;&amp;#036;salt . &amp;#036;email&amp;#41;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Does the new reset key match the old one?&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;&amp;#036;resetkey == &amp;#036;q&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &amp;#40;&amp;#036;password == &amp;#036;confirmpassword&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Update the user&amp;#39;s password&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mysql_query&amp;#40;&amp;#34;UPDATE &amp;#96;users&amp;#96; SET &amp;#96;password&amp;#96; = &amp;#39;&amp;#036;password&amp;#39; WHERE &amp;#96;email&amp;#96; = &amp;#39;&amp;#036;email&amp;#39;&amp;#34;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo &amp;#34;Your password has been successfully reset.&amp;#34;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo &amp;#34;Your password&amp;#39;s do not match.&amp;#34;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo &amp;#34;Your password reset key is invalid.&amp;#34;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Again, a lot is going on here. So let&amp;#39;s break it down line by line.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// Connect to MySQL&lt;br /&gt;&amp;#036;c = mysql_connect&amp;#40;&amp;#34;localhost&amp;#34;, &amp;#34;root&amp;#34;, &amp;#34;&amp;#34;&amp;#41;;&lt;br /&gt;mysql_select_db&amp;#40;&amp;#34;main&amp;#34;, &amp;#036;c&amp;#41;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Connecting to MySQL, again. Nothing new here.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Was the form submitted?&lt;br /&gt;if &amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;ResetPasswordForm&amp;#34;&amp;#93;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Checking to see if the form was submitted.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Gather the post data&lt;br /&gt;&amp;#036;email = mysql_real_escape_string&amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;email&amp;#34;&amp;#93;&amp;#41;;&lt;br /&gt;&amp;#036;password = md5&amp;#40;mysql_real_escape_string&amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;password&amp;#34;&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;&amp;#036;confirmpassword = md5&amp;#40;mysql_real_escape_string&amp;#40;&amp;#036;_POST&amp;#91;&amp;#34;confirmpassword&amp;#34;&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;&amp;#036;q = &amp;#036;_POST&amp;#91;&amp;#34;q&amp;#34;&amp;#93;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;This is gathering all of the post data submitted from the form and storing each value into a variable. You may notice the use of mysql_real_escape_string(). Again, we are using this to protect our database from SQL Injection. &amp;#036;q doesn&amp;#39;t need to be escaped because we aren&amp;#39;t going to be checking it with the database. Also, you may notice use of md5() on the password&amp;#39;s. This is because I assume this is the hashing you are using on your passwords. Change it if needed.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Use the same salt from the forgot_password.php file&lt;br /&gt;&amp;#036;salt = &amp;#34;PiuwrO1#O0rl@+luH1&amp;#33;froe*l?8oEb&amp;#33;iu&amp;#41;_1Xaspi*&amp;#40;sw&amp;#40;^&amp;amp;.laBr~u3i&amp;#33;c?es-l651&amp;#34;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Here we are, once again, creating the salt. Make sure this is the &lt;b&gt;EXACT&lt;/b&gt; same salt you used from the forgot_password.php file or the system won&amp;#39;t work.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Generate the reset key&lt;br /&gt;&amp;#036;resetkey = md5&amp;#40;&amp;#036;salt . &amp;#036;email&amp;#41;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;As we did in the forgot_password.php file, we are combining the salt and the user&amp;#39;s inputted e-mail and then hashing it with md5(). We are storing it into a variable called &amp;#036;resetkey this time.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Does the new reset key match the old one?&lt;br /&gt;if &amp;#40;&amp;#036;resetkey == &amp;#036;q&amp;#41;&lt;br /&gt;{&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;This is the major check. Since we combined the same salt with the same e-mail and hashed it the same way, both &amp;#036;resetkey and &amp;#036;q will be the same. If they aren&amp;#39;t the same, the user either inputted the wrong e-mail address or it&amp;#39;s a hacker trying to steal their account.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;if &amp;#40;&amp;#036;password == &amp;#036;confirmpassword&amp;#41;&lt;br /&gt;{&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;This is making sure both the password and confirmed password match.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;// Update the user&amp;#39;s password&lt;br /&gt;mysql_query&amp;#40;&amp;#34;UPDATE &amp;#96;users&amp;#96; SET &amp;#96;password&amp;#96; = &amp;#39;&amp;#036;password&amp;#39; WHERE &amp;#96;email&amp;#96; = &amp;#39;&amp;#036;email&amp;#39;&amp;#34;&amp;#41;;&lt;br /&gt;echo &amp;#34;Your password has been successfully reset.&amp;#34;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Here we are simply running a mysql_query() to update the user&amp;#39;s password and set it to the new one where their e-mail equals the one submitted. Afterward, we are echoing out that it has been successful. Again, you may need to change the table &amp;#96;users&amp;#96; and the fields depending on your database.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo &amp;#34;Your password&amp;#39;s do not match.&amp;#34;;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo &amp;#34;Your password reset key is invalid.&amp;#34;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;This is all the clean up and finalizing code. We are running else statements on previous if&amp;#39;s. The first one is for whether or not the password and confirmed password matched. If not, tell them it didn&amp;#39;t. The second is for the check determining whether or not the new recovery key matched the old one. The final curly braces closes the if statement which checked to see if the form was actually submitted.&lt;br /&gt;&lt;br /&gt;&lt;!--coloro:#CC0000--&gt;&lt;span style=&quot;color:#CC0000&quot;&gt;&lt;!--/coloro--&gt;CONGRATULATIONS&amp;#33;&lt;!--colorc--&gt;&lt;/span&gt;&lt;!--/colorc--&gt;&lt;br /&gt;&lt;br /&gt;If you have made it this far, your password reset system is complete. I hope my tutorial has helped you learn and understand new concepts. Go out and enjoy the wonderful world of PHP now&amp;#33;</description>
			<pubDate>Tue, 20 Oct 2009 18:07:22 -0500</pubDate>
			<category>PHP Tutorials</category>
			<author>Master Jake</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic133233.htm</link>
            <title>Search Engine [Basic] in PHP Tutorials</title>
            <description>Hello. Today you are going to be learning how to create a very simple search engine system which you can implement into your own website. Keep in mind that this search engine tutorial is meant to teach only the fundamental basics.&lt;br /&gt;&lt;br /&gt;If you are implementing this search engine into a professional or commercial site, be sure to update it with &lt;b&gt;paging&lt;/b&gt; so that 20 billion results aren&amp;#39;t displayed on one page. Let&amp;#39;s get started.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;1: The Database&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In order for this search engine to operate properly, we need to store information into a database which we will scan for later. You can use this to search pretty much any field in a table; however, for this example we will be using a simple &amp;quot;blog&amp;quot; type section.&lt;br /&gt;&lt;br /&gt;Our database will be very simple, and looks like this:&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;TABLE&amp;#58; blog_entries&lt;br /&gt;&lt;br /&gt;id &amp;#40;primary key; auto increment&amp;#41; - int&amp;#40;11&amp;#41;&lt;br /&gt;blogbody - text&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Obviously, a real blog_entries table would contain MUCH more data than this;however, like I said, I want to make this as simple and easily understandable as possible.&lt;br /&gt;&lt;br /&gt;Now, we will assume that there are already quite a few entries into this table for which we may search.&lt;br /&gt;&lt;br /&gt;First, we need to create an HTML form field using GET as the method so that our user&amp;#39;s can search the database.&lt;br /&gt;&lt;br /&gt;File: test.html&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;form action=&amp;#34;search.php&amp;#34; method=&amp;#34;get&amp;#34;&amp;#62;&lt;br /&gt;&amp;#60;input type=&amp;#34;text&amp;#34; name=&amp;#34;q&amp;#34; size=&amp;#34;20&amp;#34; /&amp;#62; &amp;#60;input type=&amp;#34;submit&amp;#34; value=&amp;#34; Search &amp;#34; /&amp;#62;&lt;br /&gt;&amp;#60;/form&amp;#62;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;I didn&amp;#39;t name the input for the submit button because it&amp;#39;s not really needed for this example.&lt;br /&gt;&lt;br /&gt;Now, there are a few things you may notice. First of all, this form directs the data to the page &amp;quot;search.php&amp;quot; using the &amp;quot;get&amp;quot; method. This means that if the user type&amp;#39;s in say &amp;quot;Hello World&amp;quot; in the input textbox and press&amp;#39;s &amp;quot;Search&amp;quot;, the url will look like this:&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;search.php?q=Hello+World&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;The nifty thing about using the get method is that it will automatically url encode the form data and then url decode it when we use php&amp;#39;s &amp;#036;_GET to retrieve it.&lt;br /&gt;&lt;br /&gt;Speaking of PHP, let&amp;#39;s get on with the &amp;quot;search.php&amp;quot; page which this form directs to.&lt;br /&gt;&lt;br /&gt;First we need to connect to MySQL so that we can use mysql_query and etc.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;&amp;#036;c = mysql_connect&amp;#40;&amp;#34;localhost&amp;#34;, &amp;#34;root&amp;#34;, &amp;#34;&amp;#34;&amp;#41;;&lt;br /&gt;mysql_select_db&amp;#40;&amp;#34;my_database&amp;#34;, &amp;#036;c&amp;#41;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Of course, the username, password, host, and database name will change depending on your MySQL information. Now that we are connected, let&amp;#39;s grab the value of &amp;quot;q&amp;quot; in the URL.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#036;q = mysql_real_escape_string&amp;#40;&amp;#036;_GET&amp;#91;&amp;#34;q&amp;#34;&amp;#93;&amp;#41;;&lt;br /&gt;&amp;#036;newq = strtoupper&amp;#40;&amp;#036;q&amp;#41;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;We use mysql_real_escape_string to escape harmful characters which can be used to SQL Inject the database. We also created a second variable called &amp;quot;&amp;#036;newq&amp;quot; which is simply an all uppercase version of the search query. This is that we may run a case insensitive search.&lt;br /&gt;&lt;br /&gt; Now that we have the information in which the user submitted (and keep in mind that &amp;#036;_GET automatically url decoded the data), we may run the main search query.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#036;searchQuery = mysql_query&amp;#40;&amp;#34;SELECT * FROM &amp;#96;blog_entries&amp;#96; WHERE UPPER&amp;#40;&amp;#96;blogbody&amp;#96;&amp;#41; LIKE &amp;#39;%&amp;#036;newq%&amp;#39; ORDER BY &amp;#96;id&amp;#96; DESC LIMIT 10&amp;#34;&amp;#41;;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Now, a lot is going on in this query. I hope that if you are reading this tutorial you already know a little about MySQL. First of all, we are selecting every field from the table &amp;quot;blog_entries&amp;quot; (which I showed above). We are selecting only the fields in which the value of &amp;quot;blogbody&amp;quot; contains the string &amp;quot;&amp;#036;newq.&amp;quot; We use MySQL&amp;#39;s UPPER() around the blogbody so that, once again, the search query is case insensitive. This tests a full uppercase version of the &amp;quot;blogbody&amp;quot; field with a full uppercase version of the search query. All case insensitive.&lt;br /&gt;&lt;br /&gt;You may notice the %%&amp;#39;s around &amp;#036;newq. Basically they are wildcards which mean &amp;quot;anything in this spot.&amp;quot; This means that if the user searches:&lt;br /&gt;&lt;br /&gt;&amp;#39;o&amp;#39;&lt;br /&gt;&lt;br /&gt;and the word &amp;quot;dog&amp;quot; is in &amp;quot;blogbody&amp;quot;, it will return that result.&lt;br /&gt;&lt;br /&gt;%o% = anything-o-anything&lt;br /&gt;&lt;br /&gt;dog would match in that case. This is used for better search results. In case the user searches:&lt;br /&gt;&lt;br /&gt;tut&lt;br /&gt;&lt;br /&gt;instead of &amp;quot;tutorial&amp;quot;, it will still match.&lt;br /&gt;&lt;br /&gt;You may also notice that we are ordering these by the id descending. Since the id auto increments with each new entry, the highest id is going to be the newest entry. Descending means highest to lowest. Basically we are ordering them from newest to oldest. You can also do this with a date timestamp, but we won&amp;#39;t get into that right now.&lt;br /&gt;&lt;br /&gt;Also, we are limiting this search to a maximum of 10 results. This is so the page doesn&amp;#39;t get cluttered with too many search results. If you want unlimited results, I suggest creating a paging system and adding it to your search system so that it displays say 10 search results per page.&lt;br /&gt;&lt;br /&gt;Now that we have the value of the search query tested with the database, we need to print the retrieved values (providing there are any). We can do this by using a while() loop.&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;while &amp;#40;&amp;#036;row = mysql_fetch_assoc&amp;#40;&amp;#036;searchQuery&amp;#41;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo &amp;#34;Blog Entry #&amp;#34; . &amp;#036;row&amp;#91;&amp;#34;id&amp;#34;&amp;#93; . &amp;#34;&amp;#60;br /&amp;#62;&amp;#60;br /&amp;#62;&amp;#34; . stripslashes&amp;#40;&amp;#036;row&amp;#91;&amp;#34;blogbody&amp;#34;&amp;#93;&amp;#41; . &amp;#34;&amp;#60;hr /&amp;#62;&amp;#34;;&lt;br /&gt;}&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;A few things are going on here. We are assigning the variable &amp;quot;&amp;#036;row&amp;quot; to each row of data retrieved from the search query. Each time the while loop increments, one new row is retrieved and we can print data associated with that row. mysql_fetch_assoc() is simply retrieving the rows and storing them in an associative array of &amp;quot;&amp;#036;row.&amp;quot;&lt;br /&gt;&lt;br /&gt;These values can be accessed with the variable name, brackets, and the field name in quotes:&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#036;row&amp;#91;&amp;#34;blogbody&amp;#34;&amp;#93;; // returns the blogbody field&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;The rest is pretty self explanatory. We are echoing out the id of each blog entry that was successfully matched with the search query, and then echoing out the actually blogbody of that field itself. You may notice &amp;quot;stripslashes()&amp;quot; around the blogbody. I assumed that whoever was making the blog system used &amp;quot;mysql_real_escape_string()&amp;quot; to escape the blogbody before entry into the database.&lt;br /&gt;&lt;br /&gt;This make&amp;#39;s all single and double quotes (and a few other characters) have a backslash before them. E.g. &amp;quot; becomes &amp;#092;&amp;quot;. We need to strip those slashes when echoing them out so that &amp;#092;&amp;quot; returns back to &amp;quot;, etc.&lt;br /&gt;&lt;br /&gt;Well, that&amp;#39;s pretty much it. I hope you found this tutorial helpful, and I hope that it wasn&amp;#39;t too confusing. Here is the final code put together:&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// Connect to MySQL&lt;br /&gt;&amp;#036;c = mysql_connect&amp;#40;&amp;#34;localhost&amp;#34;, &amp;#34;root&amp;#34;, &amp;#34;&amp;#34;&amp;#41;;&lt;br /&gt;mysql_select_db&amp;#40;&amp;#34;my_database&amp;#34;, &amp;#036;c&amp;#41;;&lt;br /&gt;&lt;br /&gt;// Retrieve the Search String&lt;br /&gt;&amp;#036;q = mysql_real_escape_string&amp;#40;&amp;#036;_GET&amp;#91;&amp;#34;q&amp;#34;&amp;#93;&amp;#41;;&lt;br /&gt;&amp;#036;newq = strtoupper&amp;#40;&amp;#036;q&amp;#41;;&lt;br /&gt;&lt;br /&gt;// Run the Search Query&lt;br /&gt;&amp;#036;searchQuery = mysql_query&amp;#40;&amp;#34;SELECT * FROM &amp;#96;blog_entries&amp;#96; WHERE UPPER&amp;#40;&amp;#96;blogbody&amp;#96;&amp;#41; LIKE &amp;#39;%&amp;#036;newq%&amp;#39; ORDER BY &amp;#96;id&amp;#96; DESC LIMIT 10&amp;#34;&amp;#41;;&lt;br /&gt;&lt;br /&gt;// Display Results Based on the Retrieved Data&lt;br /&gt;while &amp;#40;&amp;#036;row = mysql_fetch_assoc&amp;#40;&amp;#036;searchQuery&amp;#41;&amp;#41;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo &amp;#34;Blog Entry #&amp;#34; . &amp;#036;row&amp;#91;&amp;#34;id&amp;#34;&amp;#93; . &amp;#34;&amp;#60;br /&amp;#62;&amp;#60;br /&amp;#62;&amp;#34; . stripslashes&amp;#40;&amp;#036;row&amp;#91;&amp;#34;blogbody&amp;#34;&amp;#93;&amp;#41; . &amp;#34;&amp;#60;hr /&amp;#62;&amp;#34;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;If you are wondering why I didn&amp;#39;t just use &amp;quot;strtoupper&amp;quot; on the &amp;quot;&amp;#036;q&amp;quot; value itself, I wanted it separate so that the original search string was saved. This way, if you wanted to print out what they searched, you could:&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;echo &amp;#34;You searched for &amp;#60;b&amp;#62;&amp;#34; . stripslashes&amp;#40;&amp;#036;q&amp;#41; . &amp;#34;&amp;#60;/b&amp;#62;&amp;#34;;&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;</description>
			<pubDate>Tue, 20 Oct 2009 11:48:32 -0500</pubDate>
			<category>PHP Tutorials</category>
			<author>Master Jake</author>
         </item>
         <item>
            <link>http://forums.dreamincode.net/showtopic132768.htm</link>
            <title>Installing FLTK for Beginners in C++ Tutorials</title>
            <description>Hi, This tutorial is for installing FLTK in your Linux Operating System. i am using Ubuntu jaunty 9.04. You can use this guide to install it in other operating system.&lt;br /&gt;&lt;br /&gt;Before installing FLTK in ubuntu or any other Linux distros you need few packages. If you try to install it without these pre-build packages, it will produce an error. &lt;br /&gt;&lt;br /&gt;1. You need g++-x.x ( x.x is the version number 3.0+, preferably 4.3 )&lt;br /&gt;   &lt;br /&gt;             You can install this using &amp;#39;build-essentials&amp;#39;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;ubuntu &amp;#58; sudo apt-get install build-essentials&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;These essential packages comes with CD rom. All you have to do is add the CD-ROM to software sources.&lt;br /&gt;&lt;br /&gt;2. installing autoconf and automake&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;sudo apt-get install autoconf automake&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;3. installing xorg-dev packages and libglut3-dev&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;sudo apt-get install xorg-dev libglut3-dev&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;So the files that needed to be installed are:&lt;/u&gt;&lt;br /&gt;1. G++&lt;br /&gt;2. autoconf&lt;br /&gt;3. automake&lt;br /&gt;4. xorg-dev&lt;br /&gt;5. libglut3-dev&lt;br /&gt;&lt;br /&gt;In whatever linux distro you are using, use the package manager to install all these. &lt;!--coloro:#FF0000--&gt;&lt;span style=&quot;color:#FF0000&quot;&gt;&lt;!--/coloro--&gt;These will also install other dependency files.&lt;!--colorc--&gt;&lt;/span&gt;&lt;!--/colorc--&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Installing FLTK&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;1. donwload FLTK from their website &lt;a href=&quot;http://www.fltk.org&quot; target=&quot;_blank&quot;&gt;http://www.fltk.org&lt;/a&gt;&lt;br /&gt;2. unrar the package.&lt;br /&gt;3. navigate to the extracted folder in terminal&lt;br /&gt;4. run the following commands in terminal&lt;br /&gt;    ./configure&lt;br /&gt;    sudo make&lt;br /&gt;    sudo make install&lt;br /&gt;&lt;br /&gt;You are done&amp;#33;.&lt;br /&gt;&lt;b&gt;First fltk Code:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;#include &amp;#60;fltk/Window.h&amp;#62;&lt;br /&gt;#include &amp;#60;fltk/Widget.h&amp;#62;&lt;br /&gt;#include &amp;#60;fltk/run.h&amp;#62;&lt;br /&gt;#include &amp;#60;fltk/ask.h&amp;#62;&lt;br /&gt;using namespace fltk;&lt;br /&gt;&lt;br /&gt;void window_callback&amp;#40;Widget* widget, void*&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;if &amp;#40;ask&amp;#40;&amp;#34;Do you really want to exit?&amp;#34;&amp;#41;&amp;#41;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#40;&amp;#40;Window*&amp;#41;widget&amp;#41;-&amp;#62;hide&amp;#40;&amp;#41;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main&amp;#40;int argc, char **argv&amp;#41; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;Window *window = new Window&amp;#40;300, 180&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;window-&amp;#62;callback&amp;#40;window_callback&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;window-&amp;#62;begin&amp;#40;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;Widget *box = new Widget&amp;#40;20, 40, 260, 100, &amp;#34;Hello, World&amp;#33;&amp;#34;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;box-&amp;#62;box&amp;#40;UP_BOX&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;box-&amp;#62;labelfont&amp;#40;HELVETICA_BOLD_ITALIC&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;box-&amp;#62;labelsize&amp;#40;36&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;box-&amp;#62;labeltype&amp;#40;SHADOW_LABEL&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;window-&amp;#62;end&amp;#40;&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;window-&amp;#62;show&amp;#40;argc, argv&amp;#41;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;return run&amp;#40;&amp;#41;;&lt;br /&gt;}&lt;br /&gt;&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;I got this code from fltk website. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Compiling FLTK program:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In your terminal &lt;br /&gt; &lt;!--c1--&gt;&lt;div class='codetop'&gt;CODE&lt;/div&gt;&lt;div class='codemain'&gt;&lt;!--ec1--&gt;Syntax&amp;#58; fltk2-config --compile &amp;#60;filename.cpp&amp;#62;&lt;br /&gt; &amp;#036;&amp;#62; fltk2-config --compile Apps.cpp&lt;br /&gt; &amp;#036;&amp;#62; ./Apps&lt;!--c2--&gt;&lt;/div&gt;&lt;!--ec2--&gt;&lt;br /&gt;&lt;br /&gt;Now Fltk is properly installed in you Linux Distro.&lt;img src=&quot;style_emoticons/&lt;#EMO_DIR#&gt;/smile.gif&quot; style=&quot;vertical-align:middle&quot; emoid=&quot;:)&quot; border=&quot;0&quot; alt=&quot;smile.gif&quot; /&gt;</description>
			<pubDate>Sun, 18 Oct 2009 10:11:15 -0500</pubDate>
			<category>C++ Tutorials</category>
			<author>balasurfs</author>
         </item>
   </channel>
</rss>
