<?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>Jeff Combs - IT Professional / Web Developer</title>
	<atom:link href="http://jcombs.net/feed" rel="self" type="application/rss+xml" />
	<link>http://jcombs.net</link>
	<description>System Administration</description>
	<lastBuildDate>Sat, 31 Mar 2012 23:19:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Debian Squeeze Lamp Server</title>
		<link>http://jcombs.net/linux/debian-squeeze-lamp-server</link>
		<comments>http://jcombs.net/linux/debian-squeeze-lamp-server#comments</comments>
		<pubDate>Sat, 31 Mar 2012 23:19:45 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://jcombs.net/?p=244</guid>
		<description><![CDATA[Here is a few commands to get a Squeeze development server up quick. apt-get install mysql-server mysql-client apt-get install apache2 apt-get install php5 libapache2-mod-php5 /etc/init.d/apache2 restart apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl /etc/init.d/apache2 restart apt-get install phpmyadmin To search for PHP5 [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a few commands to get a Squeeze development server up quick.</p>
<blockquote><p>
apt-get install mysql-server mysql-client</p>
<p>apt-get install apache2</p>
<p>apt-get install php5 libapache2-mod-php5</p>
<p>/etc/init.d/apache2 restart</p>
<p>apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl</p>
<p>/etc/init.d/apache2 restart</p>
<p>apt-get install phpmyadmin
</p></blockquote>
<p>To search for PHP5 packages use apt-cache</p>
<blockquote><p>
apt-cache search php5<br />
</blockquote</p>
]]></content:encoded>
			<wfw:commentRss>http://jcombs.net/linux/debian-squeeze-lamp-server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Key Authentication</title>
		<link>http://jcombs.net/linux/ssh-key-authentication</link>
		<comments>http://jcombs.net/linux/ssh-key-authentication#comments</comments>
		<pubDate>Sat, 10 Mar 2012 16:26:17 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://jcombs.net/?p=241</guid>
		<description><![CDATA[To avoid entering a password on each SSH session you can generate ssh public keys and copy to the remote server. From the client machine use the following: ssh-keygen -t dsa Copy id_dsa.pub to remote server scp ~/.ssh/id_dsa.pub remote_machine:/tmp Login to the remote machine and append the keys to authorized_keys2 in your home folder cat [...]]]></description>
			<content:encoded><![CDATA[<p>To avoid entering a password on each SSH session you can generate ssh public keys and copy to the remote server.  From the client machine use the following:</p>
<blockquote><p>
ssh-keygen -t dsa
</p></blockquote>
<p>Copy id_dsa.pub to remote server</p>
<blockquote><p>
scp ~/.ssh/id_dsa.pub remote_machine:/tmp
</p></blockquote>
<p>Login to the remote machine and append the keys to authorized_keys2 in your home folder</p>
<blockquote><p>
cat /tmp/id_dsa.pub >> ~/.ssh/authorized_keys2
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://jcombs.net/linux/ssh-key-authentication/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xedebug with Cakephp and Netbeans</title>
		<link>http://jcombs.net/uncategorized/xedebug-with-cakephp-and-netbeans</link>
		<comments>http://jcombs.net/uncategorized/xedebug-with-cakephp-and-netbeans#comments</comments>
		<pubDate>Wed, 07 Mar 2012 15:10:08 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jcombs.net/?p=239</guid>
		<description><![CDATA[I&#8217;m using Debian and Xedebug is available via the package manager. apt-get install php5-xdebug Configure PHP to use xdebug. vi /etc/php5/conf.d/xdebug.ini ; configuration for php xdebug module zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so xdebug.remote_enable = 1 xdebug.remote_handler = dbgp xdebug.remote_mode = req xdebug.remote_host = 10.11.228.223 ; [Remote address if debugging from a remote client] xdebug.remote_port = 9000 xdebug.max_nesting_level = 500 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using Debian and Xedebug is available via the package manager.</p>
<blockquote><p>
apt-get install php5-xdebug
</p></blockquote>
<p>Configure PHP to use xdebug.</p>
<blockquote><p>
vi /etc/php5/conf.d/xdebug.ini</p>
<p>; configuration for php xdebug module<br />
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so</p>
<p>xdebug.remote_enable = 1<br />
xdebug.remote_handler = dbgp<br />
xdebug.remote_mode = req<br />
xdebug.remote_host = 10.11.228.223 ; [Remote address if debugging from a remote client]<br />
xdebug.remote_port = 9000<br />
xdebug.max_nesting_level = 500 ; [This may be needed for larger scripts]<br />
xdebug.profiler_enable_trigger = 1 ; [Use trigger to enable with something like chrome/firefox extensions]<br />
;xdebug.profiler_enable = 1
</p></blockquote>
<p>Configure netbeans under Tool > Options.  Make sure PHP is configured with the proper port.  You can remove the option to stop at first line.  You must also make sure the project has the webroot defined under sources. Without this setting the debugger will not stop at the breakpoints. </p>
]]></content:encoded>
			<wfw:commentRss>http://jcombs.net/uncategorized/xedebug-with-cakephp-and-netbeans/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable mod_status for CAKEPHP</title>
		<link>http://jcombs.net/cakephp/enable-mod_status-for-cakephp</link>
		<comments>http://jcombs.net/cakephp/enable-mod_status-for-cakephp#comments</comments>
		<pubDate>Fri, 02 Mar 2012 14:39:53 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://jcombs.net/?p=224</guid>
		<description><![CDATA[I&#8217;ve been trying to isolate a CPU issue for an app running on Apache2 written with Cakephp. Apache has a module to monitor the server status with mod_status. http://www.debian-administration.org/article/Monitoring_Apache_with_mod_status For Apache 1.2 enable mod_info and restart apache. sudo a2enmod info sudo /etc/init.d/apache2 restart You should also enabled ExtendedStatus. sudo vi /etc/apache2/conf.d/extendedstatus Add the following ExtendedStatus [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been trying to isolate a CPU issue for an app running on Apache2 written with Cakephp.  Apache has a module to monitor the server status with mod_status. http://www.debian-administration.org/article/Monitoring_Apache_with_mod_status</p>
<p>For Apache 1.2 enable mod_info and restart apache.</p>
<blockquote><p>
sudo a2enmod info<br />
sudo /etc/init.d/apache2 restart
</p></blockquote>
<p>You should also enabled ExtendedStatus. </p>
<blockquote><p>
sudo vi /etc/apache2/conf.d/extendedstatus
</p></blockquote>
<p>Add the following</p>
<pre class="brush: text">
ExtendedStatus On
</pre>
<p>Once the module is enabled you have to enable the settings in the appropriate vhost in /etc/apache2/sites-enabled</p>
<pre class="brush: text">
&lt;Location /server-status&gt;
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost ip6-localhost
&lt;/Location&gt;
</pre>
<p>The problem if you are using cakephp is that the .htaccess will try to route the request which will fail.  You have to edit your .htaccess file to look like the following:</p>
<pre class="brush: text">
&lt;IfModule mod_rewrite.c&gt;
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !=/server-status
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
&lt;/IfModule&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jcombs.net/cakephp/enable-mod_status-for-cakephp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find and Delete Files</title>
		<link>http://jcombs.net/uncategorized/find-and-delete-files</link>
		<comments>http://jcombs.net/uncategorized/find-and-delete-files#comments</comments>
		<pubDate>Sun, 19 Feb 2012 17:33:03 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jcombs.net/?p=221</guid>
		<description><![CDATA[If you need to find and delete files you can execute the following command. find /path/to/search -name &#039;file-to-search-for&#039; -exec rm -f \; If you want to be prompted for each file you can use -i instead of -f]]></description>
			<content:encoded><![CDATA[<p>If you need to find and delete files you can execute the following command.</p>
<pre class="brush: text">
find /path/to/search -name &#039;file-to-search-for&#039; -exec rm -f \;
</pre>
<p>If you want to be prompted for each file you can use -i instead of -f</p>
]]></content:encoded>
			<wfw:commentRss>http://jcombs.net/uncategorized/find-and-delete-files/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect root mail to external address in Debian</title>
		<link>http://jcombs.net/linux/redirect-root-mail-to-external-address-in-debian</link>
		<comments>http://jcombs.net/linux/redirect-root-mail-to-external-address-in-debian#comments</comments>
		<pubDate>Sat, 24 Dec 2011 17:53:14 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://jcombs.net/?p=217</guid>
		<description><![CDATA[To redirect root mail to an external email just use /etc/aliases # vi /etc/aliases root: youremail@email.com # newaliases]]></description>
			<content:encoded><![CDATA[<p>To redirect root mail to an external email just use /etc/aliases</p>
<pre class="brush: text">
# vi /etc/aliases
</pre>
<blockquote><p>
root:  youremail@email.com
</p></blockquote>
<pre class="brush: text">
# newaliases
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jcombs.net/linux/redirect-root-mail-to-external-address-in-debian/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drop Foreign Key Constraint using INNODB</title>
		<link>http://jcombs.net/database/drop-foreign-key-constraint-using-innodb</link>
		<comments>http://jcombs.net/database/drop-foreign-key-constraint-using-innodb#comments</comments>
		<pubDate>Tue, 23 Aug 2011 19:25:47 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://jcombs.net/?p=214</guid>
		<description><![CDATA[I recently needed to make some database modifications that required removing some existing foreign key constraints. The command looks like this. ALTER table tablename DROP FOREIGN KEY foreign_key_name MySQL was throwing errors. mysql> ALTER TABLE reviews DROP FOREIGN KEY priority_id; ERROR 1025 (HY000): Error on rename of &#8216;./dbname/reviews&#8217; to &#8216;./dbname/#sql2-62f5-145b&#8217; (errno: 152) If you run [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to make some database modifications that required removing some existing foreign key constraints.  The command looks like this.</p>
<pre class="brush: sql">
ALTER table tablename DROP FOREIGN KEY foreign_key_name
</pre>
<p>MySQL was throwing errors.</p>
<blockquote><p>
mysql> ALTER TABLE reviews DROP FOREIGN KEY priority_id;<br />
ERROR 1025 (HY000): Error on rename of &#8216;./dbname/reviews&#8217; to &#8216;./dbname/#sql2-62f5-145b&#8217; (errno: 152)
</p></blockquote>
<p>If you run</p>
<pre class="brush: sql">
SHOW CREATE TABLE tablename
</pre>
<p>You&#8217;ll see the constraint names.  You can then delete the foreign key based on the constraint.</p>
<pre class="brush: sql">
ALTER TABLE tablename DROP FOREIGN KEY `reviews_ibfk_24`;
</pre>
<p>You can then drop the column as needed. </p>
]]></content:encoded>
			<wfw:commentRss>http://jcombs.net/database/drop-foreign-key-constraint-using-innodb/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Alter Table with InnoDB Foreign Key Constraint</title>
		<link>http://jcombs.net/database/mysql-alter-table-with-innodb-foreign-key-constraint</link>
		<comments>http://jcombs.net/database/mysql-alter-table-with-innodb-foreign-key-constraint#comments</comments>
		<pubDate>Fri, 05 Aug 2011 13:06:53 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://jcombs.net/?p=207</guid>
		<description><![CDATA[In a recent project I needed to add a new table that would create a foreign key constraint on an existing table. I&#8217;m using the InnoDB storage engine. The existing table is employees and the new table is shifts. Shifts table is pretty simple. CREATE TABLE shifts ( id INT AUTO_INCREMENT NOT NULL, shift VARCHAR(15) [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent project I needed to add a new table that would create a foreign key constraint on an existing table.  I&#8217;m using the InnoDB storage engine.  The existing table is employees and the new table is shifts.  Shifts table is pretty simple.</p>
<pre class="brush: sql">
CREATE TABLE shifts (
        id INT AUTO_INCREMENT NOT NULL,
        shift VARCHAR(15) NOT NULL,
        PRIMARY KEY(id)
) ENGINE=InnoDB;
</pre>
<p>The existing employees table needed a new column called &#8220;shift_id&#8221; that would reference the shifts table. The following code can be used to add the column and then add the foreign key constraint.</p>
<pre class="brush: sql">
ALTER TABLE employees ADD shift_id INT AFTER group_id;
ALTER TABLE employees ADD CONSTRAINT FOREIGN KEY(shift_id) REFERENCES shifts(id) ON UPDATE CASCADE ON DELETE SET NULL;
</pre>
<p>The first alter statement worked fine, but the second kept throwing an error 150.  You can view more details about the last error with the following:</p>
<pre class="brush: sql">
SHOW INNODB STATUS;
</pre>
<p>I would see the following:</p>
<blockquote><p>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
LATEST FOREIGN KEY ERROR<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
110805  8:49:16 Error in foreign key constraint of table backlogreviews/#sql-62f5_23:<br />
FOREIGN KEY(shift_id) REFERENCES shifts(id) ON UPDATE CASCADE ON DELETE SET NULL:<br />
Cannot resolve table name close to:<br />
(id) ON UPDATE CASCADE ON DELETE SET NULL
</p></blockquote>
<p>This didn&#8217;t exactly help as I know the shifts table exists.  I did some searching on google and found some hints, but these mostly indicated the column doesn&#8217;t match up correctly.  Turns out I had a syntax error when creating the shifts table.  The engine was INNOBD (notice the BD should read DB).  Instead of throwing an error when creating the table it just used MyISAM.  Since the storage engines didn&#8217;t match I was getting the error.</p>
]]></content:encoded>
			<wfw:commentRss>http://jcombs.net/database/mysql-alter-table-with-innodb-foreign-key-constraint/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Allow remote access to MySQL</title>
		<link>http://jcombs.net/database/allow-remote-access-to-mysql</link>
		<comments>http://jcombs.net/database/allow-remote-access-to-mysql#comments</comments>
		<pubDate>Fri, 29 Jul 2011 20:51:13 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://jcombs.net/?p=203</guid>
		<description><![CDATA[I&#8217;m recently working on a project where I wanted to start playing with MySQL workbench to create an ER diagram for an existing database. I&#8217;m running Workbench on a Windows 7 machine with MySQL running on Ubuntu. Run the following to give the remote machine access. mysql&#62; grant all privileges on *.* to root@&#039;remote_machone&#039; identified [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m recently working on a project where I wanted to start playing with MySQL workbench to create an ER diagram for an existing database.  I&#8217;m running Workbench on a Windows 7 machine with MySQL running on Ubuntu.  Run the following to give the remote machine access.</p>
<pre class="brush: text">
mysql&gt; grant all privileges on *.* to root@&#039;remote_machone&#039; identified by &#039;root password&#039;;
Query OK, 0 rows affected (0.12 sec)
</pre>
<p>You may not want to use the root account, but this will give you remote access. </p>
]]></content:encoded>
			<wfw:commentRss>http://jcombs.net/database/allow-remote-access-to-mysql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Password Hashing in CakePHP</title>
		<link>http://jcombs.net/cakephp/password-hashing-in-cakephp</link>
		<comments>http://jcombs.net/cakephp/password-hashing-in-cakephp#comments</comments>
		<pubDate>Wed, 27 Jul 2011 14:12:31 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://jcombs.net/?p=196</guid>
		<description><![CDATA[In a recent project I needed to add some validation to my User model. I&#8217;m using the Auth Component that is included with CakePHP. In this particular instance I wanted to allow a change password form. The form would have three fields (current_password, new_password, confirm_password). In the Model I wanted to first check if the [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent project I needed to add some validation to my User model.  I&#8217;m using the Auth Component that is included with CakePHP.  In this particular instance I wanted to allow a change password form.  The form would have three fields (current_password, new_password, confirm_password).  In the Model I wanted to first check if the current password was entered correctly.  </p>
<p>Validation should always happen in the model so I created a new function that would check for the current password for the logged in user.  The Auth component automatically hashes the password with SHA1 and uses the Security Salt as part of the password string to create the hash, so I needed to hash the &#8220;current_password&#8221; field from the form to check for a match.  This is where I ran into the problem.  I tried using the following:</p>
<pre class="brush: php">
function checkCurrentPassword($data) {
    $id = $this-&gt;data[$this-&gt;alias][&#039;id&#039;]; // passed the user ID from the form as a hidden field
    $pwd = $this-&gt;field(&#039;password&#039;, array(&#039;id&#039; =&gt; $id)); // get the current password from the database
    if(Security::hash($data[&#039;current_password&#039;]) != $pwd) {
        return false;
    }
    return true;
}
</pre>
<p>You can see that $id is passed from the form and $pwd is a variable for the current password in the database.  Auth will automatically hash an input with the name &#8220;password&#8221;, but my form is using &#8220;current_password&#8221;, so it is sent in cleartext.  This needs to be hashed first.  I attempted to use the Security::hash function but my validated kept failing.  </p>
<p>As it turns out the Security::hash function is only using SHA1 without the Security Salt added.  What I was able to do is use the AuthComponent::password function instead which does use the Security Salt configured in core.php.  New code looks like:</p>
<pre class="brush: php">
function checkCurrentPassword($data) {
    $id = $this-&gt;data[$this-&gt;alias][&#039;id&#039;];
    $pwd = $this-&gt;field(&#039;password&#039;, array(&#039;id&#039; =&gt; $id));
    if(AuthComponent::password($data[&#039;current_password&#039;]) != $pwd) {
        return false;
    }
    return true;
}
</pre>
<p>The validate array would look like this:</p>
<pre class="brush: php">
var $validate = array(
&#039;current_password&#039; =&gt; array(
    &#039;rule&#039; =&gt; &#039;checkCurrentPassword&#039;,
    &#039;message&#039; =&gt; &#039;Current password was not entered correctly&#039;
    )
);
</pre>
<p>Update:  Security::hash actually takes a third parameter documented in the API to use the Security.salt value</p>
<blockquote><p>
Create a hash from string using given method. Fallback on next available method.</p>
<p>Parameters:</p>
<p>        string $string required</p>
<p>        String to hash<br />
        string $type optional NULL</p>
<p>        Method to use (sha1/sha256/md5)<br />
        boolean $salt optional false</p>
<p>        If true, automatically appends the application&#8217;s salt value to $string (Security.salt)
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://jcombs.net/cakephp/password-hashing-in-cakephp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

