<?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>Beginnercode.com &#187; php</title>
	<atom:link href="http://www.beginnercode.com/category/computing/programming/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.beginnercode.com</link>
	<description>The adventures of an amateur coder</description>
	<lastBuildDate>Wed, 27 Apr 2011 20:07:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
  <link>http://www.beginnercode.com</link>
  <url>http://www.beginnercode.com/wp-content/themes/neuron/favicon.ico</url>
  <title>Beginnercode.com</title>
</image>
		<item>
		<title>Adding a second argument to CI form_validation callbacks</title>
		<link>http://www.beginnercode.com/2011/04/27/adding-a-second-argument-to-ci-form_validation-callbacks/</link>
		<comments>http://www.beginnercode.com/2011/04/27/adding-a-second-argument-to-ci-form_validation-callbacks/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 20:07:54 +0000</pubDate>
		<dc:creator>^Lestat</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.beginnercode.com/?p=333</guid>
		<description><![CDATA[About a month ago I started working with the CodeIgniter framework. It&#8217;s the first framework I have worked with and frankly, I love it!
So I was looking to add a second parameter to a form_validation callback. Here&#8217;s what I found:

$this-&#62;form_validation('user_name', 'name', &#34;callback_test_name[$param2]&#34;);

and the callback:

test_name($name, $param2){
    ..// some logic to return
}

The form_validation class [...]]]></description>
			<content:encoded><![CDATA[<p>About a month ago I started working with the CodeIgniter framework. It&#8217;s the first framework I have worked with and frankly, I love it!</p>
<p>So I was looking to add a second parameter to a form_validation callback. Here&#8217;s what I found:</p>
<pre class="brush: php;">
$this-&gt;form_validation('user_name', 'name', &quot;callback_test_name[$param2]&quot;);
</pre>
<p>and the callback:</p>
<pre class="brush: php;">
test_name($name, $param2){
    ..// some logic to return
}
</pre>
<p>The form_validation class uses the form value as the first parameter, and you can pass the second parameter in the arguments as you would with any other rule references. (First snippet)</p>
<p>At first I was calling 2 validations. First the standard type of validation, <strong>then another validation on the same input</strong>. * BAD IDEA * </p>
<p>There were some issues with order of operations. I found it best to chain the whole lot together. Like so:</p>
<pre class="brush: php;">
$this-&gt;form_validation('user_name', 'name', &quot;required|min_length[10]|callback_test_name[$param2]&quot;);
</pre>
<p>I hope that helps anybody with the same question.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.beginnercode.com/2011/04/27/adding-a-second-argument-to-ci-form_validation-callbacks/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>REGEX For common courier tracking numbers</title>
		<link>http://www.beginnercode.com/2010/11/09/regex-for-common-courier-tracking-numbers/</link>
		<comments>http://www.beginnercode.com/2010/11/09/regex-for-common-courier-tracking-numbers/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 22:37:40 +0000</pubDate>
		<dc:creator>^Lestat</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.beginnercode.com/?p=322</guid>
		<description><![CDATA[I was on the hunt not only to find the different variations each courier had for their tracking numbers but also a regex to match. Most of the google fu I found was outdated. Fedex &#8220;recently&#8221; (months? years? days?) changed from a 12 digit to 15 digit system. And NO, tracking numbers are not totally [...]]]></description>
			<content:encoded><![CDATA[<p>I was on the hunt not only to find the different variations each courier had for their tracking numbers but also a regex to match. Most of the google fu I found was outdated. Fedex &#8220;recently&#8221; (months? years? days?) changed from a 12 digit to 15 digit system. And NO, tracking numbers are not totally random. There is usually a space separation on the printed labels you see. Each of the spaced out subsets have a meaning to the courier as well as a checksum. Checksum being, a pre selected sequence of particular number positions added together then divided by a pre selected number. That you can search up yourself if you like. I didn&#8217;t find all too much on that matter either.</p>
<p>I am not very good with regex so if there are any suggestions by l33t coderz, they are more than welcome. On with the codes:</p>
<pre class="brush: php;">

/****
[ UPS ]
9 digits, or 1Z+whatever digits
The quick brown fox 1Z9999W99999999999 jumps over the lazy dog.
*/
$ups = '/(\b\d{9}\b)|(\b1Z\d+\b)/';

/****
[ Fedex ]
12 digits, 15 digits, or '96'+ 20 digits
The quick brown fox 999999999999 jumps over the lazy dog.
*/
$fedex = '/(\b96\d{20}\b)|(\b\d{15}\b)|(\b\d{12}\b)/';

/***
[ USPS ]
30 digits, '91'+20 digits, 20 digits (untested)
&lt; TOTALLY UNTESTED BY ME AT THIS TIME &gt;
*/
$usps = '/(\b\d{30}\b)|(\b91\d+\b)|(\b\d{20}\b)/';
</pre>
<p>I did get the common characters per courier from <a href="http://www.packagetrackr.com/help/carriers">Packagetrackr</a>. I don&#8217;t know how much of it is accurate, but from what I could tell from my experience with FedEx and UPS it seemed to be in line. I was unable to find an all inclusive source.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.beginnercode.com/2010/11/09/regex-for-common-courier-tracking-numbers/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>php: Checking if a directory is empty</title>
		<link>http://www.beginnercode.com/2008/02/21/php-checking-if-a-directory-is-empty/</link>
		<comments>http://www.beginnercode.com/2008/02/21/php-checking-if-a-directory-is-empty/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 15:16:19 +0000</pubDate>
		<dc:creator>^Lestat</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.beginnercode.com/index.php/2008/02/21/php-checking-if-a-directory-is-empty/</guid>
		<description><![CDATA[I found myself working with text files a little more recently and was looking for a way to tell if a directory was empty. Why? In my case I wanted to check if a directory was empty. If it wasn&#8217;t, to grab the data in those files and put them in a database.
What I didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I found myself working with text files a little more recently and was looking for a way to tell if a directory was empty. Why? In my case I wanted to check if a directory was empty. If it wasn&#8217;t, to grab the data in those files and put them in a database.</p>
<p>What I didn&#8217;t want to do was have the expense of connecting to a database if the directory didn&#8217;t have any files in it to begin with. After chatting with my good friend TDavid at <a href="http://www.php-scripts.com/">php-scripts.com</a>, I decide to run with his suggestion&#8230;</p>
<p>Fill (or don&#8217;t fill) a variable with information if there were files in the directory. Then test the var to confirm or deny if there are files in the directory. It&#8217;s really a small bit of code&#8230;</p>
<pre class="brush: php;">
//----- Check if ticket dir has files. If it has files,
// set a variable to hold the list of file names.

$dir = &quot;../path/to/my/textfiles&quot;;      // set directory

if($handle = opendir($dir)){           // open directory

	while(($file = readdir($handle)) !== false){
		if($file != &quot;.&quot; &amp;&amp; $file != &quot;..&quot;){
			$file_list[] = $file;  // Set file list variable
		}

	}

	closedir($handle);      // Close directory
}
</pre>
<p>If there are files in this directory, the variable $file_list would not only exist, but also contain files. For example&#8230;</p>
<pre class="brush: php;">
Array
(
    [0] =&gt; 195972.txt
    [1] =&gt; 196027.txt
    [2] =&gt; 196053.txt
    [3] =&gt; 196067.txt...
)
</pre>
<p>If there aren&#8217;t any files in this directory, the variable $file_list would not even exist because no $file would be inserted into it. At this point we can check/ test the variable to output or do further processing&#8230;</p>
<pre class="brush: php;">
if(isset($file_list)){
    echo &quot;This dir has files!&quot;;
    // perform further processing
    // eg: collect each files contents
} else {
    echo &quot;This dir has NO files!&quot;;
    // stop processing
    // Not much do do with this since there are no files
}
</pre>
<p>Of course there are a few ways of checking to see if a directory is empty, but this way seemed to be the most simplistic to me. If you wanted to you could turn the entire lot into a function for reuse, and less script code clutter.</p>
<p>Comments? Questions?</p>
<p><tags>php, empty directory</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://www.beginnercode.com/2008/02/21/php-checking-if-a-directory-is-empty/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MySQL Conditional Insert</title>
		<link>http://www.beginnercode.com/2007/12/20/mysql-conditional-insert/</link>
		<comments>http://www.beginnercode.com/2007/12/20/mysql-conditional-insert/#comments</comments>
		<pubDate>Thu, 20 Dec 2007 22:13:05 +0000</pubDate>
		<dc:creator>^Lestat</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php Snippets]]></category>

		<guid isPermaLink="false">http://www.beginnercode.com/index.php/2007/12/20/mysql-conditional-insert/</guid>
		<description><![CDATA[I came across a situation where I needed to pull records from 1 db to another on a recurring basis. I read many different ways to do it via searching around the net. Some of the suggestions included creating a temporary table and copying it over. What was lacking was that sometimes the new table [...]]]></description>
			<content:encoded><![CDATA[<p>I came across a situation where I needed to pull records from 1 db to another on a recurring basis. I read many different ways to do it via searching around the net. Some of the suggestions included creating a temporary table and copying it over. What was lacking was that sometimes the new table also needed to be UPDATED, as the information changed from the original table.</p>
<p>I&#8217;ve come up with a dirty little example to show this can be done. There are <i>more</i> keywords that can enhance the <b><a href="http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html">ON DUPLICATE KEY UPDATE</a></b> function even more. The Example is assuming an &#8220;employees&#8221; table that looks like so:</p>
<table style="border-collapse:collapse;border:1px solid #000;">
<tr>
<th>employees</th>
</tr>
<tr>
<td style ="border:1px solid #000;">id (PK)</td>
</tr>
<tr>
<td style="border:1px solid #000;">first_name</td>
</tr>
</table>
<p>For brevity, I&#8217;ve left out connection data etc;</p>
<pre class="brush: php;">
$myArray = array(0 =&gt; array('id' =&gt; '1', 'fname' =&gt; 'Steve'),
                      array('id' =&gt; '2', 'fname' =&gt; 'sara'),
                      array('id' =&gt; '3', 'fname' =&gt; 'Matt')
                 );

// Don't forget to validate &amp; clean your data
// Connect to db here 

foreach($myArray as $key =&gt; $value){
          $query = &quot;INSERT INTO employees
          (id, first_name) VALUES ('$value[id]', '$value[fname]')
          ON DUPLICATE KEY UPDATE first_name = '$value[fname]'&quot;;

          $result = mysql_query($query);

          if(!$result){

                    print(&quot;Problem: &quot; . mysql_error() . &quot;&quot;);
          } else {

                    print(&quot;Success !&quot;);
          }

}
</pre>
<p>Read the manual on this for more information. This snippet will INSERT if a UNIQUE (in this case &#8216;id&#8217;) does not exist. It will UPDATE any existing unique. In this case any existing &#8216;id&#8217;s, the &#8216;first_name&#8217; column will get updated. </p>
<p>One could also use the <b><a href="http://dev.mysql.com/doc/refman/5.0/en/replace.html">REPLACE</a></b> function. As I understand the difference, REPLACE will DELETE any matching uniques, and INSERT a new record in it&#8217;s place.</p>
<p>Comments? Better ways? I&#8217;m always up for learning something new so please chime in ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.beginnercode.com/2007/12/20/mysql-conditional-insert/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>php: Installing imagick extension on WindowsXP</title>
		<link>http://www.beginnercode.com/2007/10/12/php-installing-imagick-extension-on-windowsxp/</link>
		<comments>http://www.beginnercode.com/2007/10/12/php-installing-imagick-extension-on-windowsxp/#comments</comments>
		<pubDate>Fri, 12 Oct 2007 16:39:40 +0000</pubDate>
		<dc:creator>^Lestat</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.beginnercode.com/index.php/2007/10/12/php-installing-imagick-extension-on-windowsxp/</guid>
		<description><![CDATA[This may seem simple enough to many programmers out there but this threw me for a few days. This is how you install imagick on a windows server. If your site is on a shared host, you need to ask your host to install the extension for you.
For this example I am running php 5.2.4 [...]]]></description>
			<content:encoded><![CDATA[<p>This may seem simple enough to many programmers out there but this threw me for a few days. This is how you install imagick on a windows server. If your site is on a shared host, you need to ask your host to install the extension for you.</p>
<p>For this example I am running <a href="http://www.php.net/">php</a> 5.2.4 on <a href="http://www.aprelium.com/">Abyss</a>/Apache web server</p>
<p>Download the matching pecl5 Binary <a href="http://www.php.net/downloads.php">from php.net</a>. In this case its pecl5.2-win32-200710121230.zip (matching my current php version).</p>
<p>Unpack the file.</p>
<p>Copy the php&#95;imagick.dll into php/ext/ directory</p>
<p><img src='http://www.beginnercode.com/wp-content/imgupload/2007/10/addphpextension_dll.jpg' alt='php pecl dll' /></p>
<p>Open your php.ini file and look for the &#8220;Dynamic Extensions&#8221; area. In there will be a list of items (some commented out). Add the following line to the bottom of the list: extension=php&#95;imagick.dll</p>
<p><img src='http://www.beginnercode.com/wp-content/imgupload/2007/10/addphpextension_ini.jpg' alt='Add the extension to your ini' /></p>
<p>Save the changes you made.</p>
<p>Restart your web server.</p>
<p>If these steps were successful imagick will show up on any php page using the phpinfo() function.</p>
<p><img src='http://www.beginnercode.com/wp-content/imgupload/2007/10/imagickphpinfo.jpg' alt='imagick in the phpinfo()' /></p>
<p><tags>imagick, pecl-extension, php-extension</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://www.beginnercode.com/2007/10/12/php-installing-imagick-extension-on-windowsxp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>php: Whats your commenting style?</title>
		<link>http://www.beginnercode.com/2007/08/14/php-whats-your-commenting-style/</link>
		<comments>http://www.beginnercode.com/2007/08/14/php-whats-your-commenting-style/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 15:26:42 +0000</pubDate>
		<dc:creator>^Lestat</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.beginnercode.com/index.php/2007/08/14/php-whats-your-commenting-style/</guid>
		<description><![CDATA[I was writing up a few scripts and as I was adding my commenting I noticed I tend to comment differently depending on the difficulty of the script and how many different parts or procedures there are to it. I don&#8217;t have a set convention, but I suppose as with all things it would make [...]]]></description>
			<content:encoded><![CDATA[<p>I was writing up a few scripts and as I was adding my commenting I noticed I tend to comment differently depending on the difficulty of the script and how many different parts or procedures there are to it. I don&#8217;t have a set convention, but I suppose as with all things it would make things easier on myself and others if I had some kind of standardization&#8230;</p>
<p>For larger &#8216;areas&#8217; that contain functions or a series of procedures that extract or parse sections of data I&#8217;m now starting with this:</p>
<pre class="brush: php;">
/***
*
* This is a comment.
* Here I leave notes about the section and what it does.
* I may also include notes to myself here.
* Note: This could probably be done more eficiently
*
*/
</pre>
<p>
As there are more breakdowns within these sections I&#8217;m using this:</p>
<pre class="brush: php;">
/*  [ Parse out the text file ]  */
</pre>
<p>
And further drilled down I use the more inline commenting</p>
<pre class="brush: php;">
/*  [ Print data]  */

$parts = explode(&quot;|&quot;, $the_array); // get the parts

$color = false; // set color var for shading every other row

print(&quot;&lt;table&gt;&quot;); 

// loop through data &amp; print
foreach($parts as $key =&gt; $row){ 

    // CSS Note: shading &lt;tr&gt;'s with css mostly works with nice browsers
    // For IE 6+ one needs to shade the &lt;td&gt;'s

    if($color){
        print(&quot;&lt;tr class=\&quot;rowColor1\&quot;&gt; &quot;); // start row with color 1
        $color = !$color; // unset the color so it alternates next loop
    } else {
        print(&quot;&lt;/tr&gt;&lt;tr class=\&quot;rowColor2\&quot;&gt; &quot;); // start row with color 2
        $color = true; // set the color so it alternates next loop
    }

    print(&quot;&lt;td&gt;$row[first_name]&lt;/td&gt;&lt;/tr&gt;&quot;); // print cell data and close the row
}

print(&quot;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&quot;);
</pre>
<p>The inline comments still seem a bit &#8216;messy&#8217; to me. But for now it will work.</p>
<p>One of the reasons I decided to standardize is because even with commenting and extra line spaces in the scripts it was still difficult to sort out what exactly was going on. Another thing that tripped my thought was having a glance at <a href="http://www.phpdoc.org/">phpDocumentor</a>. It seems to function on how you comment your code. I did try to install it but for some reason it was way over my head. It looks like a neat tool but I rarely seem to write more than 4 different files and those are often less than 300-400 lines. </p>
<p>I&#8217;ve yet to test it in comments but my plugin to allow code viewing is much like bbc code. &#91;code lang=&#34;php&#34;&#93; // comment  &#91;&#47;code&#93;</p>
<p>So whats your style? Is there a standard? What have you seen that looks the cleanest? Leave a comment&#8230; with some comments ;-)</p>
<p><b><u>Update 12/3/07</u></b> Elizabeth Naramore has written a <a href="http://shiflett.org/blog/2007/dec/php-advent-calendar-day-2">nice article</a> on the effectiveness of comments in your code over at the Chris Shiflett blog. It&#8217;s a great read on WHY commenting is good in your code.</p>
<p><tags>php, comment, code, script, php+script, php+comment</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://www.beginnercode.com/2007/08/14/php-whats-your-commenting-style/feed/</wfw:commentRss>
		<slash:comments>90</slash:comments>
		</item>
		<item>
		<title>My Favorite Dev Tools</title>
		<link>http://www.beginnercode.com/2007/03/08/my-favorite-dev-tools/</link>
		<comments>http://www.beginnercode.com/2007/03/08/my-favorite-dev-tools/#comments</comments>
		<pubDate>Thu, 08 Mar 2007 22:03:07 +0000</pubDate>
		<dc:creator>^Lestat</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.beginnercode.com/?p=122</guid>
		<description><![CDATA[I&#8217;ve recently reformatted my computer and started missing my favorite dev tools. In an attempt to record them, I can also share them with others.
A list of my current favorite web tools&#8230;
Text Editor:

Notepad 2 &#8211; Very Light. Very Simple.

Compression Utility:

IZARC &#8211; IMO, better than winzip

Localhost Server (Apache/mySQL):

Wamp &#8211; Run an Apache web server on your [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently reformatted my computer and started missing my favorite dev tools. In an attempt to record them, I can also share them with others.</p>
<p>A list of my current favorite web tools&#8230;</p>
<p><u><b>Text Editor:</b></u>
<ul>
<li><a href="http://www.flos-freeware.ch/notepad2.html">Notepad 2</a> &#8211; Very Light. Very Simple.</li>
</ul>
<p><u><b>Compression Utility:</b></u>
<ul>
<li><a href="http://www.izarc.org/">IZARC</a> &#8211; IMO, better than winzip</li>
</ul>
<p><u><b>Localhost Server (Apache/mySQL):</b></u>
<ul>
<li><a href="http://www.wampserver.com/en/">Wamp</a> &#8211; Run an Apache web server on your PC. You can configure it to run or not run on startup. It also includes mySQl and a few php extensions.</li>
</ul>
<p><u><b>Firefox extensions:</b></u>
<ul>
<li><a href="https://addons.mozilla.org/firefox/539/">measureit</a> &#8211; Measure pixels right on your screen.</li>
<li><a href="https://addons.mozilla.org/firefox/271/">colorzilla</a> &#8211; Grab colors off of web pages, zoom, and built in color picker.</li>
<li><a href="https://addons.mozilla.org/firefox/60/">web developer</a> &#8211; CSS, XHTML, Screen resize, line guides, disable styles and much much more.</li>
<li><a href="https://addons.mozilla.org/firefox/1843/">firebug</a> &#8211; A great tool especially for pages created in php. You may have 100 lines of code before the html begins. This helps you debug xhtml issues on &#8220;line 12&#8243; which is actually line 112. Works well with included php files as well.</li>
</ul>
<p><u><b>IE Explorer Add On:</b></u>
<ul>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&#038;displaylang=en">IE Dev Toolbar</a>(For IE Similar to Firebug)</li>
<p><tags>Tools, Dev, Developer, Dev Tools</tags></ul>
]]></content:encoded>
			<wfw:commentRss>http://www.beginnercode.com/2007/03/08/my-favorite-dev-tools/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ODBC Viewer</title>
		<link>http://www.beginnercode.com/2007/02/28/odbc-viewer/</link>
		<comments>http://www.beginnercode.com/2007/02/28/odbc-viewer/#comments</comments>
		<pubDate>Wed, 28 Feb 2007 18:56:09 +0000</pubDate>
		<dc:creator>^Lestat</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.beginnercode.com/?p=121</guid>
		<description><![CDATA[I had recently been peeking into a SQL database via Microsoft Access. I got quite used to browsing all the tables and fields, seeing their data types, and visually seeing their relationships. I&#8217;ve just began a project that connects to a proprietary(aged) database that uses ODBC to connect to it. Access would not allow me [...]]]></description>
			<content:encoded><![CDATA[<p>I had recently been peeking into a SQL database via Microsoft Access. I got quite used to browsing all the tables and fields, seeing their data types, and visually seeing their relationships. I&#8217;ve just began a project that connects to a proprietary(aged) database that uses ODBC to connect to it. Access would not allow me to view this the same (At least I couldn&#8217;t figure it out).</p>
<p>After a quick search I found a freeware application called <a href="http://passportodbc.embassy-software-inc.qarchive.org/">passportODBC</a>(You can download from <a href="http://www.google.com/search?source=ig&#038;hl=en&#038;q=passportODBC&#038;btnG=Google+Search">other locations/ sites</a>). It does require some information from you to register it. Some basic info like your name, and email and a phone number.</p>
<p><center><a style="border:none;" href="http://www.beginnercode.com/wp-content/imgupload/passport.jpg"><img src="http://www.beginnercode.com/wp-content/imgupload/_passport.jpg" width="250" height="146" alt="passportODBC" title="passportODBC"  /></a></center></p>
<p>It&#8217;s not as fast as access and SQL server 2005, but I&#8217;m suspecting a lot of that has to do that it is ODBC. It&#8217;s really quite simple to use. Choose your data source, enter some credentials and go. You can view tables, all the fields, and the field attributes.</p>
<p><tags>ODBC, programming, database</tags></p>
<p><b>Update 2/28/07 1:20PM</b><br />
Embassy Software offers the download <a href="http://www.edi-software.net/news3.html">direct from their site</a>.</p>
<p><b>Update 5/16/07</b><br />
I found a more simple tool for viewing via ODBC. You can compose queries and the likes. It&#8217;s much more simple to use (for me anyways) <b>ODBC View</b> can be downloaded from <a href="http://www.sliksoftware.co.nz/">sliksoftware.co.nz</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.beginnercode.com/2007/02/28/odbc-viewer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>REGEX Library</title>
		<link>http://www.beginnercode.com/2006/03/09/regex-library/</link>
		<comments>http://www.beginnercode.com/2006/03/09/regex-library/#comments</comments>
		<pubDate>Thu, 09 Mar 2006 19:23:13 +0000</pubDate>
		<dc:creator>^Lestat</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php Snippets]]></category>

		<guid isPermaLink="false">http://www.beginnercode.com/?p=91</guid>
		<description><![CDATA[I was working up a form and needed to come up with an email regex. I know by now I probably should have my own regex library, or even be able to write my own &#8211; but I haven&#8217;t exercised my regex skills enough. Often time doesn&#8217;t allow an extensive learning period when your already [...]]]></description>
			<content:encoded><![CDATA[<p>I was working up a form and needed to come up with an email regex. I know by now I probably should have my own regex library, or even be able to write my own &#8211; but I haven&#8217;t exercised my regex skills enough. Often time doesn&#8217;t allow an extensive learning period when your already half way through creating a form! </p>
<p>I came across this great <a href="http://regexlib.com/default.aspx">regex library at regexlib.com</a>. It&#8217;s searchable, offers on the fly tests of user contibuted regular expresssions, rss feeds of recently added patterns, and contains a <a href="http://regexlib.com/CheatSheet.aspx">Cheat Sheet</a> for regex reference.</p>
<p>Of course, programmer beware. Be careful copying and pasting code. And definately test that code before you implement it.</p>
<p><tags>regex, php</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://www.beginnercode.com/2006/03/09/regex-library/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>php: syntax woes</title>
		<link>http://www.beginnercode.com/2006/01/03/php-syntax-woes/</link>
		<comments>http://www.beginnercode.com/2006/01/03/php-syntax-woes/#comments</comments>
		<pubDate>Tue, 03 Jan 2006 22:40:02 +0000</pubDate>
		<dc:creator>^Lestat</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.beginnercode.com/?p=73</guid>
		<description><![CDATA[Today I fought what I thought was some kind of permissions error. I was learning how to create a database table in mySQL with php.
After 3 hours I figured out my error was due to syntax.
&#8220;AUTO-INCREMENT&#8221; is not the same as &#8220;AUTO_INCREMENT&#8221;
I looked over that line at least a thousand times thinking &#8211;  thats [...]]]></description>
			<content:encoded><![CDATA[<p>Today I fought what I thought was some kind of permissions error. I was learning how to create a database table in mySQL with php.</p>
<p>After 3 hours I figured out my error was due to syntax.<br />
&#8220;AUTO-INCREMENT&#8221; is not the same as &#8220;AUTO_INCREMENT&#8221;</p>
<p>I looked over that line at least a thousand times thinking &#8211;  thats right.</p>
<p>When you are trouble shooting code:<br />
Break down the elements.<br />
Print out the variables  print_r();<br />
Put in escape messages while you are creating:</p>
<pre class="brush: php;">
if($this_is_true){
  print(&quot;Its all good&lt;br /&gt;&quot;);
} else {
  print(&quot;Houston, we've got a problem&quot;);
}
</pre>
<p>or print all the elements getting $_POSTED:
<pre class="brush: php;">
print_r($_POST);
</pre>
<p>or print all the elements in an array:
<pre class="brush: php;">
print_r($myArray);
</pre>
<p>&#8230;it only takes a few seconds to code that temporarily in to your code to help find problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.beginnercode.com/2006/01/03/php-syntax-woes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

