New year; fresh installs and stuff

Well a new year is here and with it I have some nice fresh dev tools to use.  PDT 2.0 was released on 29th December 2008 and is something I've been looking forward to as a keen PDT user for a while.  PDT 2.0 is much better with dynamic languages now that it's using the DLTK.  The intelligence and code completion on PHP/HTML/Javascript projects is a real leap forward although it can appear a little sluggish re-building the workspace. After switching to PDt 2.0 I also noticed that MacPortts 1.7 had been released.  I've been on MacPorts 1.6 for a while and there's been an on-going issue trying to install a couple of ports; logrotate for one.  It also sometimes had problems doing a PHP5/Apache2 install when you didn't want MySQL in the mix.   Thankfully MacPorts 1.7 fixes this and I decided to completely refresh my PHP5/Apache2 install on MacPorts from scratch.   I've now got a lovely clean PHP/Apache setup with XDebug, PHPYaz & Memcache.   Don't things always feel much better when you've installed them again from scratch?! To top it all off I swapped out the PC I have been running as  a Gentoo Linux server for the last few years.   My parents upgraded their PC after the hard drive died and I inherited a slightly newer, quieter machine to use as a server.   Gentoo has been my distro of since 2003 after previously dabbing with Slackware, Mandrake and RedHat.   I alwasys go through the minimal install to get exactly the setup I want – no universal install CD's here please!  The result is a lean, fast and rock-solid Linux server tailored perfectly to the hardware it's installed on. The final addition to the list is a new router to replace my aging Draytek Vigor 2600We – that didn't work out so well though.   I just knew deep down that I shouldn't have gone to PC World and chosen one.  I just knew that PC World would only sell your typical Belkin, Netgear or Linksys shite but I went and bought one anyway – a Belkin F5D8633-4, 802.11n-draft wireless ADSL modem/router with 4 port switch.  It's going back to PC World this weekend and I'm now back on my trusty Draytek until I decide to invest in a better replacement, probably another Draytek.  More about that in my next post.

Scriptaculous 'Draggable' in scrolling container ignores Position.includeScrollOffsets=true ?

UPDATEThis only happens when “ghosting” is set to true on the draggable – unfortunately, I need ghosting to be enabled on what I am doing… I've been chasing a problem round for about a day now and am convinced there is a problem in the latest version of Script.aculo.us (v 1.82) – I've created a test page to demonstrate it. The situation is when you have Draggable(s) inside a scrolling container element.  The scrolling element is of fixed size, it has the CSS 'overflow' properly set to either 'scroll' or 'auto' and there are elements inside it marked as being draggable – for example.
new Draggable(myDraggableElement, {ghosting:true, revert:true, scroll:'main'});
'main' is the ID of the scrolling container element around the Draggable(s). As soon as you scroll down in the scrolling container and start to drag a draggable, the draggable is off-set from the mouse pointer by an ever-increasing distance, depending on how far down you've scrolled the scroll bar. Now then, this all works fine when using a Sortable instread of a Draggable but you have to remember to use…
Position.includeScrollOffsets = true;
…before creating the Sortable. So, my question is, why does this not work for a Draggable when it works fine in the same instance for a Sortable? On looking through the code in Script.aculo.us it appears tha the Draggable code does not indeed honour the Position.includeScrollOffsets booleam – why?  Is this an oversight on their part? I've tried asking in the #prototype IRC channel – no luck.  I've posted to the Prototype & Script.aculo.us Google Group and had no replies at all (why don't people reply to difficult questions and forums are only full of n00b questions?!).   On doing a good Google search the closest I can find is this bug report on Rails Trac :-

Draggable does not include scroll offset when dragging in a scrollable container
When setting the scroll property in a draggable, it does not set Position.includeScrollOffsets to true. So, although the draggable is drawn correctly and scrolling occurs as expected, droppables within the scrolling container are not activated correctly.
This bug report sounds exactly like the bug I'm seeing.  It was opened 2 years ago, updated 1 year ago and still not resolved…WTF ?    There are two patches posted though but neither of these seem to solve the problem for me. Back to digging around in the code I guess and try to work out how it's intended to work.  I'm still investigating but will update more as and when I find anything…

PHP 5 & Apache 2 installation on OSX with MacPorts

Now that MacPorts 1.7.x is finally out I thought I'd re-new my MacPorts installation and document the installation procedure for a basic PHP 5 and Apache 2 setup.   Let me know if anything below fails but it worked fine for me today (20 December 2008).
Pre-requisites
Read the installing MacPorts guide and get all the pre-requisites installed, such as X11, X11User/SDK, XCode.
Steps
Install the MacPorts DMG for your specific version of Mac OSX.   In my instance I was using the Leopard installer.
sudo port -v selfupdate
sudo port install php5 +apache2
Go and find something to do for about an hour whilst the installation takes place… During the install you'll have noticed the following displayed in the output…
######################################################## # A startup item has been generated that will aid in # starting apache2 with launchd. It is disabled # by default. Execute the following command to start it, # and to cause it to launch at startup: # # sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist ########################################################
It's your choice if you want to execute that or not.  I don't personally like Apache2 automatically starting every time I boot my machine so I start and stop in manually.  If you want Apache2 to start whenever you boot then use the command above. At the end of the install log you'll have also noticed the following displayed…
If this is your first install, you might want cd /opt/local/apache2/modules /opt/local/apache2/bin/apxs -a -e -n “php5” libphp5.so
Ignore that for now, we need to do a couple of extra things first…
sudo cp /opt/local/etc/php.ini-recommended /opt/local/etc/php.ini
sudo cp /opt/local/apache2/conf/httpd.conf.sample /opt/local/apache2/conf/httpd.conf
Then we want to use the command mentioned above, but through sudo…
cd /opt/local/apache2/modules sudo /opt/local/apache2/bin/apxs -a -e -n “php5” libphp5.so
Add the following two lines to the end of /opt/local/apache2/conf/httpd.conf
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
Start Apache with…
sudo /opt/local/apache2/bin/apachectl start
Check it works by firing up your web browser and going to http://localhost.  You should see “It works!”. Create a file, phpinfo.php, in /opt/local/apache2/htdocs with the following content…
<?php phpinfo.php; ?>
Try to access it at http://localhost/phpinfo.php and hopefully it'll show you your PHP configuration within Apache.  If it does then everything is configured correctly, if not then retry the steps above!
Getting things to launch at boot time
If you want Apache and Memcache to load at boot time then use the following:-
sudo launchctl load -w /Library/LaunchDaemons/org.macports.memcached.plist sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
Optional installation bits
At work I use XDebug, PHPYaz and Memcache as well.  I'll document these some other time.