<?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>Nicolas DEBARNOT</title>
	<atom:link href="http://nicolas.debarnot.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nicolas.debarnot.com</link>
	<description>Web development</description>
	<lastBuildDate>Mon, 06 Feb 2012 08:13:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Choosing the right PHP development environment</title>
		<link>http://nicolas.debarnot.com/2009/12/choosing-the-right-php-development-environment/</link>
		<comments>http://nicolas.debarnot.com/2009/12/choosing-the-right-php-development-environment/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 16:13:27 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[environment]]></category>

		<guid isPermaLink="false">http://nicolas.debarnot.com/?p=63</guid>
		<description><![CDATA[When I first started coding PHP websites, I was using Emacs on a Linux computer. Then I switched to UltraEdit on Windows. I had a Linux server on the local network running Apache with PHP and MySQL. My projects were &#8230; <a href="http://nicolas.debarnot.com/2009/12/choosing-the-right-php-development-environment/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I first started coding PHP websites, I was using Emacs on a Linux computer. Then I switched to UltraEdit on Windows. I had a Linux server on the local network running Apache with PHP and MySQL. My projects were on the server and I was accessing the files through Samba. When developing locally, I switched my hosts file in order to point my website&#8217;s hostname to my local server instead of the production one. I was using FTP to put files online. Today I&#8217;m using a much more evolved approach as the following describes&#8230;</p>
<h2><span id="more-63"></span></h2>
<h2>Team work</h2>
<p>Although this works quite fine when you&#8217;re alone, it doesn&#8217;t anymore when a team of several developers are working together. What happens when two persons edit the same file? This could result in data loss. The solution to this problem is that every developer has his/her own copy of the source code on his/her machine and that we&#8217;re using a CVS like Subversion or Git. I&#8217;m personally using <strong>Subversion</strong> so that&#8217;s the one I&#8217;ll be talking about. Such a system allows developers to collaborate on a project. Source code and its history are stored on a remote server. Versionning conflicts are resolved either automatically or by the user himself. I won&#8217;t go into details in here as there are already plenty of information available on the Internet. On Windows, I recommend installing <a href="http://tortoisesvn.tigris.org/" target="_blank">Tortoise svn</a> while on Linux or Mac OS X you&#8217;ll easily find a Subversion package. With Eclipse, the easiest way is to you Subversion&#8217;s Eclipse plugin: <a href="http://subclipse.tigris.org/" target="_blank">subclipse</a>.</p>
<h2>Standalone environment for everyone</h2>
<p>As each developer has its own copy of the source code, the simplest thing is for everyone to have his/her own web server.</p>
<p>On Windows, the easiest way is to use an all-in-one distribution like <a href="http://www.apachefriends.org/en/xampp.html" target="_blank">XAMPP</a>. This package provides Apache, PHP, MySQL and many common PHP extensions (provided as already compiled DLLs of course).</p>
<p>Today I&#8217;m on Mac OS X Snow Leopard and while XAMPP also exists for Linux or Mac OS I prefer compiling things myself. There&#8217;s an excellent tutorial at the following address that will explain you how to install Apache 2 and PHP5 on a Mac using MacPorts: <a href="http://2tbsp.com/content/install_apache_2_and_php_5_macports" target="_blank">http://2tbsp.com/content/install_apache_2_and_php_5_macports</a>.</p>
<h2>How do I access my personal web server?</h2>
<p>Although you can use subdirectories of your web server (http://localhost/project/), you may find it more convenient to use its real URL by overloading it in your hosts file (by adding an entry like 127.0.0.1 www.website.com). The inconvenient with this method is that you need to change your hosts file and reload your browser every time you need to switch from dev to production. I&#8217;m personally using specific hostsnames for my projects such as www.website.dev for example. This can be either a real hostname like www.website.info while the production one is www.website.com or a fake hostname like www.website.dev. The former needs a real hostname set up to point to 127.0.0.1 while the latter only requires an entry in your hosts file. The idea behing this solution is for every developer to use the same URLs on their machines which can be useful.</p>
<h2>And what about the database?</h2>
<p>Well&#8230; that depends on what you will be doing. Here are the questions that you and your developers need to address:</p>
<ul>
<li>does every developer often modify the structure of your database on tables also used by others?</li>
<li>do you need to be working with regularly updated data?</li>
<li>is everyone working on the same local network or do you need worldwide database access?</li>
</ul>
<p>Personally I&#8217;m using one database server hosted on the Internet so everyone can access it whether it is from the office or outside of it. This MySQL server gets the data from the production sever every night so we&#8217;re always working with accurate data. We actually have two different databases on the same server with the same data updated nightly so that when someone needs to change the structure and that it affects others, he can change the database he&#8217;s using. Of course, synchronization can be temporarily deactivated so that our changes are not lost every night.</p>
<h2>Code editing</h2>
<p>I&#8217;ve been using Eclipse for a while now and I really like it. Eclipse PDT has all the tools you need for PHP developments&#8230; except subclipse that is not installed by default.</p>
<h2>Versionning: using branches or the trunk?</h2>
<p>CVS repositories are usually structured as follows: the <strong>trunk</strong> represents the main line of development, <strong>tags</strong> are snapshots of your project&#8217;s status in time (1.0 stable version or pre-release for example), and finally <strong>branches</strong> consist of specific subdivisions of your project: for example, when a subteam of developers start working on a big and long modification of your project, they should create a new branch. At least that&#8217;s how I&#8217;m working.</p>
<p>The production server gets files from the trunk so everyday work is performed on the trunk. When starting lengthy projects that prevents files from being commited before the whole thing is finished, we&#8217;re creating a new branch. Keep in mind that you may have to fix critical bugs quickly without waiting for a long project to be finished to put your fix online!</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolas.debarnot.com/2009/12/choosing-the-right-php-development-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minimizing Javascript and CSS in Eclipse</title>
		<link>http://nicolas.debarnot.com/2009/12/minimizing-javascript-and-css-in-eclipse/</link>
		<comments>http://nicolas.debarnot.com/2009/12/minimizing-javascript-and-css-in-eclipse/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 13:27:00 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[minimize]]></category>

		<guid isPermaLink="false">http://nicolas.debarnot.com/?p=3</guid>
		<description><![CDATA[Websites need to load as quickly as possible. The results of Internet connections being faster and faster is that we can&#8217;t stand anymore waiting for a page to load. We&#8217;re used to speed and if the page doesn&#8217;t load, I&#8217;ll &#8230; <a href="http://nicolas.debarnot.com/2009/12/minimizing-javascript-and-css-in-eclipse/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Websites need to load as quickly as possible. The results of Internet connections being faster and faster is that we can&#8217;t stand anymore waiting for a page to load. We&#8217;re used to speed and if the page doesn&#8217;t load, I&#8217;ll just close the tab and go somewhere else.</p>
<p>Minimizing is the process of reducing the size of CSS and JavaScript files by compressing it. This is achieved by removing unnecessary white spaces and newlines and also by renaming JavaScript variables to something shorter. With this technique I&#8217;ve managed to reduce the size of some JS files by 50%. Yahoo! provides a wonderful tool called <a href="http://developer.yahoo.com/yui/compressor/" target="_blank">YUICompressor</a> that does the job for you.</p>
<p>I&#8217;ve been looking for a way to automatically minimize JS and CSS files upon save in Eclipse in my PHP projects&#8230; finally found out how to do it!</p>
<p><span id="more-3"></span></p>
<p>The idea is to edit .src.js and .src.css files. When saving the file, Eclipse will minimize it and create or update the corresponding .js or .css file using YUICompressor. So you will be editing the .src.js or .src.css file while of course, your website uses the .js or .css files. Note that I&#8217;m using Eclipse PDT.</p>
<p>We simply need a shell script (Mac OS or Linux) or Batch script (Windows) that minifies the file. Here&#8217;s the Mac OS / Linux shell script:</p>
<pre>#!/bin/bash
# minifies js and css files
# by Nicolas DEBARNOT
if [ -f $1 ]
then
 file=`echo $1 | sed 's/\.src//'`
 java -jar yuicompressor-2.4.2.jar $1 -o $file --charset utf-8 --nomunge
fi</pre>
<p>And the Windows batch script:</p>
<pre>@echo off
set inputfile=%1
set outputfile=%inputfile:.src=%
java -jar yuicompressor-2.4.2.jar %inputfile% -o %outputfile% --charset utf-8 --nomunge</pre>
<p>In Eclipse, open project properties, add a new builder, put under &#8220;location&#8221; the path to the minimizer script. Working directory should contain the yuucompressor-2.4.2.jar file and give it as argument the current resource using Eclipse&#8217;s variables: ${resource_loc}.</p>
<p>Make sure that &#8220;The selected resource&#8221; is checked in the &#8220;Refresh tab&#8221; and that &#8220;During auto builds&#8221; is checked in the &#8220;Build Options&#8221; tab.</p>
<p>Save your new builder and make sure that &#8220;Build Automatically&#8221; is checked in the &#8220;Project&#8221; menu and voilà!</p>
]]></content:encoded>
			<wfw:commentRss>http://nicolas.debarnot.com/2009/12/minimizing-javascript-and-css-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

