AliGrant.com
 
Valid XHTML 1.0!

Valid CSS!

Powered by PHP

Get FireFox

1&1 Internet


Archived News

Convert URLs to links automatically with PHPFriday 20th July 2012
Lots of blogs and things about this kicking around - many complicated, many just don't work. This seemed to do the trick for me:


public static function ParseURL($text) {
$text = preg_replace('`www.S+`', 'http://{0}', $text);
$text = preg_replace('`[a-z]{3,6}://S+.S*`', '<a href="$0" rel="nofollow">$0</a>', $text);
return $text;
}

public static function ParseEmail($text) {
return preg_replace('`[w.-]+@w+[w.-]*?.w{1,4}`im', '<a href="mailto:$0">$0</a>', $text);
}


PHP: PDT vs ZendTuesday 10th July 2012
I've used Zend Studio for years, but don't use most of it's features - PDT is a freebee plugin shipped with Eclipse (which Zend is built on) that offers the basic functionality.

There is a comparison on the Zend web-site, which seems a little misleading.

As I don't work on huge projects (and generally use naming conventions) I have no need for automatic re-factoring, so I can't comment on that.

The rest seems fine - Syntax highlighting, code hinting and PHP Docs. The only thing I've encountered so far is the code formatter is not customisable with PDT. Fortunately, somebody has written a plugin that gives us all that lovely functionality and it can be found here:
I'm a big user of the Smarty template engine, something that I wish Zend Studio would support - but again, there is a freebee plugin that provides basic syntax highlighting (no hinting I'm afraid) which works with both PDT and Zend:


Git!Friday 6th July 2012
No, not you, the version control software.

Professionally, I deal with Microsoft's offerings - personally I opted for SVN. The latter is a nightmare to use - I'm not so fed up with it I figure I'd try the current darling of the version control world, Git.

It has taken longer than I had hoped to setup. While Git is decentralised, I very definitely work in a commit to server process. So I setup Git on my openSUSE server (easy) - but I often work remotely and want to be able to access this repository over HTTPS.

This can be done easily with Apache as a web-server, but there are some configuration gotchas:
Whilst my server is Linux, my workstations are all mostly Windows. And whilst I'm happy with a CLI for running a server, I feel for merging and viewing version tress a GUI is needed. GitHub provide the most swish looking, so based on nothing apart from slick looks, I went with this. Whist it's designed for repositories on GitHub, you can use other repos:
Then I have the issue of sometimes having to go through an authenticating proxy server...
This partially worked, but most git commands hung/froze. This turned out to be due to my use of CNTLM to handle proxy authentication - and for some reason the openSUSE version is 0.35 where the latest is 0.92. An update to 0.92.3 fixed the issue:
Finally everything seems to be working, I now have to move some projects over to it and see if it's less hassle.


Previous Next