<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- generator="FeedCreator 1.7.2-ppt (info@mypapit.net)" -->
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="">
        <title>KevBaldwyn</title>
        <description>KevBaldwyn - Latest Content</description>
        <link>www.kevbaldwyn.co.uk</link>
       <dc:date>2011-10-24T11:32:26+01:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2010/08/rewriting-multiple-domains-to-one-domain-with--htaccess/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2010/08/get-the-number-of-days-between-2-dates-with-php/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2010/09/flushing-the-dns-cache-on-mac-osx/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2010/09/how-to-find-the-longitude-and-latitude-for-a-postcode-or-town-name-using-php-and-the-google-maps-api/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2010/09/find-the-distance-between-2-locations-on-a-map-with-php/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2010/09/find-and-replace-html-links-with-php/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2010/10/uploading-large-files-with-php/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2010/10/intercept-and-re-route-emails-with-a-swift-mailer-php-plugin/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2010/10/detecting-if-the-mouse-is-over-a-movieclip-in-flash-actionscript-3/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2010/12/php-resize-images-with-imagemagick-or-the-gd-library/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2011/01/using-postmark-to-send-emails-with-swiftmailer/"/>
                <rdf:li rdf:resource="www.kevbaldwyn.co.uk/code/2011/03/image-and-resource-caching-with-htaccess/"/>
            </rdf:Seq>
        </items>
    </channel>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2010/08/rewriting-multiple-domains-to-one-domain-with--htaccess/">
        <dc:format>text/html</dc:format>
        <dc:date>2010-08-01T22:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>Rewriting multiple domains to one domain with .htaccess</title>
        <link>www.kevbaldwyn.co.uk/code/2010/08/rewriting-multiple-domains-to-one-domain-with--htaccess/</link>
        <description>&lt;p&gt;If you are running a website with more than one domain ie; www.example.com and www.example.co.uk, then you are probably aware that if you don't have all your domains resolving to one host only then you can suffer from a duplicate content penalty, where the ranking for your webpages is split across multiple domains.&lt;/p&gt;&lt;p&gt; The more common problem though is when you have http://www.example.com and http://example.com both resolving to the same place. Even though they are the same domain, google does treat them as separate entities.&lt;/p&gt;
&lt;p&gt;I find this useful also when dealing with flash movies that are requesting content from a php script for example, with everything resolving to the same host you don't need to worry about crossdomain.xml policy files.&lt;/p&gt;
&lt;p&gt;The following couple of lines in your .htaccess file will resolve any of these issues.&lt;/p&gt;
&lt;pre&gt;
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
&lt;/pre&gt;
&lt;p&gt;This ensures that any paths that do not start with http://www.example.com will redirect with a &lt;a class=&quot;external&quot; href=&quot;http://en.wikipedia.org/wiki/HTTP_301&quot;&gt;301 http status code&lt;/a&gt; to http://www.example.com&lt;/p&gt;
&lt;p&gt;Be sure to choose how you want your domain to resolve, for example if you wanted everything to resolve to http://example.com instead of http://www.example.com then use this:&lt;/p&gt;
&lt;pre&gt;
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
&lt;/pre&gt;</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2010/08/get-the-number-of-days-between-2-dates-with-php/">
        <dc:format>text/html</dc:format>
        <dc:date>2010-08-09T22:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>Get the number of days between 2 dates with php</title>
        <link>www.kevbaldwyn.co.uk/code/2010/08/get-the-number-of-days-between-2-dates-with-php/</link>
        <description>&lt;p&gt;To get the number of days between 2 dates try this.&lt;/p&gt;

&lt;pre lang=&quot;php&quot;&gt;

function differenceInDays($startDate, $endDate) {
	$dateDiff = strtotime($endDate) - strtotime($startDate);
	return floor($dateDiff/(60*60*24));
}

&lt;/pre&gt;

&lt;p&gt;This could easily be extended to get the number of weeks, minutes, years or whatever.&lt;/p&gt;</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2010/09/flushing-the-dns-cache-on-mac-osx/">
        <dc:format>text/html</dc:format>
        <dc:date>2010-09-06T22:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>Flushing the DNS cache on Mac OSX</title>
        <link>www.kevbaldwyn.co.uk/code/2010/09/flushing-the-dns-cache-on-mac-osx/</link>
        <description>&lt;p&gt;To flush the DNS cache on a Mac (OS X 10.6) I use this from a terminal window:&lt;/p&gt;
