<?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>Thijs Lensselink&#039;s Blog &#187; Project</title>
	<atom:link href="http://lenss.nl/tag/project/feed/" rel="self" type="application/rss+xml" />
	<link>http://lenss.nl</link>
	<description>Webdevelopment and stuff...</description>
	<lastBuildDate>Thu, 26 Apr 2012 21:48:12 +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>VIM for a PHP developer</title>
		<link>http://lenss.nl/2011/04/vim-for-a-php-developer/</link>
		<comments>http://lenss.nl/2011/04/vim-for-a-php-developer/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 20:04:28 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[syntax]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=1208</guid>
		<description><![CDATA[For my coding work i mostly use Zend Studio. And i am a big fan of this IDE. But i also do a lot of work in the shell. And that asks for at least basic vim knowledge. My colleague is a big vim fan. And does most of his work in vim. So last [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vim.org/" target="_blank"><img src="http://lenss.nl/wp-content/uploads/2011/04/vim_logo.png" alt="" title="vim_logo" width="80" height="80" class="alignleft size-full wp-image-1222" style="float:left;margin:10px;" /></a>For my coding work i mostly use <a href="http://www.zend.com/en/products/studio/">Zend Studio</a>. And i am a big fan of this IDE. But i also do a lot of work in the shell. And that asks for at least basic <a href="http://www.vim.org/">vim</a> knowledge. My colleague is a big vim fan. And does most of his work in vim. So last week i was compiling a cheat-sheet for my self. And came across a <a href="http://www.slideshare.net/ZendCon/vim-for-php-programmers-presentation">slideshow</a> of one of <a href="http://zmievski.org/">Andrei Zmievski</a>&#8216;s talks. This slide show got me inspired enough to start playing around with vim a bit. And this is the result of it.</p>
<p>We need to have vim installed of course.</p>
<blockquote><p>$ sudo aptitude install vim</p></blockquote>
<p>Vim doesn&#8217;t seem to create the user folder automatically. So we need to create these our self. We&#8217;ll start off with a folder for plugins, color schemes and syntax settings.</p>
<blockquote><p>$ mkdir ~/.vim<br />
$ mkdir ~/.vim/{syntax,colors,plugin}</p></blockquote>
<p>Most of the time i will be editing <strong>.php</strong> files. So i want some good syntax support for that. Vim has a nice plugin system. And there does seem to be a syntax file for PHP <a href="http://www.vim.org/scripts/script.php?script_id=1571">available</a>. It&#8217;s a bit outdated. But will do for now. The only thing to do to enable it is copy it to the plugin directory.</p>
<blockquote><p>$ mv php.vim ~/.vim/syntax</p></blockquote>
<p>Now we have a very powerful but basic PHP editor. That&#8217;s nice and all. I would like to at least have some sort of a project manager. And there is a plugin for that as well. <a href="http://www.vim.org/scripts/script.php?script_id=69">Download</a> &#038; copy!</p>
<blockquote><p>$ mv project.vim ~/.vim/plugin</p></blockquote>
<p>Ok that&#8217;s pretty cool. But it still looks like crap. Time for some theme sugar. It actually took me quite some time to find a theme i like. Guess i am picky. The theme / colour scheme i settled for is called wombat. The <a href="http://dengmao.wordpress.com/2007/01/22/vim-color-scheme-wombat/">original</a> file didn&#8217;t do much for me. But i found a <a href="http://www.vim.org/scripts/script.php?script_id=2465">good</a> 256 colour version.</p>
<blockquote><p>$ mv wombat256mod.vim ~/.vim/colors</p></blockquote>
<p><a href="http://lenss.nl/wp-content/uploads/2011/04/wombat-html.png"><img src="http://lenss.nl/wp-content/uploads/2011/04/wombat-html-300x60.png" alt="" title="wombat-html" width="300" height="60" class="alignleft size-medium wp-image-1215" /></a></p>
<p><a href="http://lenss.nl/wp-content/uploads/2011/04/wombat-php.png"><img src="http://lenss.nl/wp-content/uploads/2011/04/wombat-php-300x128.png" alt="" title="wombat-php" width="300" height="128" class="alignleft size-medium wp-image-1216" /></a></p>
<p>That&#8217;s starting to look like a pretty nice setup. Time to make some settings permanent and to enable some other features.</p>
<blockquote><p>$ vim ~/.vimrc</p></blockquote>
<p>And add some settings</p>
<blockquote><p>
set rule<br />
set wrapscan<br />
set number<br />
set backspace=start,indent,eol</p>
<p>set t_Co=256<br />
colorscheme wombat256mod</p>
<p>autocmd FileType php set omnifunc=phpcomplete#CompletePHP
</p></blockquote>
<p>In the meantime i found this interesting post on Matthew Weier O&#8217;Phinney&#8217;s blog about using <a href="http://weierophinney.net/matthew/archives/134-exuberant-ctags-with-PHP-in-Vim.html">ctags , VIM and PHP</a>. That looks like interesting stuff. So let&#8217;s add it. With <a href="http://ctags.sourceforge.net/">ctags</a> it&#8217;s possible to scan a source tree. And compile a sort of index file that vim can use for lookups. </p>
<blockquote><p>$ sudo aptitude install exuberant-ctags<br />
$ mkdir ~/.vim/tags</p></blockquote>
<p>Creating an index file is a piece of cake. Move to a source directory and issue the following command.</p>
<blockquote><p>$ cd /some/path<br />
$ ctags-exuberant -R -f ~/.vim/tags/filename -h &#8220;.php&#8221;<br />
&#8211;exclude=&#8221;.svn&#8221; &#8211;totals=yes<br />
&#8211;tag-relative=yes &#8211;PHP-kinds=+cf<br />
&#8211;regex-PHP=&#8217;/abstract class ([^ ]*)/\1/c/&#8217;<br />
&#8211;regex-PHP=&#8217;/interface ([^ ]*)/\1/c/&#8217;<br />
&#8211;regex-PHP=&#8217;/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/&#8217;</p></blockquote>
<p>This will scan the whole directory structure recursively while using the regular expressions to extract useful information from the source files it finds. When done and when the parameter <em>&#8211;totals=yes</em> is used the following output is displayed. But probably with different numbers.</p>
<blockquote><p>2375 files, 466018 lines (14628 kB) scanned in 11.7 seconds (1246 kB/s)<br />
199296 tags added to tag file<br />
199296 tags sorted in 0.00 seconds</p></blockquote>
<p>Time to enable tags. I want to use multiple files. Some standard files for common frameworks / libraries. And a tag file per project.</p>
<blockquote><p>$ vim ~/.vimrc<br />
set tags=tags;~/.vim/tags/filename</p></blockquote>
<p>So let&#8217;s start vim and have a look at what we have so far. The first thing we do when vim has started is launch the :Project plugin.</p>
<blockquote><p>$ vim<br />
:Project</p></blockquote>
<p><a href="http://lenss.nl/wp-content/uploads/2011/04/vim-project-1.png"><img src="http://lenss.nl/wp-content/uploads/2011/04/vim-project-1-300x175.png" alt="" title="vim-project-1" width="300" height="175" class="alignleft size-medium wp-image-1219" /></a></p>
<p><a href="http://lenss.nl/wp-content/uploads/2011/04/vim-project-2.png"><img src="http://lenss.nl/wp-content/uploads/2011/04/vim-project-2-300x174.png" alt="" title="vim-project-2" width="300" height="174" class="alignleft size-medium wp-image-1220" /></a></p>
<p>The project plugin took some time to get used to. But it&#8217;s a very convenient plugin. And easy to get the hang of. It&#8217;s possible to create the project settings by hand. But the plugin comes with a build in tool for this. While in <em>:Project</em> mode and hitting <em>\C</em> will make it easy to create new projects.</p>
<blockquote><p>$ vim<br />
:Project<br />
\C</p></blockquote>
<p>This will guide you through the process with a few short and simple questions.</p>
<blockquote><p>Enter the Name of the Entry: [ project name ]<br />
Enter the Absolute Directory to Load: [ absolute path ]<br />
Enter the CD parameter: [ path to move into ]<br />
Enter the File Filter: [ file filter : *.php ]</p></blockquote>
<p>When that&#8217;s done the screen will be in edit mode inside the .vimproject file. Displaying something like this.</p>
<blockquote><p>
Project name=/path/to/project CD=/path/to/project filter=&#8221;*.php&#8221; {<br />
  filename.ext<br />
  folder&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
}</p></blockquote>
<p>It&#8217;s possible to alter the project setup here. Like adding more files. Or even adding files from other locations outside of the project.</p>
<blockquote><p>Project name=/path/to/project CD=/path/to/project filter=&#8221;*.php&#8221; {<br />
  filename.ext<br />
  folder&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>  External=/some/other/path CD=/some/other/path filter=&#8221;*.php&#8221; {<br />
    filename.ext<br />
  }<br />
}</p></blockquote>
<p>When done editing. Just do like normally in vim.</p>
<blockquote><p>:w</p></blockquote>
<p>Pretty cool we have a project browser on the left. That is easy to navigate with the arrow keys. And a work canvas on the right.</p>
<p>Time to test the ctags created index files. Place the cursor at the beginning of a string that you want to lookup. And hit <strong>CTRL + ]</strong> and <strong>CTRL + T</strong> to get back. Another cool way to open the source file is by using horizontal split windows by using <strong>CTRL + W ]</strong>.</p>
<p>Testing auto-complete is just as easy. Type some php core function name partly <em>str_</em> and hit <strong>CTRL + x</strong> and <strong>CTRL + o</strong>. This will display the following scrollable drop down..</p>
<p><a href="http://lenss.nl/wp-content/uploads/2011/04/vim-autocomplete.png"><img src="http://lenss.nl/wp-content/uploads/2011/04/vim-autocomplete-300x134.png" alt="" title="vim-autocomplete" width="300" height="134" class="alignleft size-medium wp-image-1212" /></a></p>
<p>That&#8217;s about it. I had good fun exploring all the features and possibilities. And have only scratched the surface. One more thing i found on Matthew&#8217;s blog was a way to test and run PHP script from vim. Awesome stuff. You can read about it <a href="http://weierophinney.net/matthew/archives/164-Vim-Productivity-Tips-for-PHP-Developers.html">here</a>. Although i like vim. I don&#8217;t think i will be leaving ZS any time soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2011/04/vim-for-a-php-developer/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>SVN repository and project structure</title>
		<link>http://lenss.nl/2008/08/svn-repository-and-project-structure/</link>
		<comments>http://lenss.nl/2008/08/svn-repository-and-project-structure/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 09:54:06 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[Structure]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://lenss.nl/blog/?p=109</guid>
		<description><![CDATA[When i first started out as a web developer. i didn&#8217;t really mind about structure. Almost every project had different directory structure. And namespaces i never heard off. I noticed that the longer i write code. The more I&#8217;m looking for a basic structure to start from. This can be the structure of a web [...]]]></description>
			<content:encoded><![CDATA[<p>When i first started out as a web developer. i didn&#8217;t really mind about structure. Almost every project had different directory structure. And <a href="http://en.wikipedia.org/wiki/Namespace">namespaces</a> i never heard off. I noticed that the longer i write code. The more I&#8217;m looking for a basic structure to start from. This can be the structure of a web application / site. but also the structure inside the <a href="http://subversion.tigris.org/">SVN</a> repository.</p>
<p>So today i took a bit of time to think about a good structure for our new SVN repository here at the office. After a bit of browsing the web. Looking at other proposals. And looking around our old SVN repository. I came up with a new structure.</p>
<p>Our SVN repository will start off with three directories.</p>
<blockquote><p>
&#8211; Development<br />
&#8211; Design<br />
&#8211; ??
</p></blockquote>
<p>The Development directory is what i will be talking about. I can&#8217;t talk for the designers. Because.. well i&#8217;m not one of them. Although i did a lot of design work in the past. The ?? directory is for another part of our department. So let&#8217;s see what i came up with.</p>
<p>Inside the Development directory we start of with two directories.</p>
<blockquote><p>
&#8211; Projects<br />
&#8211; Library
</p></blockquote>
<p><strong>Projects:</strong><br />
This directory will contain all projects. With projects i mean web applications / sites. All these projects will adhere to a basic structure. Which i will talk about a bit later. Besides the same basic structure. Every projects has the trunk, tags and branches sub directories. If a project contains &#8220;sub&#8221; projects. The trunk, tags and branches will shift one level deeper in the tree. Below is a small example.</p>
<blockquote><p>
&#8211; Project_1<br />
&#8212;- trunk<br />
&#8212;- tags<br />
&#8212;- branches<br />
&#8211; Project_2<br />
&#8212;- www<br />
&#8212;&#8212; trunk<br />
&#8212;&#8212; tags<br />
&#8212;&#8212; branches<br />
&#8212;- intranet<br />
&#8212;&#8212; trunk<br />
&#8212;&#8212; tags<br />
&#8212;&#8212; branches
</p></blockquote>
<p><strong>Library:</strong><br />
The library directory will contain all shared libraries. This can be third party libraries or internally developed libraries that will be used in multiple applications. Below is a small example. I&#8217;m not sure about the trunk, tags, branches directories yet. For the internally developed libraries we will implement this structure. For the third party libraries we won&#8217;t. I think :)</p>
<blockquote><p>
&#8211; Zend<br />
&#8211; DB<br />
&#8212;- trunk<br />
&#8212;- tags<br />
&#8212;- branches
</p></blockquote>
<p>Now this will cover most of the project parts. What&#8217;s left now is defining a basic structure for the projects that will ive inside the repository and on the web servers. For a basic structure i&#8217;m inspired by the layout of an <a href="http://framework.zend.com">Zend Framework</a> <a href="http://nl.wikipedia.org/wiki/Model-View-Controller-model">MVC</a> style project. Why? i already work with this structure for a while now. outside and inside the Zend Framework projects. It separates the code from the views / templates. It makes sure the code is outside the web root. And it just looks clean.</p>
<p>So for our projects i came up with this structure.</p>
<p>The structure really consists of three parts. The first is &#8220;public&#8221;. This directory contains all data that should be globally accessible. We can think about images, stylesheetes, javascript libraries, etc.</p>
<blockquote><p>
&#8211; public<br />
&#8212;- images<br />
&#8212;- css<br />
&#8212;- scripts<br />
&#8212;- index.*
</p></blockquote>
<p>The application directory contains all the real code and views / templates. All views / templates will be stored in the views directory. All project specific code will be placed in the library directory. And if the project is MVC based. It will use the controllers directory to store the application controllers.</p>
<blockquote><p>
&#8211; application<br />
&#8212;- controllers<br />
&#8212;- library<br />
&#8212;- views
</p></blockquote>
<p>The final part of the structure is a collection of directories that can but are not always used in a project. </p>
<p>The logs directory can be handy for logging data of the application. But can also be used to store php error logs or maybe even Apache logs. The cache directory is there to store cached files. The structure inside this directory will depend on the cache mechanism used in the project. The files directory contains files that are somehow linked to the project but have no place in any other directories. Some test scripts or tools can be placed there. And last but not least the docs directory. Which will contain all project documentation.</p>
<blockquote><p>
&#8211; logs<br />
&#8211; cache<br />
&#8211; files<br />
&#8211; docs
</p></blockquote>
<p>I wanted to post this yesterday. But i just couldn&#8217;t find any time for it. Yesterday i showed the initial proposal to the rest of the team. But we didn&#8217;t decide yet. What the final structure will be.</p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2008/08/svn-repository-and-project-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
