Labels

css (1) jQuery (7) linux (38) mac (70) php (29) python (1) svn/git (9) trac (4) ubuntu (1) virtualbox (6) vista (2) windows (14)

Monday, 29 November 2010

Enable nat port forwarding in vmware fusion 3

If you have nat networking on vmware fusion 3 and want to enable port forwarding you need to edit /Library/Application Support/VMware Fusion/vmnet8/nat.conf at the bottom you'll see two sections [incomingudp] and [incomingtcp]

To add a port forwarding under whichever section you require add

<remoteport> = <vm ip address>:<vm port>

i.e. 8888 = 192.168.78.134:80 will redirect all traffic from 8888 to the vm with ip 192.168.78.134 to port 80

Then restart vmware fusion networking by running /Library/Application\ Support/VMware\ Fusion/boot.sh --restart

How to enable remote syslogd in OSX 10.6

If you have an apple airport under the airport utitlity advanced pane you'll see a Logging and Statistics tab, there contains a Syslog Destination Address, which basically logs info about your airport to the machine specified by the ip address so you can view it in the console.

However! By default syslogd on a mac isn't listening to enable it you need to edit /System/Library/LaunchDaemons/com.apple.syslogd.plist at the bottom you'll see "Un-comment the following lines to enable the network syslog protocol listener." so do what it says, then either reboot or run 
launchctl
unload /System/Library/LaunchDaemons/com.apple.syslogd.plist 
load /System/Library/LaunchDaemons/com.apple.syslogd.plist 
exit

That'll enable the remote syslog feature and you'll get messages like 

28/11/2010 18:29:26 <AIRPORTIP> <AIRPORTNAME> natpmp[-1] Debug Public address reported as <YOURIP> to <CLIENT>:5353

Tuesday, 23 November 2010

PHP namespaces and exceptions

If you are converting all php errors to exceptions or dealing with other exceptions via a try catch statement you must put the path to the namespace in the exception.

I.e.

<?php
namespace MyNameSpace;

try
{
//some code that causes an exception
}
catch (\Exception $e)
{

}
?>

If you don't add the \ it won't be caught.

Thanks to this blog for pointing it out http://onehackoranother.com/logfile/2009/01/php-5-3-exception-gotcha