<?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/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.icpep.org</link>
	<description>Just another techie stuff</description>
	<lastBuildDate>Fri, 23 Jul 2010 04:53:01 +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>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 [...]]]></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 href="icpep.org/downloads/graphics.h">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 style="padding-left: 30px;">-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32</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>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Bubble Sort and Graphics.h in Dev C++" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Bubble+Sort+and+Graphics.h+in+Dev+C++" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/bubble-sort-and-graphics-h-in-dev-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change a String or Character in MySQL</title>
		<link>http://www.icpep.org/change-a-string-or-character-in-mysql/</link>
		<comments>http://www.icpep.org/change-a-string-or-character-in-mysql/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 05:00:01 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1066</guid>
		<description><![CDATA[Knowing the right MySQL statement is the most important part in having thousands of data in your database, one false move and you can&#8217;t undo things.    If you want to change a string or character in your database and doing it manually in thousands or millions of entries then that should consume all of your [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-1067 aligncenter" title="mysql" src="http://www.icpep.org/wp-content/uploads/2010/04/mysql.jpg" alt="" width="300" height="225" /></p>
<p style="text-align: justify;">Knowing the right MySQL statement is the most important part in having thousands of data in your database, one false move and you can&#8217;t undo things.    If you want to change a string or character in your database and doing it manually in thousands or millions of entries then that should consume all of your time.</p>
<p style="text-align: justify;">One example scenario is when you want to change all the entries containing a character &#8216;_&#8217; to this character &#8216;-&#8217; .  All you need to do is have a backup first on that specific table or database so that whatever false move you  will be doing, you can still have the data back.  After having the backup here is the SQL syntax that you should enter:</p>
<div style="border: 2px solid #CECECE; padding: 5px; background: #F1F1F1;">UPDATE Table SET Column = Replace(Column, &#8216;find value&#8217;, &#8216;replacement value&#8217;) WHERE xxx</div>
<p>Where in my scenario:</p>
<div style="border: 2px solid #CECECE; padding: 5px; background: #F1F1F1;">UPDATE paging SET pagename = Replace(pagename, &#8216;_&#8217;, &#8216;-&#8217;)</div>
<p>There within less than a minute I was able to change all the data containing &#8216;_&#8217;.  It saved me a lot of time and I can continue coding some other stuff rather than editing the data manually.  Hope this helps and happy coding!</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Change a String or Character in MySQL" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Change+a+String+or+Character+in+MySQL" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/change-a-string-or-character-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Main Domain</title>
		<link>http://www.icpep.org/getting-main-domain/</link>
		<comments>http://www.icpep.org/getting-main-domain/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 18:04:13 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1046</guid>
		<description><![CDATA[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 this function while searching for a good Regular Expression to fulfill such result. &#60;?php function get_base_domain($url)  { $debug = 0; $base_domain = ''; $G_TLD = array( 'biz','com','edu','gov','info','int','mil','name','net','org','aero','asia','cat','coop','jobs','mobi','museum', 'pro','tel','travel','arpa','root','berlin','bzh','cym','gal','geo','kid','kids','lat','mail','nyc','post','sco','web','xxx', 'nato','example','invalid','localhost','test','bitnet','csnet','ip','local','onion','uucp', 'co' [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify; padding-left: 30px;"><img class="size-full wp-image-1047 aligncenter" title="php" src="http://www.icpep.org/wp-content/uploads/2010/04/php.jpg" alt="" width="300" height="225" /></p>
<p style="text-align: justify;">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 this function while searching for a good Regular Expression to fulfill such result.</p>
<pre class="php"><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpFunctionKeyword">function</span><span class="htmlText"> get_base_domain</span><span class="phpOperator">(</span>$url<span class="phpOperator">)</span>  <span class="phpOperator">{</span>
$debug <span class="phpOperator">=</span> 0;
$base_domain <span class="phpOperator">=</span> <span class="phpString">''</span><span class="phpText">;</span>
$G_TLD <span class="phpOperator">=</span> <span class="phpFunction">array</span><span class="phpOperator">(</span>
<span class="phpString">'biz'</span>,<span class="phpString">'com'</span>,<span class="phpString">'edu'</span>,<span class="phpString">'gov'</span>,<span class="phpString">'info'</span>,<span class="phpString">'int'</span>,<span class="phpString">'mil'</span>,<span class="phpString">'name'</span>,<span class="phpString">'net'</span>,<span class="phpString">'org'</span>,<span class="phpString">'aero'</span>,<span class="phpString">'asia'</span>,<span class="phpString">'cat'</span>,<span class="phpString">'coop'</span>,<span class="phpString">'jobs'</span>,<span class="phpString">'mobi'</span>,<span class="phpString">'museum'</span>,
<span class="phpString">'pro'</span>,<span class="phpString">'tel'</span>,<span class="phpString">'travel'</span>,<span class="phpString">'arpa'</span>,<span class="phpString">'root'</span>,<span class="phpString">'berlin'</span>,<span class="phpString">'bzh'</span>,<span class="phpString">'cym'</span>,<span class="phpString">'gal'</span>,<span class="phpString">'geo'</span>,<span class="phpString">'kid'</span>,<span class="phpString">'kids'</span>,<span class="phpString">'lat'</span>,<span class="phpString">'mail'</span>,<span class="phpString">'nyc'</span>,<span class="phpString">'post'</span>,<span class="phpString">'sco'</span>,<span class="phpString">'web'</span>,<span class="phpString">'xxx'</span>,
<span class="phpString">'nato'</span>,<span class="phpString">'example'</span>,<span class="phpString">'invalid'</span>,<span class="phpString">'localhost'</span>,<span class="phpString">'test'</span>,<span class="phpString">'bitnet'</span>,<span class="phpString">'csnet'</span>,<span class="phpString">'ip'</span>,<span class="phpString">'local'</span>,<span class="phpString">'onion'</span>,<span class="phpString">'uucp'</span>,
<span class="phpString">'co'</span> <span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">// country tlds <span class="phpOperator">(</span><span class="htmlText">source</span><span class="phpOperator">:</span><span class="htmlText"> http</span><span class="phpOperator">:</span>//en<span class="phpOperator">.</span>wikipedia.org/wiki/Country_code_top-level_domain<span class="phpOperator">)</span>
</span>$C_TLD <span class="phpOperator">=</span> <span class="phpFunction">array</span><span class="phpOperator">(</span>
<span class="phpString">'ac'</span>,<span class="phpString">'ad'</span>,<span class="phpString">'ae'</span>,<span class="phpString">'af'</span>,<span class="phpString">'ag'</span>,<span class="phpString">'ai'</span>,<span class="phpString">'al'</span>,<span class="phpString">'am'</span>,<span class="phpString">'an'</span>,<span class="phpString">'ao'</span>,<span class="phpString">'aq'</span>,<span class="phpString">'ar'</span>,<span class="phpString"><span class="phpKeyword">'as'</span></span>,<span class="phpString">'at'</span>,<span class="phpString">'au'</span>,<span class="phpString">'aw'</span>,<span class="phpString">'ax'</span>,<span class="phpString">'az'</span>,
<span class="phpString">'ba'</span>,<span class="phpString">'bb'</span>,<span class="phpString">'bd'</span>,<span class="phpString">'be'</span>,<span class="phpString">'bf'</span>,<span class="phpString">'bg'</span>,<span class="phpString">'bh'</span>,<span class="phpString">'bi'</span>,<span class="phpString">'bj'</span>,<span class="phpString">'bm'</span>,<span class="phpString">'bn'</span>,<span class="phpString">'bo'</span>,<span class="phpString">'br'</span>,<span class="phpString">'bs'</span>,<span class="phpString">'bt'</span>,<span class="phpString">'bw'</span>,<span class="phpString">'by'</span>,<span class="phpString">'bz'</span>,
<span class="phpString">'ca'</span>,<span class="phpString">'cc'</span>,<span class="phpString">'cd'</span>,<span class="phpString">'cf'</span>,<span class="phpString">'cg'</span>,<span class="phpString">'ch'</span>,<span class="phpString">'ci'</span>,<span class="phpString">'ck'</span>,<span class="phpString">'cl'</span>,<span class="phpString">'cm'</span>,<span class="phpString">'cn'</span>,<span class="phpString">'co'</span>,<span class="phpString">'cr'</span>,<span class="phpString">'cu'</span>,<span class="phpString">'cv'</span>,<span class="phpString">'cx'</span>,<span class="phpString">'cy'</span>,<span class="phpString">'cz'</span>,
<span class="phpString">'de'</span>,<span class="phpString">'dj'</span>,<span class="phpString">'dk'</span>,<span class="phpString">'dm'</span>,<span class="phpString"><span class="phpKeyword">'do'</span></span>,<span class="phpString">'dz'</span>,<span class="phpString">'ec'</span>,<span class="phpString">'ee'</span>,<span class="phpString">'eg'</span>,<span class="phpString">'er'</span>,<span class="phpString">'es'</span>,<span class="phpString">'et'</span>,<span class="phpString">'eu'</span>,<span class="phpString">'fi'</span>,<span class="phpString">'fj'</span>,<span class="phpString">'fk'</span>,<span class="phpString">'fm'</span>,<span class="phpString">'fo'</span>,
<span class="phpString">'fr'</span>,<span class="phpString">'ga'</span>,<span class="phpString">'gd'</span>,<span class="phpString">'ge'</span>,<span class="phpString">'gf'</span>,<span class="phpString">'gg'</span>,<span class="phpString">'gh'</span>,<span class="phpString">'gi'</span>,<span class="phpString">'gl'</span>,<span class="phpString">'gm'</span>,<span class="phpString">'gn'</span>,<span class="phpString">'gp'</span>,<span class="phpString">'gq'</span>,<span class="phpString">'gr'</span>,<span class="phpString">'gs'</span>,<span class="phpString">'gt'</span>,<span class="phpString">'gu'</span>,<span class="phpString">'gw'</span>,
<span class="phpString">'gy'</span>,<span class="phpString">'hk'</span>,<span class="phpString">'hm'</span>,<span class="phpString">'hn'</span>,<span class="phpString">'hr'</span>,<span class="phpString">'ht'</span>,<span class="phpString">'hu'</span>,<span class="phpString">'id'</span>,<span class="phpString">'ie'</span>,<span class="phpString">'il'</span>,<span class="phpString">'im'</span>,<span class="phpString">'in'</span>,<span class="phpString">'io'</span>,<span class="phpString">'iq'</span>,<span class="phpString">'ir'</span>,<span class="phpString">'is'</span>,<span class="phpString">'it'</span>,<span class="phpString">'je'</span>,
<span class="phpString">'jm'</span>,<span class="phpString">'jo'</span>,<span class="phpString">'jp'</span>,<span class="phpString">'ke'</span>,<span class="phpString">'kg'</span>,<span class="phpString">'kh'</span>,<span class="phpString">'ki'</span>,<span class="phpString">'km'</span>,<span class="phpString">'kn'</span>,<span class="phpString">'kr'</span>,<span class="phpString">'kw'</span>,<span class="phpString">'ky'</span>,<span class="phpString">'kz'</span>,<span class="phpString">'la'</span>,<span class="phpString">'lb'</span>,<span class="phpString">'lc'</span>,<span class="phpString">'li'</span>,<span class="phpString">'lk'</span>,
<span class="phpString">'lr'</span>,<span class="phpString">'ls'</span>,<span class="phpString">'lt'</span>,<span class="phpString">'lu'</span>,<span class="phpString">'lv'</span>,<span class="phpString">'ly'</span>,<span class="phpString">'ma'</span>,<span class="phpString">'mc'</span>,<span class="phpString">'md'</span>,<span class="phpString">'mg'</span>,<span class="phpString">'mh'</span>,<span class="phpString">'mk'</span>,<span class="phpString">'ml'</span>,<span class="phpString">'mm'</span>,<span class="phpString">'mn'</span>,<span class="phpString">'mo'</span>,<span class="phpString">'mp'</span>,<span class="phpString">'mq'</span>,
<span class="phpString">'mr'</span>,<span class="phpString">'ms'</span>,<span class="phpString">'mt'</span>,<span class="phpString">'mu'</span>,<span class="phpString">'mv'</span>,<span class="phpString">'mw'</span>,<span class="phpString">'mx'</span>,<span class="phpString">'my'</span>,<span class="phpString">'mz'</span>,<span class="phpString">'na'</span>,<span class="phpString">'nc'</span>,<span class="phpString">'ne'</span>,<span class="phpString">'nf'</span>,<span class="phpString">'ng'</span>,<span class="phpString">'ni'</span>,<span class="phpString">'nl'</span>,<span class="phpString">'no'</span>,<span class="phpString">'np'</span>,
<span class="phpString">'nr'</span>,<span class="phpString">'nu'</span>,<span class="phpString">'nz'</span>,<span class="phpString">'om'</span>,<span class="phpString">'pa'</span>,<span class="phpString">'pe'</span>,<span class="phpString">'pf'</span>,<span class="phpString">'pg'</span>,<span class="phpString">'ph'</span>,<span class="phpString">'pk'</span>,<span class="phpString">'pl'</span>,<span class="phpString">'pn'</span>,<span class="phpString">'pr'</span>,<span class="phpString">'ps'</span>,<span class="phpString">'pt'</span>,<span class="phpString">'pw'</span>,<span class="phpString">'py'</span>,<span class="phpString">'qa'</span>,
<span class="phpString">'re'</span>,<span class="phpString">'ro'</span>,<span class="phpString">'ru'</span>,<span class="phpString">'rw'</span>,<span class="phpString">'sa'</span>,<span class="phpString">'sb'</span>,<span class="phpString">'sc'</span>,<span class="phpString">'sd'</span>,<span class="phpString">'se'</span>,<span class="phpString">'sg'</span>,<span class="phpString">'sh'</span>,<span class="phpString">'si'</span>,<span class="phpString">'sk'</span>,<span class="phpString">'sl'</span>,<span class="phpString">'sm'</span>,<span class="phpString">'sn'</span>,<span class="phpString">'sr'</span>,<span class="phpString">'st'</span>,
<span class="phpString">'sv'</span>,<span class="phpString">'sy'</span>,<span class="phpString">'sz'</span>,<span class="phpString">'tc'</span>,<span class="phpString">'td'</span>,<span class="phpString">'tf'</span>,<span class="phpString">'tg'</span>,<span class="phpString">'th'</span>,<span class="phpString">'tj'</span>,<span class="phpString">'tk'</span>,<span class="phpString">'tl'</span>,<span class="phpString">'tm'</span>,<span class="phpString">'tn'</span>,<span class="phpString">'to'</span>,<span class="phpString">'tr'</span>,<span class="phpString">'tt'</span>,<span class="phpString">'tv'</span>,<span class="phpString">'tw'</span>,
<span class="phpString">'tz'</span>,<span class="phpString">'ua'</span>,<span class="phpString">'ug'</span>,<span class="phpString">'uk'</span>,<span class="phpString">'us'</span>,<span class="phpString">'uy'</span>,<span class="phpString">'uz'</span>,<span class="phpString">'va'</span>,<span class="phpString">'vc'</span>,<span class="phpString">'ve'</span>,<span class="phpString">'vg'</span>,<span class="phpString">'vi'</span>,<span class="phpString">'vn'</span>,<span class="phpString">'vu'</span>,<span class="phpString">'wf'</span>,<span class="phpString">'ws'</span>,<span class="phpString">'ye'</span>,<span class="phpString">'yu'</span>,
<span class="phpString">'za'</span>,<span class="phpString">'zm'</span>,<span class="phpString">'zw'</span>,<span class="phpString">'eh'</span>,<span class="phpString">'kp'</span>,<span class="phpString">'me'</span>,<span class="phpString">'rs'</span>,<span class="phpString">'um'</span>,<span class="phpString">'bv'</span>,<span class="phpString">'gb'</span>,<span class="phpString">'pm'</span>,<span class="phpString">'sj'</span>,<span class="phpString">'so'</span>,<span class="phpString">'yt'</span>,<span class="phpString">'su'</span>,<span class="phpString">'tp'</span>,<span class="phpString">'bu'</span>,<span class="phpString">'cs'</span>,<span class="phpString">'dd'</span>,<span class="phpString">'zr'</span>
<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">// get domain
</span>>if <span class="phpOperator">(</span> <span class="phpOperator">!</span>$full_domain <span class="phpOperator">=</span><span class="htmlText"> get_url_domain</span><span class="phpOperator">(</span>$url<span class="phpOperator">)</span> <span class="phpOperator">)</span> <span class="phpOperator">{</span>
<span class="phpKeyword">
return </span>$base_domain<span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpComment">// now the fun
</span><span class="phpComment">//<span class="phpKeyword"> break </span>up domain, reverse
</span>$DOMAIN <span class="phpOperator">=</span> <span class="phpFunction">explode</span><span class="phpOperator">(</span><span class="phpString">'<span class="phpOperator">.</span>'</span>, $full_domain<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
if </span><span class="phpOperator">(</span> $debug <span class="phpOperator">)</span> <span class="phpFunction">print_r</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">)</span><span class="phpText">;</span>
$DOMAIN <span class="phpOperator">=</span> <span class="phpFunction">array_reverse</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
if </span><span class="phpOperator">(</span> $debug <span class="phpOperator">)</span> <span class="phpFunction">print_r</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">// first check<span class="phpKeyword"> for </span>ip address
</span>>if <span class="phpOperator">(</span> <span class="phpFunction">count</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">)</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> <span class="phpNumber">4</span> &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span> <span class="phpFunction">is_numeric</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">[</span><span class="phpNumber">0</span><span class="phpOperator">]</span><span class="phpOperator">)</span> &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span> <span class="phpFunction">is_numeric</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">[</span><span class="phpNumber">3</span><span class="phpOperator">]</span><span class="phpOperator">)</span> <span class="phpOperator">)</span> <span class="phpOperator">{</span>
<span class="phpKeyword">
return </span>$full_domain<span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpComment">//<span class="phpKeyword"> if </span><span class="htmlText">only </span><span class="phpNumber">2</span> domain parts, that must be our domain
</span>>if <span class="phpOperator">(</span> <span class="phpFunction">count</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">)</span> <span class="phpOperator">&lt;</span><span class="phpOperator">=</span> <span class="phpNumber">2</span> <span class="phpOperator">)</span><span class="phpKeyword"> return </span>$full_domain<span class="phpText">;</span>
<span class="phpKeyword">
if </span><span class="phpOperator">(</span><span class="htmlText"> in_</span><span class="phpFunction">array</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">[</span><span class="phpNumber">0</span><span class="phpOperator">]</span>, $C_TLD<span class="phpOperator">)</span> &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span><span class="htmlText"> in_</span><span class="phpFunction">array</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">[</span><span class="phpNumber">1</span><span class="phpOperator">]</span>, $G_TLD<span class="phpOperator">)</span> &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">2</span><span class="phpOperator">]</span> <span class="phpOperator">!</span><span class="phpOperator">=</span> <span class="phpString">'www'</span> <span class="phpOperator">)</span> <span class="phpOperator">{</span>
$full_domain <span class="phpOperator">=</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">2</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">.</span>'</span> <span class="phpOperator">.</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">1</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">.</span>'</span> <span class="phpOperator">.</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">0</span><span class="phpOperator">]</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpKeyword">
else </span><span class="phpOperator">{</span>
$full_domain <span class="phpOperator">=</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">1</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">.</span>'</span> <span class="phpOperator">.</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">0</span><span class="phpOperator">]</span><span class="phpText">;</span>;
<span class="phpOperator">}</span>
<span class="phpComment">// did we succeed<span class="phpOperator">?</span>
</span>>return $full_domain<span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpFunctionKeyword">function</span><span class="htmlText"> get_url_domain</span><span class="phpOperator">(</span>$url<span class="phpOperator">)</span>  <span class="phpOperator">{</span>
$domain <span class="phpOperator">=</span> <span class="phpString">''</span><span class="phpText">;</span>
$_URL <span class="phpOperator">=</span> <span class="phpFunction">parse_url</span><span class="phpOperator">(</span>$url<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">// sanity check
</span>>if <span class="phpOperator">(</span> <span class="phpFunction">empty</span><span class="phpOperator">(</span>$_URL<span class="phpOperator">)</span> <span class="phpOperator">|</span><span class="phpOperator">|</span> <span class="phpFunction">empty</span><span class="phpOperator">(</span>$_URL<span class="phpOperator">[</span><span class="phpString">'host'</span><span class="phpOperator">]</span><span class="phpOperator">)</span> <span class="phpOperator">)</span>  <span class="phpOperator">{</span>
$domain <span class="phpOperator">=</span> <span class="phpString">''</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpKeyword">
else </span><span class="phpOperator">{</span>
$domain <span class="phpOperator">=</span> $_URL<span class="phpOperator">[</span><span class="phpString">'host'</span><span class="phpOperator">]</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpKeyword">
return </span>$domain<span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span></pre>
<p>To test the code we can use the function,</p>
<pre class="php">$url  <span class="phpOperator">=</span> <span class="phpString">'http<span class="phpOperator">:</span><span class="phpComment">//www<span class="phpOperator">.</span>icpep.org'</span><span class="phpText">;</span>
</span><span class="phpFunction">echo</span> get_base_domain<span class="phpOperator">(</span>$url<span class="phpOperator">)</span> <span class="phpText">;</span> // icpep.org</pre>
<p><a href="http://icpep.org/wp-content/uploads/files/get.main.domain.txt">Click here to download</a>.</p>
<p style="text-align: justify;">This code really helped me a lot.  There are a lot of Regular expressions out there but this simple approach can break all those head breaking expressions.  Btw, this function is free of use and is under GNU licensing.   Hope this functions is of big help to you also, happy coding!</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Getting Main Domain" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Getting+Main+Domain" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/getting-main-domain/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Translation Services</title>
		<link>http://www.icpep.org/translation-services/</link>
		<comments>http://www.icpep.org/translation-services/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 18:17:32 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=881</guid>
		<description><![CDATA[Google has provided web developers foreign language translation api. Web content translation is not a problem anymore, with google&#8217;s Google Translate, research from different countries is now made possible. This is a big help especially for researchers on the net, we can now easily understand web contents and even text from outside sources which also [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-882 aligncenter" title="translate_logo" src="http://www.icpep.org/wp-content/uploads/2009/10/translate_logo.gif" alt="translate_logo" width="205" height="40" /></p>
<p style="text-align: justify;">Google has provided web developers <span>foreign language translation api. </span><span>Web content translation is not a problem anymore, with google&#8217;s Google Translate, research from different countries is now made possible. </span></p>
<p style="text-align: justify;"><span>This is a big help especially for researchers on the net, we can now easily understand web contents and even text from outside sources which also serves as a document translation services.  Google allows us to copy and  paste phrases, sentences and paragraphs from outside sources  to their google translate and by selecting the language you desire we can now get translation to it.</span></p>
<p style="text-align: justify;">But how do we add google translate on our website?  I have provided 3 different ways on how to achieve google translate on your website.  The easiest is for wordpress users, you can add a <span>web content translation by downloading the plugin <a title="Global Translator" href="http://wordpress.org/extend/plugins/global-translator/">Global Translator </a> </span>.  Follow the steps carefully and you can provide your users translation of different languages according to your choice as set on the administration panel.</p>
<p>The second way of adding a web content translation software by google is by adding a snippet of  codes which they have provided on their site<a href="http://translate.google.com/translate_tools"> Google Translate</a> or just copy and paste the code below and add it on your website.  This is also the code I used in this blog.<span id="more-881"></span></p>
<div style="border:1px solid #00B3F0; background-color: #F4F4F4;padding: 5px;">&lt;div id=&#8221;google_translate_element&#8221;&gt;&lt;/div&gt;&lt;script&gt;</p>
<p>function googleTranslateElementInit() {</p>
<p>new google.translate.TranslateElement({</p>
<p>pageLanguage: &#8216;en&#8217;</p>
<p>}, &#8216;google_translate_element&#8217;);</p>
<p>}</p>
<p>&lt;/script&gt;&lt;script src=&#8221;http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit&#8221;&gt;&lt;/script&gt;</p></div>
<p>If you want to have your own design and style you can still add translation to your site below is an example of the code.  Make sure you have images of the flags as what I used in the code.</p>
<div style="border:1px solid #00B3F0; background-color: #F4F4F4;padding:5px;">&lt;form action=&#8221;http://www.google.com/translate&#8221; &gt;</p>
<p>&lt;script language=&#8221;JavaScript&#8221;&gt;</p>
<p>&lt;!&#8211;</p>
<p>document.write (&#8220;&lt;input name=u value=&#8221;+location.href+&#8221; type=hidden&gt;&#8221;)</p>
<p>// &#8211;&gt;</p>
<p>&lt;/script&gt;</p>
<p>&lt;table width=&#8221;185&#8243; height=&#8221;100%&#8221; align=&#8221;right&#8221; style=&#8221;margin-right:5px;&#8221;&gt;</p>
<p>&lt;tr&gt;</p>
<p>&lt;td colspan=&#8221;5&#8243; style=&#8221;background:#C9E2FF;color:#000099;padding:5px; border:1px solid #ACC5EF;&#8221;&gt;&lt;span style=&#8221;font-size:10px; &#8220;&gt;&lt;b&gt;Click flag to change language&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p>&lt;tr&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;</p>
<p>&lt;input name=&#8221;hl&#8221; value=&#8221;en&#8221; type=&#8221;hidden&#8221;&gt;</p>
<p>&lt;input name=&#8221;ie&#8221; value=&#8221;UTF8&#8243; type=&#8221;hidden&#8221;&gt;</p>
<p>&lt;input name=&#8221;langpair&#8221; value=&#8221;" type=&#8221;hidden&#8221;&gt;</p>
<p>&lt;input name=&#8221;langpair&#8221; value=&#8221;en|fr&#8221; title=&#8221;French&#8221; src= &#8220;images/flags/french.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221;  type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|ko&#8221; title=&#8221;Korean&#8221; src= &#8220;images/flags/korean.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221;  type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|da&#8221; title=&#8221;Danish&#8221; src= &#8220;images/flags/denmark.png&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|cy&#8221; title=&#8221;Welsh&#8221; src= &#8220;images/flags/welsh.gif&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221;  type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|zh-CN&#8221; title=&#8221;Chinese Simplified&#8221; src= &#8220;images/flags/chinese.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p>&lt;tr&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|de&#8221; title=&#8221;German&#8221; src= &#8220;images/flags/german.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|it&#8221; title=&#8221;Italian&#8221; src= &#8220;images/flags/italian.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|sl&#8221; title=&#8221;Slovenian&#8221; src= &#8220;images/flags/slovenian.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|ru&#8221; title=&#8221;Russian&#8221; src= &#8220;images/flags/russia.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221;  type=&#8221;image&#8221; &gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|pt&#8221; title=&#8221;Portuguese&#8221; src= &#8220;images/flags/pt.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p>&lt;tr&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|es&#8221; title=&#8221;Spanish&#8221; src= &#8220;images/flags/spanish.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair&#8221; value=&#8221;en|ja&#8221; title=&#8221;Japanese&#8221; src= &#8220;images/flags/japanese.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;</p>
<p>&lt;input name=&#8221;langpair&#8221; value=&#8221;en|cs&#8221; title=&#8221;Czech&#8221; src= &#8220;images/flags/czech.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;</p>
<p>&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair2&#8243; value=&#8221;en|no&#8221; title=&#8221;Norwegian&#8221; src= &#8220;images/flags/norwegian.jpg&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;td align=&#8221;center&#8221;&gt;&lt;input name=&#8221;langpair2&#8243; value=&#8221;en|ar&#8221; title=&#8221;Arabic&#8221; src= &#8220;images/flags/arabic.gif&#8221; onClick=&#8221;this.form.langpair.value=this.value&#8221; type=&#8221;image&#8221; /&gt;&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p>&lt;/table&gt;</p>
<p>&lt;/form&gt;</p></div>
<p>An example of the snippet can be found in this <a href="http://rstrading.com">link</a>.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">
<h3 class="r"><a class="l" onmousedown="return clk(this.href,'','','res','1','','0CAkQFjAA')" href="http://www.translate.google.com/translate_t"><em> </em><em>Google Translate</em></a></h3>
</div>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Translation Services" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Translation+Services" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/translation-services/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Code Igniter Query</title>
		<link>http://www.icpep.org/code-igniter-query/</link>
		<comments>http://www.icpep.org/code-igniter-query/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 06:36:53 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=869</guid>
		<description><![CDATA[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 package. In Code Igniter the class that has the database queries or the methods that deals with getting the data on the database is placed inside the MODEL folder.  Just [...]]]></description>
			<content:encoded><![CDATA[<p align="center">
<img src="http://www.icpep.org/wp-content/uploads/2009/10/php-code.jpg" alt="php code" title="php code" width="360" height="288" class="alignnone size-full wp-image-875" />
</p>
<p><a href="http://www.icpep.org/code-igniter-installation-and-first-run/">Code Igniter</a> is one of the best PHP framework available today.  It is free to download and user guide can be found together with the package.</p>
<p>In Code Igniter the class that has the database queries or the methods that deals with getting the data on the database is placed inside the MODEL folder.  Just remember the &#8220;D&#8221; which tells us that Database methods are placed in this folder as what Jeffrey Way said in his tutorials.</p>
<p>Here are different Methods to query the database which is based in <a href="http://net.tutsplus.com">Nettuts+</a> tutorials.</p>
<p>Inside my Model folder I created a file Mydb.php, so the name of my class should be the same as the filename I created.<br />
<span id="more-869"></span></p>
<pre>
< ?php
class Mydb extends Model {
	function getData() {
		$this->db->select('title,content'); #where title and content are fields
		$sql = $this->db->get('data');  #data is a database table
		if($sql->num_rows() > 0) {
			foreach($sql->result() as $row) {
				$data[] = $row;
			}
			return $data;
		}
        }
}
?>
</pre>
<p>In this method the line <em>$this->db->select(&#8216;title,content&#8217;);</em> is using code igniter &#8220;active records&#8221; where I stated the fields I need but if you want to get all the data just remove this line.  The line <em>$sql = $this->db->get(&#8216;data&#8217;);</em> tells the name of the table where I want to get the fields title and content.  To make sure I have something to work on the line <em>$sql->num_rows() > 0</em> is placed and the data is placed inside the array $data[].</p>
<p>To be more specific in using code igniter active records,</p>
<pre>
< ?php
class Mydb extends Model {
	function getData() {
		$this->db->select('title,content');
		$this->db->from('data');
		$this->db->where('id',1);
		$sql = $this->db->get();
		if($sql->num_rows() > 0) {
			foreach($sql->result() as $row) {
				$data[] = $row;
			}
			return $data;
		}
        }
}
?>
</pre>
<p>Another way of querying is:</p>
<pre>
< ?php
class Mydb extends Model {
	function getData() {
		$sql = $this->db->query('SELECT * FROM data');
		if($sql->num_rows() > 0) {
			foreach($sql->result() as $row) {
				$data[] = $row;
			}
			return $data;
		}
	}
}
?>
</pre>
<p>The line<em> $sql = $this->db->query(&#8216;SELECT * FROM data&#8217;);</em> is simply putting the query inside the predefined method in Code Igniter $this->db->query(&#8216;[query]&#8216;).  Still the data returned is an array.</p>
<p>To query with a user input,</p>
<pre>
< ?php
class Mydb extends Model {
	function getData() {
		$sql = "select * from data where id=?";
		$val = $this->db->query($sql, 2);
		if($val->num_rows() > 0) {
			foreach($val->result() as $row) {
				$data[] = $row;
			}
			return $data;
		}
	}
}
?>
</pre>
<p>The line <em>$sql = &#8220;select * from data where id=?&#8221;;</em> is our database query where ? is any value passed to it.  The line <em>$val = $this->db->query($sql, 2);</em> is where we execute our query and the value passed to &#8220;?&#8221; is 2. But what if we have more than 1 condition in our query,</p>
<pre>
< ?php
class Mydb extends Model {
	function getData() {
		$sql = "select * from data where id=? and author = ?";
		$val = $this->db->query($sql, array(1, 'Allan'));
		if($val->num_rows() > 0) {
			foreach($val->result() as $row) {
				$data[] = $row;
			}
			return $data;
		}
	}
}
?>
</pre>
<p>If we have more than one condition in our query we just use an array stating the value for our conditions.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Code Igniter Query" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Code+Igniter+Query" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/code-igniter-query/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Session Authentication</title>
		<link>http://www.icpep.org/session-authentication/</link>
		<comments>http://www.icpep.org/session-authentication/#comments</comments>
		<pubDate>Wed, 20 May 2009 12:25:56 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=609</guid>
		<description><![CDATA[One problem in creating a PHP Session Authentication is that when you are logged in and suddenly logs out and click the back button you will be returned to the page where you kast visited.   Isn&#8217;t this a problem especially when you have important data in that page.  So if you have problem with this [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-610 aligncenter" title="phpsession" src="http://www.icpep.org/wp-content/uploads/2009/05/phpsession.jpg" alt="phpsession" width="446" height="210" /></p>
<p style="text-align: justify;">One problem in creating a PHP Session Authentication is that when you are logged in and suddenly logs out and click the back button you will be returned to the page where you kast visited.   Isn&#8217;t this a problem especially when you have important data in that page.  So if you have problem with this let me share a code that will surely eleminate the problem.  In this code there is no need for javascripts to disable the back button(what if js is disabled on the browser?).</p>
<p style="text-align: justify;">The code uses session and when the user logs out the user is redirected to the login page and when he clicks the back button it will redirect back to the login page.  This is one trick for PHP Security Authentication.</p>
<p style="text-align: center;">
<pre>#create a function to redirect the user to login page
#this should be on your php functions
function redirect($url){
	echo "&lt;script type='text/javascript'&gt;";
	echo "window.location.href='$url'";
	echo "&lt;/script&gt;";
}
#this should be in your page where you authenticate the user
session_start();
$sql = mysql_query("select * from user
       where username=\"$username\" and userpassword=\"$password\"");
if(mysql_num_rows($sql) &gt; 0) {
 $_SESSION['auth'] = true;
} else{
  redirect('login.php');
}
#so on the logout file there should be
session_destroy();
redirect('login.php');</pre>
<p align="justify"><span id="more-609"></span>Before starting in any of your PHP file you need to put this codes so that every now and the session is well monitored.</p>
<pre>if( $_SESSION['auth'] == true) {
#PHP code here ...
} else{
redirect('login.php');
}</pre>
<p style="text-align: justify;">So in this code if the session is not true the user is redirected to the login page.  So when the user press that back button the user is always redirected to login page because the session created was destroyed.  I hope this code will help a lot especially those who just started their PHP programming.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Session Authentication" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Session+Authentication" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/session-authentication/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Neural Network Programming</title>
		<link>http://www.icpep.org/neural-network-programming/</link>
		<comments>http://www.icpep.org/neural-network-programming/#comments</comments>
		<pubDate>Wed, 13 May 2009 12:27:51 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Robotics]]></category>
		<category><![CDATA[Neural Networks]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=573</guid>
		<description><![CDATA[Thank You to Jovencito Talasan One method of Neural Network Programming is Q Learning that will be applied for ai robots. Q learning is is an off-policy method that can be run on top of any strategy wandering in the Markov Decision Process (MDP). It uses the information observed to approximate the optimal function, from [...]]]></description>
			<content:encoded><![CDATA[<p>Thank You to Jovencito Talasan</p>
<p align="justify">
One method of Neural Network Programming is Q Learning that will be applied for ai robots.  Q learning is is an off-policy method that can be run on top of any strategy wandering in the Markov Decision Process (MDP). It uses the information observed to approximate the optimal function, from which one can construct the optimal policy or to summarize the function of Q learning, only the state-action function needs to be stored and updated.</p>
<p>
This the intelliBrain Mobot&#8217;s <strong>Flow Chart</strong>:</p>
<p align="center"><img class="aligncenter size-full wp-image-485" title="flow-chart-of-mobile-robot-function" src="http://www.icpep.org/wp-content/uploads//flow-chart-of-mobile-robot-function.jpg" alt="flow-chart-of-mobile-robot-function" width="297" height="240" /></p>
<p><span id="more-573"></span></p>
<p align="justify">The Language used for the Neural Network Programming is JAVA.  The Program was then loaded to the controller. </p>
<pre>LEARN_RATE = 0.35f; // the learning rate constant
public static float EXPLORE_RATE = 0.15f; // the rate it tries out random
//actions
private static Servo mLeftServo;
private static Servo mRightServo;
byte [][] state;
byte [][]action;
private static float [][] Q; // table of Q-values (action,state)
byte i = -1; // last state
byte a = -1; // last action
byte a1 = 0; // action with highest q-value
float r = 0; // Last reward
public ObstacleAvoidance(byte actions, byte states) // constructor
{
state = new byte[states][4]; // 16 unique states, 4 unique SENSOR
action = new byte[actions][2]; // 4 unique actions with 2 actuators
initAction(action);
initState(state);
Q = new float[actions][states]; // table of Q-values for action-states
//setRandomValues(Q);
setLearnedQValues(Q);
}
public static void main(String [] args)
{
byte actions = 4;
byte states = 16;
long iterMax=100000;
ObstacleAvoidance qutil = new ObstacleAvoidance(actions, states);
ObstacleAvoidance qbrain = new ObstacleAvoidance(actions, states);
byte[] e = new byte[8]; // The environment values
2
byte [] motorCommand = new byte[2]; // Commands to send to motors
mLeftServo=IntelliBrain.getServo(1);
mRightServo=IntelliBrain.getServo(2);
for (long iter=0;iter&lt;=3)
e[0]=1;
else
e[0]=0;
if(e[5]&lt;=4)
e[1]=1;
else
e[1]=0;
if (e[6]&lt;=3)
e[2]=1;
else
e[2]=0;
if (e[7]&lt;=3)
e[3]=1;
else
e[3]=0;
}
public static void initAction(byte [][] state)
{
byte count = 0;
for(byte i=0;i&lt;2;++i)
for(byte j=0;j&lt;2;++j)
{
state[count][0] = i;
state[count][1] = j;
++count;
}
}
public static void initState(byte [][] state)
{
byte count = 0;
for(byte i=0;i&lt;2;++i)
for(byte j=0;j&lt;2;++j)
for(byte k=0;k&lt;2;++k)
for(byte l=0;l&lt;2;++l)
{
state[count][0] = i;
state[count][1] = j;
state[count][2] = k;
state[count][3] = l;
5
++count;
}
}
public static void setRandomValues(float [][] Q)
{
for(byte i=0;i=0)
{
r = getRewardValue(e);
a1 = getMaxAction(j);
Q[a][i] = Q[a][i] + LEARN_RATE * (r + Q[a1][j] - Q[a][i]);
// Q["+a+"]["+i+"] = " + System.out.println(""+Q[a][i]);
}
i = j;
// GREEDY
float rand = (float)Math.random();
if(rand &gt; EXPLORE_RATE)
{
a = getMaxAction(j);
//System.out.println("Q["+a+"]["+j+"] = " + Q[a][j]);
}
// E-GREEDY
else
a = (byte)(Math.random() * 4);
buzzer.beep();
return a;
}
// find the largest Q-value for a given state (j), and return action
public byte getMaxAction(byte state)
8
{
float max = -1000;
byte action = 0;
for(byte a=0;a max)
{
max = Q[a][state];
action = a;
}
}
return action;
}
public byte getState(byte [] e)
{
byte count = 0;
for(byte i=0;i&lt;2;++i)
for(byte j=0;j&lt;2;++j)
for(byte k=0;k&lt;2;++k)
for(byte l=0;l&lt;2;++l)
{
if (e[0] == state[count][0])
if (e[1] == state[count][1])
if (e[2] == state[count][2])
if (e[3] == state[count][3])
return count;
++count;
}
return -1;
}
public float getRewardValue(byte [] e)
{
byte reward=0;
if(a==0)
reward += 3; // good reward
if (e[0] == 1||e[1] == 1||e[2] == 1||e[3] == 1)
reward -= 2; // give bad reward: penalize
return reward ;
}
}</pre>
<p>To view the Result of the intellibrain Neural Network Programming on ai Robots.  Click <a href="http://www.icpep.org/robot-kits/"> here</a></p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Neural Network Programming" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Neural+Network+Programming" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/neural-network-programming/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Assembly Language Tutorial</title>
		<link>http://www.icpep.org/assembly-language-tutorial/</link>
		<comments>http://www.icpep.org/assembly-language-tutorial/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 02:32:43 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[Assembly Language]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=474</guid>
		<description><![CDATA[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 unlike some of the other programs that passwords can be changed without accessing the source code. But here we created a program that has a fixed password abcdef. It is [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">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 unlike some  of the other programs that passwords can be changed without accessing the source code.  But here we created a program that has a fixed password abcdef.  It is then displayed as a # when type from the keyboard. When password is correct the background color is the changed and the ASCII characters then is displayed.   A86 is used as the assembler for the program.  Below is a sample output of the program.</p>
<p style="text-align: center;"><img class="size-full wp-image-500 aligncenter" title="password_assemblylanguagetutorial" src="http://www.icpep.org/wp-content/uploads//password_assemblylanguagetutorial.jpg" alt="password_assemblylanguagetutorial" width="500" height="250" /><strong></strong></p>
<p><span id="more-474"></span><br />
<script type="text/javascript"><!--
google_ad_client = "pub-4547412119801593";
/* Assembly Language Tutorial */
google_ad_slot = "4908892565";
google_ad_width = 468;
google_ad_height = 15;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></p>
<pre>call clear		;clear the screen
call center
mov ah,09h		;display string
lea dx,msg2		;prints Enter password
int 21h
mov bl,3
again:
        mov ah,07		;direct keyboard input
        int 21h
        mov bh,al		;move the input al to bh
        cmp bh,0dh
        je again
        call asterisk
        cmp bh,'a'		;compare bh with J
        je again1		;if equal jump to again
        jne wrong		;if not to wrong
again1:
        mov ah,07
        int 21h
        mov bh,al
        cmp bh,0dh
        je invalid9
        call asterisk
        cmp bh,08h
        je again
        cmp bh,'b'		;compare bh with P
        je again2
        jne wrong
again2:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,'c'		;compare bh with h
        je again3
        jne wrong
invalid9:
         call invalid8
 again3:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,'d'		;compare bh with I
        je again4
        jne wrong
again4:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,'P'		;compare bh with C
        je again5
        jne wrong
again5:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,'e'		;compare bh with E
        je again6
        jne wrong
again6:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,'f'		;compare bh with s
        je again7
        jne wrong
invalid8:
        call invalid
again7:
        mov ah,07
        int 21h
        mov bh,al
        cmp bh,0dh	;compare the input with the enter key
        je exit
        jne wrong
wrong:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,0dh	;compare the input with the enter key
        je invalid
        jne wrong
invalid:
        call clear
        call center
        mov ah,09
        lea dx,msg1	;prints retry password
        int 21h
        dec bl		;decrements bl until 3 attempts
        cmp bl,0
        je invalid2
        jmp again
invalid2:
        call clear
        call center
        mov ah,09		;print password failed!!!
        lea dx,msg3
        int 21h
        int 20h
exit:
        call clear
        call center</pre>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4547412119801593";
/* 665E59Assembly Language Tutorial Sample Program */
google_ad_slot = "8541998060";
google_ad_width = 250;
google_ad_height = 250;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></p>
<pre>
;ASCII program
	mov ax,0600		;setting background
	mov bh, 30h		;color of the attribute
	mov cx,0000h		;where the color starts to point
	mov dx,184fh		;where the color ends to point
	int 10h			
	mov ax,0b800		;location of the screen
	mov es,ax		;location of the screen move to es register
	mov bx,60+(160*4)	;where the title starts to display and move to bx register
	mov si,msg4		;the message move to si register
	mov cx,16		;the numbers of letters that will display
print:
	mov al,b[si]		;the value of si is move to al register
	mov es:[bx],al		;move the value of al to the location of es:[bx]
	inc si			;increment the si
	add bx,2		;add bx by 1 for the attribute
	loop print		;looping
	int 21h			;to terminate the loop
	mov bh,0		;holds the characters
	mov di,160*8		;where the characters will display and move to di register
	mov cx,255		;the number of characetrs that will display
char:
        mov al,bh		;moving bh to the al register
        mov es:[di],al		;move the value of al is move to the location of es:[di]
        inc bh			;increment the bh
        add di,8		;to make 20 columns
        loop char		;looping
	int 20h			;to terminate the loop
msg4:db 'ASCII CHARACTERS'
msg3 db 'PASSWORD INCORRECT!DENIED ACCESS!$'
msg2 db 'PASSWORD: $'
msg1 db 'RETRY: $'
asterisk:			;prints asterisk
        mov ah,09h
        lea dx,ask
        int 21h
        ret
ask db '#$'
clear:			;clear screen
        mov ax,03
        int 10h
center:			;set cursor at the center
        mov ah,02
        mov bh,00
        mov dh,12
        mov dl,33
        int 10h
        ret</pre>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Assembly Language Tutorial" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Assembly+Language+Tutorial" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/assembly-language-tutorial/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP Compare Date</title>
		<link>http://www.icpep.org/php-compare-date/</link>
		<comments>http://www.icpep.org/php-compare-date/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 01:50:04 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=468</guid>
		<description><![CDATA[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 the net about comparing date in PHP. One good application for this PHP snippet about comparing a date is that when the date filled is an invalid date range(e.g. the [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;" align="justify"><img class="size-full wp-image-469 aligncenter" title="php" src="http://www.icpep.org/wp-content/uploads/2009/04/php.jpg" alt="php" width="300" height="225" /></p>
<p align="justify">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 the net about comparing date in PHP. One good application for this PHP snippet about comparing a date is that when the date filled is an invalid date range(e.g. the date of borrow is greater than the date of return) or should I say wrong date input.  When I searched the net the resources was so limited that some are even trash.  So I decided to share the function I made and maybe this can help others or maybe there are any bugs somewhere on the code and have it corrected.<br />
<span id="more-468"></span></p>
<pre>function dateComapare($dformat, $endDate, $beginDate) {
    $endDateNew = explode($dformat, $endDate);
    $endDateNewDay     =  $endDateNew[0];
    $endDateNewMonth   =  $endDateNew[1];
    $endDateNewYear    =  $endDateNew[2];
    $beginDateNew = explode($dformat, $beginDate);
    $beginDateNewDay     =  $beginDateNew[0];
    $beginDateNewMonth   =  $beginDateNew[1];
    $beginDateNewYear    =  $beginDateNew[2];
    $yrDiff = $beginDateNewYear - $endDateNewYear;
    if($yrDiff &lt; 0 &amp;&amp; $yrDiff != 0 ){
    return 'Year Exceeds!';
  }
  else{
    $mthDiff = $beginDateNewMonth - $endDateNewMonth;
    if($mthDiff &lt; 0 &amp;&amp; $mthDiff != 0){
      return 'Month Exceeds!';
    }
    else{
      $dayDiff = $beginDateNewDay - $endDateNewDay;
      if($dayDiff &lt; 0 &amp;&amp; $dayDiff != 0 ){
        return 'Date Exceeds!';
      }
      else{
        return 'Date OK';
      }
    }
  }
}</pre>
<p><script type="text/javascript">// < ![CDATA[
// < ![CDATA[
google_ad_client = "pub-4547412119801593";
/* PHP Compare Date */
google_ad_slot = "2138395949";
google_ad_width = 468;
google_ad_height = 15;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script><br />
The code above will compare for the year first and then the month and then the date. If the given input is invalid then it prompts the error on which part of the borrow form was mistakenly filled up.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for PHP Compare Date" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+PHP+Compare+Date" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/php-compare-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code Igniter Installation and First Run</title>
		<link>http://www.icpep.org/code-igniter-installation-and-first-run/</link>
		<comments>http://www.icpep.org/code-igniter-installation-and-first-run/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 10:44:02 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[malware]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=222</guid>
		<description><![CDATA[Code Igniter is an PHP Application Development Framework &#8211; a toolkit for PHP developers. The main goal of Code Igniter is to enable developers to develop projects much faster than they could have done ( if they have started from scratch) by providing a rich set of libraries for commonly needed tasks, as well as [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-394 aligncenter" title="code-igniter-logo" src="http://www.icpep.org/wp-content/uploads/2009/01/code-igniter-logo.jpg" alt="code-igniter-logo" width="245" height="141" /></p>
<p style="text-align: justify;">Code Igniter is an PHP Application Development Framework &#8211; a toolkit for PHP developers. The main goal of Code Igniter is to enable developers to develop projects much faster than they could have done ( if they have started from scratch) by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries.</p>
<p style="text-align: justify;">You can download Code Igniter from <a href="http://codeigniter.com/downloads/">http://www.codeigniter.com/</a></p>
<p style="text-align: justify;">How to Install:</p>
<p style="text-align: justify;">1. Download the zip file from the above URL.</p>
<p style="text-align: justify;">2. unzip the files and put them to your webserver where you want to. lets assume that you put it at codeigniter folder of your web server.<span id="more-222"></span></p>
<p style="text-align: justify;">3. Open the application/config/config.php file with a text editor and set your base URL. lets assume that your base URL is set like this:</p>
<p style="text-align: justify;">$config['base_url'] = “http://localhost/codeigniter/”;</p>
<p style="text-align: justify;">Note:</p>
<p style="text-align: justify;">Where code igniter is the folder name where you saved the downloaded files.</p>
<p style="text-align: justify;">4. if you intend to use a database, open the application/config/database.php file with a text editor and set your database settings. Set the following variables according to your setup.</p>
<p style="text-align: justify;"><script type="text/javascript"><!--
google_ad_client = "pub-4547412119801593";
/* code igniter */
google_ad_slot = "6059567623";
google_ad_width = 250;
google_ad_height = 250;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script> $db['default']['hostname'] = “localhost”;  $db['default']['username'] = “root”;  $db['default']['password'] = “*****”;  $db['default']['database'] = “codeigniterDb”;  $db['default']['dbdriver'] = “mysql”;  $db['default']['dbprefix'] = “”;  $db['default']['active_r'] = TRUE;  $db['default']['pconnect'] = TRUE;  $db['default']['db_debug'] = TRUE;  $db['default']['cache_on'] = FALSE;  $db['default']['cachedir'] = “”;  5. now you are ready to run our installed piece of software. in order to run Code Igniter you have to visit the following URL in you web server.  http://localhost/codeigniter/index.php/  if your setup is correct then you will see a welcome page with heading  “Welcome to Code Igniter!”  Now you are ready to work with Code Igniter.  Note: if you try to access the Code Igniter installation like the following then you will definitely get an error message.  http://localhost/codeigniter/  http://localhost/codeigniter/index.php  By default Code Igniter follows (Search Engine Friendly (SEF) URL and for this they use segment based URL which will come to next tutorial.  <script type="text/javascript"><!--
google_ad_client = "pub-4547412119801593";
/* code igniter */
google_ad_slot = "6059567623";
google_ad_width = 250;
google_ad_height = 250;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Code Igniter Installation and First Run" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Code+Igniter+Installation+and+First+Run" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/code-igniter-installation-and-first-run/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
