<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Computers ala Mike</title>
	<atom:link href="http://mcrusch.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mcrusch.wordpress.com</link>
	<description>The only thing better than learning from your mistakes is learning from somebody else&#039;s</description>
	<lastBuildDate>Sun, 23 Oct 2011 13:25:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mcrusch.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Computers ala Mike</title>
		<link>http://mcrusch.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mcrusch.wordpress.com/osd.xml" title="Computers ala Mike" />
	<atom:link rel='hub' href='http://mcrusch.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Java: Always Override hashCode() if Overriding equals()</title>
		<link>http://mcrusch.wordpress.com/2010/12/08/java-always-override-hashcode-if-overriding-equals/</link>
		<comments>http://mcrusch.wordpress.com/2010/12/08/java-always-override-hashcode-if-overriding-equals/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 22:57:41 +0000</pubDate>
		<dc:creator>mcrusch</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://mcrusch.wordpress.com/?p=35</guid>
		<description><![CDATA[I knew better. Yet, I decided to be lazy and not override hashCode() even though I was overriding equals() in my class. Then, I put them in sets. Then, I tried to do set operations, and it was all over. Problems first arose when I was trying to get the difference and intersection of two [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=35&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I knew better.  Yet, I decided to be lazy and not override hashCode() even though I was overriding equals() in my class.  Then, I put them in sets.  Then, I tried to do set operations, and it was all over.</p>
<p>Problems first arose when I was trying to get the difference and intersection of two HashSets using removeAll and retainAll.  The one set had two elements, and the other set one element.  The one element was equal to, but not identical to, one of the elements in the first set.  However, first.retainAll(second) rendered first to an empty set, and first.removeAll(second) would leave first untouched.  It was almost as if removeAll and retainAll were using identity rather than equality.</p>
<p>However, then I found a post (http://www.java-forums.org/advanced-java/12812-does-retainall-use-equals.html) where Norm set me and the poster straight.  We had both forgotten to implement hashCode().</p>
<p>For a HashSet to determine if an element exists inside of it, it uses hashCode to look in a bucket.  If you implement hashCode incorrectly, then you could have equal elements with different hashCodes, and when the HashSet attempts to find your object, it will be looking in the wrong bucket.  It will never find it.</p>
<p>You will similarly break your HashMap objects if your keys have improperly implemented hashCode() methods.</p>
<p>So, if you override equals(), make sure your hashCode() method will return the same value for any two equal instances, or else you&#8217;re asking for trouble!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcrusch.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcrusch.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcrusch.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcrusch.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mcrusch.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mcrusch.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mcrusch.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mcrusch.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcrusch.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcrusch.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcrusch.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcrusch.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcrusch.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcrusch.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=35&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mcrusch.wordpress.com/2010/12/08/java-always-override-hashcode-if-overriding-equals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6c1e3a10307f666b31b2000b50802983?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mcrusch</media:title>
		</media:content>
	</item>
		<item>
		<title>Installing Apache 2.2 on Windows 7</title>
		<link>http://mcrusch.wordpress.com/2010/02/10/installing-apache-2-2-on-windows-7/</link>
		<comments>http://mcrusch.wordpress.com/2010/02/10/installing-apache-2-2-on-windows-7/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 22:47:54 +0000</pubDate>
		<dc:creator>mcrusch</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[new computer 2010]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://mcrusch.wordpress.com/?p=24</guid>
		<description><![CDATA[After installing Apache 2.2 using the installer on Windows 7 64-bit, it did not work. I got the following error messages during the last part of the install: First window of errors: Installing the Apache2.2 service The Apache2.2 service is successfully installed. Testing httpd.conf&#8230;. Errors reported here must be corrected before the service can be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=24&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After installing Apache 2.2 using the installer on Windows 7 64-bit, it did not work.  I got the following error messages during the last part of the install:</p>
<p>First window of errors:</p>
<blockquote><p>Installing the Apache2.2 service<br />
The Apache2.2 service is successfully installed.<br />
Testing httpd.conf&#8230;.<br />
Errors reported here must be corrected before the service can be started.<br />
httpd.exe: Could not reliably determine the server&#8217;s fully qualified domain name<br />
, using 10.56.78.2 for ServerName<br />
(OS 10048)Only one usage of each socket address (protocol/network address/port)<br />
is normally permitted.  : make_sock: could not bind to address 0.0.0.0:80<br />
no listening sockets available, shutting down<br />
Unable to open logs<br />
Note the errors or messages above, and press the  key to exit.  15&#8230;</p></blockquote>
<p>Second window of errors:</p>
<blockquote><p>httpd.exe: Could not reliably determine the server&#8217;s fully qualified domain name<br />
, using 10.56.78.2 for ServerName<br />
(OS 10048)Only one usage of each socket address (protocol/network address/port)<br />
is normally permitted.  : make_sock: could not bind to address 0.0.0.0:80<br />
no listening sockets available, shutting down<br />
Unable to open logs<br />
Note the errors or messages above, and press the  key to exit.  25&#8230;</p></blockquote>
<p>I found nothing in the logs, but I restarted, and then it all just worked.  Oldest trick in the book!</p>
<p>My next challenge was to get it working with PHP.  The PHP install could not update httpd.conf, so I was going to have to do it manually.  Then, I found that <em>I</em> could not edit the httpd.conf either, due to <a href="http://en.wikipedia.org/wiki/User_Account_Control">UAC</a>.  I had to run my text editor as Administrator to get it to work.  To avoid this problem in the future, I set the program to always run as Administrator (is this a good idea?  not sure).</p>
<p>OK, httpd.conf updated, now apache won&#8217;t start.  The errors were not being written to the apache logs, but I found them in the Event Viewer.  It was complaining about a port in use.  Through some research, I found that skype uses port 80.  I disabled the setting in skype by going to Tools&#8230;Options&#8230;Advanced&#8230;Connection, and unchecking &#8220;Use port 80 and 443 as alternatives for incoming connections&#8221;.  I don&#8217;t use skype much&#8211;not a problem.</p>
<p>I restarted skype, but apache was still failing to start.  This time, the apache error log had the clue.  The message was</p>
<blockquote><p>[crit] (OS 1813)The specified resource type cannot be found in the image file.  : master_main: create child process failed. Exiting.</p></blockquote>
<p>A google search led me to run php from the command line, which gave me two error messages. One implicated ntwdblib.dll and the other php_mssql.dll.  Both are related to MSSQL, which I do not use.  I disabled this extension in php.ini, and <strong>it works at last!</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcrusch.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcrusch.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcrusch.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcrusch.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mcrusch.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mcrusch.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mcrusch.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mcrusch.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcrusch.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcrusch.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcrusch.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcrusch.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcrusch.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcrusch.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=24&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mcrusch.wordpress.com/2010/02/10/installing-apache-2-2-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6c1e3a10307f666b31b2000b50802983?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mcrusch</media:title>
		</media:content>
	</item>
		<item>
		<title>Lessons from my New (2010) Computer</title>
		<link>http://mcrusch.wordpress.com/2010/02/10/lessons-from-my-new-2010-computer/</link>
		<comments>http://mcrusch.wordpress.com/2010/02/10/lessons-from-my-new-2010-computer/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 22:45:42 +0000</pubDate>
		<dc:creator>mcrusch</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Lenovo]]></category>
		<category><![CDATA[new computer 2010]]></category>

		<guid isPermaLink="false">http://mcrusch.wordpress.com/?p=26</guid>
		<description><![CDATA[I just bought a Lenovo G450. It had been a long time since I bought a computer, and the purchasing and setup process has taught me quite a bit. I expect some blog posts about this over the next few weeks/months/years, but here&#8217;s a quick overview of some of the major lessons: Overall, I&#8217;ve been [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=26&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just bought a <a href="http://reviews.cnet.com/laptops/lenovo-g450-laptop-computer/4505-3121_7-33750687.html">Lenovo G450</a>.  It had been a long time since I bought a computer, and the purchasing and setup process has taught me quite a bit.  I expect some blog posts about this over the next few weeks/months/years, but here&#8217;s a quick overview of some of the major lessons:</p>
<ul>
<li>Overall, I&#8217;ve been pleased.  In particular, I&#8217;ve found that it&#8217;s &#8220;fast&#8221;.  For me, &#8220;fast&#8221; means that I can run several applications at once (I&#8217;m not a gamer) and in general do things without waiting.  I&#8217;ve found that even for basic word processing and internet, and even more so for development, you spend a decent amount of time waiting.  You get used to it, but it&#8217;s there.  I&#8217;ve found that not to be the case with the G450.</li>
<li>Lenovo&#8217;s online support resources are seriously lacking.  Depending on your model, you are sometimes sent to different sites.  Some of it is under IBM, some Lenovo.  In general, resources and help are very difficult to find (at least compared to Dell&#8217;s web site).</li>
<li>IBM/Lenovo makes an &#8220;interesting&#8221; choice regarding keyboard layout on their laptops.  Where you would expect the left Ctrl key to be, you instead find the Fn key.  It&#8217;s really annoying.  I&#8217;m getting used to it.  Do a Google search for &#8220;lenovo fn ctrl&#8221; and you&#8217;ll see what people are doing (one guy disassembled his keyboard and &#8220;rewired&#8221; it&#8211;really cool&#8211;I&#8217;m not that brave)</li>
<li>The touchpad is very sensitive with no ability to configure it.  I often accidentally click while typing.  With an updated driver that was buried on the support site, I was able to enable a feature that disables tap-to-click while typing.  It helps some.</li>
</ul>
<p>Look for upcoming posts tagged &#8220;new computer 2010&#8243;&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcrusch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcrusch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcrusch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcrusch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mcrusch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mcrusch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mcrusch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mcrusch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcrusch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcrusch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcrusch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcrusch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcrusch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcrusch.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=26&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mcrusch.wordpress.com/2010/02/10/lessons-from-my-new-2010-computer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6c1e3a10307f666b31b2000b50802983?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mcrusch</media:title>
		</media:content>
	</item>
		<item>
		<title>Disabling &#8220;Back&#8221; Behavior of Backspace in Browser</title>
		<link>http://mcrusch.wordpress.com/2009/02/03/disabling-back-behavior-of-backspace-in-browser/</link>
		<comments>http://mcrusch.wordpress.com/2009/02/03/disabling-back-behavior-of-backspace-in-browser/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 22:01:25 +0000</pubDate>
		<dc:creator>mcrusch</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://mcrusch.wordpress.com/?p=17</guid>
		<description><![CDATA[Here&#8217;s a quick little one&#8230; If you, like me, find it annoying that the backspace button takes you back one page in history in your web browser (like clicking the Back button), then you might be glad to know you can disable it (in Firefox&#8211;sorry, haven&#8217;t looked into other browsers) I found out how to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=17&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick little one&#8230;<br />
If you, like me, find it annoying that the backspace button takes you back one page in history in your web browser (like clicking the Back button), then you might be glad to know you can disable it (in Firefox&#8211;sorry, haven&#8217;t looked into other browsers)</p>
<p>I found out how to do this here:</p>
<p><a href="http://ubuntu.wordpress.com/2006/12/21/fix-firefox-backspace-to-take-you-to-the-previous-page/">http://ubuntu.wordpress.com/2006/12/21/fix-firefox-backspace-to-take-you-to-the-previous-page/</a></p>
<p>Where the author is actually doing the opposite, enabling the feature.</p>
<p>To <strong>disable</strong>:</p>
<ol>
<li>Go to about:config</li>
<li>Filter for backspace</li>
<li>Change the value for browser.backspace_action to 1 to disable back button behavior</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcrusch.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcrusch.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcrusch.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcrusch.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mcrusch.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mcrusch.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mcrusch.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mcrusch.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcrusch.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcrusch.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcrusch.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcrusch.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcrusch.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcrusch.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=17&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mcrusch.wordpress.com/2009/02/03/disabling-back-behavior-of-backspace-in-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6c1e3a10307f666b31b2000b50802983?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mcrusch</media:title>
		</media:content>
	</item>
		<item>
		<title>Generate PHP5 Interfaces from Excel file</title>
		<link>http://mcrusch.wordpress.com/2009/01/01/generate-php5-interfaces-from-excel-file/</link>
		<comments>http://mcrusch.wordpress.com/2009/01/01/generate-php5-interfaces-from-excel-file/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 23:12:37 +0000</pubDate>
		<dc:creator>mcrusch</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://mcrusch.wordpress.com/?p=12</guid>
		<description><![CDATA[After doing initial design work on some piece of code, I often find that the first task is to write a set of interfaces that I&#8217;ve designed by writing things out on paper. When there are a lot of interfaces with a lot of methods, I find it tedious to type them all in, taking [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=12&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After doing initial design work on some piece of code, I often find that the first task is to write a set of interfaces that I&#8217;ve designed by writing things out on paper.  When there are a lot of interfaces with a lot of methods, I find it tedious to type them all in, taking into account formatting and phpdoc-style documentation.  Although a good text editor helps, I wanted to go one step further.</p>
<p>So, I designed an Excel spreadsheet that would allow me to type in the interface information in a tabular form and would then generate the PHP code for me.  This does not use any script, but you have to do two text replaces afterwards that can be a little difficult depending on your text editor (<a href="http://www.ultraedit.com/">UltraEdit</a>, not free, makes it a snap).</p>
<h2>Caveats</h2>
<p>I&#8217;ll admit up-front that this is quite a hack job and probably not useful in most circumstances, but if you have a lot of interfaces (and trivial classes) to create at once, this could save you some time.  And, it&#8217;s an example of fun with formulas in Excel.  I didn&#8217;t use any script&#8211;all formulas.</p>
<p>In particular, it doesn&#8217;t handle descriptions for return values (only types) or visibility modifiers for methods (that&#8217;s one reason why it works best for interfaces).  These could be added without too much work with some more formula hacking.</p>
<h2>How It Works</h2>
<p><a href="http://asap.ahabs.wisc.edu/~mcrusch/pub/types.xls">I&#8217;ve uploaded a sample here</a>.  This is a simple set of interfaces for graphs and directed graphs.  There&#8217;s also a class.  You&#8217;ll want to start with this file.  When you&#8217;re ready to do your own, you can delete rows 3-43, and clear A2:E2 to begin your work (you want to preserve the formulas in row 2 starting at column F).</p>
<p>You start each interface or class with a &#8220;Type&#8221; line, specifying &#8220;class&#8221; or &#8220;interface&#8221;, the name, the one-line description, and the class/interface that it extends, if any.  Then, if you have further description of the class/interface, you can include Comment lines.  The Description column uses a fixed-width font and is sized to indicate the amount of room you have for these comments.  If you go too long (assumes an 80-character line limit), the field turns red.</p>
<p>Next, specify your methods.  For each method, start with a &#8220;Method&#8221; line, specifying the return type (omit for void), method name, and one-line description.  Then, you may include Comment lines.  Finally, add Parameter lines for each parameter, specifying the type, name, description, and default value.  The Description line will turn red if you go too long, and it adjusts for indentation and the like.</p>
<p>Make sure your file ends with a footer line that simply has the word Type in the first column.  Then, fill all columns after the first thick vertical border (the column &#8220;Final&#8221; and those to the right) down from row 2 to the row just above the footer row.  Copy and paste the contents of the Final column to a text editor, and you are almost there.</p>
<p>In the text editor:</p>
<ol>
<li>Remove all blank lines</li>
<li>Replace all instances of &#8220;\n&#8221; followed by an end-of-line with just the end-of-line (using the end-of-line of your choice)</li>
<li>Replace all instances of &#8220;\n&#8221; with the end-of-line of your choice</li>
</ol>
<p>If you are using Excel in Windows and UltraEdit and want Unix end-of-lines, you would replace:</p>
<ol>
<li>^p^p with ^p until there are no more</li>
<li>\n^p with ^n</li>
<li>\n with ^n</li>
</ol>
<h2>Possible Improvements</h2>
<p>One might be able to cut out the text editor step by replacing instances of \n in the formulas with the proper Excel formula to actual put the newline character in.  I think the formula is CHR?</p>
<p>One could add a separate &#8220;Return&#8221; line type that would allow for a return description.  Then, you could use the &#8220;Type&#8221; column for the method to be the visiblity modifier instead of the return type.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcrusch.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcrusch.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcrusch.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcrusch.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mcrusch.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mcrusch.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mcrusch.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mcrusch.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcrusch.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcrusch.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcrusch.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcrusch.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcrusch.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcrusch.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=12&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mcrusch.wordpress.com/2009/01/01/generate-php5-interfaces-from-excel-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6c1e3a10307f666b31b2000b50802983?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mcrusch</media:title>
		</media:content>
	</item>
		<item>
		<title>The Infamous 3221225477 and Autoloading</title>
		<link>http://mcrusch.wordpress.com/2008/11/25/3221225477-autoloading/</link>
		<comments>http://mcrusch.wordpress.com/2008/11/25/3221225477-autoloading/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 19:02:19 +0000</pubDate>
		<dc:creator>mcrusch</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://mcrusch.wordpress.com/?p=10</guid>
		<description><![CDATA[Parent: child process exited with status 3221225477 &#8212; Restarting. It wasn&#8217;t until I ran into it myself that I realized the fear that this error message strikes in the hearts of many.  It shows up in the apache error logs and is accompanied by an apache process dying.  The user sees a blank screen or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=10&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<blockquote><p>Parent: child process exited with status 3221225477 &#8212; Restarting.</p></blockquote>
<p>It wasn&#8217;t until I ran into it myself that I realized the fear that this error message strikes in the hearts of many.  It shows up in the apache error logs and is accompanied by an apache process dying.  The user sees a blank screen or an error message, and the developer is left scratching is head and wading through page after page of google hits with no solutions&#8230;</p>
<p>It sounds like there may be a number of causes, but I found one: using call_user_func_array() to call static methods of not-yet-loaded classes in PHP.  In my case, the code looked something like this:</p>
<p><code>/**<br />
&nbsp;* Delegates all function calls to static methods of $this-&gt;class.<br />
&nbsp;*<br />
&nbsp;* @param string $name static method name<br />
&nbsp;* @param array $arguments all arguments<br />
&nbsp;* @return mixed<br />
&nbsp;*/<br />
public function __call($name, $arguments)<br />
{<br />
&nbsp;&nbsp;&nbsp; return call_user_func_array(array($this-&gt;class, $name), $arguments);<br />
}</code></p>
<p>In my case, $this-&gt;class held the string &#8220;DatasetPeer&#8221; which was the name of a class.  The class was typically loaded using autoloading, and at the point in the code where this failed it had not yet been referenced, and so had not been loaded.  Apparently (at least in my version of php) call_user_func_array() called in this manner does not autoload the class, but rather crashes the apache process.  I would assume that call_user_func() works similarly.</p>
<p>The solution was to load the class, and the easist way I could think of to do that without having to actually invoke a method on the class was to use reflection:</p>
<p><code>/**<br />
&nbsp;* Delegates all function calls to static methods of $this-&gt;class.<br />
&nbsp;*<br />
&nbsp;* @param string $name static method name<br />
&nbsp;* @param array $arguments all arguments<br />
&nbsp;* @return mixed<br />
&nbsp;*/<br />
public function __call($name, $arguments)<br />
{<br />
&nbsp;&nbsp;&nbsp; // Force auto-loading of the class.  If is has not loaded yet, then<br />
&nbsp;&nbsp;&nbsp; // call_user_func_array will cause a nasty crash<br />
&nbsp;&nbsp;&nbsp; $rc = new ReflectionClass($this-&gt;class);</p>
<p>&nbsp;&nbsp;&nbsp; return call_user_func_array(array($this-&gt;class, $name), $arguments);<br />
}</code></p>
<p>I will probably now use the ReflectionClass object $rc to invoke the method, foregoing call_user_func_array() completely, but I note that this one change was sufficient to solve the problem.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcrusch.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcrusch.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcrusch.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcrusch.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mcrusch.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mcrusch.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mcrusch.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mcrusch.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcrusch.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcrusch.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcrusch.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcrusch.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcrusch.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcrusch.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=10&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mcrusch.wordpress.com/2008/11/25/3221225477-autoloading/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6c1e3a10307f666b31b2000b50802983?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mcrusch</media:title>
		</media:content>
	</item>
		<item>
		<title>DAG Ontologies in Relational Databases</title>
		<link>http://mcrusch.wordpress.com/2008/07/29/dag-ontologies-in-relational-databases/</link>
		<comments>http://mcrusch.wordpress.com/2008/07/29/dag-ontologies-in-relational-databases/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 20:19:31 +0000</pubDate>
		<dc:creator>mcrusch</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[DAG]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Ontology]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://mcrusch.wordpress.com/?p=6</guid>
		<description><![CDATA[I am designing a piece of software that will make extensive use of ontologies.  For my purpose, an ontology is a list of &#8220;terms&#8221;, each with a name and description, where the terms can be related to each other in a number of ways and the relations form a directed acyclic graph (DAG). BTW, I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=6&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am designing a piece of software that will make extensive use of ontologies.  For my purpose, an ontology is a list of &#8220;terms&#8221;, each with a name and description, where the terms can be related to each other in a number of ways and the relations form a directed acyclic graph (DAG).</p>
<p>BTW, I suggest that before you go on, you read <a href="http://www.codeproject.com/KB/database/Modeling_DAGs_on_SQL_DBs.aspx">this article</a>.  The author is trying to do something very similar to what I&#8217;m doing, and his article is excellent, with code examples and diagrams and everything.  I have devised a solution that differs in some ways.</p>
<h2>Example</h2>
<p>See <a href="http://www.codeproject.com/KB/database/Modeling_DAGs_on_SQL_DBs.aspx">the article.</a></p>
<h2>Problem</h2>
<p>The problem is that we often want to be able to quickly pull out all terms that are related, directly or indirectly, to another term.  This requires quickly finding all terms that have a path to a particular term.</p>
<p>Furthermore, we want the database design to be DBMS-independent, so it cannot use special features particular to certain DBMSes.  In particular, I&#8217;m trying to avoid stored procedures.</p>
<h2>Inspiration</h2>
<p>Not wanting to re-invent the wheel, I investigated various database packages that use ontologies, including <a href="http://www.godatabase.org">GO</a> and <a href="http://www.biosql.org">BioSQL<br />
</a></p>
<p>I also did some reading and came across this <a href="http://www.codeproject.com/KB/database/Modeling_DAGs_on_SQL_DBs.aspx">very helpful article</a> (already mentioned multiple times)</p>
<h2>Solution</h2>
<p>I decided that each ontology would be a completely self-contained unit.  Hence, a term in one ontology could not be related to a term in another ontology.</p>
<p>First of all, the schema:</p>
<h3>Schema</h3>
<p>Four tables: ontology, term, term_rel, and term_path.</p>
<ul>
<li>ontology: contains a name and description of the ontology</li>
<li>term: contains a name and description of the term, a foreign key to the ontology, and flags indicating that the term is the root term or is obsolete</li>
<li>term_rel: defines direct relationships between terms (edges on the DAG):
<ul>
<li>id: unique id</li>
<li>subj_term_id: foreign key to the subject term (a.k.a. the descendant, on the non-arrow side of the edge)</li>
<li>obj_term_id: foreign key to the object term (a.k.a. the ancestor, on the arrow side of the edge)</li>
<li>pred_term_id: a term from the &#8220;predicate&#8221; ontology indicating how the terms are related (e.g. &#8220;is a&#8221;, &#8220;has a&#8221;)</li>
<li>ontology_id: redundant foreign key to the ontology to which subj and obj belong; makes queries easier</li>
</ul>
</li>
<li>term_path: defines all paths
<ul>
<li>(contains all the same fields as term_rel), plus</li>
<li>term_path_id: nullable reference to another term_path (explained below)</li>
<li>term_rel_id: reference to a term_rel (explained below)</li>
<li>distance: number of edges on the DAG in this path</li>
</ul>
</li>
</ul>
<h3>Logic</h3>
<p>Term path has to be maintained when term_rels are added and deleted.  This logic was inspired by the aforementioned <a href="http://www.codeproject.com/KB/database/Modeling_DAGs_on_SQL_DBs.aspx">very helpful article</a>, though I have made significant changes (that make it simpler and less DB-dependant, though it does require outside logic).</p>
<p>Each term_path is identified by an integer primary key.  However, it is also defined by another term_path (call it the subpath) and a term_rel.  The subpath is that path which contains all edges of the main path, except for the last one.  So, if the path is A -&gt; B -&gt; C -&gt; D, then the subpath is A -&gt; B -&gt; C.  The term_rel is the last edge, in this case, C -&gt; D.  Paths that contain only a single edge will have no subpath (term_path_id is null).  All paths have a term_rel.</p>
<p>When adding a new relationship from A -&gt; B, do the following:</p>
<ol>
<li>Add a path from A -&gt; B with distance 1.  It will have no term_path_id, and term_rel_id will reference the term_rel just added.</li>
<li>For every existing path, P, to A (with subj_term_id = A&#8217;s id), add a new path P* from P&#8217;s subject to B.</li>
<li>Take all paths added in #1 and #2 and put them in a stack</li>
<li>If the stack is empty, then you are done.</li>
<li>Pop the top path (Pt) off the stack</li>
<li>Find all edges (term_rels) that can extend Pt.  These would have term_rel.subj_term_id = term_path (Pt).obj_term_id.  If there are none, go back to step 4.</li>
<li>For each of those edges, create a new path, extending Pt, just as you did for P in step #2, and push the new edge onto the stack.</li>
<li>Go to step 4.</li>
</ol>
<p>That&#8217;s additions.  Now for deletions.  Deletions are trivially easy if your DBMS supports cascading deletes.  Simply set the term_path.term_path_id and term_path.term_rel_id foreign keys to cascade deletes.  Now, when a term_rel is deleted, all paths that include it wil be as well.</p>
<p>If your DBMS does not suppor this, then you have two options:</p>
<ol>
<li>Use a database abstraction layer that will emulate it.</li>
<li>Implement the logic yourself</li>
</ol>
<p>I leave #2 as an exercise to the reader <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Implementation</h2>
<p>This actually works, by the way.  I&#8217;m using it.</p>
<p>I am doing this in a Symfony project, using the Propel for ORM.  So, I am able to use cascading deletes, as Propel will do the work for me if the underlying DBMS will not.</p>
<p>The code is available upon request.  I will be happy to provide it for you.  Since it&#8217;s all done within the Propel framework, it may be hard to follow for those not familiar with Propel.  Your best bet is to hit me up via my <a href="http://asap.ahabs.wisc.edu/genome-evolution-laboratory/personnel/michael-rusch.html">work web page</a>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mcrusch.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mcrusch.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcrusch.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcrusch.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcrusch.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcrusch.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mcrusch.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mcrusch.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mcrusch.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mcrusch.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcrusch.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcrusch.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcrusch.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcrusch.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcrusch.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcrusch.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=6&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mcrusch.wordpress.com/2008/07/29/dag-ontologies-in-relational-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6c1e3a10307f666b31b2000b50802983?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mcrusch</media:title>
		</media:content>
	</item>
		<item>
		<title>PHP Debugging in Eclipse (with Symfony, too)</title>
		<link>http://mcrusch.wordpress.com/2008/06/10/php-debugging-in-eclipse-with-symfony-too/</link>
		<comments>http://mcrusch.wordpress.com/2008/06/10/php-debugging-in-eclipse-with-symfony-too/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 17:48:45 +0000</pubDate>
		<dc:creator>mcrusch</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[PDT]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://mcrusch.wordpress.com/?p=3</guid>
		<description><![CDATA[Much has been written about debugging PHP in eclipse, yet for all the blogs and tutorials I have had no end of problems. My setup was complicated by the fact that I was trying to debug command-line scripts using the symfony framework. Only the last part was really symfony-dependent, however. Here is what finally worked [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=3&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Much has been written about debugging PHP in eclipse, yet for all the blogs and tutorials I have had no end of problems.  My setup was complicated by the fact that I was trying to debug command-line scripts using the symfony framework.  Only the last part was really symfony-dependent, however.  Here is what finally worked for me.</p>
<h3>My setup:</h3>
<ul>
<li>Windows XP</li>
<li>PHP 5.2.6</li>
<li>Eclipse 3.3</li>
<li>Symfony 1.0.11</li>
</ul>
<h3>Debugger Choice: Zend</h3>
<p>First I needed to decide on a debugger.  In the end I found that Xdebug caused nasty PHP crashes at the end of some runs.  I&#8217;m not sure why I had this problem, but I wound up using Zend.</p>
<h3>Eclipse, servers, and clients</h3>
<p>Eclipse 3.3 comes with debug clients for Xdebug and Zend debugger built-in.  If you look in Window -&gt; Preferences, PHP -&gt; Debug -&gt; Installed Debuggers, you should see them there.  This does not mean, however, that you have everything you need ready to go.</p>
<p>PHP must also be configured (in php.ini) with debugging support.  This involves loading an extension for Zend debugger or Xdebug.  Eclipse comes with a version PHP configured with Zend debugger.  On my system it was here:</p>
<p>C:\Program Files\eclipse\plugins\org.zend.php.debug.debugger.win32.x86_5.2.10.v20070905\resources\php5\php.exe</p>
<p>The key to this is that in that same directory is a php.ini that loads ZendDebugger.dll (also in the same directory).</p>
<p>Furthermore, Eclipse seems to require that your PHP have debugging support built in, even when you Run (not Debug).</p>
<h3>Other considerations</h3>
<p>The Zend debugger slows down PHP significantly.  I didn&#8217;t want to have it enabled by default.  So, I created a separate ini file that includes the Zend debugger and told Eclipse to use it.</p>
<p>My code used MySQL, so I needed at least that extension loaded in PHP.</p>
<h3>The Steps</h3>
<ol>
<li>Install everything (Apache, PHP, Eclipse, Symfony, etc.)</li>
<li>Find ZendDebugger.dll in your eclipse plugins dir (see path above for a hint)</li>
<li>Copy it to your PHP extensions dir (a subdir of your main PHP dir)</li>
<li>Create a copy of php.ini called php-debug.ini</li>
<li>In php-debug.ini add the following (substituting in the proper path to PHP):</li>
<blockquote><p>zend_extension_ts=&#8221;C:/Program Files/PHP/ext/ZendDebugger.dll&#8221;</p></blockquote>
<li>In Eclipse, go to Window -&gt; Preferences, PHP -&gt; PHP Executables</li>
<li>Click Add</li>
<li>Specify a name that you will recognize</li>
<li>In Executable path, find your standard php.exe (not part of Eclipse)</li>
<li>In config path, specify php-debug.ini</li>
<li>Choose Zend Debugger</li>
<li>Add</li>
<li>Now, to run or debug you will need to choose the PHP Executable that you created.</li>
</ol>
<h3>Symfony</h3>
<p>To make it work with symfony, create the following file, named bootstrap.php, in your project root dir:</p>
<blockquote><p>&lt;?php<br />
// From symfony.bat<br />
ini_set(&#8216;html_errors&#8217;, &#8217;0&#8242;);<br />
ini_set(&#8216;open_basedir&#8217;, &#8221;);<br />
// &#8216;Calls&#8217; the php script symfony<br />
require(&#8216;./symfony&#8217;);<br />
?&gt;</p></blockquote>
<p>Then, to run a symfony command, for example symfony test-unit Foo, you would do the following:</p>
<ol>
<li>Go to Run -&gt; Open Run Dialog (or Open Debug Dialog)</li>
<li>Make sure PHP Debugger and PHP Executable are set correctly.</li>
<li>Specify bootstrap.php as the php file to run</li>
<li>In the php script arguments, put the symfony parameters (e.g. test-unit Foo)</li>
</ol>
<p>For regular symfony commands you would still do it straight from the command-line, or using Symfoclipse.  This is useful for unit tests and the like where it would invoke your code.</p>
<h3>Problems</h3>
<p>Sometimes, PHP executables that are created are not made available in the Run or Debug dialogs.  I don&#8217;t know why, but creating new PHP executables (without removing the old ones first) seems to work around the problem.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mcrusch.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mcrusch.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcrusch.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcrusch.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcrusch.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcrusch.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mcrusch.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mcrusch.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mcrusch.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mcrusch.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcrusch.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcrusch.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcrusch.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcrusch.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcrusch.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcrusch.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcrusch.wordpress.com&amp;blog=3945047&amp;post=3&amp;subd=mcrusch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mcrusch.wordpress.com/2008/06/10/php-debugging-in-eclipse-with-symfony-too/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6c1e3a10307f666b31b2000b50802983?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mcrusch</media:title>
		</media:content>
	</item>
	</channel>
</rss>
