Eclipse PDT – code assist or PHP Manual not working

If you are new to Eclipse PDT and find that code assist or the PHP Manual (Shift+F2 or Open PHP Manual) are not working for a particular project, check that you have a file named .buildpath in the root of your project.

If there is nothing there, try creating a new project (File / New / PHP Project) grab the file from there and copy it into your existing project.

Alternatively just paste in the following:
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath>

MySQL Transactions will automatically rollback if not committed

Just a quick note on this one, because although it seems obvious, I couldn’t find this explicitly mentioned anywhere in the MySQL manual entry for transaction syntax.

However if you issue an SQL ‘START TRANSACTION’ statement, anything you do after that will not affect the tables unless the ‘COMMIT’ statement is issued (assuming they are InnoDB tables). This is great because if your server crashed or you lost your connection to it, your data is protected.

Here’s an article from weberdev.com with more information: Using transactions in MySQL

Finding top level directory sizes with Linux

If you need to find out where the hard drive space on your Linux server has been taken up, here is a suggestion.

From the root directory if you use:

sudo du -h

You get an unmanageably long list of all the subdirectories on your system.
If you direct the output to a file however, you can use egrep to provide a useful summary, just showing the totals for the top level directories:

sudo du -h > ~/dirsize.txt
egrep ‘^[0-9.MKG]+[[:space:]]+./[a-z]+$’ dirsize.txt

Consuming a web reference in a class library with C# and .NET 3.5

Since .NET 3.5 you can’t add a web reference to a class library project, so how can you access web services?

Actually it is much easier.

  1. Right click the Class Library project and select Add Service Reference…
  2. Add the URL of the Web Service and click Go
  3. Give it a meaningful Namespace then click OK

Visual Studio will add a Service References folder and a system.serviceModel to the app.config file.

To invoke methods of the web service, first you create an instance of the SoapClient class then just use that object:

MyService.WebService1SoapClient myClient = new MyService.WebService1SoapClient();

In my example above MyService is the Namespace I used in the Add Service Reference dialog.

That is all there is to it.