&lt;pre&gt;dscacheutil -flushcache&lt;/pre&gt;
&lt;p&gt;It's a handy trick when your Mac isn't displaying correctly the new site you have just uploaded.&lt;/p&gt;</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2010/09/how-to-find-the-longitude-and-latitude-for-a-postcode-or-town-name-using-php-and-the-google-maps-api/">
        <dc:format>text/html</dc:format>
        <dc:date>2010-09-09T22:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>How to find the longitude and latitude for a postcode or town name using php and the google maps api</title>
        <link>www.kevbaldwyn.co.uk/code/2010/09/how-to-find-the-longitude-and-latitude-for-a-postcode-or-town-name-using-php-and-the-google-maps-api/</link>
        <description>&lt;p&gt;I've been playing around with the google maps api and various location based things recently, and one thing I needed to do was convert a location (specifically a UK postcode) to a longitude and latitude to plot on a google map. &lt;/p&gt;

&lt;p&gt;For this function to work the only thing you will need is a valid google map api key for the domain you are using this on. &lt;a class=&quot;external&quot; href=&quot;http://code.google.com/apis/maps/signup.html&quot;&gt;You can get one here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can throw a town name or a postcode at it and it should work. Give it try and see what results you get, a postcode should always work as there is only ever going to be one postcode, whereas there may be multiple towns with the same name, which may cause unexpected results.&lt;/p&gt;


&lt;pre lang=&quot;php&quot;&gt;

define('GOOGLE_MAP_API', 'your_key_here');

/**
  * get latitude and longitude from a postcode or town name
  * @param string $location poostcode or town name to convert
  * @return array
**/
function getLatLon($location) {
	
	$g_postcode = strtoupper(trim($location)); //for google query
	
	$googleURL  = 'http://www.google.com/uds/GlocalSearch?callback=google.search.LocalSearch.RawCompletion';
	$googleURL .= '&amp;context=0';
	$googleURL .= '&amp;q=' . urlencode($g_postcode . ', ') . 'UK';
	$googleURL .= '&amp;key=' . GOOGLE_MAP_API . '';
	$googleURL .= '&amp;v=1.0';
	
	// query the url ----------------
	$options = array(
		CURLOPT_RETURNTRANSFER =&gt; true,     // return web page
		CURLOPT_HEADER         =&gt; false,    // don't return headers
		CURLOPT_FOLLOWLOCATION =&gt; true,     // follow redirects
		CURLOPT_ENCODING       =&gt; &quot;&quot;,       // handle all encodings
		CURLOPT_USERAGENT      =&gt; &quot;spider&quot;, // who am i
		CURLOPT_AUTOREFERER    =&gt; true,     // set referer on redirect
		CURLOPT_CONNECTTIMEOUT =&gt; 120,      // timeout on connect
		CURLOPT_TIMEOUT        =&gt; 120,      // timeout on response
		CURLOPT_MAXREDIRS      =&gt; 10,       // stop after 10 redirects
	);

	$ch      = curl_init($googleURL);
	curl_setopt_array($ch, $options);
	$content = curl_exec($ch);
	$err     = curl_errno($ch);
	$errmsg  = curl_error($ch);
	$header  = curl_getinfo($ch);
	curl_close($ch);

	$header['errno']   = $err;
	$header['errmsg']  = $errmsg;
	$header['content'] = $content;
	
	// parse the results to retreive lat and long --------------
	if($header['errno'] == 0) {
		
		if(preg_match('/google.search.LocalSearch.RawCompletion\(\'0\',(.*), 200, null, 200\)/', $header['content'], $match)) {

			$ar = json_decode($match[1], true);

			return array('latitude' =&gt; $ar['viewport']['center']['lat'], 
						 'longitude' =&gt; $ar['viewport']['center']['lng']);
						 
		}else{
			die('Unable to parse result'); 
		}			 
	}else{
		die($header['errmsg']);
	}
}


