<?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>David Behler</title>
	<atom:link href="http://www.davidbehler.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidbehler.de</link>
	<description>Helping people get websites since 2004</description>
	<lastBuildDate>Tue, 30 Aug 2011 12:58:21 +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>TortoiseSVN – Change User After Save Authentication</title>
		<link>http://www.davidbehler.de/2011/08/tortoisesvn-%e2%80%93-change-user-after-save-authentication/</link>
		<comments>http://www.davidbehler.de/2011/08/tortoisesvn-%e2%80%93-change-user-after-save-authentication/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 12:58:21 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[TortoiseSVN]]></category>

		<guid isPermaLink="false">http://www.davidbehler.de/?p=92</guid>
		<description><![CDATA[I had to update the credentials I use for one of the repos I work on but in TortoiseSVN there&#8217;s no built-in way of updating the saved credentials if the entered user is still valid (otherwise it will prompt you for a new username/password), except deleting all the saved authentication info for ALL repos worked [...]]]></description>
			<content:encoded><![CDATA[<p>I had to update the credentials I use for one of the repos I work on but in TortoiseSVN there&#8217;s no built-in way of updating the saved credentials if the entered user is still valid (otherwise it will prompt you for a new username/password), except deleting all the saved authentication info for ALL repos worked on via TortoiseSVN.</p>
<p>After some research on Google I found this blog post by <a href="http://johnnycoder.com/blog/2008/07/31/tortoisesvn-change-user-after-save-authentication/" target="_blank">JohnnyCoder</a> where he describes the same problem solved it using the above mentioned method of removing all the saved data. Lucky for me in one of the comments <a href="http://www.brad-divine.com/" target="_blank">Brad Divine</a> described a different approach which would only require you to delete a single file, the one holding the credentials for the one repo you want to update instead all of them. Sadly his approach didn&#8217;t work for me but with a slight adjustment to the path he mentioned I got it working on my Windows 7 system:</p>
<p>Go to this folder:</p>
<blockquote><p>C:\Users\&lt;your-username&gt;\AppData\Roaming\Subversion\auth\svn.simple</p></blockquote>
<p>The files you find here can viewed in any text editor and each file holds the credentials for one repository. They all have cryptic names but you can manually open them all and find the one you are looking for real quickly. Once you got it, just delete the file and next time you want to commit or update your local copy, TortoiseSVN will ask you for new credentials.</p>
<p>In case you are wondering, the folder for XP users looks like this:</p>
<blockquote><p>C:\Documents and Settings\&lt;your-username&gt;\Application Data\Subversion\auth\svn.simple\</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.davidbehler.de/2011/08/tortoisesvn-%e2%80%93-change-user-after-save-authentication/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dev-Box: mod_rewrite and Virtual Hosts for your Apache</title>
		<link>http://www.davidbehler.de/2011/07/dev-box-mod_rewrite-and-virtual-hosts/</link>
		<comments>http://www.davidbehler.de/2011/07/dev-box-mod_rewrite-and-virtual-hosts/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 18:45:35 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Dev-Box]]></category>

		<guid isPermaLink="false">http://www.davidbehler.de/?p=90</guid>
		<description><![CDATA[This is gonna be a quick one, but I think you&#8217;ll find this quite useful &#8230; if you don&#8217;t already know it by heart ;) As I promised in my initial Dev-Box post, I promised to give further useful instructions/tips for your development VM, so here we go: mod_rewrite and Virtual Hosts for Apache. Two [...]]]></description>
			<content:encoded><![CDATA[<p>This is gonna be a quick one, but I think you&#8217;ll find this quite useful &#8230; if you don&#8217;t already know it by heart ;)</p>
<p>As I promised in my initial <a title="Dev-Box" href="http://www.davidbehler.de/2011/03/virtual-machine-for-developers/">Dev-Box</a> post, I promised to give further useful instructions/tips for your development VM, so here we go: mod_rewrite and Virtual Hosts for Apache. Two basics that every coder should know by heart and uses every day (even though he might not be aware of it). I, for example, create a virtual host for every new project I start. That way I can access them easily via their own URL and don&#8217;t have to remember the exact folders they reside in.</p>
<p><span id="more-90"></span></p>
<h3>mod_rewrite</h3>
<p>This is a module for Apache that &#8220;uses a rule-based rewriting engine to rewrite requested URLs on the fly&#8221; (quoted from the <a title="Apache Docs" href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html" target="_blank">Apache Docs</a>). It allows you to use .htaccess files to redirect/restrict access to your website very easily. Installing is quite easy and the only thing you need to do, no configuration needed:</p>
<blockquote><p>a2enmod rewrite<br />
/etc/init.d/apache2 reload</p></blockquote>
<p>That&#8217;s it, now you can use .htaccess just like you are used to.</p>
<h3>Virtual Hosts</h3>
<p>Virtual Hosts basically let you maintain more than one server/website on one machine and allow you to use a simple url like http://my_project.vm instead of something like http://url-to-my-vm/folder1/folder2/folder3. They are a bit more tricky but nothing too hard and once you got the first one working it&#8217;s mostly copy &amp; paste. We&#8217;ll start with editing the Apache config and then we&#8217;ll continue and finish with editing your hosts file.</p>
<h4>Apache</h4>
<p>For each virtual host (=website) you want to run on your server you&#8217;ll have to create a file. In this example we&#8217;ll setup a virtual host for local website, e.g. dev-box.vm:</p>
<blockquote><p>cd /etc/apache2/sites-available<br />
nano dev-box</p></blockquote>
<p>Now we&#8217;ve navigated to the folder where all virtual hosts are stored and opened a new file called &#8220;dev-box&#8221; in our well-known editor nano. I&#8217;ve accustomed myself to naming the files the same as the website (in this case dev-box), but you can actually name them however you want. Anway, the contents of a virtual host file looks always the same, except three lines that are unique for each website you set up:</p>
<blockquote><p>&lt;VirtualHost *:80&gt;<br />
ServerName <strong>url-to-the-website</strong><br />
ServerAdmin webmaster@localhost<br />
DocumentRoot <strong>path-to-website-folder</strong><br />
&lt;Directory <strong>path-to-website-folder</strong>&gt;<br />
Options Indexes FollowSymLinks MultiViews<br />
AllowOverride All<br />
Order allow,deny<br />
allow from all<br />
&lt;/Directory&gt;<br />
ErrorLog /var/log/apache2/error.log<br />
LogLevel warn<br />
CustomLog /var/log/apache2/access.log combined<br />
ServerSignature On<br />
&lt;/VirtualHost&gt;</p></blockquote>
<p>Place the above in the nano editor and replace the placeholders with the following:</p>
<blockquote><p><strong>url-to-website</strong>: This should be the actual url that you&#8217;ll use to access this website, in our case dev-box.vm<br />
<strong>path-to-website-folder</strong>: This should be the path to the root folder of your website, basically where the index.php will be. In this case something like /var/www/dev-box/</p></blockquote>
<p>After you save the file you&#8217;ll have to enable it and that&#8217;s it for the linux part:</p>
<blockquote><p>a2ensite dev-box<br />
/etc/init.d/apache2 reload</p></blockquote>
<p>For future virtual hosts you can just copy your existing one to a new file and edit that one:</p>
<blockquote><p>cp dev-box new-project<br />
nano new-project</p></blockquote>
<h4>Windows</h4>
<p>Now go to your hosts file on your system (C:\Windows\System32\drivers\etc for Windows), open the host file and add the following line:</p>
<blockquote><p>IP-to-your-VM dev-box.vm</p></blockquote>
<p>Save the file and that&#8217;s it. From now on when you go to dev-box.vm in your browser it will use your VM&#8217;s IP to look up the IP and the server will know that you are requesting dev-box.vm and that it should look for the files in the website folder you entered in the virtual hosts file.</p>
<p><code>/etc/init.d/apache2 restart</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidbehler.de/2011/07/dev-box-mod_rewrite-and-virtual-hosts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dev-Box: Installing a Mail Server</title>
		<link>http://www.davidbehler.de/2011/07/dev-box-setting-up-a-mail-server-2/</link>
		<comments>http://www.davidbehler.de/2011/07/dev-box-setting-up-a-mail-server-2/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 21:43:43 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Dev-Box]]></category>
		<category><![CDATA[Dovecot]]></category>
		<category><![CDATA[Mail Server]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Virtual Machine]]></category>

		<guid isPermaLink="false">http://www.davidbehler.de/?p=85</guid>
		<description><![CDATA[It&#8217;s been a while, but I&#8217;m back with another useful tutorial for all those out there using VMs like my Dev-Box. Last time I talked about getting SVN to work on your VM and now time it&#8217;s all about setting up a mail server, something you need for pretty much every web application you might [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while, but I&#8217;m back with another useful tutorial for all those out there using VMs like my <a href="http://www.davidbehler.de/2011/03/virtual-machine-for-developers/" target="_blank">Dev-Box</a>. Last time I talked about getting SVN to work on your VM and now time it&#8217;s all about setting up a mail server, something you need for pretty much every web application you might develop.</p>
<p>As my posts are meant for users that use VMs for local development, I&#8217;ll not tell you how to install a usual mail server, but rather how to configure it that way, that all outgoing emails go to one email address instead of the address they are meant for. Using such a catch-all setup allows you to test emails coming from your app without having to send mails to existing accounts and even allows you to use your live database for testing and not having to worry that the live users might get an email that&#8217;s only meant for testing.</p>
<h3><span id="more-85"></span>Installation</h3>
<p>Installing the mailing software is actually pretty easy, just run the below command and select the &#8220;No Configuration&#8221; option when asked how you want your server to be configured. We&#8217;ll take care of this ourself.</p>
<blockquote><p>apt-get install dovecot-postfix</p></blockquote>
<h3>Configuration</h3>
<p>The configuration is where it gets kinda tricky. The way we are gonna set it up, all emails send by your server will be redirected to a single email address you define. In my case I&#8217;ll use an gmail account that all my the emails from my VM will be send to but in theory you could use any email account with any provider. So let&#8217;s get it started and I&#8217;ll explain further as we get along:</p>
<p>First we add a rule that makes sure all emails are redirected to a single email address. We do this by creating a new file called recipient_canonical_map</p>
<blockquote><p>cd /etc/postfix<br />
nano recipient_canonical_map</p></blockquote>
<p>with this content</p>
<blockquote><p>/./ gmail_username@gmail.com</p></blockquote>
<p>Once you saved the file we open up the postfix main config file</p>
<blockquote><p>nano main.cf</p></blockquote>
<p>and enter this content</p>
<blockquote><p>recipient_canonical_classes = envelope_recipient<br />
recipient_canonical_maps = regexp:/etc/postfix/recipient_canonical_map</p></blockquote>
<p>Now we can continue to the second part of the configuration where we make sure all the outgoings email are actually send and are send to your email address. We open up the main.cf file again</p>
<blockquote><p>nano main.cf</p></blockquote>
<p>and add the following lines</p>
<blockquote><p># TLS parameters<br />
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem<br />
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key<br />
smtpd_use_tls=no<br />
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache<br />
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache</p>
<p># See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for<br />
# information on enabling SSL in the smtp client.</p>
<p>myhostname = vidyadhar.home.network<br />
alias_maps = hash:/etc/aliases<br />
alias_database = hash:/etc/aliases<br />
myorigin = /etc/mailname<br />
mydestination =<br />
relayhost = [smtp.gmail.com]:587<br />
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128<br />
mailbox_size_limit = 0<br />
recipient_delimiter = +<br />
inet_interfaces = loopback-only<br />
default_transport = smtp<br />
relay_transport = smtp<br />
inet_protocols = all</p>
<p># SASL Settings<br />
smtp_use_tls=yes<br />
smtp_sasl_auth_enable = yes<br />
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd<br />
smtp_sasl_security_options = noanonymous<br />
smtp_sasl_tls_security_options = noanonymous<br />
smtp_tls_CAfile = /etc/postfix/cacert.pem</p></blockquote>
<p>The SASL settings make sure that your server won&#8217;t be banned for spamming the mail account. Not sure if this works with other providers as well, only tested with Google Mail. To make the SASL part work we have to create a password file:</p>
<blockquote><p>nano sasl_passwd</p></blockquote>
<p>insert the following line (where you have to replace the email address and the password with your actual credentials)</p>
<blockquote><p>[smtp.gmail.com]:587   gmail_username@gmail.com:gmail_password</p></blockquote>
<p>Now we secure file and validate our certificate:</p>
<blockquote><p>chmod 400 /etc/postfix/sasl_passwd<br />
postmap /etc/postfix/sasl_passwd<br />
touch /etc/postfix/cacert.pem<br />
cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem &gt;&gt; /etc/postfix/cacert.pem</p></blockquote>
<p>After restarting the mail server we are done and you can send an email from one of your apps and it should show up in your inbox of your gmail account:</p>
<blockquote><p>/etc/init.d/postfix restart</p></blockquote>
<p>I hope you like my mail server setup and it works for you :) I didn&#8217;t test this as extensive as I wanted to, but it works for me and so I hope it does for you! I&#8217;m looking forward to your comments and critique.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidbehler.de/2011/07/dev-box-setting-up-a-mail-server-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leave Google alone ;)</title>
		<link>http://www.davidbehler.de/2011/06/leave-google-alone/</link>
		<comments>http://www.davidbehler.de/2011/06/leave-google-alone/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 13:15:43 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[FTC]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://www.davidbehler.de/?p=81</guid>
		<description><![CDATA[Google just confirmed that the Federal Trade Commission is investigating them. Propably because other websites like Expedia, TripAdvisor, WebMD have complained that Google might prefer their own websites over others in their search results. I see why they might be upset about this but to be honest I don&#8217;t see why Google should care. Sure, [...]]]></description>
			<content:encoded><![CDATA[<p>Google just confirmed that the Federal Trade Commission is investigating them. Propably because other websites like Expedia, TripAdvisor, WebMD have complained that Google might prefer their own websites over others in their search results. I see why they might be upset about this but to be honest I don&#8217;t see why Google should care.</p>
<p>Sure, Google is the biggest web search provider around and everyone uses it, but no one forces people to use it and Google can pretty much do with their search engine what they want or am I wrong here? It was the same with Microsoft some years ago when they were forced by the European Commission to add other browsers like Firefox, Safari and Opera to Windows and let the user choose which one should be installed as the standard browser. They bent to that order and now we (at least in Europe) have a choice, but I don&#8217;t honestly don&#8217;t understand why they could be forced to do so. Don&#8217;t get me wrong, I&#8217;m glad more people might actually switch from IE to some other/better browser but why should a company have to actively support their competitors?</p>
<p>Am I the only one that thinks this isn&#8217;t right?`Or am I missing the point here? Please feel free to comment on/explain what&#8217;s going on here!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidbehler.de/2011/06/leave-google-alone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dev-Box: Installing SVN</title>
		<link>http://www.davidbehler.de/2011/03/dev-box-installing-svn/</link>
		<comments>http://www.davidbehler.de/2011/03/dev-box-installing-svn/#comments</comments>
		<pubDate>Sat, 12 Mar 2011 20:46:43 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Dev-Box]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[TortoiseSVN]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Version Control]]></category>
		<category><![CDATA[Virtual Machine]]></category>

		<guid isPermaLink="false">http://www.davidbehler.de/?p=66</guid>
		<description><![CDATA[My last post about setting up a Virtual Machine to use as your local webserver was quite the success (hits increased from about 30 to nearly 1000 within 2 days&#8230;and dropped back to somewhere slightly above the old value by now) and I promised I would write some more tutorials on how to install some [...]]]></description>
			<content:encoded><![CDATA[<p>My <a href="http://www.davidbehler.de/2011/03/virtual-machine-for-developers/" target="_blank">last post</a> about setting up a Virtual Machine to use as your local webserver was quite the success (hits increased from about 30 to nearly 1000 within 2 days&#8230;and dropped back to somewhere slightly above the old value by now) and I promised I would write some more tutorials on how to install some useful libs, so here we go and start with SVN in combination with <a href="http://tortoisesvn.net/" target="_blank">TortoiseSVN</a> a SVN client for Windows.</p>
<p><span id="more-66"></span>For those that haven&#8217;t heard of SVN before, here&#8217;s a short summary from <a href="http://en.wikipedia.org/wiki/Apache_Subversion" target="_blank">Wikipedia</a>:</p>
<blockquote><p><strong>Apache Subversion</strong> (often abbreviated <strong>SVN</strong>, after the command name <em>svn</em>) is a <a href="http://en.wikipedia.org/wiki/Software_versioning" target="_blank">software versioning</a> and a <a href="http://en.wikipedia.org/wiki/Revision_control" target="_blank">revision control</a> system founded and sponsored in 2000 by <a href="http://en.wikipedia.org/wiki/CollabNet" target="_blank">CollabNet</a> Inc. Developers use Subversion to maintain current and historical versions of files such as <a href="http://en.wikipedia.org/wiki/Source_code" target="_blank">source code</a>, web pages, and documentation.</p></blockquote>
<p>And here are some terms you&#8217;ll run into.</p>
<ul>
<li>Repository: SVN creates a repository for each project and it&#8217;s basically the place where all the files and their history is stored. It&#8217;s located on the server that runs SVN, in your case propably the VM from my last tutorial.</li>
<li>Checkout: It&#8217;s your local copy of the repository where you make your changes to the files. It&#8217;s usually located on your local machine in your webserver root where you work and edit files. In your case that&#8217;s propably not the case and it would be in the /var/www on your VM because that&#8217;s where you work via shared folders.</li>
<li>Commit: It&#8217;s a command that sends all the changes you made to the files in your checkout folder to the repository. Each commit creates a new revision with it&#8217;s own number that let&#8217;s you revert your files to an older version that you commited before.</li>
<li>Update: Compares your local copy to the repository and updates your local files to mirror any changes commited by other users since your last checkout/update.</li>
</ul>
<h3>Installation</h3>
<p>Installing SVN is actually pretty easy, like most of the libs. Configuration is where it might get tricky, but we&#8217;ll come to that in a bit.</p>
<blockquote><p>apt-get install subversion libapache2-svn</p></blockquote>
<p>That&#8217;s it, SVN is installed. Now we can start with the configuration. First we gotta think of a place where we want to locate our repositories. I located mine in the home folder but you can put it pretty much everywhere you want:</p>
<blockquote><p>cd /home<br />
mkdir svn</p></blockquote>
<p>Now we&#8217;ve created a folder called &#8220;svn&#8221; in /home and can continue by creating a passwd file we can use for all upcoming projects:</p>
<blockquote><p>htpasswd -c /etc/subversion/passwd &lt;user name&gt;</p></blockquote>
<p>This will prompt you to enter a password for the user. You can choose whatever user name and password you want. These credentials will be used to access your repositories. I chose user name &#8220;root&#8221; with my root password out of habit, but it&#8217;s entirely up to you. Now that we are all set we can setup our first project.</p>
<h3>Setting up a project</h3>
<p>These steps need to be taken whenever you want to start a new project with it&#8217;s own repository. In the following please replace &lt;project name&gt; with the name of your project, it shouldn&#8217;t contain any characters that don&#8217;t work well with URLs, e.g. umlauts or space, and keep it lower case just to be sure. First we create a folder for the new project in our svn folder and then we create the repository:</p>
<blockquote><p>cd /home/svn<br />
mkdir &lt;project name&gt;<br />
svnadmin create /home/svn/&lt;project name&gt;</p></blockquote>
<p>Next thing we need to do is configure Apache to allow TortoiseSVN to connect to our repository:</p>
<blockquote><p>nano /etc/apache2/apache2.conf</p></blockquote>
<p>Now that you&#8217;ve opened the Apache config file, please scroll to the bottom and insert this and save the changes:</p>
<blockquote><p>&lt;Location /svn/&lt;project name&gt;&gt;<br />
DAV svn<br />
SVNPath /home/svn/&lt;project name&gt;<br />
AuthType Basic<br />
AuthName &#8220;&lt;project name&gt;&#8221;<br />
AuthUserFile /etc/subversion/passwd<br />
&lt;LimitExcept GET PROPFIND OPTIONS REPORT&gt;<br />
Require valid-user<br />
&lt;/LimitExcept&gt;<br />
&lt;/Location&gt;</p></blockquote>
<p>Now run this command to make sure the repository is owned by the HTTP user:</p>
<blockquote><p>chown -R www-data:www-data /home/svn/&lt;project name&gt;</p></blockquote>
<p>This will tell Apache that our repository can be found under http://ip-address-of-my-vm/svn/&lt;project name&gt; and allows us to use a client like TortoiseSVN to connect to our repository.<br />
Now you have to restart Apache and after that your repository should be ready to go:</p>
<blockquote><p>/etc/init.d/apache2 restart</p></blockquote>
<h3>TortoiseSVN</h3>
<p>First we need to download and install TortoiseSVN from their <a href="http://tortoisesvn.net/downloads.html" target="_blank">website</a>. Choose the version matching your system (32 or 64bit) and install it using the pre-selected options after the download is done. I use the 64bit version but there shouldn&#8217;t be any differences to the 32bit version. If you are asked to reboot, then please do so and afterwards go to the shared folder from your VM where you usually work in.</p>
<p>Right click and select &#8220;SVN Checkout&#8221;. It opens a new window where you are asked to enter the URL of the repository and the Checkout directory. For the first one you enter</p>
<blockquote><p>http://ip-to-your-vm/svn/&lt;project name&gt;</p></blockquote>
<p>and the second one defaults to the &lt;project name&gt; but you can choose whatever folder you want as long as it&#8217;s empty (it doesn&#8217;t have to exist yet, TortoiseSVN will create it if needed). Leave the other options as they are and click &#8220;OK&#8221;. You should see a new window that says &#8220;Completed At revision: 0&#8243; or something like that.</p>
<p>Now you can navigate to the new folder and start working on your project. If you&#8217;ve done some changes, e.g. created a new file or whatever and want to commit them to the repository, then simply right-click the project folder and select &#8220;SVN Commit&#8221;. You&#8217;ll see a text input at the top and a list of all new/deleted/changed files below that. In the text are you are supposed to enter a &#8220;message&#8221; or rather a comment which describes what has changed and below you should select all files that are related to these changes/de-select all files that are not related. After clicking &#8220;OK&#8221; your changes will be tranferred to the repository and new revision will be created.</p>
<p>Small tip: If you want to enhance existing projects of yours with some SVN powered version control, then you can simply create a new project like I describe above, copy your files from their old project folder to the new one and commit your changes.</p>
<p>If you are not the only one working on the repository, e.g. because you are using the VM in the local network of your company, you&#8217;ll need to run &#8220;SVN Update&#8221; now and then (each time you start working propably) to make sure you have the latest versions of the files and don&#8217;t work on old copies that have already been changed by someone else.</p>
<p>SVN offers some more options but I guess you can figure them out yourself by playing around with TortoiseSVN, at least that&#8217;s how got to know it ;) Feel free to leave a comment if you want me to elaborate on some of the options.</p>
<p>That&#8217;s it. You&#8217;ve successfully setup SVN+TortoiseSVN and can start working in a safer environment where you can keep track of all your changes.</p>
<p>I hope you like this tutorial as much as you liked my last one and I&#8217;m looking forward to your comments and critique.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidbehler.de/2011/03/dev-box-installing-svn/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dev-Box: Virtual Machines for Developers</title>
		<link>http://www.davidbehler.de/2011/03/virtual-machine-for-developers/</link>
		<comments>http://www.davidbehler.de/2011/03/virtual-machine-for-developers/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 16:13:55 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Dev-Box]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Virtual Machine]]></category>

		<guid isPermaLink="false">http://www.davidbehler.de/?p=19</guid>
		<description><![CDATA[This post goes out to all the coders using a Windows machine for development. Might be interesting for others aswell but I can&#8217;t say much about that as I&#8217;m a Windows user myself ;) So what is this about? Well, some time ago I ran into smaller problems when trying to move a website from [...]]]></description>
			<content:encoded><![CDATA[<p>This post goes out to all the coders using a Windows machine for development. Might be interesting for others aswell but I can&#8217;t say much about that as I&#8217;m a Windows user myself ;)</p>
<p>So what is this about? Well, some time ago I ran into smaller problems when trying to move a website from my local machine (which used XAMPP) to a real server (which was running on Ubuntu or some other Linux distro) and it was hard to fix the problems because of the differences between Windows and Linux servers.</p>
<p>I talked about this with a friend of mine and he told me about Virtual Machines (=VM). I had never heard of them before but what I heard was intriguing. Virtual Machines allow you to run a machine inside your machine, e.g. a Linux server inside your Windows machine. So you can use this VM with Linux to test your website locally before moving it to the real server. I know that no server is like the other and you might still run into some problems due to different library versions and so on, but you gotta admit that two Linux servers have way more in common than a Linux and a Windows server ;)</p>
<p>So in this post I&#8217;ll tell you how to setup your own VM with all the libs you need. Even if you haven&#8217;t worked with Linux before, you should be able to follow this tutorial/example easily.<br />
<span id="more-19"></span></p>
<h3>Contents</h3>
<ul>
<li><a href="#getting-started">Getting started</a></li>
<li><a href="#first-steps">First steps</a></li>
<li><a href="#connecting-to-your-vm">Connecting to your VM</a></li>
<li><a href="#adding-some-web">Adding some web to your server</a></li>
<li><a href="#setting-up-mysql">Setting up MySQL</a></li>
<li><a href="#accessing-your-files">Accessing your files</a></li>
<li><a href="#what-else">What else is there to do?</a></li>
</ul>
<p><span style="color: #ff0000;"><strong>Beware:  VMs created with this tutorial are not secure and should only be used  in a local environment. Please don&#8217;t use these instructions to setup a  real server.</strong></span></p>
<h3>Getting started</h3>
<p>First you have to get some player to run the vm in, e.g. <a href="http://www.vmware.com/products/player/" target="_blank">VMware Player</a>, <a href="http://www.vmware.com/products/server/" target="_blank">VMware Server</a> or <a href="http://www.vmware.com/products/ws" target="_blank">VMware Workstation</a>. The former ones are for free, but the later one costs quite a bit and is only suitable for companies or if you want to run multiple VMs at once.</p>
<p>Next thing you need is the VM itself. You can either download the basic version with nothing but the OS installed from <a href="http://www.thoughtpolice.co.uk/vmware/" target="_blank">thoughtpolice</a> (I used Ubuntu 10.10 for this tutorial) or download the ready-to-go version that&#8217;s the result of this tutorial:<br />
Basic version from thoughtpolice: <a href="http://www.thoughtpolice.co.uk/vmware/#ubuntu10.10" target="_blank">Click here</a><br />
Ready-to-go version: <a href="http://www.davidbehler.de/wp-content/plugins/download-monitor/download.php?id=1" target="_blank">Click here</a></p>
<p>After you&#8217;ve installed the player you should propably take a look at the network settings aka Virtual Network Editor. For me it always worked with VMnet0 set to type &#8220;Bridged&#8221; and &#8220;Automatic&#8221; selected in the Bridged to dropdown. Now you can go ahead and load the VM into the player (File -&gt; Open) and after that&#8217;s done you should edit the Virtual Machine settings and set the Network Apapter to Bridged aswell.Now fire it up and if all goes well you should be prompted to login. For both versions you can use the following credentials to login:</p>
<blockquote><p><strong>Basic Version</strong><br />
Username: notroot<br />
Password: thoughtpolice</p>
<p><strong>Ready-to-to Version</strong><br />
Username: root<br />
Password: thoughtpolice</p></blockquote>
<p>If you use the basic version you got the following options how to proceed:</p>
<ol>
<li>You can either prepend &#8220;sudo &#8221; before all the commands listed below when executing them, which basically means &#8220;run the following command as root&#8221;</li>
<li>Each time you login you run &#8220;sudo -s&#8221; once, which means that all commands executed in the current session will be run as root</li>
<li>You proceed as in option 2 and afterwards you run &#8220;passwd&#8221; to change the password of the root user. Now you can login as root with your new password and don&#8217;t have to use sudo anymore.</li>
</ol>
<p>To your information: If you are inside your player (e.g. clicked on the console to enter your login credentials) and can&#8217;t get back to windows, try pressing Ctrl + Alt. That one kept me trapped for a while ;)</p>
<h3 id="first-steps">First steps</h3>
<p>First we want to make sure that all pre-installed libs are up-to-date. To do this we have to run two commands on the console:</p>
<blockquote><p>apt-get update</p></blockquote>
<p>This will make sure that all our sources (that&#8217;s what tells  the server what libraries are available and so on) are up-to-date.</p>
<blockquote><p>apt-get upgrade</p></blockquote>
<p>And this one will update all your installed libs to the newest version that&#8217;s found in the sources.<br />
The next step would be to change your root password, both for security and simplicity reasons. It&#8217;s way easier to enter a password that you know well than entering thoughtpolice! You can skip this step if you are using the basic version and used option 3.</p>
<blockquote><p>passwd</p></blockquote>
<p>And now you will be prompted to enter a new password. Easy as pie ;)<br />
Finally you might want to change the keyboard layout. The US keyboard layout is the default and that&#8217;s not suitable for everyone. Just run this command and a setup dialog will popup and ask what layout you want to use:</p>
<blockquote><p>dpkg-reconfigure console-setup</p></blockquote>
<h3 id="connecting-to-your-vm">Connecting to your VM</h3>
<p>As you&#8217;ve noticed you can use the player to access the VM and enter commands in the console. But as you get trapped inside the player and can&#8217;t copy/paste text from/to the console it&#8217;s rather tedious to work that way. That&#8217;s where so called SSH Clients come into play. They allow you to connect to your VM (or rather the server that&#8217;s running inside) via an external program that&#8217;s way easier to handle. One of such clients is <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" target="_blank">Putty</a>. I know that it hasn&#8217;t been updated in a while but it still works really great and doesn&#8217;t even have to be installed, it&#8217;s just a single executable that you run whenever you need to connect to a remote machine via SSH.</p>
<p>Now to get this working you need to install SSH on your VM. If you&#8217;ve downloaded the ready-to-go version that&#8217;s already the case and you can skip to the <a href="#ip-address">next paragraph</a>, the rest must run this command in their console:</p>
<blockquote><p>apt-get install openssh-server</p></blockquote>
<p>This will install an SSH server on your console and enable you to connect to it from the outside.</p>
<p><span id="ip-address">To</span> actually be able to connect to your VM you need one more thing: the IP address. If the network is configured correctly this command will list all <a href="http://en.wikipedia.org/wiki/Network_card" target="_blank">interfaces</a> and their attributes, one of them being the IP address:</p>
<blockquote><p>ifconfig</p></blockquote>
<p>The interface you should watch out for is eth0 and the value of &#8220;inet addr&#8221; is the IP address we are looking for. Now that we got the IP address we can start Putty enter the IP into the &#8220;Host Name&#8221; field and click &#8220;Open&#8221;. If all went well you should be prompted to login. Just use the credentials from above (with the new password you set&#8230;if you even bothered to change it).</p>
<p>Instead of entering your IP address each time you want to access your server either via SSH or in your browser you could go ahead an edit your hosts file and add an entry with your server&#8217;s IP address. The hosts file is usually located here: C:\Windows\System32\drivers\etc and can be used to translate an IP address into a host name. For example if your VM&#8217;s IP address was 192.168.178.152 you could add this entry and your VM would from now on be available under the host name &#8220;my_vm&#8221; (additionally to the IP address of course):</p>
<blockquote><p>192.168.178.152    my_vm</p></blockquote>
<p>Whenever I tell you to enter the IP address of the VM, you can enter the host name instead if you&#8217;ve setup your hosts file properly.</p>
<h3 id="adding-some-web">Adding some web to your server</h3>
<p>Now that we are connected we can install the important stuff: Apache, PHP, MySQL&#8230;our staff of life.<br />
Apache and PHP are simple, just run these two commands and you are done:</p>
<blockquote><p>apt-get install apache2<br />
apt-get install php5</p></blockquote>
<p>If you now open your browser and go to http://ip-address-of-my-vm (or http://host-name-of-my-vm) you should see the standard &#8220;It works!&#8221; message from apache. To see if PHP was installed properly aswell we need to create a simple php file to run in the browser. First switch to your webroot by entering this command:</p>
<blockquote><p>cd /var/www</p></blockquote>
<p>There&#8217;s nothing in there except the index.html (which is shown when opening your VM&#8217;s IP in the browser) and now we need to create a new file. This can be done by opening the pre-installed editor and supplying a non-existand filename as a parameter:</p>
<blockquote><p>nano info.php</p></blockquote>
<p>Where &#8220;nano&#8221; is the pre-installed editor and info.php the (in this case non-existant) file we want to edit. Now that the editor is open you can enter plain php, e.g. this:</p>
<blockquote><p>&lt;?php phpinfo(); ?&gt;</p></blockquote>
<p>To close the editor you need to press Ctrl+X and confirm that you want to save the modified buffer. After that you can open the info.php file in your browser and should see the standard phpinfo() output.<br />
If how ever your browser asks you to download the .php file instead of displaying it, you need to run this command to restart your apache2 server:</p>
<blockquote><p>/etc/init.d/apache2 restart</p></blockquote>
<h3 id="setting-up-mysql">Setting up MySQL</h3>
<p>What else do we all need? Exactly, a database! I prefer MySQL and that&#8217;s why it&#8217;s featured in this tutorial, but you could (more or less) easily install PostgreSQL, or whatever else you prefer, instead. Anyway, installing MySQL is as simple as all the stuff before has been. Run the below commands and follow the on-screen instructions:</p>
<blockquote><p>apt-get install mysql-server<br />
apt-get install php5-mysql</p></blockquote>
<p>This will install the newest MySQL server available, 5.1.49 as of this moment. To see what version was installed you can run this command and enter your root password:</p>
<blockquote><p>mysql -u root -p</p></blockquote>
<p>After entering the root password you choose during the installation, you&#8217;ll find yourself in the MySQL command client and should see something like this at the top:</p>
<blockquote><p>Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 37<br />
Server version: 5.1.49-1ubuntu8.1 (Ubuntu)</p></blockquote>
<p>To get back to the console simply press Ctrl+C. If however you could not connect and get a &#8220;Connection refused&#8221; error, then you have to edit the MySQL config file and change the bind-address value:</p>
<blockquote><p>nano /etc/mysql/my.cnf</p></blockquote>
<p>By pressing Ctrl+W you can search for a text in the file you are editing. Search for &#8220;bind-address&#8221; and comment out the whole line by adding &#8220;#&#8221; in front.</p>
<p>Now that we have MySQL running we need some easy way to access the database and what easier way is there than phpMyAdmin? Let&#8217;s install it:</p>
<blockquote><p>apt-get install phpmyadmin</p></blockquote>
<p>During the installation you will be asked to make some configuration choices, here&#8217;s what I chose:</p>
<ul>
<li>apache2</li>
<li>Yes</li>
<li>my MySQL root password</li>
<li>my MySQL root password (and confirmed it)</li>
</ul>
<p>After the install is done you can see if it worked and go to http://ip-address-of-my-vm/phpmyadmin. If you get a 404 error don&#8217;t worry it&#8217;s easy to fix. First we have to open the apache2 configuration file</p>
<blockquote><p>nano /etc/apache2/apache2.conf</p></blockquote>
<p>and now we scroll to the bottom of the file and add this line and save the changes:</p>
<blockquote><p>Include /etc/phpmyadmin/apache.conf</p></blockquote>
<p>Now after restarting the apache2 server with the following command you should be able to open phpmyadmin in your browser:</p>
<blockquote><p>/etc/init.d/apache2 restart</p></blockquote>
<p>and now you can login with username &#8216;root&#8217; and the password you chose.</p>
<h3 id="accessing-your-files">Accessing your files</h3>
<p>Now the last thing you propably want to do is use the console to edit your files. As a Windows user you are used to some nice GUI and propably have been working with your favorite editor for quite some time now. That&#8217;s where  a handy lib called &#8220;Samba&#8221; comes in handy: It let&#8217;s you share files and folders between Linux and Windows machines. Now install is easy, configuration is where it might get tricky:</p>
<blockquote><p>apt-get install samba smbfs</p></blockquote>
<p>After the install is done, we open the config file and here&#8217;s what I my config looks like/yours should look like:</p>
<blockquote><p>[global]<br />
netbios name = Linux-PC<br />
workgroup = WORKGROUP<br />
server string = Linux Samba Server<br />
load printers = no<br />
show add printer wizard = no<br />
disable spoolss = yes<br />
use client driver = yes<br />
log file = /var/log/%m.log<br />
lock directory = /var/lock<br />
max log size = 0<br />
security = User<br />
encrypt passwords = true<br />
smb passwd file = /etc/samba/smbpasswd<br />
socket options = IPTOS_LOWDELAY TCP_NODELAY<br />
security mask = 0777<br />
create mask = 0777<br />
fstype = NTFS<br />
max smbd processes = 10<br />
map to guest = Bad User<br />
csc policy = disable<br />
hide dot files = yes<br />
hide files = /./.*/aquota.*/<br />
veto files = /aquota.*/<br />
block size = 4096<br />
guest ok = no<br />
getwd cache = Yes<br />
lm announce = yes<br />
lm interval = 120<br />
max xmit = 8192<br />
display charset = UTF8<br />
unix charset = UTF8<br />
status = no<br />
deadtime = 1<br />
level2 oplocks = True<br />
dns proxy = no</p>
<p>[www]<br />
comment = Homepage<br />
path = /var/www<br />
force group = www-data<br />
force user = www-data<br />
browseable = yes<br />
public = yes<br />
writable = yes<br />
valid users = samba<br />
read list =<br />
create mode = 0775<br />
directory mode = 0775</p></blockquote>
<p>Prior to editing/overwriting the config file you should make a copy of the original file so you will have the original settings as a reference and to re-use as necessary:</p>
<blockquote><p>cp /etc/samba/smb.conf /etc/samba/smb.conf.original</p></blockquote>
<p>Easiest way for you to replace the existing content of the config file with the above is by opening nano, entering the new content and then overwriting the existing file:</p>
<blockquote><p>cd /etc/samba<br />
nano</p></blockquote>
<p>Now copy the above list of config values and right-click into the editor, this will paste the before copied content. Now press Ctrl+X, confirm the first question and when prompted for a filename enter &#8220;smb.conf&#8221; and when asked to overwrite the existing file confirm again. The above value for &#8220;valid users&#8221; tells Samba what users may connect to the shared folder, in this case the user &#8220;samba&#8221;. By default that user does not exist so we have to add it and set a password. First we add the user to the system, then we add it to samba. Just enter the following commands and follow the instructions:</p>
<blockquote><p>adduser samba<br />
smbpasswd -a samba</p></blockquote>
<p>After that&#8217;s done we restart the Samba service (not really sure that&#8217;s necessary but better save than sorry) and we should be able to connect to our server by mapping a network drive:</p>
<blockquote><p>restart smbd</p></blockquote>
<p>Now try mapping a network drive to \\ip-address-of-my-vm\www and when prompted for a username/password just enter your credentials for the samba account. If you can access the folder but don&#8217;t have permission to write to it, then run this command and it should be fixed:</p>
<blockquote><p>chmod a+wrx /var/www</p></blockquote>
<h3 id="what-else">What else is there to do?</h3>
<p>Plenty, but for now you are good to go. In further blog posts I&#8217;ll tell you how to setup a mail server, connect to SVN/Git and some more useful libs you propably even haven&#8217;t heard of yet ;) To end this post I&#8217;ll give you a list of the most important commands you&#8217;ll need when working (most of them already used above):</p>
<p>Run command X with root privileges if current user is not root:</p>
<blockquote><p>sudo X</p></blockquote>
<p>Become root for complete session:</p>
<blockquote><p>sudo -s</p></blockquote>
<p>Change to directory X:</p>
<blockquote><p>cd X</p></blockquote>
<p>Get contents of current directory:</p>
<blockquote><p>dir</p></blockquote>
<p>Open file in text editor nano:</p>
<blockquote><p>nano filename</p></blockquote>
<p>Copy a file:</p>
<blockquote><p>copy oldfilename newfilename</p></blockquote>
<p>Move/rename a file:</p>
<blockquote><p>mv oldfilename newfilename</p></blockquote>
<p>Create a new directory X:</p>
<blockquote><p>mkdir X</p></blockquote>
<p>Remove directory X:</p>
<blockquote><p>rmdir X</p></blockquote>
<p>Update apt-get sources:</p>
<blockquote><p>apt-get update</p></blockquote>
<p>Update installed packages:</p>
<blockquote><p>apt-get upgrade</p></blockquote>
<p>Install package X:</p>
<blockquote><p>apt-get install X</p></blockquote>
<p>Remove package X:</p>
<blockquote><p>apt-get &#8211;purge remove X</p></blockquote>
<p>Restart Apache:</p>
<blockquote><p>/etc/init.d/apache2 restart</p></blockquote>
<p><span style="color: #ff0000;"><strong>Beware:  VMs created with this tutorial are not secure and should only be used  in a local environment. Please don&#8217;t use these instructions to setup a  real server.</strong></span></p>
<p>If you run into any problems feel free to either post in the comments or have a look at the <a href="https://help.ubuntu.com/community" target="_blank">Ubuntu Community Documentation</a>. It helped me quite a bit when I started out with Linux and wrote this article.</p>
<p>I&#8217;m looking forward to your comments, criticism and suggenstions on how to improve this further/what you want to see in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidbehler.de/2011/03/virtual-machine-for-developers/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Proto.Spy</title>
		<link>http://www.davidbehler.de/2011/02/proto-spy/</link>
		<comments>http://www.davidbehler.de/2011/02/proto-spy/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 21:00:09 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Prototype]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Spy]]></category>

		<guid isPermaLink="false">http://www.davidbehler.de/?p=58</guid>
		<description><![CDATA[A while back a friend of mine mentioned this site to me: It checks which porn sites you have been on. The technology used to achieve this is quite simple. It inserts links to a bunch of porn sites in the page and uses Javascript to check the link color, abusing the fact that browsers [...]]]></description>
			<content:encoded><![CDATA[<p>A while back a friend of mine mentioned this <a href="http://didyouwatchporn.com/">site</a> to me: It checks which porn sites you have been on.</p>
<p>The technology used to achieve this is quite simple. It inserts links to a bunch of porn sites in the page and uses Javascript to check the link color, abusing the fact that browsers by default use different colors for links you have visited or have not.</p>
<p>Some days ago I came across a blog <a href="http://davidwalsh.name/jquery-spyjax">post</a> by David Walsh in which he described how to perform the above described check using jQuery. I was amazed how easy that was and thought it must be equaly easy to do the same using Prototype. Well, here we go:</p>
<p>I&#8217;ve set up a <a href="http://davidbehler.de/projects/proto.spy/">demo</a> that checks a small number of sites (no porn, sorry).</p>
<p>Here is the small function I use to do the checks:</p>
<pre title="code">Event.observe(window,'load',function(){
 siteList.each(function(site){
  var a = new Element('a', { href: 'http://' + site, }).addClassName('check').insert(site);
  if(a.getStyle('color') == '#800080' || a.getStyle('color') == 'rgb(0, 128, 0)') {
   $('link-list').insert(a.addClassName('highlight').removeClassName('check').wrap('li'));
  } else {
   var b = new Element('a', { href: 'http://www.' + site }).addClassName('check').insert(site);
   if(b.getStyle('color') == '#800080' || b.getStyle('color') == 'rgb(0, 128, 0)') {
    $('link-list').insert(b.addClassName('highlight').removeClassName('check').wrap('li'));
   } else {
    $('link-list').insert(a.removeClassName('check').wrap('li'));
   }
  }
 });
},false);</pre>
<p>with siteList being an array of sites that will be checked. The basically creates an anchor element for each site in the array and checks that elements color. If it matches my defined css style for visited links, than I add the class name &#8216;highlight&#8217; to the element, otherwise I don&#8217;t. That&#8217;s pretty much what David Walsh does aswell, but additionally to that I check both http://example.com and http://www.example.com as some might have visited the one but not the other. If none were visited, I show the http://example.com link.</p>
<p>Any questions? No? Then start abusing this ;)</p>
<p>P.S.: This is an older post I copied from my old blog. Thought some of you might find this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidbehler.de/2011/02/proto-spy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extended logging of database errors in CodeIgniter</title>
		<link>http://www.davidbehler.de/2011/02/extended-logging-of-database-errors-in-codeigniter/</link>
		<comments>http://www.davidbehler.de/2011/02/extended-logging-of-database-errors-in-codeigniter/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 00:51:01 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Error Logging]]></category>

		<guid isPermaLink="false">http://www.davidbehler.de/?p=50</guid>
		<description><![CDATA[Some of you might and now and then have run into a database error while working with CI. Such errors are mostly caused by errors in your querys like not escaping user input or your fields or simply syntax errors. In small applications that not much of a problem, but the bigger the application the [...]]]></description>
			<content:encoded><![CDATA[<p>Some of you might and now and then have run into a database error while working with CI. Such errors are mostly caused by errors in your querys like not escaping user input or your fields or simply syntax errors.</p>
<p>In small applications that not much of a problem, but the bigger the application the harder it get&#8217;s to find the part where the bad query is hiding.</p>
<p><a href="http://codeigniter.com/forums/member/49567/">dootzky</a> from the CodeIgniter Forum had exactly that problem and with a little help from <a href="http://codeigniter.com/forums/member/45875/">wiredesignz</a> we were able to add some more detail to the error messages!</p>
<p>Simply add this to the body of &#8216;application/errors/error_db.php&#8217;:</p>
<pre title="code">if($_SERVER['HTTP_HOST'] == 'localhost') {
   $trace = debug_backtrace();
   echo "<strong>The error occured in file ".$trace[4]['file']." on line ".$trace[4]['line']."</strong>";
}</pre>
<p>Now additionally to the error you already know, you will be shown in which file and on which line the error occured (the db-&gt;get() method was called)! As this might pose a security risk on live systems, dootzky added the check for localhost.</p>
<p>I know that with CI 2.0 this might be obsolete because the error messages were enhanced, atleast the database errors now show filename and line, but someone still using some older version of CI (like I do for most of my older projects) might still find this handy.</p>
<p>P.S.: This is an older post I copied from my old blog. Thought some of you might find this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidbehler.de/2011/02/extended-logging-of-database-errors-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I&#8217;m back!</title>
		<link>http://www.davidbehler.de/2011/02/im-back/</link>
		<comments>http://www.davidbehler.de/2011/02/im-back/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 19:58:38 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.davidbehler.de/?p=13</guid>
		<description><![CDATA[It took me quite a while but now it&#8217;s official: I&#8217;m back in the blogging business! My old blog was running on my own blogging software, dBlog, but as development wasn&#8217;t coming along as well as I hoped it would (mostly due to me constantly running out of time) I finally came around to switching [...]]]></description>
			<content:encoded><![CDATA[<p>It took me quite a while but now it&#8217;s official: I&#8217;m back in the blogging business!</p>
<p>My old blog was running on my own blogging software, dBlog, but as development wasn&#8217;t coming along as well as I hoped it would (mostly due to me constantly running out of time) I finally came around to switching to WordPress and setting this thing up properly. It still needs some work, e.g. a different theme and maybe some header image,  but it&#8217;s running and I&#8217;ll improve on the rest in the following few weeks.</p>
<p>So what&#8217;s to expect of this one? Pretty much what I blogged about before: coding :) Propably less about my own projects than more general stuff that might be handy for some of my readers (do I even have any? haha) like code-snippets, tutorials and whatever else I might stumble upon.</p>
<p>If I find the time I&#8217;ll copy some of my old entries and post them here, but I won&#8217;t promise anything ;)</p>
<p>So long!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidbehler.de/2011/02/im-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

