<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mark Flint</title>
	<atom:link href="http://www.markflint.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.markflint.net</link>
	<description>Web Development</description>
	<lastBuildDate>Sun, 11 Dec 2011 11:56:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>PHP mySQL Database backup</title>
		<link>http://www.markflint.net/archives/390</link>
		<comments>http://www.markflint.net/archives/390#comments</comments>
		<pubDate>Sun, 11 Dec 2011 11:55:10 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[mySQL]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=390</guid>
		<description><![CDATA[There are times when you need to get an SQL dump of a database but you don&#8217;t have access to management tools AND system(), exec() and passthru() commands are disabled. This script from David Walsh will do the trick: &#60;?php /** * Thaks to David Walsh (http://davidwalsh.name/backup-mysql-database-php) */ backup_tables('localhost', 'root', '', 'bvcb_forms'); /* backup the [...]]]></description>
			<content:encoded><![CDATA[<p>There are times when you need to get an SQL dump of a database but you don&#8217;t have access to management tools AND system(), exec() and passthru() commands are disabled. This script from David Walsh will do the trick:</p>
<pre class="brush: php; light: true;">
&lt;?php
/**
 * Thaks to David Walsh (http://davidwalsh.name/backup-mysql-database-php)
 */

backup_tables('localhost', 'root', '', 'bvcb_forms');

/* backup the db OR just a table */

function backup_tables($host, $user, $pass, $name, $tables = '*') {

    $return = '';

    $link = mysql_connect($host, $user, $pass);
    mysql_select_db($name, $link);

    //get all of the tables
    if ($tables == '*') {
	$tables = array();
	$result = mysql_query('SHOW TABLES');
	while ($row = mysql_fetch_row($result)) {
	    $tables[] = $row[0];
	}
    } else {
	$tables = is_array($tables) ? $tables : explode(',', $tables);
    }

    //cycle through
    foreach ($tables as $table) {
	$result = mysql_query('SELECT * FROM ' . $table);
	$num_fields = mysql_num_fields($result);

	$return.= 'DROP TABLE ' . $table . ';';
	$row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE ' . $table));
	$return.= &quot;\n\n&quot; . $row2[1] . &quot;;\n\n&quot;;

	for ($i = 0; $i &lt; $num_fields; $i++) {
	    while ($row = mysql_fetch_row($result)) {
		$return.= 'INSERT INTO ' . $table . ' VALUES(';
		for ($j = 0; $j &lt; $num_fields; $j++) {
		    $row[$j] = addslashes($row[$j]);
		    $row[$j] = preg_replace(&quot;/\n/&quot;, &quot;/\\n/&quot;, $row[$j]);
		    if (isset($row[$j])) {
			$return.= '&quot;' . $row[$j] . '&quot;';
		    } else {
			$return.= '&quot;&quot;';
		    }
		    if ($j &lt; ($num_fields - 1)) {
			$return.= ',';
		    }
		}
		$return.= &quot;);\n&quot;;
	    }
	}
	$return.=&quot;\n\n\n&quot;;
    }

    //save file
    $handle = fopen('db-backup-' . time() . '-' . (md5(implode(',', $tables))) . '.sql', 'w+');
    fwrite($handle, $return);
    fclose($handle);
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/390/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Timestamp columns… when phpMyAdmin won’t let you change defaults!</title>
		<link>http://www.markflint.net/archives/386</link>
		<comments>http://www.markflint.net/archives/386#comments</comments>
		<pubDate>Wed, 16 Nov 2011 09:12:13 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[Odds]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=386</guid>
		<description><![CDATA[ALTER TABLE my_table CHANGE created created TIMESTAMP NOT NULL DEFAULT 0, CHANGE modified modified TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL]]></description>
			<content:encoded><![CDATA[<pre class="brush: sql; light: true;">
ALTER TABLE my_table CHANGE created created TIMESTAMP NOT NULL DEFAULT 0, CHANGE modified modified TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/386/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programatically edit a CSV file</title>
		<link>http://www.markflint.net/archives/381</link>
		<comments>http://www.markflint.net/archives/381#comments</comments>
		<pubDate>Mon, 24 Oct 2011 18:39:35 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[CSV]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=381</guid>
		<description><![CDATA[Here&#8217;s an example of adding a leading zero to columns 2 and 3 of the CSV file: $input = fopen('numbers.csv','r'); $output = fopen('numbers_touched.csv','w'); while($csv_line = fgetcsv($input,1024)) { $line = array(); foreach ($csv_line as $k =&#62; $field){ if ($k == 2 &#124;&#124; $k == 3) { $field = '0' . $field; } $line[] = $field; } [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an example of adding a leading zero to columns 2 and 3 of the CSV file:</p>
<pre class="brush: php; light: true;">
$input = fopen('numbers.csv','r');
$output = fopen('numbers_touched.csv','w');
while($csv_line = fgetcsv($input,1024)) {
	$line = array();
	foreach ($csv_line as $k =&gt; $field){
		if ($k == 2 || $k == 3) {
			$field = '0' . $field;
		}
		$line[] = $field;
	}
	fputcsv($output,$line);
}
fclose($input);
fclose($output);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/381/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash backup script</title>
		<link>http://www.markflint.net/archives/376</link>
		<comments>http://www.markflint.net/archives/376#comments</comments>
		<pubDate>Thu, 20 Oct 2011 14:12:33 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[compression]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=376</guid>
		<description><![CDATA[Here&#8217;s a script for backing up directories and databases. All files are compresses, and files older than 30 days are removed. # # Backup script # # Make compressed backups of directories/files, and old backups # Format: YEAR MONTH DAY - HOUR MINUTE SECOND DATE=$(date +%Y%m%d-%H%M%S) # backup directories and files tar -czf "/backup/target_file-$DATE.tar.gz" /home/username/public_html/home/ [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a script for backing up directories and databases. All files are compresses, and files older than 30 days are removed.<br />
<code><br />
#<br />
# Backup script<br />
#<br />
# Make compressed backups of directories/files, and old backups</p>
<p># Format: YEAR MONTH DAY - HOUR MINUTE SECOND<br />
DATE=$(date +%Y%m%d-%H%M%S)</p>
<p># backup directories and files<br />
tar -czf "/backup/target_file-$DATE.tar.gz" /home/username/public_html/home/<br />
tar -czf "/backup/target_file_forwarders-$DATE.tar.gz" /etc/valiases/domain_name.co.uk</p>
<p># backup databases<br />
# this could be done in one command, but I want to keep separate files<br />
mysqldump database1 | gzip -f > "/backup/databases/database1-$DATE.sql.gz"<br />
mysqldump database2 | gzip -f > "/backup/databases/database2-$DATE.sql.gz"</p>
<p># delete files older than 30 days recursively on this path<br />
find /backup -type f -mtime +30 -exec rm  -f {} \;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/376/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find mysql database size from command line</title>
		<link>http://www.markflint.net/archives/370</link>
		<comments>http://www.markflint.net/archives/370#comments</comments>
		<pubDate>Thu, 20 Oct 2011 09:03:37 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[database size]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=370</guid>
		<description><![CDATA[SELECT table_schema "database name", sum( data_length + index_length ) / 1024 / 1024 "Database size in MB" FROM information_schema.TABLES GROUP BY table_schema;]]></description>
			<content:encoded><![CDATA[<p><code>SELECT table_schema "database name", sum( data_length + index_length ) / 1024 / 1024 "Database size in MB" FROM information_schema.TABLES GROUP BY table_schema;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/370/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make a compressed tarball, and extract the same</title>
		<link>http://www.markflint.net/archives/365</link>
		<comments>http://www.markflint.net/archives/365#comments</comments>
		<pubDate>Wed, 19 Oct 2011 18:24:13 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ball]]></category>
		<category><![CDATA[compressed]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[tar]]></category>
		<category><![CDATA[tarball]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=365</guid>
		<description><![CDATA[Create a bzip&#8217;ed tarball tar -cjvf test.tbz home -c tells tar to create an archive. j tells it to bzip the file. v makes it display the names of of the files as it processes them. z is to compress the file and f tells tar to use the next name in the command (test.tbz [...]]]></description>
			<content:encoded><![CDATA[<p>Create a bzip&#8217;ed tarball<br />
<code>tar -cjvf test.tbz home</code></p>
<p>-c tells tar to create an archive. j tells it to bzip the file. v makes it display the names of of the files as it processes them. z is to compress the file and f tells tar to use the next name in the command (test.tbz in the example). The final argument is the directory to be processed.</p>
<p>Likewise create a gzip&#8217;ed tarball<br />
<code>tar -czvf test.tar.gz home</code></p>
<p>The z flag tells it to use gzip compression.</p>
<p>Extracting is simple too:<br />
<code>tar -xzvf test.tar.gz</code> (gzip) or <code>tar -xjvf test.tbz</code> (bzip)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/365/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing orphaned virtfs mounts</title>
		<link>http://www.markflint.net/archives/358</link>
		<comments>http://www.markflint.net/archives/358#comments</comments>
		<pubDate>Wed, 19 Oct 2011 18:16:10 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[virtfs]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=358</guid>
		<description><![CDATA[Shows who is logged in: # who Anybody running a virtfs, or any orphaned virtfs users? cat /proc/mounts &#124; grep virtfs Unmount them! for i in `cat /proc/mounts &#124;grep virtfs &#124;grep user_name_here &#124;awk ‘{print$2}’`; do umount $i; done]]></description>
			<content:encoded><![CDATA[<p>Shows who is logged in:<br />
<code># who</code></p>
<p>Anybody running a virtfs, or any orphaned virtfs users?<br />
<code>cat /proc/mounts | grep virtfs</code></p>
<p>Unmount them!<br />
<code>for i in `cat /proc/mounts |grep virtfs |grep user_name_here |awk ‘{print$2}’`; do umount $i; done</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/358/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Timthumb and Ajax</title>
		<link>http://www.markflint.net/archives/348</link>
		<comments>http://www.markflint.net/archives/348#comments</comments>
		<pubDate>Thu, 29 Sep 2011 10:56:15 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[Timthumb]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=348</guid>
		<description><![CDATA[Timthumb is a great tool for cropping/resizing images dynamically at the time the page loads. But what if you want to update the src of an image tag with a new image, for example, in an image carousel? You can use timthumb via an ajax call, but the resulting data is binary so you have [...]]]></description>
			<content:encoded><![CDATA[<p>Timthumb is a great tool for cropping/resizing images dynamically at the time the page loads. But what if you want to update the src of an image tag with a new image, for example, in an image carousel?</p>
<p>You can use timthumb via an ajax call, but the resulting data is binary so you have to do two things: 1) convert the binary to base64, 2) add a prefix to the src attribut it to tell the browser how to handle it.</p>
<p>So converting the binary data to base64 is done inside the timthumb script. What I did was check for a param in the GET and, if present, I converted the data to base64. In the timthumb serveCacheFile() function I replaced these line:</p>
<pre class="brush: php; light: true;">
$imageDataSize = filesize($this-&amp;gt;cachefile) - (strlen($this-&amp;gt;filePrependSecurityBlock) + 6);
$this-&amp;gt;sendImageHeaders($imgType, $imageDataSize);
$bytesSent = @fpassthru($fp);
</pre>
<p>with this:</p>
<pre class="brush: php; light: true;">
		$imageDataSize = filesize($this-&amp;gt;cachefile) - (strlen($this-&amp;gt;filePrependSecurityBlock) + 6);

		if (isset($_GET['marko'])){
			// Look out for the 'marko' flag. This is serving a base64 encoded string so
			// that an HTML image tag can display the file in it's src attribute. Useful
			// when Ajax is needed to resize files for a carousel.
			$fsize = filesize($this-&amp;gt;cachefile);
	        $binary = fread($fp,$fsize);
	        $bin64 = base64_encode($binary);
			fclose($fp);
			echo 'data:image/bmp;base64,'.$bin64;
			return true;
		} else {
			$this-&amp;gt;sendImageHeaders($imgType, $imageDataSize);
			$bytesSent = @fpassthru($fp);
		}
</pre>
<p>Then in my HTML page I have a bit of jQuery as follows:</p>
<pre class="brush: jscript; light: true;">
	load_link = encodeURI(&amp;quot;&amp;amp;src=&amp;quot; + link + &amp;quot;&amp;amp;h=194&amp;amp;w=263&amp;amp;marko=1&amp;quot;);
	$.get('/images/timthumb.php', load_link, updateLink);

	function updateLink(data) {
	    $('#flickr-first-photo').attr('src',data);
	}
</pre>
<p>Where the &#8216;link&#8217; var is the external file, in my case, a flickr hosted image. You can see I&#8217;m passing marko=1 in as a GET param. This is my flag that I pick up in the timthumb.php script. The function updateLink() adds the base64 encoded data to the src of the image with id flickr-first-photo.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/348/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing XML: xpath attributes</title>
		<link>http://www.markflint.net/archives/342</link>
		<comments>http://www.markflint.net/archives/342#comments</comments>
		<pubDate>Fri, 10 Jun 2011 17:29:33 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=342</guid>
		<description><![CDATA[Here are two examples of getting attribute values using an xpath query: one using simpleXML and one using DOM document. Both queries are on namespaces within the XML file. First here&#8217;s the DOM Document version: $dom = new DomDocument(); // it's possible to use the static method ::load instead of intantiating $dom-&#62;load('http://api.flickr.com/services/feeds/groups_pool.gne?id=12345678@N00&#38;format=rss_200'); $xpath = new [...]]]></description>
			<content:encoded><![CDATA[<p>Here are two examples of getting attribute values using an xpath query: one using simpleXML and one using DOM document. Both queries are on namespaces within the XML file.</p>
<p>First here&#8217;s the DOM Document version:</p>
<pre class="brush: php; light: true;">
$dom = new DomDocument();
// it's possible to use the static method ::load instead of intantiating
$dom-&gt;load('http://api.flickr.com/services/feeds/groups_pool.gne?id=12345678@N00&amp;format=rss_200');
$xpath = new DOMXPath($dom);
$result = $xpath-&gt;query(&quot;//media:thumbnail/@url&quot;);
foreach ($result as $val) {
    // make an array of thumbnail URLs from a Flickr group
    $thumbsArray[] = $val-&gt;nodeValue;
}
</pre>
<p>&#8230; and the SimpleXML version:</p>
<pre class="brush: php; light: true;">
$xml = simplexml_load_file('http://api.flickr.com/services/feeds/groups_pool.gne?id=12345678@N00&amp;format=rss_200');
$result = $xml-&gt;xpath('//media:thumbnail/@url');
foreach ($result as $val) {
    // make an array of thumbnail URLs from a Flickr group
    $thumbsA[] = (string)$val['url'];
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/342/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.htaccess for canonical issues</title>
		<link>http://www.markflint.net/archives/340</link>
		<comments>http://www.markflint.net/archives/340#comments</comments>
		<pubDate>Tue, 10 May 2011 23:21:02 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=340</guid>
		<description><![CDATA[Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^markflint\.net$ [NC] RewriteRule ^(.*)$ http://www.markflint.net/$1 [R=301,L]]]></description>
			<content:encoded><![CDATA[<p><code>Options +FollowSymLinks<br />
RewriteEngine On<br />
RewriteCond %{HTTP_HOST} ^markflint\.net$ [NC]<br />
RewriteRule ^(.*)$ http://www.markflint.net/$1 [R=301,L]</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/340/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XML parsing and Namespaces</title>
		<link>http://www.markflint.net/archives/335</link>
		<comments>http://www.markflint.net/archives/335#comments</comments>
		<pubDate>Tue, 26 Apr 2011 12:21:30 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=335</guid>
		<description><![CDATA[Here&#8217;s a simpleXML script I used to parse a feed. There are MP3 links that are under the namespace xmlns:media=&#8221;http://search.yahoo.com/mrss/&#8221;. The links are in the feed like this: &#60;media:group&#62; &#60;media:content url='linkformp3.mp3' /&#62; &#60;/media:group&#62; To get at the url attribute you first have to access the &#8216;media&#8217; namespace by using children('media',true). This tells the parser to [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a simpleXML script I used to parse a feed. There are MP3 links that are under the namespace xmlns:media=&#8221;http://search.yahoo.com/mrss/&#8221;. The links are in the feed like this:</p>
<pre class="brush: xml; light: true;">
&lt;media:group&gt;
    &lt;media:content url='linkformp3.mp3' /&gt;
&lt;/media:group&gt;
</pre>
<p>To get at the url attribute you first have to access the &#8216;media&#8217; namespace by using <code>children('media',true)</code>. This tells the parser to find children of the namespace prefix &#8216;media&#8217;. Another way to do this is to use the url declared for the namespace, but using children(&#8216;media&#8217;,true) seems easier. Here&#8217;s the full script:</p>
<pre class="brush: php; light: true;">
&lt;?php
$file = 'http://www.ucbmedia.co.uk/feeds/wft/index.php';
$xml = simplexml_load_file($file, 'SimpleXMLElement', LIBXML_NOCDATA);

foreach ($xml-&gt;channel-&gt;item as $item) {
    echo &quot;&lt;b&gt;&quot;.$item-&gt;title.&quot;&lt;/b&gt;&lt;br&gt;&lt;br&gt;&quot;;
    echo $item-&gt;description.&quot;&lt;br&gt;&lt;br&gt;&quot;;
    echo $item-&gt;pubDate.&quot;&lt;br&gt;&lt;br&gt;&quot;;
    // get children for namespace prefixed 'media'
    $media = $item-&gt;children('media',true);
    $mp3 = $media-&gt;group-&gt;content-&gt;attributes();
    echo $mp3['url'].&quot;&lt;br&gt;&lt;hr&gt;&lt;br&gt;&lt;br&gt;&quot;;
}
?&gt;
</pre>
<p>Also notice the way of loading a feed and preserving CDATA in simpleXML, <code>simplexml_load_file($file, 'SimpleXMLElement', LIBXML_NOCDATA);</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/335/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Map a local domain using apache httpd.conf and windows hosts file</title>
		<link>http://www.markflint.net/archives/327</link>
		<comments>http://www.markflint.net/archives/327#comments</comments>
		<pubDate>Thu, 14 Apr 2011 08:15:56 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[Windows webserver]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=327</guid>
		<description><![CDATA[Add a host file definition, eg: mydomain.dev 127.0.0.1 This tells your PC to send that domain to localhost. Now in apache&#8217;s httpd.conf you set up a virtual host to map that domain on localhost to a &#8216;DocumentRoot&#8217; directory on your machine: &#60;VirtualHost 127.0.0.1&#62; ServerName mydomain.dev DocumentRoot &#34;C:\xampp\htdocs\mydomain&#34; &#60;/VirtualHost&#62;]]></description>
			<content:encoded><![CDATA[<p>Add a host file definition, eg:</p>
<p><code>mydomain.dev    127.0.0.1</code></p>
<p>This tells your PC to send that domain to localhost. Now in apache&#8217;s httpd.conf you set up a virtual host to map that domain on localhost to a &#8216;DocumentRoot&#8217; directory on your machine:</p>
<pre class="brush: xml; light: true;">
&lt;VirtualHost 127.0.0.1&gt;
ServerName mydomain.dev
DocumentRoot &quot;C:\xampp\htdocs\mydomain&quot;
&lt;/VirtualHost&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/327/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Conditionally load jQuery</title>
		<link>http://www.markflint.net/archives/319</link>
		<comments>http://www.markflint.net/archives/319#comments</comments>
		<pubDate>Sat, 09 Apr 2011 19:00:00 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[conditional load]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=319</guid>
		<description><![CDATA[&#60;script type=&#34;text/javascript&#34;&#62; // load jQuery if not already loaded if (typeof jQuery == 'undefined') { var head = document.getElementsByTagName(&#34;head&#34;)[0]; script = document.createElement('script'); script.id = 'jQuery'; script.type = 'text/javascript'; script.src = 'pathto/jQuery/jquery-1.5.1.min.js'; head.appendChild(script); } &#60;/script&#62;]]></description>
			<content:encoded><![CDATA[<pre class="brush: jscript; light: true;">
&lt;script type=&quot;text/javascript&quot;&gt;
// load jQuery if not already loaded
if (typeof jQuery == 'undefined') {
   var head = document.getElementsByTagName(&quot;head&quot;)[0];
   script = document.createElement('script');
   script.id = 'jQuery';
   script.type = 'text/javascript';
   script.src = 'pathto/jQuery/jquery-1.5.1.min.js';
   head.appendChild(script);

}
&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/319/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test if variable exists</title>
		<link>http://www.markflint.net/archives/311</link>
		<comments>http://www.markflint.net/archives/311#comments</comments>
		<pubDate>Sun, 03 Apr 2011 12:33:48 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[test is set]]></category>
		<category><![CDATA[test variable exists]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=311</guid>
		<description><![CDATA[if(typeof(a) != &#34;undefined&#34;){...}]]></description>
			<content:encoded><![CDATA[<pre class="brush: jscript; light: true;">
if(typeof(a) != &quot;undefined&quot;){...}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/311/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS transparencies</title>
		<link>http://www.markflint.net/archives/309</link>
		<comments>http://www.markflint.net/archives/309#comments</comments>
		<pubDate>Sat, 26 Mar 2011 13:01:08 +0000</pubDate>
		<dc:creator>moflint</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css transparency]]></category>

		<guid isPermaLink="false">http://www.markflint.net/?p=309</guid>
		<description><![CDATA[.transparency_class { /* IE 8 */ -ms-filter: &#34;progid:DXImageTransform.Microsoft.Alpha(Opacity=90)&#34;; /* IE 5-7 */ filter: alpha(opacity=90); /* Netscape */ -moz-opacity: 0.9; /* Safari 1.x */ -khtml-opacity: 0.9; /* Modern browsers */ opacity: 0.9; }]]></description>
			<content:encoded><![CDATA[<pre class="brush: css; light: true;">
.transparency_class {
  /* IE 8 */
  -ms-filter: &quot;progid:DXImageTransform.Microsoft.Alpha(Opacity=90)&quot;;

  /* IE 5-7 */
  filter: alpha(opacity=90);

  /* Netscape */
  -moz-opacity: 0.9;

  /* Safari 1.x */
  -khtml-opacity: 0.9;

  /* Modern browsers */
  opacity: 0.9;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.markflint.net/archives/309/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