&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Update&lt;/b&gt;:Thanks to Matt Broadley for spotting a typo in the return array - now fixed.&lt;/p&gt;</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2010/09/find-the-distance-between-2-locations-on-a-map-with-php/">
        <dc:format>text/html</dc:format>
        <dc:date>2010-09-20T22:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>Find the distance between 2 locations on a map with php</title>
        <link>www.kevbaldwyn.co.uk/code/2010/09/find-the-distance-between-2-locations-on-a-map-with-php/</link>
        <description>&lt;p&gt;Recently I needed to get the distance between 2 points (2 UK postcode's), here is a rundown of what I did. I started doing it in pure php then I needed to incorporate it into a SQL query so I could order a set of locations based on each location's distance from the same point, so both solutions are below.&lt;/p&gt;

&lt;h3&gt;Maths&lt;/h3&gt;
&lt;p&gt;Skip this bit if you just want the code.&lt;/p&gt;

&lt;p&gt;Think back to school and try and remember &lt;a class=&quot;external&quot; href=&quot;http://www.pythagorastheorem.co.uk/&quot;&gt;pythagoras and his theroem&lt;/a&gt; which states that:
&lt;span class=&quot;italic&quot;&gt;The square of a right angled triangle's hypotonuse is equal to the square of the sum of it's other sides squared&lt;/span&gt;...or something along those lines, better understood like this:&lt;/p&gt;
&lt;pre&gt;hypotonuse = sqrt(width x width + height x height)&lt;/pre&gt;

&lt;p&gt;Think of our 2 points as each end of the hypotonuse and things start to make sense.&lt;/p&gt;
&lt;p&gt;Once we convert our width and height values into longitude and latitude values then we can apply this to 2 points on a map and find the hypotonuse - or the distance between these 2 points.&lt;/p&gt;

&lt;p&gt;There is however one thing we must do first if we want accurate and useable results. First we must convert our latitudes and longitudes into a unit we can use (in this case miles) and secondly, to make our results that much more accurate, we should take into account the curvature of the earth.&lt;/p&gt;
&lt;pre&gt;x = 69.1 * (lat2 - lat1)
y = 69.1 * (lon2 - lon1) * cos(lat1/57.3) 
sqrt(x * x + y * y)&lt;/pre&gt;

&lt;p&gt;Now we have a formula we can apply it to some code.&lt;/p&gt;


&lt;h3&gt;php&lt;/h3&gt;
&lt;p&gt;Using pythagoras' simple equation we can simply map variables to the sides of the triangle and substitute the width and height for longitude and latitude values.&lt;/p&gt;
&lt;pre lang=&quot;php&quot;&gt;

/**
 * @param array $from an array containing 2 keys: 'latitude' and 'longitude'
 * @param array $to an array containing 2 keys: 'latitude' and 'longitude'
 * @return float
 */
function calculateDistance($from, $to) {
	$x = 69.1 * ($to['latitude'] - $from['latitude']);
	$y = 69.1 * ($to['longitude'] - $from['longitude']) * cos($from['latitude'] / 57.3);
	return sqrt(($x*$x) + ($y*$y));
}

&lt;/pre&gt;
&lt;p&gt;To use this its as simple as this:&lt;/p&gt;
&lt;pre lang=&quot;php&quot;&gt;

$fromLocation = array('longitude' =&gt; '',
		      'latitude'  =&gt; '');
$toLocation = array('longitude' =&gt; '',
		    'latitude'  =&gt; '');

$distance = calculateDistance($fromLocation, $toLocation);


&lt;/pre&gt;

&lt;h3&gt;sql&lt;/h3&gt;
&lt;p&gt;This is the solution I used for my query, I used some php to help with building the query just to make the code a little more maintainable. This is presuming you have the longitude and latitude values stored in a table and you are querying against those values with a longitude and latitude that you already know. I've written another &lt;a href=&quot;/code/2010/09/how-to-find-the-longitude-and-latitude-for-a-postcode-or-town-name-using-php-and-the-google-maps-api/&quot;&gt;function to get the longitude and latitude&lt;/a&gt; of a town or postcode using php.&lt;/p&gt;
&lt;pre lang=&quot;php&quot;&gt;

$x = &quot;(69.1 * (table.latitude - &quot; . $location['latitude'] . &quot;))&quot;;
$y = &quot;(69.1 * (table.longitude - &quot; . $location['longitude'] . &quot;) * &quot; . cos($location['latitude'] / 57.3) . &quot;)&quot;;
		
$distance = &quot;SQRT((&quot; . $x . &quot; * &quot; . $x . &quot;) + (&quot; . $y . &quot; * &quot; . $y . &quot;)) AS distance&quot;;

// We now add this into a query to return all results within a set distance of a point and order them by the distance from that point.
$query = &quot;SELECT table.*, &quot; . $distance . &quot;
	  FROM table
	  HAVING distance &lt;= 10 
	    ORDER BY distance ASC&quot;;


&lt;/pre&gt;

&lt;h3&gt;Notes&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;This is all set up to return results based on miles - if you want kilometers you will need to change all instances of 69.1 to 111&lt;/li&gt;
  &lt;li&gt;The calculation used to accomodate the curvature of the earth is better than nothing but if calculating large distances it may not be accurate enough and at that point you start to get into the realm of doubling float point numbers and more complicated maths which is beyond most needs (definitely mine).&lt;/li&gt;
  &lt;li&gt;If you missed it, &lt;a href=&quot;/code/2010/09/how-to-find-the-longitude-and-latitude-for-a-postcode-or-town-name-using-php-and-the-google-maps-api/&quot;&gt;here is how to get the longitude and latitude&lt;/a&gt; of a position using php and google maps&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2010/09/find-and-replace-html-links-with-php/">
        <dc:format>text/html</dc:format>
        <dc:date>2010-09-29T22:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>Find and replace html links with PHP</title>
        <link>www.kevbaldwyn.co.uk/code/2010/09/find-and-replace-html-links-with-php/</link>
        <description>&lt;p&gt;Here is a great function that I'm using in a handy string utility class. It takes a string of text (plain text or html) and finds any web addresses ie http://www.kevbaldwyn.co.uk/ and turns them into html links (&amp;lt;a&amp;gt; tags).&lt;/p&gt;
&lt;pre lang=&quot;php&quot;&gt;

function parseLinks($str) {
	return ereg_replace(&quot;[[:alpha:]]+://[^&lt;&gt;[:space:]]+[[:alnum:]/]&quot;,&quot;&lt;a href=\&quot;\\0\&quot;&gt;\\0&lt;/a&gt;&quot;, $str);
}

&lt;/pre&gt;
&lt;p&gt;Simples!&lt;/p&gt;</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2010/10/uploading-large-files-with-php/">
        <dc:format>text/html</dc:format>
        <dc:date>2010-10-14T22:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>Uploading large files with php</title>
        <link>www.kevbaldwyn.co.uk/code/2010/10/uploading-large-files-with-php/</link>
        <description>&lt;p&gt;I&amp;#39;m posting this as much for my own reference as much as anything as I&amp;#39;m always looking it up!&lt;/p&gt;
&lt;p&gt;The default &lt;a class=&quot;external&quot; href=&quot;http://uk2.php.net/manual/en/ini.core.php#ini.upload-max-filesize&quot;&gt;upload_max_filesize in php is 8MB&lt;/a&gt; and if you are dealing with uploading .pdf files or videos and any large files then I expect this won&amp;#39;t be enough. Place these few lines in an .htaccess file and you should be good to go (amend the values as you see fit).&lt;/p&gt;
&lt;pre&gt;
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200
&lt;/pre&gt;
</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2010/10/intercept-and-re-route-emails-with-a-swift-mailer-php-plugin/">
        <dc:format>text/html</dc:format>
        <dc:date>2010-10-21T22:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>Intercept and re-route emails with a Swift Mailer php plugin</title>
        <link>www.kevbaldwyn.co.uk/code/2010/10/intercept-and-re-route-emails-with-a-swift-mailer-php-plugin/</link>
        <description>&lt;p&gt;&lt;a class=&quot;external&quot; href=&quot;http://swiftmailer.org/&quot;&gt;Swift Mailer&lt;/a&gt; is a php library that automates and makes sending emails from php scripts a breeze. It is feature rich and in my opinion the best mail library available for php.&lt;/p&gt;
&lt;p&gt;One of the things I like about it is it's plugin architecture, it is simple to use and super simple to implement your own plugins. Swift Mailer comes packaged with a set of useful plugins however it was missing something that I have used in scripts previously, that is the ability to intercept emails before they are sent and send them to a different email address.&lt;/p&gt;
&lt;h3&gt;Background&lt;/h3&gt;
&lt;p&gt;The reason for doing this is simply a development and debugging process. I like to set my development environment up so I can route all emails that the eventual live site will send to a development address. That way as I'm testing I can register email addresses on the development site as realname@realwebsite.com, then when I test the site and an email gets fired off it will send to a &quot;debugging&quot; email address that I specify (eg. debug@mywebsite.com). Then when the site goes live I switch the debugging off so all emails will get sent to their relevant recipients.&lt;/p&gt;
&lt;p&gt;This is really useful if the site you are developing has lots of different users/emails that it needs to send, such as forums and notifications, or if the data you are using comes from a real source and you don't want to spam a set of real email addresses with your test emails.&lt;/p&gt;
&lt;h3&gt;Solution&lt;/h3&gt;
&lt;p&gt;With all this in mind the solution was simple - to write a Swift Mailer plugin. You can &lt;a href=&quot;{call:plugin.downloader.path(/app/plugins/thirdparty/Swift-4.0.6/lib/classes/Swift/Plugins/InterceptPlugin.php)}&quot;&gt;download the Intercept plugin here&lt;/a&gt;. To install you simply need to drop the file into your Swift plugins directory (&lt;b&gt;Swift-4.0.6/lib/Swift/Plugins/&lt;/b&gt;InterceptPlugin.php)&lt;/p&gt;
&lt;p&gt;To use it you just need to register the plugin and set the email address you want to route emails to instead of their original destination.&lt;/p&gt;

&lt;pre lang=&quot;php&quot;&gt;

// require the Swift library
require_once('Swift-4.0.6/lib/swift_required.php');

// create the message and all other options as you would normally
$message = Swift_Message::newInstance();

$message-&gt;setSubject('A message subject.');
$message-&gt;addPart('&lt;b&gt;The message&lt;/b&gt;', 'text/html');
$message-&gt;setBody('The message');

$message-&gt;setFrom(array('from@example.com' =&gt; 'From Address'));

$message-&gt;setTo(array('name@example.co.uk', 'different_name@anotherwebsite.com'));

$mailer = Swift_Mailer::newInstance(Swift_MailTransport::newInstance());


/**
 * here we register the plugin with a new instance of Swift_Plugins_InterceptPlugin 
 * the only parameter the constructor takes is the debugging email address
 *
 * this plugin MUST BE THE LAST plugin registered as it changes the 'to' field 
 * of the email so if you are using the decorator plugin for example it will 
 * disrupt the way that works and your emails won't be decorated properly. 
 */									
$mailer-&gt;registerPlugin(new Swift_Plugins_InterceptPlugin('debugging@example.com'));


// send as you would normally
$mailer-&gt;batchSend($message);

&lt;/pre&gt;
&lt;p&gt;Obviously a good idea would be to set up a switch within your own system that sets whether you use this plugin or not depending on if the code is being executed within a live or development environment.&lt;/p&gt;
&lt;h3&gt;Resources&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a class=&quot;external&quot; href=&quot;http://swiftmailer.org/&quot;&gt;Swift Mailer&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;{call:plugin.downloader.path(/app/plugins/thirdparty/Swift-4.0.6/lib/classes/Swift/Plugins/InterceptPlugin.php)}&quot;&gt;Download the Intercept Plugin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2010/10/detecting-if-the-mouse-is-over-a-movieclip-in-flash-actionscript-3/">
        <dc:format>text/html</dc:format>
        <dc:date>2010-10-21T22:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>Detecting if the mouse is over a movieclip in Flash actionscript 3</title>
        <link>www.kevbaldwyn.co.uk/code/2010/10/detecting-if-the-mouse-is-over-a-movieclip-in-flash-actionscript-3/</link>
        <description>&lt;p&gt;Actionscript 3 doesn't have any native support for detecting if the mouse is over a particular movieclip. It does have the following mouse events however:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;MouseEvent.MOUSE_MOVE - fired when the mouse moves&lt;/li&gt;
  &lt;li&gt;MouseEvent.MOUSE_OUT - fired when the mouse leaves an object&lt;/li&gt;
  &lt;li&gt;MouseEvent.MOUSE_OVER - fired when the mouse enters an object&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The last 2 will only fire the moment the mouse enters or leaves an object and the first only fires when the mouse is actually moving so they aren't that much use to us here.&lt;/p&gt;
&lt;p&gt;I have written a small AS3 class called mouseWatch that can be used to handle checking if the mouse is within a movieclip. You can &lt;a href=&quot;{call:plugin.downloader.path(/app/webroot/imgs/lib/mouseWatch.as)}&quot;&gt;download mouseWatch here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To use it you must set any movieclips that you want to monitor to have mouseWatch as their class definition (or have their class definition extend mouseWatch)&lt;/p&gt;
&lt;p&gt;Once you have done that you have access to the boolean isIn property which states whether the mouse is in the movieclip or not. You also have 2 events that you can define as actions to perform when the mouse is on and off the movieclip.&lt;/p&gt;
&lt;pre lang=&quot;as&quot;&gt;

/**
 * a simple example usuage
 */
public class document extends MovieClip {
	
	public var mc:MovieClip;
		
	public function document() {
	
		// mc is a movieclip with its class path set to mouseWatch
		// therefore it has access to 2 new methods that we can define here
		mc.onEvent = doOnEvent;
		mc.offEvent = doOffEvent;
		
	}
	
	public function doOnEvent() {
		// do something
	}
	
	public function doOffEvent() {
		// do something
	}
	
}
	
&lt;/pre&gt;

&lt;p&gt;Now if the mouse moves over and remains over the movieclip it will perform the methods we defined.&lt;/p&gt;
&lt;p&gt;In actual fact there is an optional third method defined: a 'beforeEvent'. This is fired just before both the onEvent and outEvent and can be used as a check for an additional condition if you want.&lt;/p&gt;

&lt;pre lang=&quot;as&quot;&gt;
		
	public function document() {
	
		// mc is a movieclip with its class path set to mouseWatch
		// therefore it has access to 2 new methods that we can define here
		mc.onEvent = doOnEvent;
		mc.offEvent = doOffEvent;
		
		// another method to check if the mouse is greater that a certain point 
		mc.beforeEvent = isXMouseGreaterThan;
		
	}
	
	public function isXMouseGreaterThan() {
		return (mouseX &gt; 200) ? true : false;
	}
	
	
&lt;/pre&gt;

&lt;p&gt;Thanks goes to Matt Maxwell for the initial function and idea &lt;a class=&quot;external&quot; href=&quot;http://mattmaxwellas3.blogspot.com/2008/12/mouse-enter-and-leave-movieclip-using.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Resources&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;{call:plugin.downloader.path(/app/webroot/imgs/lib/mouseWatch.as)}&quot;&gt;Download mouseWatch.as&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2010/12/php-resize-images-with-imagemagick-or-the-gd-library/">
        <dc:format>text/html</dc:format>
        <dc:date>2010-12-08T23:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>PHP Resize Images with ImageMagick or the GD Library</title>
        <link>www.kevbaldwyn.co.uk/code/2010/12/php-resize-images-with-imagemagick-or-the-gd-library/</link>
        <description>&lt;p&gt;I'ts pretty common to need to do some form of server side image manipulation these days. I've had various scripts and bits of code kicking around that perform various image manipulation tasks for a while, so I decided to put them together in one handy package that deals with the majority of tasks I find myself needing to do.&lt;/p&gt;
&lt;p&gt;Currently it can use either the native php &lt;a href=&quot;http://php.net/manual/en/book.image.php&quot; class=&quot;external&quot;&gt;GD library&lt;/a&gt; that is common in most installations of php, or it can use &lt;a href=&quot;http://www.imagemagick.org&quot; class=&quot;external&quot;&gt;ImageMagick&lt;/a&gt; which is a standalone programme that needs to be compiled and installed on your system. On a linux system this can be as simple as:&lt;/p&gt;
&lt;pre&gt;
apt-get install imagemagick
&lt;/pre&gt;
&lt;p&gt;However this isn't about installing ImageMagick so if you do not have imagemagick installed or do not know how, either use the native GD support or install ImageMagick, I highly reccomend it.&lt;/p&gt;
&lt;p&gt;The package is written so that it implements a common interface for dealing with the image manipulation process. This means that you can easily switch between which image processing utility you wish to use (GD or ImageMagick), without having to re-write or change your code or logic.&lt;/p&gt;
&lt;p&gt;If using ImageMagick you DO NOT need the &lt;a href=&quot;http://www.php.net/manual/en/book.imagick.php&quot; class=&quot;external&quot;&gt;native php ImageMagic extension&lt;/a&gt; installed. This class uses the command line to send requests to ImageMagick.&lt;/p&gt;
&lt;h2&gt;Usage&lt;/h2&gt;
&lt;h3&gt;Examples&lt;/h3&gt;
&lt;p&gt;1) Create an image scaled to be 100 pixels wide using the &lt;b&gt;GD&lt;/b&gt; library and save it to another directory.&lt;/p&gt;
&lt;pre lang=&quot;php&quot;&gt;
try {
	
	// the constructor takes 2 arguments - source image and the image manipulation programme to be used
	$image = new imageTransform('imgs/original.jpg', 'GD');
	
	// set the destination file to be created - DO NOT include the file extension as this gets added automatically
	$image-&gt;setOutputFile('imgs/tests/gd/resize_width_100_gd');
	
	// create the new image
	$image-&gt;resizeToWidth(100);
	
}catch(Exception $e) {
	die($e-&gt;getMessage());
}
&lt;/pre&gt;

&lt;p&gt;2) Create an image scaled to be 100 pixels high using the &lt;b&gt;GD&lt;/b&gt; library, change the filetype to jpg with a quality of 85%, save it to another directory and then output the image to the browser&lt;/p&gt;
&lt;pre lang=&quot;php&quot;&gt;
try {
	
	// the constructor takes 2 arguments - source image and the image manipulation programme to be used
	$image = new imageTransform('imgs/original.jpg', 'GD');
	
	// set the destination file to be created - DO NOT include the file extension as this gets added automatically
	$image-&gt;setOutputFile('imgs/tests/gd/resize_height_100_gd');
	
	// overwrite default properties
	$image-&gt;setOutputProperties(array('type' =&gt; 'jpg', 'quality' =&gt; 85));
	
	// create the new image
	$image-&gt;resizeToHeight(100);
	
	// output the image - sends relevant headers etc
	$image-&gt;render(); 
	
}catch(Exception $e) {
	die($e-&gt;getMessage());
}
&lt;/pre&gt;

