Dec 1 2008

I’m really growing to love Eclipse (specifically PHP Development Tools, the PHP extension for it), and how versatile and useful a work environment it is. It really does have everything, and it really helps you get on with what you need to do, when you’re not blogging that is… Now I know why developers have been raving about Eclipse all this time.

One thing I learned today is the huge importance of Perspectives and Views in Eclipse. When Kelvin first said “right, stop using PhpEd, and use this Eclipse thing”, I was overwhelmed by the feature-richness, and my knee-jerk reaction was to just set it up as close to the way I used PhpEd. Thats the first mistake I made, because although I got it close, I missed out on all the glorious features I could’ve been using.

Our Eclipse configuration at work uses Eclipse, PDT, Mylyn, SVN and CollabNet - which integrates wonderfully into our Sourceforge 5.0 server. Mylyn and CollabNet allow task management and allows me to work on Sourceforge artefacts within the Eclipse environment. A rather cool feature is contexts, which allow me to basically attach a list of files to the SF artefact, and when I activate the task in my Task List (note, not “Tasks”, “Task Lists”, a part of Mylyn), it opens all the files I was working on.

Because of our heavy reliance on SourceForge (everything we do has an associated artefact), it makes sense to make use of the CollabNet perspective. If I want to go into “task management mode”, i.e. line up a load of work that has been assigned to me, I switch to the CollabNet perspective. I open an artefact from my assigned artefacts list in the CollabNet view, and it automatically adds it to my Mylyn Task list. I can then say “right, I’m working on this one”, and click a little blob which turns blue, and then I’m working on it. If I’ve been previously working on it, and I attached the context, it automatically opens the files I was working on.

This was meant to be a short homage to Eclipse, but has turned into a little rant, but now that Kelvin set up the SVN repository on Friday properly, we’re actually FINALLY using source control, after the months of me (and Chris) nagging him to get it set up. It’s a little step, but we’re working on the same checkout at the moment, but eventually all that will change. I’ll start bugging him for that soon…

Anyway, if you’re a PHP developer, on a Mac, Windows or Linux, and you’re not using Eclipse PDT yet, I strongly suggest you do so. It’ll make your productivity increase hugely - it did mine!

Nov 27 2008

I had a handy mechanism working on my old old CVS server, and I’ve been using it for some time on my current SVN server.

Basically, whenever you commit a file to the repository, if you have a checked out workspace on the same server, then it will automatically update to the latest revision of the checked out branch or trunk. It’s handy so you don’t have to “svn up” every time you make a change, especially if you’re making lots of tiny changes.

This guide was original from Marc Grabanski’s blog, so 99% of credit goes to him.

cd /svnroot/hooks/
cp post-commit.tmpl post-commit
chmod +x post-commit

You can make a little program to update all your SVN repositories, so nano svnupdate.c:

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
 
int main(void)
{
  execl(
    "/usr/bin/svn",
    "svn",
    "update",
    "/path/to/mywebsite1.co.uk/www/",
    "/path/to/mywebsite2.co.uk/www/",
    "/path/to/mywebsite3.co.uk/www/",
    (const char *) NULL);
  return(EXIT_FAILURE);
}

You can add as many paths as you like there, just copy and paste the line and edit the path to your needs. You need to then compile it, test it.

gcc -o svnupdate svnupdate.c
env - ./svnupdate

Nano your post-commit file and add in the FULL path to your svnupdate program:

/path/to/svnroot/hooks/svnupdate

Oct 21 2008

I’ve managed to set up a Subversion repository on my 1and1.co.uk hosting now, and even got it working directly from eclipse. This may or may not work on other shared hosts. It was pretty simple, and here’s how I did it:

  • Use PuTTY to connect to your server
  • If you haven’t already got Subversion (type “svn” to check), follow this guide to install it.
  • Set up an SVN repository:
svnadmin create [repository name]
  • Import your existing files:
svn import name-of-folder file:///path/to/repos -m 'First Import'

That’s the repository set up, now to set up Eclipse PDT.

  • You need an SSH client for this - I use TortoisePlink which is built into TortoiseSVN. You can either go down the private key route and have password-less SSH logon, or alternatively the simpler (and much less secure) way is to include the -pw option on TortoisePlink. If you are not concerned about security, then do this. If not, there are plenty of guides on setting up a password-less SSH logon.
  • Open the Subversion config (on Vista, that is C:\Users\[username]\AppData\Roaming\Subversion\config) and in the [tunnels] section, add this line:
ssh = C:/Program Files/TortoiseSVN/bin/TortoisePlink.exe -pw [your-password]
  • Once you’ve done that, right click the PHP Explorer, select Import. In the SVN folder, select “Checkout Projects from SVN”.
  • The URL to your SVN repository should be:
svn+ssh://[1and1-username]@[hostname]/[full-path-to-repository]
  • You can find the full path by typing navigating to the repository directory in PuTTY, and typing “pwd” if you don’t already know.
  • For 1and1, I just use the default website (sNNNNNN.websitehome.co.uk) rather than any of my domains, but I expect it would work with any of the domains you have set up with the destination as your home directory.
  • Clicking next should load up the list of folders in the repository and you can select one, or the entire repository to checkout.
  • Change any options you want changed, and then Finish to import it. You should now see a new (or existing project if you already had one) project in your PHP Explorer, ready for you to use with Subversion enabled.

This list is the steps that I took to do this, and I sourced my information from these various places. This should hopefully help anyone get through the problems of setting up a repository on 1and1 who uses Eclipse PDT.

Sep 15 2008

Here at Netbasic we’ve been using PhpEd for some time, but recently we’ve taken the move to Eclipse, using the PHP Development Tools (PDT) plug-in. It certainly doesn’t lack features (due to the entirely pluggable design), and isn’t bad looking. Takes some getting used to, as moving development environments does for anyone, but I’m mostly used to it now. The CollabNet plugin is handy, and allows us to connect to our SourceForge 5.0 install directly from Eclipse, as well as having Subversion etc.. Generally, it’s the same as PhpEd anyway, but free-er under the Eclipse Public License (EPL).

Jan 10 2008

The fact that the company I work for uses SourceSafe is really beginning to piss me off. I think I’m not the only one, but just take a look at this article:

http://www.highprogrammer.com/alan/windev/sourcesafe.html

Read the rest of this entry »