<?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>Camilo Lozano III &#187; Info.Tech</title>
	<atom:link href="http://camilord.kagayan.com/category/information-technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://camilord.kagayan.com</link>
	<description>Linux for Servers, Macintosh for Graphics and Windows for Solitair...</description>
	<lastBuildDate>Sat, 24 Jul 2010 13:07:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>dev-C++ : Bubble Sort with Graphic Plotting</title>
		<link>http://camilord.kagayan.com/2010/07/24/dev-c-bubble-sort-with-graphic-plotting/</link>
		<comments>http://camilord.kagayan.com/2010/07/24/dev-c-bubble-sort-with-graphic-plotting/#comments</comments>
		<pubDate>Sat, 24 Jul 2010 13:01:10 +0000</pubDate>
		<dc:creator>Camilo III</dc:creator>
				<category><![CDATA[Info.Tech]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[dev-C++]]></category>

		<guid isPermaLink="false">http://camilord.kagayan.com/?p=423</guid>
		<description><![CDATA[I&#8217;m having difficulties in creating good programming algorithm with C++. I find its very difficult. Somehow, I would like to share my accomplishment in creating this program, Bubble Sort with Graphic Plotting. But first, what is bubble sort? Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the list to be]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m having difficulties in creating good programming algorithm with C++. I find its very difficult. Somehow, I would like to share my accomplishment in creating this program, Bubble Sort with Graphic Plotting. But first, what is bubble sort?</p>
<p><strong>Bubble sort </strong>is a simple sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm gets its name from the way smaller elements &#8220;bubble&#8221; to the top of the list. Because it only uses comparisons to operate on elements, it is a comparison sort.</p>
<p>Below is the demo, source codes and libraries needed&#8230;</p>
<ul>
<li><a class="downloadlink" href="http://camilord.kagayan.com/download/bubbesort.exe" title="Version1.0 downloaded 5 times" >Bubble Sort with Graphic Plotting Demo (executable file) (5)</a></li>
<li><a class="downloadlink" href="http://camilord.kagayan.com/download/bubblesort2_source.zip" title="Version1.0 downloaded 0 times" >Bubble Sort with Graphic Plotting (Source Code) (0)</a></li>
<li><a class="downloadlink" href="http://camilord.kagayan.com/download/graphic_lib.zip" title="Version1.0 downloaded 0 times" >Graphic Library (0)</a></li>
</ul>
<p>If you have better algorithm solutions, if you don&#8217;t mind, can you email it to me&#8230; Like to see how others solve the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://camilord.kagayan.com/2010/07/24/dev-c-bubble-sort-with-graphic-plotting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPTABLES &#8211; Logging and dropping traffic in a single rule</title>
		<link>http://camilord.kagayan.com/2010/07/15/iptables-logging-and-dropping-traffic-in-a-single-rule/</link>
		<comments>http://camilord.kagayan.com/2010/07/15/iptables-logging-and-dropping-traffic-in-a-single-rule/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 12:00:56 +0000</pubDate>
		<dc:creator>Camilo III</dc:creator>
				<category><![CDATA[Info.Tech]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://camilord.kagayan.com/?p=420</guid>
		<description><![CDATA[Many people who are familiar with IPCHAINS (the predecessor to IPTABLES) are familiar with the ability to simply tack on a &#8216;-l&#8217; to also log rules which match that rule. In IPTABLES this is not done the same way and no such option exists. To accomplish the same task in IPTABLES you could simply put]]></description>
			<content:encoded><![CDATA[<p>Many people who are familiar with IPCHAINS (the predecessor to  IPTABLES) are familiar with the ability to simply tack on a &#8216;-l&#8217; to also  log rules which match that rule.  In IPTABLES this is not done the same  way and no such option exists.</p>
<p>To accomplish the same task in IPTABLES you could simply put a  identical rule with a LOG action before every drop rule, but that will  fill your script with copies of the same rule and force updates in  multiple locations.  This is therefore not an ideal solution.</p>
<p>The cleanest method of accomplishing this is to create a new chain  which does both the LOG and DROP for you.  The following IPTABLES rules  will create a LOGDROP chain.</p>
<pre># Create the LOGDROP chain
 iptables -N LOGDROP &gt; /dev/null 2&gt; /dev/null
 iptables -F LOGDROP
 iptables -A LOGDROP -j LOG --log-prefix "LOGDROP "
 iptables -A LOGDROP -j DROP</pre>
<p>The first rule in this set creates the new chain.  The output is sent  to /dev/null because if you attempt to run this twice on the same  system, you will get an error saying the chain already exists.  It&#8217;s up  to you if you want to see that message or not.</p>
<p>The second rule flushes the contents of the chain, again, so that if  you run it twice on the same system you don&#8217;t have duplicate rules in  the chain.</p>
<p>The third rule LOGS the traffic with the added &#8220;LOGDROP&#8221; prefix and  the fourth rule DROPs the traffic</p>
<p>What this now means is that you can easily log and drop traffic or  even log and accept traffic (with minor modifications to the above), by  creating a rule such as this:</p>
<pre># Log and drop all connections to the HTTP port
 iptables -A INPUT -p tcp --dport 80 -j LOGDROP</pre>
<p>As you can see, you now simply use the LOGDROP target in order to log  and drop any traffic you want.  You must ensure that you define the  LOGDROP target BEFORE you attempt to use it in a rule.</p>
<p>If anyone has any comments or corrections for this, please let me  know using the comment system below.</p>
<p><strong><em>Article From: http://www.techbytes.ca/techbyte136.html</em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://camilord.kagayan.com/2010/07/15/iptables-logging-and-dropping-traffic-in-a-single-rule/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating SSL certificates using OpenSSL</title>
		<link>http://camilord.kagayan.com/2010/05/10/generating-ssl-certificates-using-openssl/</link>
		<comments>http://camilord.kagayan.com/2010/05/10/generating-ssl-certificates-using-openssl/#comments</comments>
		<pubDate>Mon, 10 May 2010 04:56:35 +0000</pubDate>
		<dc:creator>Camilo III</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Info.Tech]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://camilord.kagayan.com/?p=399</guid>
		<description><![CDATA[Based on Centos Wiki on HowTo SSL &#8211; http://wiki.centos.org/HowTos/Https I simplified the procedure to create a bash script. Here&#8217;s the code; #!/bin/bash umask 077 echo "" if [ $# -eq 0 ] ; then echo $"Usage: `basename $0` &#60;DOMAIN_NAME&#62; [...]" echo "" exit 0 fi for target in $@ ; do keyFile=${target}.key crtFile=${target}.crt csrFile=${target}.csr echo]]></description>
			<content:encoded><![CDATA[<p>Based on Centos Wiki on HowTo SSL &#8211; http://wiki.centos.org/HowTos/Https</p>
<p>I simplified the procedure to create a bash script. Here&#8217;s the code;</p>
<pre>#!/bin/bash
umask 077

echo ""
if [ $# -eq 0 ] ; then
 echo $"Usage: `basename $0` &lt;DOMAIN_NAME&gt; [...]"
 echo ""
 exit 0
fi

for target in $@ ; do

 keyFile=${target}.key
 crtFile=${target}.crt
 csrFile=${target}.csr

 echo $keyFile
 echo $crtFile
 echo $csrFile

 # Generate private key
 openssl genrsa -out $keyFile 1024 

 # Generate CSR
 openssl req -new -key $keyFile -out $csrFile

 echo ""
 echo "Please enter the number of days which SSL Certificate will be valid:"
 read DAYS
 echo ""

 # Generate Self Signed Key
 openssl x509 -req -days $DAYS -in $csrFile -signkey $keyFile -out $crtFile
done</pre>
<p>Or download the script below&#8230;</p>
<p><strong>Download: <a class="downloadlink" href="http://camilord.kagayan.com/download/gencert.zip" title="Version0.0.1.0 downloaded 6 times" >gencert (6)</a> bash script</strong></p>
<p>How to add <strong>gencert</strong> command to your system:</p>
<ol>
<li>Download the gencert bash script</li>
<li>Extract the file</li>
<li>chmod u+x gencert</li>
<li>then copy the gencert file to /bin/</li>
<li>Wallaah! You&#8217;re done!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://camilord.kagayan.com/2010/05/10/generating-ssl-certificates-using-openssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CEntOS: Securing FTP (vsftpd) and SSH</title>
		<link>http://camilord.kagayan.com/2010/05/08/centossecuring-ftp-vsftpd-and-ssh/</link>
		<comments>http://camilord.kagayan.com/2010/05/08/centossecuring-ftp-vsftpd-and-ssh/#comments</comments>
		<pubDate>Sat, 08 May 2010 15:13:20 +0000</pubDate>
		<dc:creator>Camilo III</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Info.Tech]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[vsftpd]]></category>

		<guid isPermaLink="false">http://camilord.kagayan.com/?p=388</guid>
		<description><![CDATA[SECURING FTP Use chroot_local_user=YES then the vsftpd.chroot_list becomes a list of users to NOT chroot. So&#8230; you said chroot ALL users but ftpuser. Notice the commented out lines. In /etc/vsftpd/vsftpd.conf: chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftpd.chroot_list edited /etc/vsftpd.chroot_list: add users only that DO NOT NOT NOT NOT get chrooted. use /sbin/nologin edited /etc/passwd entry for ftpuser: ftpuser:X:#:#:FTP User]]></description>
			<content:encoded><![CDATA[<p><strong>SECURING FTP</strong></p>
<p>Use chroot_local_user=YES then the vsftpd.chroot_list becomes a list of users to NOT chroot. So&#8230; you said chroot ALL users but ftpuser.</p>
<p>Notice the commented out lines.<br />
In /etc/vsftpd/vsftpd.conf:<br />
chroot_local_user=YES<br />
chroot_list_enable=YES<br />
chroot_list_file=/etc/vsftpd.chroot_list</p>
<p>edited /etc/vsftpd.chroot_list:<br />
add users only that DO NOT NOT NOT NOT get chrooted.</p>
<p>use /sbin/nologin<br />
edited /etc/passwd entry for ftpuser:<br />
ftpuser:X:#:#:FTP User Account:/home/ftpuser/./:/sbin/nologin</p>
<p>&#8212;&#8212;&#8212;&#8212;</p>
<p>chroot_local_user=YES<br />
chroot_list_enable=YES<br />
means that by default ALL users get chrooted except users in the file</p>
<p>chroot_local_user=NO<br />
chroot_list_enable=YES<br />
means that by default ONLY users in the file get chrooted.</p>
<p>See the difference?</p>
<p>Article by: <a href="http://www.linuxquestions.org/questions/user/jordanh-71777/">JordanH</a></p>
<p><strong>SECURING SSH</strong></p>
<p>Edit /etc/ssh/sshd_config and at the bottom of the file, add these lines&#8230;</p>
<p># Allowed users to login SSH<br />
#AllowUsers root user002</p>
<p># Disallow users in logging in at SSH<br />
#DenyUsers user001</p>
]]></content:encoded>
			<wfw:commentRss>http://camilord.kagayan.com/2010/05/08/centossecuring-ftp-vsftpd-and-ssh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Prototype POS System &#8211; Transparent GUI</title>
		<link>http://camilord.kagayan.com/2010/04/23/prototype-pos-system-transparent-gui/</link>
		<comments>http://camilord.kagayan.com/2010/04/23/prototype-pos-system-transparent-gui/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 08:48:45 +0000</pubDate>
		<dc:creator>Camilo III</dc:creator>
				<category><![CDATA[Info.Tech]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Visual C#]]></category>

		<guid isPermaLink="false">http://camilord.kagayan.com/?p=381</guid>
		<description><![CDATA[POS System &#8211; Transparent GUI My article is about a prototype POS system for grocery stores or 24 hours mini marts using Transparency graphical user interface. Transparency in MS Visual C# works similar to chroma keys in Adobe After Effects or Premiere. All you have to do is set a color key to make it]]></description>
			<content:encoded><![CDATA[<p>POS System &#8211; Transparent GUI</p>
<p style="text-align: center;"><a href="http://camilord.kagayan.com/wp-content/uploads/2010/04/screenshot.jpg"><img class="aligncenter size-medium wp-image-386" title="Transparent POS System screenshot" src="http://camilord.kagayan.com/wp-content/uploads/2010/04/screenshot-300x230.jpg" alt="" width="300" height="230" /></a></p>
<p>My article is about a prototype POS system for grocery stores or 24 hours mini marts using Transparency graphical user interface.</p>
<p>Transparency in MS Visual C# works similar to chroma keys in Adobe After Effects or Premiere. All you have to do is set a color key to make it transparent.</p>
<ol>
<li>As you create a form as Form1, go to Form1 properties and set TransparencyKey to Black.</li>
<li>Then set your Backcolor of your form to Black.</li>
<li>In Photoshop or any image editing tools, create an GUI or layout design then save as PNG format.</li>
<li>In Form1 properties, set BackgroundImage and select the PNG image you created from Photoshop or other image editing tools.</li>
<li>Set also the FormBorderStyle to None and Opacity to 95%.</li>
<li>Then run your project. You&#8217;ll see the transparency works well. <img src='http://camilord.kagayan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>
<p>See my sample source code.</p>
<a class="downloadlink" href="http://camilord.kagayan.com/download/testNewUI.zip" title="Version0.0.1 downloaded 11 times" >Prototype POS System - Transparent GUI (11)</a>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://camilord.kagayan.com/2010/04/23/prototype-pos-system-transparent-gui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual C#: Detect Conflict Schedule</title>
		<link>http://camilord.kagayan.com/2010/01/18/visual-csharp-detect-conflict-schedule/</link>
		<comments>http://camilord.kagayan.com/2010/01/18/visual-csharp-detect-conflict-schedule/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 08:55:53 +0000</pubDate>
		<dc:creator>Camilo III</dc:creator>
				<category><![CDATA[Info.Tech]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Visual C#]]></category>

		<guid isPermaLink="false">http://camilord.kagayan.com/?p=325</guid>
		<description><![CDATA[It seems a lot of people are searching about solving conflict schedule. So I decided to create a sample. Below is the core code of checking conflict schedule&#8230; // sample conflict detection (defined) [start] DateTime d = new DateTime(2010, 1, 13); richTextBox1.Text = DateTime.Now.ToLongDateString() + &#8221; = &#8221; + d.ToLongDateString() + &#8220;\n&#8221;; if (DateTime.Now.CompareTo(d) &#62;]]></description>
			<content:encoded><![CDATA[<div id="attachment_329" class="wp-caption alignright" style="width: 281px"><img class="size-medium wp-image-329" title="det_conf_sched" src="http://camilord.kagayan.com/wp-content/uploads/2010/01/det_conf_sched-271x300.jpg" alt="Screenshot" width="271" height="300" /><p class="wp-caption-text">Screenshot</p></div>
<p>It seems a lot of people are searching about solving conflict schedule. So I decided to create a sample. Below is the core code of checking conflict schedule&#8230;</p>
<blockquote><p>// sample conflict detection (defined) [start]<br />
DateTime d = new DateTime(2010, 1, 13);<br />
richTextBox1.Text = DateTime.Now.ToLongDateString() + &#8221; = &#8221; + d.ToLongDateString() + &#8220;\n&#8221;;<br />
if (DateTime.Now.CompareTo(d) &gt; 0)<br />
{<br />
richTextBox1.Text += &#8220;true\n&#8221; + DateTime.Now.CompareTo(d).ToString();<br />
}<br />
else<br />
{<br />
richTextBox1.Text += &#8220;false\n&#8221; + DateTime.Now.CompareTo(d).ToString();<br />
}<br />
richTextBox1.Text += &#8220;\n\n&#8221;;<br />
DateTime dx = DateTime.Now;<br />
//MessageBox.Show(dx.Hour.ToString());<br />
DateTime[] dt = new DateTime[4];<br />
// enrolled schedule<br />
dt[0] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 8, 0, 0);<br />
dt[1] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 9, 0, 0);<br />
// adding new schedule<br />
dt[2] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 9, 0, 0);<br />
dt[3] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 10, 0, 0);<br />
// checking schedule conflict<br />
if (((dt[0].CompareTo(dt[2]) &lt; 0) &amp;&amp; (dt[1].CompareTo(dt[2]) &gt; 0)) || (dt[0].ToShortTimeString() == dt[2].ToShortTimeString()))<br />
{<br />
richTextBox1.Text += dt[0].ToShortTimeString() + &#8221; &#8211; &#8221; + dt[1].ToShortTimeString() + &#8221; against &#8221; + dt[2].ToShortTimeString() + &#8221; &#8211; &#8221; + dt[3].ToShortTimeString() + &#8220;\nResult: CONFLICT&#8221;;<br />
}<br />
else<br />
{<br />
richTextBox1.Text += dt[0].ToShortTimeString() + &#8221; &#8211; &#8221; + dt[1].ToShortTimeString() + &#8221; against &#8221; + dt[2].ToShortTimeString() + &#8221; &#8211; &#8221; + dt[3].ToShortTimeString() + &#8220;\nResult: NO CONFLICT&#8221;;<br />
}<br />
// sample conflict detection (defined) [end]</p></blockquote>
<p>If you want to download the whole code, link below and enjoy&#8230; Do not practice the copy and paste! <img src='http://camilord.kagayan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Download: <a class="downloadlink" href="http://camilord.kagayan.com/download/detectScheduleConflict.zip" title="Versionv.0.1.0 downloaded 14 times" >Detect Conflict Schedule (14)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://camilord.kagayan.com/2010/01/18/visual-csharp-detect-conflict-schedule/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ubuntu Professional Certification</title>
		<link>http://camilord.kagayan.com/2009/12/18/ubuntu-professional-certification/</link>
		<comments>http://camilord.kagayan.com/2009/12/18/ubuntu-professional-certification/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 14:11:58 +0000</pubDate>
		<dc:creator>Camilo III</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Info.Tech]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://camilord.kagayan.com/?p=293</guid>
		<description><![CDATA[Today, I tried to answer the pre-test of UPC or the Ubuntu Professional Certification&#8230; and the result was&#8230; Dear Camilo III, Thank you very much for taking part in the pre-training assessment. Your score is 9, which means that you are probably over-qualified for this course. As a next step we suggest that you read]]></description>
			<content:encoded><![CDATA[<div id="attachment_302" class="wp-caption alignright" style="width: 230px"><img class="size-medium wp-image-302" title="Ubuntu Girl" src="http://camilord.kagayan.com/wp-content/uploads/2009/12/1594658226_d32d14d87e-220x300.jpg" alt="Ubuntu Girl" width="220" height="300" /><p class="wp-caption-text">Ubuntu Girl</p></div>
<p>Today, I tried to answer the pre-test of UPC or the Ubuntu Professional Certification&#8230; and the result was&#8230;</p>
<blockquote><p>Dear Camilo III,</p>
<p>Thank you very much for taking part in the pre-training assessment.</p>
<p>Your score is 9, which means that you are probably over-qualified for this course.</p>
<p>As a next step we suggest that you read through the Deploying Ubuntu Server Edition course overview found here: <a style="color: #005488;" href="http://www.ubuntu.com/training/certificationcourses/server" target="_blank">http://www.ubuntu.com/training/certificationcourses/server</a> and then complete the corresponding online assessment.</p>
<p>Ubuntu Training courses are taught by Canonical-trained Ubuntu Certified Instructors. The Deploying Ubuntu Server Edition course is available through online training and classroom training, so you can can learn in the environment that suits you best.</p>
<p>Visit: <a style="color: #005488;" href="http://www.ubuntu.com/training" target="_blank">www.ubuntu.com/training</a> for more information.</p>
<p>Best regards and good luck<br />
The Ubuntu Training Team</p></blockquote>
<p>How flattering!! I admit it, I&#8217;m not that good&#8230; but anyway, the test is so easy.. hahahaha.. <img src='http://camilord.kagayan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  And one thing, I don&#8217;t have a dollars to pay the $1,600 for the Deploying Ubuntu Server Edition Certification. Its like PhP 76,800.00 in my country, that is 9 months to save my whole salary. hahahaha.. Damn! I will starved to death if I will take the exam&#8230; <img src='http://camilord.kagayan.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://camilord.kagayan.com/2009/12/18/ubuntu-professional-certification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual C#: Retrieving Image (BLOB) from MySQL database</title>
		<link>http://camilord.kagayan.com/2009/12/14/visual-c-retrieving-image-blob-from-mysql-database/</link>
		<comments>http://camilord.kagayan.com/2009/12/14/visual-c-retrieving-image-blob-from-mysql-database/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 07:48:29 +0000</pubDate>
		<dc:creator>Camilo III</dc:creator>
				<category><![CDATA[Info.Tech]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Visual C#]]></category>

		<guid isPermaLink="false">http://camilord.kagayan.com/?p=286</guid>
		<description><![CDATA[I&#8217;ve been searching an article about storing and retrieving an image (BLOB data type) from MySQL database. Somehow, I only found the retrieving process but I created the storing process using PHP&#8230; You may download my works, link provided below&#8230; idsystem_database.sql.zip &#8211; the dump file of MySQL database; import this SQL file before running the]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been searching an article about storing and retrieving an image (BLOB data type) from MySQL database. Somehow, I only found the retrieving process but I created the storing process using PHP&#8230; <img src='http://camilord.kagayan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You may download my works, link provided below&#8230;</p>
<ul>
<li>idsystem_database.sql.zip &#8211; the dump file of MySQL database; import this SQL file before running the project</li>
<li>the rest of the files are the project sample files</li>
</ul>
<p>-&gt; <a class="downloadlink" href="http://camilord.kagayan.com/download/retrieveImg_public.zip" title="Versionv.0.1.0 downloaded 39 times" >retrieveImg_public.zip (39)</a> or http://camilord.kagayan.com/my.files/retrieveImg_public.zip</p>
<p>For the credits, Thanks to Markusek Peter&#8230;</p>
<blockquote><p>MySqlConnection myConnection = new MySqlConnection(myConnString);</p>
<p>string testQuery = &#8220;SELECT sp.studePhoto, s.firstName, s.lastName</p>
<p>FROM students AS s, student_photos AS sp WHERE s.id = sp.studentID&#8221;;<br />
MySqlCommand myCommand = new MySqlCommand(testQuery, myConnection);</p>
<p>myConnection.Open();<br />
MySqlDataReader myReader = myCommand.ExecuteReader();</p>
<p>FileStream fs; // Writes the BLOB to a file (*.jpg).</p>
<p>BinaryWriter bw; // Streams the BLOB to the FileStream object.</p>
<p>int bufferSize = 100; // Size of the BLOB buffer.</p>
<p>// The BLOB byte[] buffer to be filled by GetBytes.</p>
<p>byte[] outbyte = new byte[bufferSize];<br />
long retval; // The bytes returned from GetBytes.<br />
long startIndex = 0; // The starting position in the BLOB output.</p>
<p>while (myReader.Read())<br />
{<br />
DateTime tmp = new DateTime();<br />
tmp = DateTime.Now;<br />
// Create a file to hold the output.<br />
string filename = camilordMD5(tmp.ToLongDateString().ToString() + tmp.ToLongTimeString().ToString()) + &#8220;.jpg&#8221;;</p>
<p>string dest = Directory.GetCurrentDirectory() + &#8220;/&#8221; + filename;<br />
fs = new FileStream(dest, FileMode.OpenOrCreate, FileAccess.Write);<br />
bw = new BinaryWriter(fs);</p>
<p>// Reset the starting byte for the new BLOB.<br />
startIndex = 0;<br />
// Read the bytes into outbyte[] and retain the number of bytes returned.</p>
<p>//myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize);<br />
retval =(long) myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize);<br />
lblName.Text = myReader.GetString(1) + &#8221; &#8221; + myReader.GetString(2);</p>
<p>// Continue reading and writing while there are bytes beyond the size of the buffer.<br />
while (retval == bufferSize)<br />
{<br />
bw.Write(outbyte);<br />
bw.Flush();</p>
<p>// Reposition the start index to the end of the last buffer and fill thebuffer.<br />
startIndex += bufferSize;<br />
retval = myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize);</p>
<p>}</p>
<p>pictureBox1.ImageLocation = Directory.GetCurrentDirectory() + &#8220;/test.jpg&#8221;;<br />
//pictureBox1.Image = retval;</p>
<p>// Write the remaining buffer.</p>
<p>bw.Write(outbyte, 0, (int)retval &#8211; 1);<br />
bw.Flush();</p>
<p>// Close the output file.<br />
bw.Close();<br />
fs.Close();<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://camilord.kagayan.com/2009/12/14/visual-c-retrieving-image-blob-from-mysql-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual C#: Handling X button (top-right)</title>
		<link>http://camilord.kagayan.com/2009/12/07/visual-c-handling-x-button-top-right/</link>
		<comments>http://camilord.kagayan.com/2009/12/07/visual-c-handling-x-button-top-right/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 02:21:46 +0000</pubDate>
		<dc:creator>Camilo III</dc:creator>
				<category><![CDATA[Info.Tech]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Visual C#]]></category>

		<guid isPermaLink="false">http://camilord.kagayan.com/?p=281</guid>
		<description><![CDATA[Disabling the X button private const int CP_NOCLOSE_BUTTON = 0x200; protected override CreateParams CreateParams { get { CreateParams myCp = base.CreateParams; myCp.ClassStyle = myCp.ClassStyle &#124; CP_NOCLOSE_BUTTON; return myCp; } } Add confirmation if window closing or closed&#8230; Insert this code to Main form or the Form1.cs&#8230; private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (MessageBox.Show("Are]]></description>
			<content:encoded><![CDATA[<p><strong><img class="alignright size-full wp-image-306" title="xbutton" src="http://camilord.kagayan.com/wp-content/uploads/2009/12/xbutton.jpg" alt="xbutton" width="223" height="223" />Disabling the X button</strong></p>
<pre>private const int CP_NOCLOSE_BUTTON = 0x200;

protected override CreateParams CreateParams
{
     get
     {
        CreateParams myCp = base.CreateParams;
        myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;
        return myCp;
     }
}</pre>
<p><strong>Add confirmation if window closing or closed&#8230;</strong></p>
<p>Insert this code to Main form or the Form1.cs<strong>&#8230;</strong></p>
<p><strong><br />
</strong></p>
<pre>private void Form1_Closing(object sender,
                   System.ComponentModel.CancelEventArgs e)
{
     if (MessageBox.Show("Are you sure you want to exit?", "Confirm exit",
         MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
     {
        e.Cancel = true;
     }
}</pre>
<p>Insert this to Form1.Designer.cs&#8230;</p>
<pre>this.Closing += new System.ComponentModel.CancelEventHandler(
                             this.frmCCS_Closing);</pre>
]]></content:encoded>
			<wfw:commentRss>http://camilord.kagayan.com/2009/12/07/visual-c-handling-x-button-top-right/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[PHP] Converting a value to MAC address format</title>
		<link>http://camilord.kagayan.com/2009/10/20/php-converting-a-value-to-mac-address-format/</link>
		<comments>http://camilord.kagayan.com/2009/10/20/php-converting-a-value-to-mac-address-format/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 15:37:24 +0000</pubDate>
		<dc:creator>Camilo III</dc:creator>
				<category><![CDATA[Info.Tech]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://camilord.kagayan.com/?p=277</guid>
		<description><![CDATA[I just want to post this since someone ask about it. It might help if someone in this world is searching for an answer with the same problem my friend does. This is about converting a value of 0014:f8c4:9e32 or 0014f8c49e32 to 00:14:f8:c4:9e:32&#8230; Now here&#8217;s some answers for that&#8230; function convertMACAddress($input) {     // clean]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-311" title="php_code" src="http://camilord.kagayan.com/wp-content/uploads/2009/10/php_code-300x193.jpg" alt="php_code" width="300" height="193" />I just want to post this since someone ask about it. It might help if someone in this world is searching for an answer with the same problem my friend does. This is about converting a value of <strong>0014:f8c4:9e32</strong> or <strong>0014f8c49e32</strong> to <strong>00:14:f8:c4:9e:32</strong>&#8230;</p>
<p>Now here&#8217;s some answers for that&#8230;</p>
<pre>function convertMACAddress($input)
{
    // clean up unwanted characters
    $input = preg_replace( '/[^a-zA-Z0-9]/', '', $input);

    // initiate character positioning
    $pos = 0;

    // declare output container
    $output = '';

     // if given MAC is invalid, terminate process and return an error
     if (strlen($input) &lt; 12)
     {
           return '[Unrecognized MAC address]';
     }

    // initiate convertion...
    for ($i = 0; $i &lt; 6; $i++)
    {
           if ($i == 0)
           {
                  $output .= substr($input, $pos, 2);
           }
           else
           {
                   $output .= ':'.substr($input, $pos, 2);
            }
            $pos += 2;
     }

      return $output;
}</pre>
<p>That&#8217;s it&#8230; Problem solved. <img src='http://camilord.kagayan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  If need a sample code, please download the source -&gt; <a class="downloadlink" href="http://camilord.kagayan.com/download/mac.convert.zip" title="Version0.0.1 downloaded 28 times" >Mac Convert (28)</a> &#8212; Have fun coding..</p>
]]></content:encoded>
			<wfw:commentRss>http://camilord.kagayan.com/2009/10/20/php-converting-a-value-to-mac-address-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