&lt;p&gt;3) Create an image scaled to fit within a box 300 x 300 pixels using &lt;b&gt;ImageMagick&lt;/b&gt; and save it to another directory.&lt;/p&gt;
&lt;pre lang=&quot;php&quot;&gt;
try {
	
	// the constructor takes 2 arguments - source image and the image manipulation programme to be used
	$image = new imageTransform('imgs/original.jpg', 'imagemagick');
	
	// if using image magick be sure to set the path to it
	$image-&gt;mObj-&gt;bin = '/usr/bin/';
	
	// set the destination file to be created - DO NOT include the file extension as this gets added automatically
	$image-&gt;setOutputFile('imgs/tests/gd/fit_300x300_im');
	
	// create the new image fitting into a 300x300 box, any areas of the box that are visible have a background colour of #CCCCCC
	$image-&gt;padToFit(300, 300, '#CCCCCC');
	
}catch(Exception $e) {
	die($e-&gt;getMessage());
}
&lt;/pre&gt;


&lt;h3&gt;Features&lt;/h3&gt;
&lt;p&gt;Currently it supports the following methods for transforming the image&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;$image-&gt;resizeToWidth([width]);&lt;/li&gt;
  &lt;li&gt;$image-&gt;resizeToHeight([height]);&lt;/li&gt;
  &lt;li&gt;$image-&gt;crop([width], [height]);&lt;/li&gt;
  &lt;li&gt;$image-&gt;scaleToFit([width], [height]);&lt;/li&gt;
  &lt;li&gt;$image-&gt;padToFit([width], [height], [background_colour]);&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more information have a read through the code comments, hopefully they aren't too cryptic!&lt;/p&gt;

