How to change the URL of a Subversion repository
Thu Jul 29 15:50:55 UTC 2010
If you have changed the URL of a Subversion repository and want to adjust your local copy to continue working as before, then execute the command:
Useful tips on PHP streams
Tue Jun 22 14:56:39 UTC 2010
PHP is a rich language with some features not very popular but extremely useful, like the underlying streams architecture.
Almost all the PHP functions that expect a file, can also accept a URL or stream.
How this can be useful?
Let's say you want to construct a SoapClient in PHP against a regular file containing your WSDL:
$soapClient = new SoapClient('MyService.wsdl');
That will work without problems, but what would happens if you want to construct the same WebService against a string with the exactly content of the MyService.wsdl file?
$content = '';
$soapClient = new SoapClient($content);
That will cause an error because the constructor of this class only accept a file or stream as a parameter.
The solution is to wrap the string into a data stream, in this way:
$soapClient = new SoapClient('data://text/plain;base64,' . base64_encode($content));
Another example can be found when using the PHPExcel library. This library creates spreadsheets and there is not (evident) option to save them to an output stream (stdout).
So, if you want to throw the image into the standard ouput instead of a file, you can invoke this method directly:
writer = new PHPExcel_Writer_Excel2007($excel);
$writer->save('php://output');
Hope you like this article and it has helped you to discover the amazing flexibility of the streams API in PHP.
Maven trick for bad programmers (skip tests)
Thu May 13 08:58:12 UTC 2010
A good programmer should never forget to test the code during and after the development phase, but if you are in a hurry you may find this line useful:
mvn -Dmaven.test.skip
Please don't say I told you this to anybody ;)
Remove BOM mark from files with VIM
Thu Mar 11 21:13:22 UTC 2010
Some evil editors add the BOM (Byte Order Mark) at the beginnig of the files you edit with them.
A new version of my personal blog
Sat Feb 27 15:34:27 UTC 2010
Welcome back old reader! This is a new version (third version actually) of my personal web site.