<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TECHiE TALKS &#187; Programming</title>
	<atom:link href="http://www.icpep.org/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.icpep.org</link>
	<description>Just another techie stuff</description>
	<lastBuildDate>Wed, 01 Feb 2012 23:59:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Setting Up a MemCached Server</title>
		<link>http://www.icpep.org/setting-up-a-memcached-server/</link>
		<comments>http://www.icpep.org/setting-up-a-memcached-server/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 09:47:34 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Windows Hacks]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1555</guid>
		<description><![CDATA[image from www.memcached.org Based on their official website memcached is defined as: Free &#038; open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering. Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><img src="http://www.icpep.org/wp-content/uploads/2012/01/memcached_banner75-300x55.jpg" alt="memcached" title="memcached" width="300" height="55" class="aligncenter size-medium wp-image-1556" /><br /><center><em>image from www.memcached.org</em></center></p>
<p align="justify">Based on their official website <a href="http://memcached.org/" title="MemCached" target="_blank">memcached</a> is defined as:</p>
<blockquote><p>Free &#038; open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.</p>
<p>Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.</p>
<p>Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages.</p></blockquote>
<p>&mdash; memcached.org</p>
<h2 style="text-shadow:1px 0px 1px #000;font-weight:bolder;"><u>MemCached Server</u></h2>
<p align="justify">This is how I installed(<em>a simple installation</em>) my memcached server that can be accessed by a webserver on our local area network.  The server is running Ubuntu as its operating system.  <span id="highlight">Caution: The version on ubuntu&#8217;s repository could not be the latest version.  Refer to memcached&#8217;s website for the latest version.  If you want to install the latest version from the source you can refer to memcached&#8217;s <a href="http://code.google.com/p/memcached/wiki/NewInstallFromSource" title="Memcached's wiki page" target="_blank">wiki</a> page</span></p>
<p align="justify">Open synaptic package manager and install <span id="highlight">memcached</span> and <span id="highlight">php5-memcached</span>.  After the installation restart the webserver using the command:</p>
<div id="code">sudo apache2ctl restart</div>
</p>
<p>Start memcached by using the command:</p>
<p align="justify"><div id="code">/etc/init.d/memcached start</div></p>
<p>By default memcached is running on port <span id="highlight">11211</span> and is accessible by the machine with IP 127.0.0.1 which is the machine&#8217;s local IP address with <span id="highlight">64MB</span> memory allocation</p>
<p align="justify">To try if memcached is working use this simple PHP code</p>
<pre class="crayon-plain-tag"><code>&lt; ?php
$m = new Memcached();
$m-&gt;addServer('localhost', 11211);

$m-&gt;set('int', 99);
$m-&gt;set('string', 'a simple string');
$m-&gt;set('array', array(11, 12));
$m-&gt;set('object', new stdclass, time() + 300);

var_dump($m-&gt;get('int'));
var_dump($m-&gt;get('string'));
var_dump($m-&gt;get('array'));
var_dump($m-&gt;get('object'));
?&gt;</code></pre>
<p align="justify">Open the script on the browser.  Try opening the cli and telnet to memcached using the command:</p>
<p><div id="code">telnet 127.0.0.1 11211</div></p>
<p>The image below shows how the cli would look like after the command</p>
<p align="center"><img src="http://www.icpep.org/wp-content/uploads/2012/01/telnet-300x70.png" alt="telnet to memcached" title="telnet to memcached" width="300" height="70" class="aligncenter size-medium wp-image-1557" /></p>
<p align="justify">Check memcached&#8217;s status by using the command</p>
<div id="code">
stats
</div>
</p>
<p>We can get a cached value using the command:</p>
<p><div id="code">get string</div></p>
<p>It should return <span id="highlight">&#8220;a simple string&#8221;</span> as assigned on the script.</p>
<p>To explore more, commands can be seen on this page <a href="http://lzone.de/articles/memcached.htm" target="_blank"><em>http://lzone.de/articles/memcached.htm</em></a></p>
<p align="justify">To allow another machine (<em>local web server</em>) to store data on the memcached server we need to edit the configuration file using the command:</p>
<p><div id="code">
sudo nano /etc/memcached.conf
</div></p>
<p align="justify">In my case I changed the allotted memory to 256MB and allowed IP of 191.168.1.254 which is our windows webserver as seen on the image below:</p>
<p align="center"><a href="http://www.icpep.org/wp-content/uploads/2012/01/Screenshot-2.png" target="_blank"><img src="http://www.icpep.org/wp-content/uploads/2012/01/Screenshot-2-300x180.png" alt="memcached configuration" title="memcached configuration" width="300" height="180" class="aligncenter size-medium wp-image-1558" /></a></p>
<p>After the configuration I restarted memcached using the command:</p>
<p><div id="code">sudo /etc/init.d/memcached restart</div></p>
<h2 style="text-shadow:1px 0px 1px #000;font-weight:bolder;"><u>The Webserver (XAMPP)</u></h2>
<p align="justify">To quickly test the memcached server I used xampp portable version which can be downloaded on their official website <em>www.apachefriends.org</em>.</p>
<p align="justify">As stated earlier the webserver is already allowed to use the memcached server.  As an information memcached is a daemon which runs like the mysql server, so we need PHP to connect to the memcached server.</p>
<p align="justify"><ol>
<li>To start, download memcached on <a href="http://code.jellycan.com/memcached/" title="memcached windows " target="_blank">code.jellycan.com/memcached</a> which is win32 binary.
</li>
<li>After downloading extract the file (<em>recommended: C:\memcached</em>).  You should have the file <em>memcached.exe</em></li>
<li>
We can install memcached as a service on the command line using the command:</p>
<div id="code">C:\memcached\memcached.exe -d install</div>
</li>
<li>
Start memcached using the command:</p>
<div id="code">C:\memcached\memcached.exe -d start</div>
</li>
<li>
After running memcached we need to tie it with PHP using the <span id="highlight">php_memcached.dll</span>.  You should have this file on your PHP&#8217;s ext folder, if not download the file at these links <a href="http://downloads.php.net/pierre/" title="php_memcached.dll" target="_blank">http://downloads.php.net/pierre/</a>, <a href="http://www.pureformsolutions.com/pureform.wordpress.com/2008/06/17/php_memcache.dll" target="_blank">http://www.pureformsolutions.com/pureform.wordpress.com/2008/06/17/php_memcache.dll</a> or on our server: <a class='wpdm-popup' rel='colorbox' title='php_memcached.dll' href='http://www.icpep.org/?download=4' style="background:url('http://www.icpep.org/wp-content/plugins/download-manager/icon/download.png') no-repeat;padding:3px 12px 12px 28px;font:bold 10pt verdana;">php_memcached.dll.rar</a>
</li>
<li>
enable the use of php_memcached.dll by editing your php.ini and uncomment the line <span id="highlight">extension=php_memcache.dll</span> if it does not exist add this line.  After editing the file restart the webserver.
</li>
</ol>
<p>You can access the data on the memcached server by using the code below:</p>
<pre class="crayon-plain-tag"><code>&lt; ?php
        $memcache = new Memcache();
        if(!$memcache-&gt;connect('191.168.1.7', 11211))
                die(&quot;Couldn't connect to memcached!&quot;);

        $key=&quot;string&quot;;

        $result = $memcache-&gt;get($key);

        if($result)
        {
                echo &quot;$key is $result&quot;;
        }
        else
        {
            echo 'There is no data saved named '. $key;
        }
?&gt;</code></pre><p>
<p>You should have an output of <span id="highlight">&#8220;a simple string&#8221;</span>.  I hope this helped you set up the server.  Happy coding!</p>
<p>Sources:</p>
<p>http://pureform.wordpress.com/2008/01/10/installing-memcache-on-windows-for-php/</p>
<p>http://memcached.org</p>
<p>http://blogs.oracle.com/oswald/entry/cache_cache_cache_part_1</p>
<style type="text/css">li{text-align:justify;}</style>
<div id="seo_alrp_related"><h2>Posts Related to Setting Up a MemCached Server</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/fixing-apaches-error-could-not-reliably-determine-the-servers-fully-qualified-domain-name-using-127-0-1-1-for-servername-in-ubuntu/" rel="bookmark">Fixing Apache&#8217;s Error: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName in Ubuntu</a></h3><p>One of the server I am using is running ubuntu. I am installing memcached on the server and every time I restart the web server ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/smb-swat-on-centos-5/" rel="bookmark">SMB Swat on CentOS 5</a></h3><p>&nbsp; Simple howto's when SWAT is not available after you install CentOS.  To start with here are some cli commands to use, [root@goldmine ~]# yum ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/mysql-reset-root-password/" rel="bookmark">MySQL Reset Root Password</a></h3><p>My friend forgot his mysql password and the database needs to be accessed by the root user.  My friend is running MySQL 5.1 and as ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/use-gmail-account-to-relay-email-from-php-mail-function/" rel="bookmark">Use Gmail Account To Relay Email From PHP mail Function</a></h3><p>One of the things I find hard in developing a web application is using a library for sending email such as PHPMailer. I find it ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/code-igniter-installation-and-first-run/" rel="bookmark">Code Igniter Installation and First Run</a></h3><p>Code Igniter is an PHP Application Development Framework - a toolkit for PHP developers. The main goal of Code Igniter is to enable developers to ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/setting-up-a-memcached-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Gmail Account To Relay Email From PHP mail Function</title>
		<link>http://www.icpep.org/use-gmail-account-to-relay-email-from-php-mail-function/</link>
		<comments>http://www.icpep.org/use-gmail-account-to-relay-email-from-php-mail-function/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 14:53:41 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Linux How To's]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1484</guid>
		<description><![CDATA[One of the things I find hard in developing a web application is using a library for sending email such as PHPMailer. I find it hard when used to send emails. Another thing I find hard is when sending emails in a localhost webserver. It would also cost me more and would take much time in setting up my own mail server. PHP&#8217;s mail function is also very useless in such testing ground. If you are using a gmail account [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><img src="http://www.icpep.org/wp-content/uploads/2011/12/996862_internet_at_home_2.jpg" alt="Localhost Mail" title="Localhost Mail" width="300" height="300" class="aligncenter size-full wp-image-1485" /></p>
<p align="justify">One of the things I find hard in developing a web application is using a library for sending email such as PHPMailer.  I find it hard when used to send emails.  Another thing I find hard is when sending emails in a localhost webserver.  It would also cost me more and would take much time in setting up my own mail server.  PHP&#8217;s mail function is also very useless in such testing ground.</p>
<p align="justify">If you are using a gmail account and want to use PHP&#8217;s mail function in your local webserver, here is a better way to relay an email to gmail. I am using backtrack 5 Gnome and the steps will also work for debian based distros. Follow the steps below,</p>
<p>Install ssmtp,</p>
<div id="code">
$ sudo apt-get update &#038;&#038; apt-get install ssmtp
</div>
<p align="justify">After installing ssmtp, open the configuration file.</p>
<div id="code">$ sudo nano /etc/ssmtp/ssmtp.conf</div>
<p>Append the configuration at the bottom</p>
<div id="code">
AuthUser=icpep.org@gmail.com<br />
AuthPass=myPassword<br />
FromLineOverride=YES<br />
mailhub=smtp.gmail.com:587<br />
UseSTARTTLS=YES
</div>
<p>After the changes, you can now use PHP&#8217;s mail function</p>
<pre class="crayon-plain-tag"><code>&lt; ?php
$message = &quot;This is a test&quot;;
$message = wordwrap($message, 70);
mail('icpep.org@gmail.com', 'My Subject', $message);
?&gt;</code></pre>
<div id="seo_alrp_related"><h2>Posts Related to Use Gmail Account To Relay Email From PHP mail Function</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/4-thunderbird-add-ons/" rel="bookmark">4 Thunderbird Add-ons</a></h3><p>I am a great fan and a user of mozilla thunderbird. I have used different mail clients like microsoft outlook, opera mail, zimbra mail client, ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/phpmailer/" rel="bookmark">PHPMailer</a></h3><p>Sending E-Mail with PHP can be simple, or it can be very complex depending on what you want to do.  PHPmailer is a free PHP ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/pldts-port-25-smtp/" rel="bookmark">PLDT&#8217;s Port 25 (SMTP)</a></h3><p>Today, a friend and a colleague of mine called me and questioned me why she can't send emails using her mail client which is Incredimail ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/take-a-peek/" rel="bookmark">Peek Gadget</a></h3><p>What is the peek gadget?  Is it like just any ordinary gadgets?  Peek is the only gadget that is solely devoted to check emails.  Peek ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/thunderbird-to-outlook/" rel="bookmark">Thunderbird To Outlook</a></h3><p>I have successfully exported Thunderbird email files on ms outlook 2007 on a Windows XP platform which can also be done in windows vista and windows 7 platform. ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/use-gmail-account-to-relay-email-from-php-mail-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PDO Database Extensions Error</title>
		<link>http://www.icpep.org/pdo-database-extensions-error/</link>
		<comments>http://www.icpep.org/pdo-database-extensions-error/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 10:45:19 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[php pdo mysql]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1415</guid>
		<description><![CDATA[&#160; &#160; I installed Apache, MySQL and PHP on windows 7.  I tried to install drupal version 7.9 and went through an error as shown in the image below: The error &#8220;Your web server does not appear to support any common PDO database extensions.&#8221; can be fixed by following these steps: Open your php.ini file Around line 966 uncomment the line &#8220;extension=php_pdo_mysql.dll&#8221; Make sure you have php_pdo_mysql.dll on your ext folder or download it here php_pdo_mysql Restart Apache and you can [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><img class="size-full wp-image-1416 aligncenter" title="Drupal Logo" src="http://www.icpep.org/wp-content/uploads/2011/11/logo.png" alt="Drupal Logo" width="88" height="100" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>I installed Apache, MySQL and PHP on windows 7.  I tried to install drupal version 7.9 and went through an error as shown in the image below:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-1417" title="drupal pdo error" src="http://www.icpep.org/wp-content/uploads/2011/11/drupal-pdo-error.jpg" alt="drupal pdo error" width="531" height="316" /></p>
<p style="text-align: justify;">The error &#8220;<em><span style="color: #ff0000;">Your web server does not appear to support any common PDO database extensions.</span></em>&#8221; can be fixed by following these steps:</p>
<ol>
<li>Open your <em>php.ini</em> file</li>
<li>Around line 966 uncomment the line &#8220;extension=php_pdo_mysql.dll&#8221;</li>
<li>Make sure you have php_pdo_mysql.dll on your ext folder or download it here <a class='wpdm-popup' rel='colorbox' title='php_pdo_mysql' href='http://www.icpep.org/?download=3' style="background:url('http://www.icpep.org/wp-content/plugins/download-manager/icon/download.png') no-repeat;padding:3px 12px 12px 28px;font:bold 10pt verdana;">php_pdo_mysql</a></li>
<li>Restart Apache and you can continue with the installation of drupal</li>
</ol>
<div id="seo_alrp_related"><h2>Posts Related to PDO Database Extensions Error</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/php-curl/" rel="bookmark">PHP Curl</a></h3><p>If you are a web developer and having problems on Installing PHP Curl on Apache with PHP installed on Windows Operating System, below is my ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/fixing-apaches-error-could-not-reliably-determine-the-servers-fully-qualified-domain-name-using-127-0-1-1-for-servername-in-ubuntu/" rel="bookmark">Fixing Apache&#8217;s Error: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName in Ubuntu</a></h3><p>One of the server I am using is running ubuntu. I am installing memcached on the server and every time I restart the web server ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/phpmyadmin-importing-large-data/" rel="bookmark">PHPMyAdmin Importing Large Data</a></h3><p>By Default phpmyadmin can import data on your mysql database up to 2MB of data and beyond that will be an error.  This has been ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/slackware-php-gd-error/" rel="bookmark">Slackware PHP GD Error</a></h3><p>In the past months I was able to handle a LAMP server, this is my second time to handle a UNIX based web server but ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/changing-the-owner-of-your-docroot-lamp/" rel="bookmark">Changing the Owner of Your Docroot (LAMP)</a></h3><p>In a LAMP server when you upload files in your htdocs folder by default  the owner of the files is root or the account you ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/pdo-database-extensions-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql Duplicate Error</title>
		<link>http://www.icpep.org/mysql-duplicate-error/</link>
		<comments>http://www.icpep.org/mysql-duplicate-error/#comments</comments>
		<pubDate>Thu, 16 Dec 2010 00:43:44 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1199</guid>
		<description><![CDATA[I created a web application that managers collected links.  The web application was called duplicate checker where premium links collected are being stored in a mysql database.  Previously they are doing it on an excel file which automatically highlights the duplicate entry but as months pass by the file is running so slow and so I came up to a solution which is the duplicate checker. Its been almost 5 months and the system was running without any problem, its [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-medium wp-image-1202 aligncenter" title="Mysql" src="http://www.icpep.org/wp-content/uploads/2010/12/mysql1-296x300.png" alt="Mysql" width="296" height="300" /></p>
<p style="text-align: justify;">I created a web application that managers collected links.  The web application was called duplicate checker where premium links collected are being stored in a mysql database.  Previously they are doing it on an excel file which automatically highlights the duplicate entry but as months pass by the file is running so slow and so I came up to a solution which is the duplicate checker.</p>
<p style="text-align: justify;">Its been almost 5 months and the system was running without any problem, its running on a LAMP server with slackware as the chosen distro until a time came when the system errors an insert query.  The error is <span id="highlight"><em>Duplicate entry &#8217;129577&#8242; key 1</em>&#8216;</span>.  I tried to check the data but there is no duplicate entry.  I search the net and found out that SQL is corrupted which happens when MyISAM is used for tables where data is constantly changing.</p>
<blockquote><p>A better solution is not to use MyISAM for tables where the data is constantly changing<br />
- Simon Woolf</p></blockquote>
<p>As a solution to the problem a repair query was performed instead of renaming tables.</p>
<div id="code">
<p style="padding-left: 30px;">repair table <em>&lt;tablename&gt;</em></p>
</div>
<p>The table was fixed after the query and everything no is back to normal.</p>
<div id="seo_alrp_related"><h2>Posts Related to Mysql Duplicate Error</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/code-igniter-query/" rel="bookmark">Code Igniter Query</a></h3><p>Code Igniter is one of the best PHP framework available today.  It is free to download and user guide can be found together with the ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/removing-cloned-files/" rel="bookmark">Removing Unwanted Files</a></h3><p>Tired of duplicated file on your computer or unwanted files? Tired of deleting it manually? Don't worry we have a software can directly detect files ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/phpmyadmin-importing-large-data/" rel="bookmark">PHPMyAdmin Importing Large Data</a></h3><p>By Default phpmyadmin can import data on your mysql database up to 2MB of data and beyond that will be an error.  This has been ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/mysql-reset-root-password/" rel="bookmark">MySQL Reset Root Password</a></h3><p>My friend forgot his mysql password and the database needs to be accessed by the root user.  My friend is running MySQL 5.1 and as ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/slackware-php-gd-error/" rel="bookmark">Slackware PHP GD Error</a></h3><p>In the past months I was able to handle a LAMP server, this is my second time to handle a UNIX based web server but ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/mysql-duplicate-error/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Website Virus (ncoyrl.htm, zcv.gif and iframe)</title>
		<link>http://www.icpep.org/website-virus-ncoyrl-htm-zcv-gif-and-iframe/</link>
		<comments>http://www.icpep.org/website-virus-ncoyrl-htm-zcv-gif-and-iframe/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 03:34:37 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[virus]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1195</guid>
		<description><![CDATA[With millions of websites in search engines we can never be sure that the sites we are visiting are not harmful.  Some search engines like Google helps us detect websites that can cause harm to out computer.  Some search engines do not have this feature which makes us vulnerable to to exploit attacks especially for those that are webmasters.  We must always make sure that we have computer protection such as anti spyware or even the basic antivirus software which can be [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.icpep.org/wp-content/uploads/2010/12/website-virus-1.png"><img class="size-full wp-image-1196 aligncenter" title="website virus" src="http://www.icpep.org/wp-content/uploads/2010/12/website-virus-1.png" alt="website virus" width="452" height="371" /></a></p>
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;"><a href="http://www.icpep.org/wp-content/uploads/2010/12/website-virus-2.png"><img class="size-full wp-image-1197 aligncenter" title="website virus" src="http://www.icpep.org/wp-content/uploads/2010/12/website-virus-2.png" alt="website virus" width="917" height="22" /></a></p>
<p style="text-align: justify;">With millions of websites in search engines we can never be sure that the sites we are visiting are not harmful.  Some search engines like Google helps us detect websites that can cause harm to out computer.  Some search engines do not have this feature which makes us vulnerable to to exploit attacks especially for those that are webmasters.  We must always make sure that we have computer protection such as anti spyware or even the basic antivirus software which can be downloaded for free on the internet such as avast and avira.<span id="more-1195"></span></p>
<p style="text-align: justify;">Just like the <a href="http://www.icpep.org/telepornnet-redirect/" target="_blank">website virus</a> I found on some of our sites a new one existed and was not even noticed by the webmaster of the site I recently modified.  There was a script injected along the php files, as seen on the images.  I never knew how the virus got into the site, what I saw when I opened the site&#8217;s files via FTP is that there are encrypted codes along the normal pages.  I had the pages scanned and found out that the encrypted codes is a virus.  I removed the lines on the php files and in a short while it was back again.  There I found out that there are 3 files that generates the virus, 1 is the <em>index.php </em>which has the iframe tag as seen on the image, 2nd was the file <em>ncoyrl.htm </em> which has the encrypted javascript codes and lastly a gif image named <em>zcv.gif </em>which also plays a role.</p>
<p style="text-align: justify;">After I deleted the files the website no longer throws a threat warning coming from an antivirus.  We must always make sure that in an online business, security is an issue.  Let a programmer or anybody that is techie enough to check free scripts downloaded online.</p>
<div id="seo_alrp_related"><h2>Posts Related to Website Virus (ncoyrl.htm, zcv.gif and iframe)</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/on-line-virus-scan/" rel="bookmark">Online Virus Scan</a></h3><p>Surfing on the net has been trouble some now a days because there are a lot phishing, fraud, syware, malware, trojans on line. I have ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/telepornnet-redirect/" rel="bookmark">Teleporn.net Redirect</a></h3><p>In the past few days I was solving a problem on a site and the problem was this; The site has an iframe virus, the ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/black-hat-seo/" rel="bookmark">black hat Search Engine Optimization</a></h3><p>These black hat SEO techniques usually include one or more of the following characteristics: 1. One who breaks search engine rules. 2. Unethically presents content ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/how-to-check-for-virus-presence/" rel="bookmark">How to check for virus Presence</a></h3><p>There are some tools and procedures that can tell with 99.44 percent accuracy whether your computer has a virus. Here are the actions to take: ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/article-submission-websites/" rel="bookmark">Article Submission Websites</a></h3><p>Search Engine Optimization is one of the most difficult thing to do to get your site ranked in the top 3 search engines namely Google, ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/website-virus-ncoyrl-htm-zcv-gif-and-iframe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Error Occurred Executing the Microsoft VC++ Runtime Installer</title>
		<link>http://www.icpep.org/an-error-occurred-executing-the-microsoft-vc-runtime-installer/</link>
		<comments>http://www.icpep.org/an-error-occurred-executing-the-microsoft-vc-runtime-installer/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 03:06:29 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Tweak]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1191</guid>
		<description><![CDATA[MySQL is proprietary and some developers are now merging to Postgre SQL.  If you are running windows you might come across this error.  I am using windows 7 ultimate and encountered this error during installation.  I solved the problem using the command postgresql-9.0.1-1-windows.exe &#8211;install_runtimes 0 You need to navigate to where you downloaded the installer using the command prompt then you can use the command above to run the installer w/o the error Posts Related to An Error Occurred Executing the Microsoft [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.icpep.org/wp-content/uploads/2010/12/postgre-sql-error.png"><img class="size-full wp-image-1192 aligncenter" title="An error occurred executing the microsoft c++ runtime installer" src="http://www.icpep.org/wp-content/uploads/2010/12/postgre-sql-error.png" alt="An error occurred executing the microsoft c++ runtime installer" width="390" height="133" /></a></p>
<p>MySQL is proprietary and some developers are now merging to Postgre SQL.  If you are running windows you might come across this error.  I am using windows 7 ultimate and encountered this error during installation.  I solved the problem using the command</p>
<div style="background: #f1f1f1; border: #cecece 2px solid; padding: 5px;">postgresql-9.0.1-1-windows.exe &#8211;install_runtimes 0</div>
<p>You need to navigate to where you downloaded the installer using the command prompt then you can use the command above to run the installer w/o the error</p>
<div id="seo_alrp_related"><h2>Posts Related to An Error Occurred Executing the Microsoft VC++ Runtime Installer</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/internal-error-2378/" rel="bookmark">Internal Error 2378</a></h3><p>I was installing a software and throws an error Internal Error 2378. I googled the problem and most suggestions didn't work out for me, btw I am ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/fixing-apaches-error-could-not-reliably-determine-the-servers-fully-qualified-domain-name-using-127-0-1-1-for-servername-in-ubuntu/" rel="bookmark">Fixing Apache&#8217;s Error: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName in Ubuntu</a></h3><p>One of the server I am using is running ubuntu. I am installing memcached on the server and every time I restart the web server ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/pdo-database-extensions-error/" rel="bookmark">PDO Database Extensions Error</a></h3><p>&nbsp; &nbsp; I installed Apache, MySQL and PHP on windows 7.  I tried to install drupal version 7.9 and went through an error as shown ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/delete-undeletable-files/" rel="bookmark">Delete Undeletable Files</a></h3><p>How do we delete undeletable files in windows? There are files that windows don't allow us to delete especially when the file is currently being ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/packet-tracer-on-ubuntu/" rel="bookmark">Packet Tracer on Ubuntu amd64 10.10</a></h3><p>Cisco's Packet Tracer is one of my most wanted application when I was using Windows.  When you login to your account in cisco you can ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/an-error-occurred-executing-the-microsoft-vc-runtime-installer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MySQL Reset Root Password</title>
		<link>http://www.icpep.org/mysql-reset-root-password/</link>
		<comments>http://www.icpep.org/mysql-reset-root-password/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 23:18:29 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tweak]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1174</guid>
		<description><![CDATA[My friend forgot his mysql password and the database needs to be accessed by the root user.  My friend is running MySQL 5.1 and as I browsed the MySQL manual the solution provided is not working though a slight change was made.  Just like the provided step in the manual: Log on to your system as Administrator. Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-1175 aligncenter" title="mysql services" src="http://www.icpep.org/wp-content/uploads/2010/11/services.jpg" alt="mysql services" width="511" height="362" /></p>
<p style="text-align: justify;">My friend forgot his mysql password and the database needs to be accessed by the root user.  My friend is running MySQL 5.1 and as I browsed the MySQL manual the solution provided is not working though a slight change was made.  Just like the provided step in the<a title="Mysql reset manual" href="http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html" target="_blank"> manual</a>:</p>
<blockquote>
<ol type="1">
<li>Log on to your system as Administrator.</li>
<li>Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list and stop it.If your server is not running as a service, you may need to use the Task Manager to force it to stop.</li>
<li>Create a text file containing the following statements. Replace the password with the password that you want to use.<span id="more-1174"></span><br />
<pre class="crayon-plain-tag"><code>UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;</code></pre><br />
Write the <a title="12.2.11. UPDATE Syntax" href="http://dev.mysql.com/doc/refman/5.0/en/update.html"><code>UPDATE</code></a> and <a title="12.4.6.2. FLUSH Syntax" href="http://dev.mysql.com/doc/refman/5.0/en/flush.html"><code>FLUSH</code></a> statements each on a single line. The <a title="12.2.11. UPDATE Syntax" href="http://dev.mysql.com/doc/refman/5.0/en/update.html"><code>UPDATE</code></a> statement resets the password for all<code>root</code> accounts, and the <a title="12.4.6.2. FLUSH Syntax" href="http://dev.mysql.com/doc/refman/5.0/en/flush.html"><code>FLUSH</code></a> statement tells the server to reload the grant tables into memory so that it notices the password change.</li>
<li>Save the file. For this example, the file will be named <code>C:\mysql.txt</code>.</li>
<li>Open a console window to get to the command prompt: From the Start menu, select Run, then enter <strong>cmd</strong> as the command to be run.</li>
<li>mysqld &#8211;init-file=C:\\mysql.txt</li>
</ol>
</blockquote>
<p style="text-align: center;"><a href="http://www.icpep.org/wp-content/uploads/2010/11/mysql-reset-password.jpg"><img class="size-full wp-image-1176 aligncenter" title="mysql reset password" src="http://www.icpep.org/wp-content/uploads/2010/11/mysql-reset-password.jpg" alt="mysql reset password" width="537" height="266" /></a></p>
<p style="text-align: justify;"><p style="text-align: justify;">I used &#8220;mysqld &#8211;init-file=C:\\mysql.txt&#8221; instead of having mysql-nt which is the command provided on the manual.  After the that you have now changed the root password.  You can delete the mysql.txt file you created and you can now log in using the new account details.</p>
<p style="text-align: center;"><a href="http://www.icpep.org/wp-content/uploads/2010/11/mysql-reset-root-password.jpg"><img class="size-full wp-image-1177 aligncenter" title="mysql reset root password" src="http://www.icpep.org/wp-content/uploads/2010/11/mysql-reset-root-password.jpg" alt="mysql reset root password" width="537" height="266" /></a></p>
<div id="seo_alrp_related"><h2>Posts Related to MySQL Reset Root Password</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/mysql-duplicate-error/" rel="bookmark">Mysql Duplicate Error</a></h3><p>I created a web application that managers collected links.  The web application was called duplicate checker where premium links collected are being stored in a ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/phpmyadmin-importing-large-data/" rel="bookmark">PHPMyAdmin Importing Large Data</a></h3><p>By Default phpmyadmin can import data on your mysql database up to 2MB of data and beyond that will be an error.  This has been ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/brute-force-ssh/" rel="bookmark">Brute Force SSH</a></h3><p>One of the tools I like to use to test servers is bruteforceSSH.  Though most systems today can already detect bruteforce attacks some lazy system ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/smb-swat-on-centos-5/" rel="bookmark">SMB Swat on CentOS 5</a></h3><p>&nbsp; Simple howto's when SWAT is not available after you install CentOS.  To start with here are some cli commands to use, [root@goldmine ~]# yum ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/change-a-string-or-character-in-mysql/" rel="bookmark">Change a String or Character in MySQL</a></h3><p>Knowing the right MySQL statement is the most important part in having thousands of data in your database, one false move and you can't undo ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/mysql-reset-root-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Infix to Postfix and Prefix</title>
		<link>http://www.icpep.org/infix-to-postfix-and-prefix/</link>
		<comments>http://www.icpep.org/infix-to-postfix-and-prefix/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 00:27:57 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Works]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1171</guid>
		<description><![CDATA[image from www.codeproject.com On the last day of our class for the first semester, our instructor gave us an assignment about infix, postfix and prefix.  The assignment was to create a program that converts infix equations to its postfix form and prefix form.  I search around the net and the resources are so few that it took me days to have a sample program in C.  I am not that good in C programming but I can create C++ or [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.icpep.org/wp-content/uploads/2010/11/binexptrees.jpg"><img class="size-full wp-image-1172 aligncenter" title="infix prefix and postfix equations" src="http://www.icpep.org/wp-content/uploads/2010/11/binexptrees.jpg" alt="infix prefix and postfix equations" width="266" height="249" /></a><br />
<em>image from www.codeproject.com</em></p>
<p>On the last day of our class for the first semester, our instructor gave us an assignment about infix, postfix and prefix.  The assignment was to create a program that converts infix equations to its postfix form and prefix form.  I search around the net and the resources are so few that it took me days to have a sample program in C.  I am not that good in C programming but I can create C++ or C programs.  The code provided here may not be that well optimized and the structures may not be that perfect but it works well.  I used Visual C++ in modifying the program(<em>yes I just modified a program</em>):).  <a title="Infix prefix postfix c++" href="http://www.icpep.org/downloads/postfix_infix_prefix.rar" target="_blank">You can download the files here</a></p>
<div id="seo_alrp_related"><h2>Posts Related to Infix to Postfix and Prefix</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/phpmailer/" rel="bookmark">PHPMailer</a></h3><p>Sending E-Mail with PHP can be simple, or it can be very complex depending on what you want to do.  PHPmailer is a free PHP ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/what-is-programming-language/" rel="bookmark">What is Programming Language</a></h3><p>When you enter a darkened room and want to see what is inside, you turn on a light switch. When you leave the room, you ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/computer-security-threats/" rel="bookmark">Computer Security Threats</a></h3><p>In a Windows XP system files computer security threats are not new to it. The damage caused by viruses can range from rendering useless just ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/bubble-sort-and-graphics-h-in-dev-c/" rel="bookmark">Bubble Sort and Graphics.h in Dev C++</a></h3><p>Lately I have been searching  this post on the net about graphics.h in dev c++ and found few resources about it .  So I decided ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/file-extension-wps/" rel="bookmark">File Extension WPS</a></h3><p>File Extension WPS or files that has a ".wps" is not a virus(except if there is something embedded with it) but rather it is a ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/infix-to-postfix-and-prefix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple PHP Date Function</title>
		<link>http://www.icpep.org/simple-php-date-function/</link>
		<comments>http://www.icpep.org/simple-php-date-function/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 03:06:41 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1149</guid>
		<description><![CDATA[PHP has a function date where you can specify different ways on how to display the date.  How do you generate current date and display only month and date like &#8216;September 2010&#8242;.  Here is a simple php howto,&#60;div&#62;function curDate()&#160;{&#60;/div&#62; &#60;div id=&#34;_mcePaste&#34;&#62;return date(&#34;Y-m-d&#34;,mktime(date(&#34;h&#34;)+8, date(&#34;i&#34;), date(&#34;s&#34;), date(&#34;m&#34;) &#160;, date(&#34;d&#34;), date(&#34;Y&#34;)));&#60;/div&#62; &#60;div id=&#34;_mcePaste&#34;&#62;}&#60;/div&#62; &#60;div&#62;$now = substr(curDate(),0,7);&#60;/div&#62; &#60;div&#62;echo date(&#34;F Y&#34;, strtotime($now));&#60;/div&#62; &#60;div&#62;?&#38;gt;&#60;/div&#62; The code above will simply output September 2010, a simple code that will surely help you especially when coding PHP from scratch. Posts Related [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.icpep.org/wp-content/uploads/2010/09/month-year-in-php.jpg"><img class="size-full wp-image-1150 aligncenter" title="month year in php" src="http://www.icpep.org/wp-content/uploads/2010/09/month-year-in-php.jpg" alt="" width="429" height="60" /></a></p>
<p>PHP has a function date where you can specify different ways on how to display the date.  How do you generate current date and display only month and date like &#8216;September 2010&#8242;.  Here is a simple php howto,</p><pre class="crayon-plain-tag"><code>&lt;div&gt;function curDate()&nbsp;{&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;return date(&quot;Y-m-d&quot;,mktime(date(&quot;h&quot;)+8, date(&quot;i&quot;), date(&quot;s&quot;), date(&quot;m&quot;) &nbsp;, date(&quot;d&quot;), date(&quot;Y&quot;)));&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;}&lt;/div&gt;
&lt;div&gt;$now = substr(curDate(),0,7);&lt;/div&gt;
&lt;div&gt;echo date(&quot;F Y&quot;, strtotime($now));&lt;/div&gt;
&lt;div&gt;?&amp;gt;&lt;/div&gt;</code></pre><p>
The code above will simply output September 2010, a simple code that will surely help you especially when coding PHP from scratch.</p>
<div id="seo_alrp_related"><h2>Posts Related to Simple PHP Date Function</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/php-compare-date/" rel="bookmark">PHP Compare Date</a></h3><p>I was creating a program for a library and that is to have a system that will manage the borrowing of books. I was searching ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/nokia-cellphone-hacks/" rel="bookmark">Nokia Cellphone Hacks</a></h3><p>Your Nokia cell phone can be programmed to pick up radar speed traps, when programmed your cell phone picks up the radar and alerts you ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/getting-main-domain/" rel="bookmark">Getting Main Domain</a></h3><p>Do you want to extract the main domain of a URL?  Here is a function that works well and can be modified easily.  I found ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/how-to-check-for-virus-presence/" rel="bookmark">How to check for virus Presence</a></h3><p>There are some tools and procedures that can tell with 99.44 percent accuracy whether your computer has a virus. Here are the actions to take: ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/code-igniter-query/" rel="bookmark">Code Igniter Query</a></h3><p>Code Igniter is one of the best PHP framework available today.  It is free to download and user guide can be found together with the ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/simple-php-date-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bubble Sort and Graphics.h in Dev C++</title>
		<link>http://www.icpep.org/bubble-sort-and-graphics-h-in-dev-c/</link>
		<comments>http://www.icpep.org/bubble-sort-and-graphics-h-in-dev-c/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:49:20 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1101</guid>
		<description><![CDATA[Lately I have been searching  this post on the net about graphics.h in dev c++ and found few resources about it .  So I decided to write how to use graphics.h in dev-c++.  I am expecting that you have already installed bloodshed dev-cpp on your machine.  Graphics.h is a header file found in borlan c but because of its late development devcpp is now the mostly used IDE and compiler in programming c++. Below are the steps on how to [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.icpep.org/wp-content/uploads/2010/07/dev-c++.jpg"><img class="size-full wp-image-1102 aligncenter" title="dev c++" src="http://www.icpep.org/wp-content/uploads/2010/07/dev-c++.jpg" alt="dev c++" width="472" height="293" /></a></p>
<p style="text-align: justify;">Lately I have been searching  this post on the net about graphics.h in dev c++ and found few resources about it .  So I decided to write how to use graphics.h in dev-c++.  I am expecting that you have already installed bloodshed dev-cpp on your machine.  Graphics.h is a header file found in borlan c but because of its late development devcpp is now the mostly used IDE and compiler in programming c++.</p>
<p style="text-align: justify;">Below are the steps on how to get graphics.h running on your machine,</p>
<ol>
<li>download <a title="graphics.h in dev cpp" href="http://www.icpep.org/downloads/graphics.h" target="_blank">graphics.h</a> and save it to the <strong>include</strong> folder where you installed dev-cpp (C:\Dev-Cpp\include)</li>
<li>Download <a title="libbgi" href="http://www.icpep.org/downloads/libbgi.a">libbgi.a</a> and save it in the <strong>lib </strong>folder where you installed dev-cpp (C:\Dev-Cpp\lib)</li>
<li>So when you have to create a program that needs the use of graphics.h  you must instruct the linker to link in certain libraries by going to <strong>projects &gt; project options &gt; parameters tab &gt; linker column </strong>copy the lines below and paste it on that column.</li>
</ol>
<pre class="crayon-plain-tag"><code>-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32</code></pre><p>
By then you should be able to use graphics.h. As a sample I created this bubble sort algorithm as an example on how to use graphics.h in c++.<span id="more-1101"></span></p>
<div style="border: 2px solid #CECECE; padding: 5px; background: #F1F1F1;">
<div id="_mcePaste">#include &lt;iostream&gt;</div>
<div id="_mcePaste">#include &lt;graphics.h&gt;</div>
<p>#define PIXEL_COUNT 1000<br />
#define DELAY_TIME  1  /* in milliseconds */<br />
#define CLIP_ON     1</p>
<p>//using namespace std;</p>
<p>int main () {</p>
<p>int temp, x, toSort[300], loop, isSwapped=1;<br />
/* request autodetection */<br />
int gdriver = DETECT, gmode, errorcode;</p>
<p>/* initialize graphics and local variables */<br />
initgraph(&amp;gdriver, &amp;gmode, &#8220;&#8221;);</p>
<p>/* read result of initialization */<br />
errorcode = graphresult();</p>
<p>if (errorcode != grOk) {  /* an error occurred */</p>
<p>printf(&#8220;Graphics error: %s\n&#8221;, grapherrormsg(errorcode));<br />
printf(&#8220;Press any key to halt:&#8221;);<br />
getch();<br />
exit(1);               /* terminate with an error code */</p>
<p>}</p>
<p>/* Generate the numbers */<br />
for(x=0; x&lt;300; x++) {<br />
toSort[x] = rand() % 300 + 1;<br />
}</p>
<p>for(loop=0; (loop &lt;= 300)&amp;&amp; isSwapped == 1; loop++) {<br />
isSwapped = 0;<br />
for(x=0; x&lt;300; x++) {            if(toSort[x] &gt; toSort[x+1]) {</p>
<p>//swapping of data<br />
temp = toSort[x];<br />
toSort[x] = toSort[x+1];<br />
toSort[x+1] = temp;<br />
isSwapped = 1;</p>
<p>}<br />
std::cout &lt;&lt; loop &lt;&lt; &#8220;=&gt; &#8220;&lt;&lt; x &lt;&lt; &#8220;,&#8221; &lt;&lt; toSort[x] &lt;&lt; &#8221; &#8220;;</p>
<p>putpixel(x, toSort[x], 16776960);<br />
delay(DELAY_TIME);</p>
<p>}<br />
std::cout &lt;&lt; &#8220;\n\n&#8221;;<br />
if(isSwapped == 1) {<br />
cleardevice();<br />
}<br />
//loop++;<br />
}</p>
<p>//cout &lt;&lt; endl &lt;&lt; &#8220;\n\n\n&#8221;;<br />
std::cout &lt;&lt; &#8220;Loop Count: &#8221; &lt;&lt; loop &lt;&lt; &#8220;\n\n\n&#8221;;<br />
system(&#8220;pause&#8221;);<br />
return 0;<br />
}</p>
</div>
<p style="text-align: justify;">The program will have scattered points on the screen and will form a line as the loop iterates and at the end it will display how many loops are needed to sort the randomly generated numbers.</p>
<p style="text-align: justify;">If you have problems using the functions you can refer to this <a href="http://www.cs.colorado.edu/~main/bgi/doc/">link</a>.  I hope this helps in solving your problem about dev c++ graphics.h with the <strong>bubble sort algorithm</strong>.</p>
<div id="seo_alrp_related"><h2>Posts Related to Bubble Sort and Graphics.h in Dev C++</h2><ul><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/assembly-language-tutorial/" rel="bookmark">Assembly Language Tutorial</a></h3><p>Here is another Assembly Language Tutorial Sample Program. This program is creating a fixed password to a certain application. This One of the basic examples ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/learning-c/" rel="bookmark">Learning C++</a></h3><p>Since C++ is the first Language I've learned and time passed by and I forgot how create one now. So i'll be learning once again ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/howto-hello-world-in-c/" rel="bookmark">Howto Hello World in C++</a></h3><p>//Printing Hellow World! #include &lt;iostream&gt; int main() { std::cout &lt;&lt; "Hello World! \n"; system("pause"); return 0; } Line begins with //, indicating that the remainder ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/c-reading-from-a-text-file/" rel="bookmark">C++ Reading From a Text File</a></h3><p>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; using namespace std; int main() { string line; int count = 0; ifstream FileName ("try.txt"); if (FileName.is_open() &amp;&amp; !FileName.eof()){ ...</p></div></li><li><div class="seo_alrp_rl_content"><h3><a href="http://www.icpep.org/php-curl/" rel="bookmark">PHP Curl</a></h3><p>If you are a web developer and having problems on Installing PHP Curl on Apache with PHP installed on Windows Operating System, below is my ...</p></div></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/bubble-sort-and-graphics-h-in-dev-c/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