&lt;h3&gt;Download&lt;/h3&gt;
&lt;p&gt;You can download the package (one file) with all the relevant classes &lt;a href=&quot;{call:plugin.downloader.path(/app/webroot/imgs/lib/imageTransform.class.php)}&quot;&gt;from here&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2011/01/using-postmark-to-send-emails-with-swiftmailer/">
        <dc:format>text/html</dc:format>
        <dc:date>2011-01-22T23:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>Using Postmark to send emails with SwiftMailer</title>
        <link>www.kevbaldwyn.co.uk/code/2011/01/using-postmark-to-send-emails-with-swiftmailer/</link>
        <description>&lt;p&gt;SwiftMailer as I've &lt;a href=&quot;/code/2010/10/intercept-and-re-route-emails-with-a-swift-mailer-php-plugin/&quot;&gt;mentioned before&lt;/a&gt; is a great php library for creating and sending emails. Along with a great plugin architecture it is by default setup to handle SMTP, sendmail and php's native mail() function as transport agents for the email.&lt;/p&gt;
&lt;p&gt;Recently I discovered and started using &lt;a class=&quot;external&quot; href=&quot;http://postmarkapp.com/&quot;&gt;Postmark&lt;/a&gt; in a project. There can be so many issues with emails generated by a website; messages being marked as spam for numerous reasons, MTA issues, blacklisted IP addresses, shared servers, Hotmail rejecting your email, SPF records, reverse DNS, domain keys and plenty more to think about. Postmark takes care of all this for you, as they say on their website: &amp;quot;Postmark helps small and large businesses delivery and track transactional emails. Stop worrying about setup, delivery, and server maintenance.&amp;quot;. They offer an API and you will be up and running in seconds, literally - I am very impressed with this service.&lt;/p&gt;
&lt;p&gt;So with that I started looking around for a SwiftMailer transport class that someone may have written. I found &lt;a class=&quot;external&quot; href=&quot;http://code.google.com/p/postmark-swiftmailer/&quot;&gt;this project on code.google.com&lt;/a&gt; which served nearly all my needs except that it did not include any plugin support, so I had to write that in myself.&lt;/p&gt;
&lt;p&gt;I have sent an email to the author along with a copy of my code but not heard anything back and it appears to not have been updated on the google code project either, therefor I am supplying the full version here for anyone that may find it useful.&lt;/p&gt;
&lt;p&gt;The useage notes are all in the code comments but here is a quick overview.&lt;/p&gt;
&lt;pre lang=&quot;php&quot;&gt;
// include the package
require_once('Swift_PostmarkTransport.class.php');

// create an instance of the transport with your postmark API key
$transport = Swift_PostmarkTransport::newInstance('YOUR-POSTMARK-API-KEY');

$mailer = Swift_Mailer::newInstance($transport);

$message = Swift_Message::newInstance('Wonderful Subject');

// be sure to set this to sender signature you set up with postmark
$message-&gt;setFrom(array('sender@mydomain.com' =&gt; 'John Doe'));
$message-&gt;setTo(array('receiver@otherdomain.org' =&gt; 'Jane Doe'));
$message-&gt;setBody('Here is the message itself');

$mailer-&gt;send($message);
&lt;/pre&gt;
&lt;p&gt;You can &lt;a href=&quot;{call:plugin.downloader.path(/app/webroot/imgs/lib/Swift_PostmarkTransport.class.php)}&quot;&gt;download the classes here&lt;/a&gt;, I have put them all into one file for convenience.&lt;/p&gt;
</description>
    </item>
    <item rdf:about="www.kevbaldwyn.co.uk/code/2011/03/image-and-resource-caching-with-htaccess/">
        <dc:format>text/html</dc:format>
        <dc:date>2011-03-22T23:00:00+01:00</dc:date>
        <dc:source>www.kevbaldwyn.co.uk</dc:source>
        <dc:creator>kev@kevbaldwyn.co.uk</dc:creator>
        <title>Image and resource caching with htaccess</title>
        <link>www.kevbaldwyn.co.uk/code/2011/03/image-and-resource-caching-with-htaccess/</link>
        <description>&lt;p&gt;This is as much a bookmark for myself as anything. I just discovered &lt;a class=&quot;external&quot; href=&quot;http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html&quot;&gt;this .htaccess trick&lt;/a&gt; to easily set resource caching with apache. It requires mod_headers enabled which comes compiled by default but switched off. Then all you need do is add something like this to your .htaccess file:&lt;/p&gt;
&lt;pre class=&quot;source-code xml&quot;&gt;
&lt;IfModule mod_headers.c&gt;
	&lt;FilesMatch &quot;.(flv|gif|jpg|jpeg|png|ico|swf)$&quot;&gt;
	Header set Cache-Control &quot;max-age=2592000&quot;
	&lt;/FilesMatch&gt;
&lt;/IfModule&gt;
&lt;/pre&gt;
&lt;p&gt;Which will cache images and flash for one month. The link posted above has loads more info.&lt;/p&gt;</description>
    </item>
</rdf:RDF>

