<?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>Sam&#039;s Site</title> <atom:link href="http://www.samclarke.com/feed/" rel="self" type="application/rss+xml" /><link>http://www.samclarke.com</link> <description></description> <lastBuildDate>Mon, 13 Feb 2012 20:13:20 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Fix Contact Form 7 “Failed to send your message. Please try later or contact administrator by other way.”</title><link>http://www.samclarke.com/2012/02/fix-contact-form-7-failed-to-send-your-message-please-try-later-or-contact-administrator-by-other-way/</link> <comments>http://www.samclarke.com/2012/02/fix-contact-form-7-failed-to-send-your-message-please-try-later-or-contact-administrator-by-other-way/#comments</comments> <pubDate>Wed, 08 Feb 2012 20:00:19 +0000</pubDate> <dc:creator>sam</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[Contact Form 7]]></category> <category><![CDATA[plugins]]></category> <category><![CDATA[WP-Super Cache]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=359</guid> <description><![CDATA[I updated the Contact From 7 plugin I&#8217;m using on this site and then started receiving “Failed to send your message. Please try later or contact administrator by other way.” errors from it. I tried the only fix I could find &#8230; <a
href="http://www.samclarke.com/2012/02/fix-contact-form-7-failed-to-send-your-message-please-try-later-or-contact-administrator-by-other-way/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I updated the Contact From 7 plugin I&#8217;m using on this site and then started receiving “Failed to send your message. Please try later or contact administrator by other way.” errors from it. I tried the only fix I could find on the internet which was to change the from e-mail to the same domain as the website, but it didn&#8217;t help.</p><p>After looking at the code I managed to find what was causing my error, it was the WP-Super Cache plugin I&#8217;m using. The contact form plugin generates a unique token for each person who submits the form, presumably to stop <a
href="http://en.wikipedia.org/wiki/Cross-site_request_forgery">CSRF</a> attacks, which was being cached by WP-Super Cache which in turn caused the token to no longer be unique or valid.</p><p>Adding /contact/ to the excluded strings in the Advanced section of WP-Super Cache settings solved the problem for me. Hopefully this will help someone else who gets stuck by this error.</p> ]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2012/02/fix-contact-form-7-failed-to-send-your-message-please-try-later-or-contact-administrator-by-other-way/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to install Aptana Studio 3 on Ubuntu 11.10 (Oneiric)</title><link>http://www.samclarke.com/2011/11/how-to-install-aptana-studio-3-on-ubuntu-11-10-oneiric/</link> <comments>http://www.samclarke.com/2011/11/how-to-install-aptana-studio-3-on-ubuntu-11-10-oneiric/#comments</comments> <pubDate>Mon, 07 Nov 2011 17:30:22 +0000</pubDate> <dc:creator>sam</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Aptana]]></category> <category><![CDATA[IDE]]></category> <category><![CDATA[Linux]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=342</guid> <description><![CDATA[These instructions are for installing the standalone version of Aptana Studio 3. 1. Install Sun Java &#8211; Aptana Studio doesn&#8217;t currently work with OpenJDK: sudo add-apt-repository ppa:ferramroberto/java sudo apt-get update sudo apt-get install sun-java6-jdk sun-java6-plugin 2. Download &#38; install xulrunner &#8211; Ubuntu &#8230; <a
href="http://www.samclarke.com/2011/11/how-to-install-aptana-studio-3-on-ubuntu-11-10-oneiric/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>These instructions are for installing the standalone version of Aptana Studio 3.</p><p><strong>1. Install Sun Java</strong> &#8211; Aptana Studio doesn&#8217;t currently work with OpenJDK:</p><pre>sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin</pre><p><strong>2. Download &amp; install xulrunner</strong> &#8211; Ubuntu 11.10 doesn&#8217;t include xulrunner so it must be downloaded.</p><p>If you are using Ubuntu <strong>64 bit use</strong>:</p><pre>wget -O xulrunner.deb http://launchpadlibrarian.net/70321329/xulrunner-1.9.2_1.9.2.17%2Bbuild3%2Bnobinonly-0ubuntu1_amd64.deb
sudo dpkg -i xulrunner.deb</pre><p>If you are using Ubuntu <strong>32 bit use</strong>:</p><pre>wget -O xulrunner.deb http://launchpadlibrarian.net/70321863/xulrunner-1.9.2_1.9.2.17%2Bbuild3%2Bnobinonly-0ubuntu1_i386.deb
sudo dpkg -i xulrunner.deb</pre><p><strong>3. Download the Standalone version of Aptana Studio 3</strong> <strong>from</strong> <a
href="http://aptana.com/products/studio3/download">the Aptana Studio website</a>.</p><p><strong>4. Unzip it to /opt/aptana-studio-3</strong>:</p><pre>sudo unzip [name of Aptana Studio ZIP file here].zip -d /opt
sudo mv /opt/Aptana\ Studio\ 3 /opt/aptana-studio-3</pre><p><strong>5. Install the menu item:</strong></p><pre>wget http://www.samclarke.com/wp-content/uploads/2011/11/AptanaStudio.desktop
sudo mv AptanaStudio.desktop /usr/share/applications/AptanaStudio.desktop</pre><p>That&#8217;s it, Aptana Studio 3 should now be installed and ready to use. You may need to log out and back in it to show in the menu.</p> ]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2011/11/how-to-install-aptana-studio-3-on-ubuntu-11-10-oneiric/feed/</wfw:commentRss> <slash:comments>15</slash:comments> </item> <item><title>Adding custom commands to SCEditor</title><link>http://www.samclarke.com/2011/11/adding-custom-commands-to-sceditor/</link> <comments>http://www.samclarke.com/2011/11/adding-custom-commands-to-sceditor/#comments</comments> <pubDate>Sat, 05 Nov 2011 18:30:32 +0000</pubDate> <dc:creator>sam</dc:creator> <category><![CDATA[Code]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[How To]]></category> <category><![CDATA[SCEditor]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=319</guid> <description><![CDATA[For instructions on setting up SCEditor, see here. Custom command support requires SCEditor version 1.2.4+. Adding Custom Command SCEditor has a function called setCommand which updates a command if it already exists or adds it if it doesn&#8217;t. setCommand must be called before &#8230; <a
href="http://www.samclarke.com/2011/11/adding-custom-commands-to-sceditor/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>For instructions on setting up SCEditor, <a
href="http://www.samclarke.com/2011/11/how-to-use-sceditor/">see here</a>. Custom command support requires SCEditor version 1.2.4+.</p><h2>Adding Custom Command</h2><p>SCEditor has a function called setCommand which updates a command if it already exists or adds it if it doesn&#8217;t. setCommand <em>must</em> be called before the editor is initialised otherwise the command may not show in the editors toolbar.</p><p
style="text-align: left;"><strong>setCommand parameters:</strong><br
/> <strong>Name (string)</strong>: The name of the command, should be lower-case and not contain any spaces.<br
/> <strong>Exec (string or function)</strong>: Should be a function which will be called when the command is clicked or a string which will be passed to the browsers built-in <a
href="https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIDOMNSHTMLDocument#execCommand()">execCommand function</a>.<br
/> <strong>Tooltip (string)</strong>: The commands tooltip text<br
/> <strong>Keypress</strong>: Unless the command needs to handle keypress events, omit this parameter. For an example of keypress handler see the emoticon command.</p><p
style="text-align: left;"><span
id="more-319"></span>Adding a command:</p><pre>$.sceditor.setCommand(
	"test", /* commands name */
	function () {
		/* commands function, inserts the words "Hello World" */
		this.wysiwygEditorInsertHtml('&lt;span&gt;Hello World&lt;/span&gt;');
 	},
	"Test commands tooltip" /* commands tooltip */
);</pre><p>Add the command to the editors toolbar:</p><pre>$("textarea").sceditor({
	toolbar: "test,bold,italic,underline"
});</pre><p>Add an icon for the command:</p><pre>&lt;style type="text/css"&gt;
/* the commands button class is .sceditor-button-[name] so in
in this case it's .sceditor-button-test. div is the button so set
the background image of that to the icon for the command test */
.sceditor-button-test div { background: url('icons/test.png'); }
&lt;/style&gt;</pre><p>That&#8217;s it, the command test should now be added to the editor.</p><p>To update a command, simply do:</p><pre>$.sceditor.setCommand(
	"test", /* name of the command to update */
	function () {
		this.wysiwygEditorInsertHtml('&lt;span&gt;Updated Command&lt;/span&gt;');
	}
);</pre><p>The above will make the command test insert the string &#8220;Updated Command&#8221; instead of &#8220;Hello World&#8221;. It will update the command for all previous and future instances of the editor so any editor with the command test will now insert the string &#8220;Updated Command&#8221;.</p><h2>Adding a Custom BBCode</h2><p>If you are using SCEditor as a BBCode editor and you want the custom command to support BBCode, you will need to add a BBCode to the BBCode parser.</p><p>Like sceditor, sceditorBBCodePlugin has a function called setCommand which will add a BBCode to the parser.</p><p><strong>setCommand parameters:<br
/> Name (string):</strong> The name of the BBCode. e.g. for [b] it should be &#8220;b&#8221;.<br
/> <strong>Tags (object):</strong>  Should be an object with the tags which this BBCode applies to. The format should be tagname: { arttributename: [valid, attribute, values] }. Anything after the tagname: can be null to apply to all. e.g.</p><pre>{
	tagname: { /* name of tag this BBCode applies to */
		"attribute": /* this can be null if the bbcode applies to all tags with the specified name or the name of an attribute the element must have */
			["attribute1", "attributevalue2"] /* this can be null or a value the attribute must have */
	}
}</pre><p><strong>Styles (object):</strong> Should be an object with all the style attributes which this BBCode applies to. The format should attribute: [valid, attribute, values]. The values array can be null if the BBCode applies to all elements with the specified style attribute. e.g.:</p><pre>{
	"font-weight": /* CSS attribute name */
		["bold", "bolder"] /* array of valid values. This can be null if all values are valid. */
}</pre><p><strong>Format (string or function):</strong> String with &#8220;{0}&#8221; which will be replaced with the elements content or a function with the parameters (element, content) which returns a string. Element will be the HTML element being converted and content will be a string containing the elements converted contents.<br
/> <strong>Html (string or function):</strong> String with &#8220;{0}&#8221; which will be replaced with the content within the BBCode tags, or a function with the parameters (element, attrs, content) which returns a string. Element will be a string with the BBCodes name. Attrs will be an object with the BBCodes attributes, if the BBCode has a default attribute e.g. [bbcode=default attribute value] it will be set as attrs.defaultAttr. Content will be the BBCodes content parsed into HTML tags.</p><p>Adding a BBCode:</p><pre>$.sceditorBBCodePlugin.setCommand(
	"b",
	null,
	{
		"font-weight": ["bold", "bolder"]
	},
	"[b]{0}[/b]",
	"&lt;strong&gt;{0}&lt;/strong&gt;"
);</pre><p>Another example:</p><pre>$.sceditorBBCodePlugin.setCommand(
	"url",
	{
		a: {
			href: null
		}
	},
	null,
	function(element, content) {
		if(element.attr('href').substr(0, 7) == 'mailto:')
			return '[email=' + element.attr('href').substr(7) + ']' + content + '[/email]';
		return '[url=' + encodeURI(element.attr('href')) + ']' + content + '[/url]';
	},
	function(element, attrs, content) {
		if(typeof attrs.defaultAttr === "undefined")
			attrs.defaultAttr = content;
		return '&lt;a href="' + attrs.defaultAttr + '"&gt;' + content + '&lt;/a&gt;';
	}
);</pre><p>If the BBCode already exists, it will be updated.</p><p>You can download the above <a
href="http://www.samclarke.com/wp-content/uploads/2011/11/SCEditor-Custom-Commands-Example.zip">SCEditor Custom Commands Example</a>. If you have any problems just leave a comment or <a
href="/contact">contact me here</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2011/11/adding-custom-commands-to-sceditor/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>How to use SCEditor</title><link>http://www.samclarke.com/2011/11/how-to-use-sceditor/</link> <comments>http://www.samclarke.com/2011/11/how-to-use-sceditor/#comments</comments> <pubDate>Thu, 03 Nov 2011 20:22:00 +0000</pubDate> <dc:creator>sam</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[BBCode]]></category> <category><![CDATA[SCEditor]]></category> <category><![CDATA[WYSIQYG]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=241</guid> <description><![CDATA[First include the editors CSS and JavaScript files: &#60;link rel="stylesheet" href="minified/jquery.sceditor.min.css" type="text/css" media="all" /&#62; &#60;script type="text/javascript" src="minified/jquery.sceditor.min.js"&#62;&#60;/script&#62; You then need a HTML form with a textarea in it. No special attributes or classes are required, e.g.: &#60;form action="post"&#62; &#60;label for="name"&#62;Name:&#60;/label&#62; &#8230; <a
href="http://www.samclarke.com/2011/11/how-to-use-sceditor/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>First include the editors CSS and JavaScript files:</p><pre>&lt;link rel="stylesheet" href="minified/jquery.sceditor.min.css" type="text/css" media="all" /&gt;
&lt;script type="text/javascript" src="minified/jquery.sceditor.min.js"&gt;&lt;/script&gt;</pre><p><span
id="more-241"></span><br
/> You then need a HTML form with a textarea in it. No special attributes or classes are required, e.g.:</p><pre>&lt;form action="post"&gt;
	&lt;label for="name"&gt;Name:&lt;/label&gt;
	&lt;input type="text" name="name" id="name" /&gt;
<br />	&lt;label for="message"&gt;Message:&lt;/label&gt;
	&lt;textarea name="message" id="message"&gt;&lt;/textarea&gt;
<br />	&lt;input type="submit" value="Post message" /&gt;
&lt;/form&gt;</pre><p>Finally initialise SCEditor on the form textarea(s) you want with the following JS:</p><pre>$(document).ready(function() {
	/* change #message to the correct selector for your textarea(s) */
	$("#message").sceditorBBCodePlugin({ /*change sceditorBBCodePlugin to sceditor if you want a HTML editor instead of a BBCode editor */
<br />		/* insert any options here, see the readme for full list. (https://github.com/samclarke/SCEditor/blob/master/README.md) */
<br />		/* this is the CSS file for styling of the WYSIWYG input (styling for the text being edited).*/
		style: "minified/jquery.sceditor.default.min.css"
	});
});</pre><p>In the above example &#8220;#message&#8221; is selector used to select the textarea(s) to initialise the editor on. For more information on jQuery selectors <a
href="http://api.jquery.com/category/selectors/">see the jQuery docs</a>.</p><p>That&#8217;s it, the textarea(s) should be replaced with the editor and when the form is sent, the BBCode (or HTML if you&#8217;re using sceditor for HTML editing) should be set as the value of the textarea the editor is replacing. The post data can then be treated the same way a normal textarea would be, i.e. for PHP to get the posted BBCode it should be: $_POST['message']</p><h2>Using SBBCodeParser with SCEditor</h2><p>To parse the BBCode produced by the editor simply run the $_POST['message'] variable through the SBBCodeParser and you&#8217;re done.</p><pre>// include the BBCode parser
require_once('SBBCodeParser.php');
<br />// create the BBCode parser
$parser = new SBBCodeParser_Document(true, false);
<br />$parsed_message = $parser-&gt;parse($_POST['message']) // parse the posted string $_POST['message']
			-&gt;detect_links() // detect non-linked links and converted them into links
			-&gt;detect_emails() // detect non-linked e-mails and convert them into linked emails
			-&gt;detect_emoticons() // detect emoticons
			-&gt;get_html(); // get the HTML string
<br />echo $parsed_message; // show the parsed HTML</pre><h2><span
class="Apple-style-span" style="color: #333333; font-weight: 300;">You can download the above <a
href="http://www.samclarke.com/wp-content/uploads/2011/11/SCEditor-Demo.zip">SCEditor example here</a>.</span></h2> ]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2011/11/how-to-use-sceditor/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Incapsula vs. CloudFlare performance</title><link>http://www.samclarke.com/2011/11/incapsula-vs-cloudflare-performance/</link> <comments>http://www.samclarke.com/2011/11/incapsula-vs-cloudflare-performance/#comments</comments> <pubDate>Wed, 02 Nov 2011 16:10:09 +0000</pubDate> <dc:creator>sam</dc:creator> <category><![CDATA[Services]]></category> <category><![CDATA[Cloudflare]]></category> <category><![CDATA[Incapsula]]></category> <category><![CDATA[Performance]]></category> <category><![CDATA[Security]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=181</guid> <description><![CDATA[To see how Incapsula and CloudFlare compared performance wise I&#8217;ve set up two identical pages, one going through Incapsula and the other through CloudFlare, and tested them with various online tools. From my tests CloudFlare appears to be much faster &#8230; <a
href="http://www.samclarke.com/2011/11/incapsula-vs-cloudflare-performance/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>To see how Incapsula and CloudFlare compared performance wise I&#8217;ve set up two identical pages, one going through Incapsula and the other through CloudFlare, and tested them with various online tools.</p><p>From my tests CloudFlare appears to be much faster for the first few resources, but the last few resources seem take much longer to load (See Pingdom results for an example). Incapsula is slightly slower but unlike CloudFlare it’s speed is much more consistent with all the resources leading to very similar load times.<span
id="more-181"></span></p><h2>Loads.in results:</h2><p><a
href="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula_vs_cloudflare_-_loads_in_14th_oct_20111.png"><img
title="Incapsula vs Cloudflare loads.in" src="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula_vs_cloudflare_-_loads_in_14th_oct_20111.png" alt="Incapsula vs Cloudflare loads.in results" width="600" height="371" /></a></p><h2>WebPageTest.org results:</h2><p>Each test was run 3 times with both First View and Repeat View and the average taken.</p><p><a
href="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula_vs_cloudflare_-_first_view_-_webpagetest_org1.png"><img
title="Incapsula vs Cloudflare first view webpagetest.org" src="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula_vs_cloudflare_-_first_view_-_webpagetest_org1.png" alt="" width="600" height="371" /></a><br
/> <a
href="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula_vs_cloudflare_-_repeat_view_-_webpagetest_org1.png"><img
title="Incapsula vs Cloudflare Repeat view webpagetest.org" src="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula_vs_cloudflare_-_repeat_view_-_webpagetest_org1.png" alt="Incapsula vs Cloudflare Repeat view webpagetest.org results" width="600" height="371" /></a><br
/> <a
href="http://www.samclarke.com/wp-content/uploads/2011/10/total_time.png"><img
title="Incapsula vs CloudFlare - Webpagetest.org overall time" src="http://www.samclarke.com/wp-content/uploads/2011/10/total_time.png" alt="" width="600" height="371" /></a></p><h2>Pingdom results:</h2><p><a
href="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula_vs_cloudflare_-_pingdom_results1.png"><img
title="Incapsula vs Cloudflare pingdom results" src="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula_vs_cloudflare_-_pingdom_results1.png" alt="Incapsula vs Cloudflare pingdom results" width="600" height="371" /></a></p><p>Screenshot of one of the Pindom results:</p><div
id="attachment_202" class="wp-caption alignleft" style="width: 160px"><a
href="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula.png"><img
class="size-thumbnail wp-image-202 " title="Incapsula Pingdom Results" src="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula-150x150.png" alt="Incapsula Pingdom Results" width="150" height="150" /></a><p
class="wp-caption-text">Incapsula Results</p></div><div
id="attachment_201" class="wp-caption alignleft" style="width: 160px"><a
href="http://www.samclarke.com/wp-content/uploads/2011/10/CloudFlare.png"><img
class="size-thumbnail wp-image-201 " title="CloudFlare Pingdom Results" src="http://www.samclarke.com/wp-content/uploads/2011/10/CloudFlare-150x150.png" alt="CloudFlare Pingdom Results" width="150" height="150" /></a><p
class="wp-caption-text">CloudFlare Results</p></div><h2>Site-Perf.com results:</h2><p><a
href="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula_vs_cloudflare_-_site-perf_com.png"><img
title="Incapsula vs Cloudflare - site-perf.com" src="http://www.samclarke.com/wp-content/uploads/2011/10/incapsula_vs_cloudflare_-_site-perf_com.png" alt="Incapsula vs Cloudflare - site-perf.com results" width="600" height="371" /></a></p><h2>FreeSiteStatus.com results:</h2><p><a
href="http://www.samclarke.com/wp-content/uploads/2011/10/freesitestatus-performance.png"><img
title="Incapsula vs CloudFlare - Freesitestatus performance" src="http://www.samclarke.com/wp-content/uploads/2011/10/freesitestatus-performance.png" alt="Incapsula vs CloudFlare - Freesitestatus performance" width="824" height="437" /></a></p><h2>Site24X7.com results:</h2><p><a
href="http://www.samclarke.com/wp-content/uploads/2011/10/site24x7_com_web_page_performance.png"><img
title="Incapsula vs CloudFlare site24x7.com web page performance" src="http://www.samclarke.com/wp-content/uploads/2011/10/site24x7_com_web_page_performance.png" alt="site24x7.com web page performance results" width="600" height="371" /></a></p><h2>Uptime results</h2><p>The uptime checking services that only monitored in one or two locations or where the check interval was quite large ~30 minutes all reported 100% uptime. The two sites which had a shorter check interval reported outages with both Incapsula and CloudFlare.</p><p>FreeSiteStatus.com reported a 1 minute outage with both Incapsula and CloudFlare at different times. Site24X7.com reported 1 outage with Incapsula which lasted 5mins 14secs and <strong>9 outages with CloudFlare totalling 58 minutes 16 seconds!</strong></p><p>I was around during 2 of the 9 CloudFlare outages and I was able to verify that it was actually down and not a problem with the monitoring site. I also checked it wasn&#8217;t due to the test sites configuration by checking another site I use CloudFlare with as well as a couple of sites which I know use CloudFlare. All of which were down meaning it must of been a CloudFlare issue. Each outage didn&#8217;t seem to affect all locations or last too long.</p><p>Site24X7.com downtime reports are available here: <a
href="http://www.samclarke.com/wp-content/uploads/2011/10/Downtime_Report.pdf">CloudFlare&#8217;s Downtime Report (PDF)</a> <a
href="http://www.samclarke.com/wp-content/uploads/2011/10/Downtime_Report-1.pdf">Incapsula&#8217;s Downtime Report (PDF)</a></p><h2>Conclusion</h2><p>The uptime problems with CloudFlare may have just be down to a bad week. I have however experienced some outages with CloudFlare before when I wasn&#8217;t monitoring them so I think these results may be reasonable accurate. The only way to be certain would be to monitor CloudFlare for at least a few months and see how well they do. None of the outages affected all locations though and seemed to affect none US locations more than US ones.</p><p>The performance of Incapsula and CloudFlare is about the same overall. However CloudFlare is very fast for the first few resources, so I think using CloudFlare with a separate CDN would give the best performance. If uptime is the most important factor, I would say Incapsula would be the better choice.</p><p>As always though the only way to really choose is to try both and see which is better for you.</p> ]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2011/11/incapsula-vs-cloudflare-performance/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Install APC with XAMPP on Linux</title><link>http://www.samclarke.com/2011/10/install-apc-with-xampp-on-linux/</link> <comments>http://www.samclarke.com/2011/10/install-apc-with-xampp-on-linux/#comments</comments> <pubDate>Wed, 19 Oct 2011 21:59:34 +0000</pubDate> <dc:creator>sam</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[APC]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[XAMPP]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=223</guid> <description><![CDATA[If you don&#8217;t already have the XAMPP development files installed you must install them first. The XAMPP development files can be downloaded from here. Alternatively to install the XAMPP development files run the following commands: wget -O xampp-dev-files.tar.gz http://www.apachefriends.org/download.php?xampp-linux-devel-1.7.7.tar.gz sudo tar xvfz xampp-dev-files.tar.gz &#8230; <a
href="http://www.samclarke.com/2011/10/install-apc-with-xampp-on-linux/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>If you don&#8217;t already have the XAMPP development files installed you must install them first. The XAMPP development files can be downloaded <a
href="http://www.apachefriends.org/en/xampp-linux.html">from here</a>.</p><p>Alternatively to install the XAMPP development files run the following commands:</p><pre>wget -O xampp-dev-files.tar.gz http://www.apachefriends.org/download.php?xampp-linux-devel-<strong>1.7.7</strong>.tar.gz
sudo tar xvfz xampp-dev-files.tar.gz -C /opt</pre><p><strong>Note:</strong> Change 1.7.7 in the above wget command to the latest version listed on the XAMPP website linked above.<span
id="more-223"></span></p><h2>Installing APC</h2><p>First download and extract the APC source files:</p><pre>wget -O apc-latest.tar.gz http://pecl.php.net/get/APC
tar xvfz apc-latest.tar.gz
cd APC-*</pre><p>Then run phpize in the APC source directory:</p><pre> /opt/lampp/bin/phpize</pre><p>Run configure (64-bit users see below for 64-bit instructions):</p><pre>./configure --with-php-config=/opt/lampp/bin/php-config</pre><p>Compile and install:</p><pre>make
sudo make install</pre><p>Finally add &#8220;extension=apc.so&#8221; to the php.ini file and restart XAMPP:</p><pre>sudo sh -c "echo 'extension=apc.so' &gt;&gt; /opt/lampp/etc/php.ini"
sudo /opt/lampp/lampp restart</pre><h2>Linux/Ubuntu x64</h2><p>XAMPP is compiled as 32-bit so if you are using 64-bit Linux you will need to compile APC as 32-bit.</p><p>First install the 32-bit development libraries:</p><pre>sudo apt-get install libc6-dev-i386</pre><p>Next change the configure command in the above instructions to:</p><pre> ./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" --with-php-config=/opt/lampp/bin/php-config</pre><p>Then just proceed with the instructions above.</p><h2>Errors</h2><p><strong>When restarting XAMPP it ouputs a wrong ELF class error</strong><br
/> See above 64-bit section. Before running the &#8220;make&#8221; command again make sure to run &#8220;make clean&#8221; to get rid of any previous 64-bit build.</p> ]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2011/10/install-apc-with-xampp-on-linux/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Incapsula Review</title><link>http://www.samclarke.com/2011/09/incapsula-review/</link> <comments>http://www.samclarke.com/2011/09/incapsula-review/#comments</comments> <pubDate>Wed, 21 Sep 2011 15:23:57 +0000</pubDate> <dc:creator>sam</dc:creator> <category><![CDATA[Services]]></category> <category><![CDATA[firewall]]></category> <category><![CDATA[Incapsula]]></category> <category><![CDATA[Security]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=163</guid> <description><![CDATA[Incapsula, like CloudFlare, is free &#38; paid for service which claims to enhance the security of a website while boosting its performance at the same time. I’ve been testing Incapsula to see how good it is and how it compares &#8230; <a
href="http://www.samclarke.com/2011/09/incapsula-review/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Incapsula, like CloudFlare, is free &amp; paid for service which claims to enhance the security of a website while boosting its performance at the same time.</p><p>I’ve been testing Incapsula to see how good it is and how it compares to CloudFlare (which I’m currently using). This review is of the new release of Incapsula which was released on the 21 September 2011.</p><h2 dir="ltr">Setup</h2><p>Setup with Incapsula was straightforward and only took about 15 minutes from start to finish, most of which was waiting for Incapsula to notice the DNS changes. CloudFlare was slightly faster at noticing the DNS changes but not by much and as this is only done once it shouldn&#8217;t really matter.</p><p>The Incapsula control panel is easy to use and looks good with plenty of options available.<br
/> <span
id="more-163"></span><br
/> <a
href="http://www.samclarke.com/wp-content/uploads/2011/09/incapsula-controlpanel.png"><img
class="alignnone size-medium wp-image-164" title="incapsula-controlpanel" src="http://www.samclarke.com/wp-content/uploads/2011/09/incapsula-controlpanel-300x285.png" alt="" width="300" height="285" /></a></p><h2 dir="ltr">Performance</h2><p>Incapsula, just like CloudFlare, acts like a CDN which should boost a websites performance.</p><p>From my tests the performance of Incapsula appears to be very similar to that of CloudFlare’s. The PingDom results were identical for both of them. WebPageTest.org gave slightly different results but again they were both very close.</p><p>WebPageTest.org results with Incapsula:</p><div
dir="ltr"><table><colgroup><col
width="104" /><col
width="63" /><col
width="60" /><col
width="72" /><col
width="48" /><col
width="61" /><col
width="54" /><col
width="48" /><col
width="61" /><col
width="54" /></colgroup><tbody><tr><td></td><td><p
dir="ltr">Load Time</p></td><td><p
dir="ltr">First Byte</p></td><td><p
dir="ltr">Start Render</p></td><td><p
dir="ltr">Time</p></td><td><p
dir="ltr">Requests</p></td><td><p
dir="ltr">Bytes In</p></td><td><p
dir="ltr">Time</p></td><td><p
dir="ltr">Requests</p></td><td><p
dir="ltr">Bytes In</p></td></tr><tr><td><p
dir="ltr">First View (Run 5)</p></td><td><p
dir="ltr">1.985s</p></td><td><p
dir="ltr">0.474s</p></td><td><p
dir="ltr">1.505s</p></td><td><p
dir="ltr">1.985s</p></td><td><p
dir="ltr">26</p></td><td><p
dir="ltr">135 KB</p></td><td><p
dir="ltr">1.985s</p></td><td><p
dir="ltr">26</p></td><td><p
dir="ltr">135 KB</p></td></tr><tr><td><p
dir="ltr">Repeat View (Run 1)</p></td><td><p
dir="ltr">0.999s</p></td><td><p
dir="ltr">0.476s</p></td><td><p
dir="ltr">0.609s</p></td><td><p
dir="ltr">0.999s</p></td><td><p
dir="ltr">11</p></td><td><p
dir="ltr">33 KB</p></td><td><p
dir="ltr">0.999s</p></td><td><p
dir="ltr">11</p></td><td><p
dir="ltr">33 K</p></td></tr></tbody></table></div><p>WebPageTest.org results with CloudFlare:</p><div
dir="ltr"><table><colgroup><col
width="104" /><col
width="63" /><col
width="60" /><col
width="72" /><col
width="48" /><col
width="61" /><col
width="54" /><col
width="48" /><col
width="61" /><col
width="54" /></colgroup><tbody><tr><td></td><td><p
dir="ltr">Load Time</p></td><td><p
dir="ltr">First Byte</p></td><td><p
dir="ltr">Start Render</p></td><td><p
dir="ltr">Time</p></td><td><p
dir="ltr">Requests</p></td><td><p
dir="ltr">Bytes In</p></td><td><p
dir="ltr">Time</p></td><td><p
dir="ltr">Requests</p></td><td><p
dir="ltr">Bytes In</p></td></tr><tr><td><p
dir="ltr">First View (Run 2)</p></td><td><p
dir="ltr">1.731s</p></td><td><p
dir="ltr">0.474s</p></td><td><p
dir="ltr">1.348s</p></td><td><p
dir="ltr">1.731s</p></td><td><p
dir="ltr">26</p></td><td><p
dir="ltr">137 KB</p></td><td><p
dir="ltr">1.731s</p></td><td><p
dir="ltr">26</p></td><td><p
dir="ltr">137 KB</p></td></tr><tr><td><p
dir="ltr">Repeat View (Run 4)</p></td><td><p
dir="ltr">3.767s</p></td><td><p
dir="ltr">0.475s</p></td><td><p
dir="ltr">0.597s</p></td><td><p
dir="ltr">3.767s</p></td><td><p
dir="ltr">14</p></td><td><p
dir="ltr">38 KB</p></td><td><p
dir="ltr">3.767s</p></td><td><p
dir="ltr">14</p></td><td><p
dir="ltr">38 KB</p></td></tr></tbody></table></div><p>For “First Views” Incapsula did <em>slightly</em> worse compared to CloudFlare, however, with “Repeat Views” Incapsula<strong><em> a lot</em></strong> better. I think the reason CloudFlare was so slow with repeat views is because the repeat view happens straight after the first view and I suspect CloudFlare has some kind of connection limiting.</p><p>The only other tool to gave any real difference in speed was <a
href="http://loads.in/">loads.in</a> which CloudFlare did slightly better on overall but not by much.</p><h2 dir="ltr">Features</h2><p>One feature which is very different between CloudFlare and Incapsula is the DNS. With CloudFlare you point your domain to their Name Servers and use their DNS server. With Incapsula you use your own DNS server and instead just point an A record to Incapsula’s servers. Which is better depends entirely on if you want to use your own DNS server of not.</p><p>Another good feature of Incapsula is that it has options to be notified when specific threats happen and what to do about them. The free account of Incapsula also has better stats which have more information and update faster than those of CloudFlare’s free account.</p><p>One of the best features of both Incapsula and CloudFlare has to be their ability at stopping spam. They both reduce spam down to much more manageable levels by blocking all those annoying spam bots.</p><h2 dir="ltr">Security</h2><p>Incapsula, like CloudFlare, is a good added layer of security but it should <strong><em>not</em></strong> replace any of your existing security.</p><p>Both Incapsula and CloudFlare have the same problem. If the attacker gets the servers IP address, they can then attack the server directly which will completely bypass all the added security. You could setup the server to allow only Incapsula or CloudFlare IP addresses to connect to it, which should solve most of the problem. It isn’t really ideal though and as far as I’m aware it isn’t mentioned anywhere as something they recommend. Doing that also wouldn’t stop things like DDOS attacks.</p><p>Incapsula dose help reduce spam greatly and should stop basic script kiddies and robots from getting in. Determined attackers will, however, be able to bypass it by attacking the server directly and you will be back to whatever security you currently have on your server. It should help reduce the security logs though so you can concentrate on protecting yourself from real threats.</p><h2 dir="ltr">Price</h2><p>It’s free! Provided your website fits into the small account (currently 25GB bandwidth a month) the price is great! If it doesn’t fit in the free account, it should hopefully generate enough revenue to cover the costs of the paid accounts.</p><p>Unlike CloudFlare, Incapsula doesn&#8217;t have a one size fits all price plan which would be good for medium sized websites, if the smallest paid account wasn’t so much more expensive then CloudFlare. Providing you don’t need any of the paid for features a small website should fit easily into the free account, so this shouldn’t be too much of a problem.</p><h2 dir="ltr">Overall</h2><p>Setup: 9.95/10. It loses .05 for being a little slower.<br
/> Performance: 10/10<br
/> Features: 10.05/10. It gets .05 back for having so many features free.<br
/> Security: 7.5/10. Good but like CloudFlare it offers no protection if the attacker gets the servers IP address.<br
/> Price: 10/10. It’s free!<br
/> Overall: 9/10</p><p>Both CloudFlare and Incapsula have their pros and cons, and choosing one really depends on the website you want to protect and which one you prefer using.</p><p>If you have a medium to large sized website then CloudFlare, with it’s one size fits all pricing, is probably a better deal. Incapsula on the other hand gives better features with their free account like more security features, stats which update faster, and options to be notified when certain threats happen.</p><p>Overall though I think the only way to decide is to try them (they&#8217;re both free after all) and see which you prefer. You can sign up for <a
href="http://www.incapsula.com/sign-up">Incapsula here</a> and <a
href="https://www.cloudflare.com/sign-up.html">CouldFlare here</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2011/09/incapsula-review/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>SBBCodeParser &#8211; PHP BBCode parser class</title><link>http://www.samclarke.com/2011/09/sbbcodeparser-php-bbcode-parser-class/</link> <comments>http://www.samclarke.com/2011/09/sbbcodeparser-php-bbcode-parser-class/#comments</comments> <pubDate>Thu, 15 Sep 2011 19:20:50 +0000</pubDate> <dc:creator>sam</dc:creator> <category><![CDATA[Code]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[BBCode]]></category> <category><![CDATA[Library]]></category> <category><![CDATA[Parser]]></category> <category><![CDATA[SBBCode]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=133</guid> <description><![CDATA[SBBCodeParser is a simple PHP BBCode parser class which makes it easy to add your own BBCodes. SBBCodeParser is licensed under the LGPL and the source code is available on GitHub. Example usage: Example of adding a custom BBCode: Currently &#8230; <a
href="http://www.samclarke.com/2011/09/sbbcodeparser-php-bbcode-parser-class/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>SBBCodeParser is a simple PHP BBCode parser class which makes it easy to add your own BBCodes.</p><p>SBBCodeParser is licensed under the LGPL and the source code is available on <a
href="https://github.com/samclarke/SBBCodeParser">GitHub</a>.</p><p>Example usage:</p><pre class="brush: php; title: ; notranslate">$parser = new SBBCodeParser_Document();
$parser-&gt;add_emoticons(array(
	':)' =&gt; 'http://localhost/Classes/SCEditor-punbb/punbb-1.3.5/img/smilies/smile.png',
	'=)' =&gt; 'http://localhost/Classes/SCEditor-punbb/punbb-1.3.5/img/smilies/smile.png'
));
echo $parser-&gt;parse('This should be [b]bold[/b] and this should be [i]italic[/i]')
	-&gt;detect_links()
	-&gt;detect_emails()
	-&gt;detect_emoticons()
	-&gt;get_html();</pre><p>Example of adding a custom BBCode:</p><pre class="brush: php; title: ; notranslate">
$bbcode = new SBBCodeParser_BBCode('youtube', function($content, $attribs)
{
    if(substr($content, 0, 23) === 'http://www.youtube.com/')
        $uri = $content;
    else
        $uri = 'http://www.youtube.com/v/' . $content;
    return '&lt;iframe width=&quot;480&quot; height=&quot;390&quot; src=&quot;' . $uri . '&quot; frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;';
}, SBBCodeParser_BBCode::BLOCK_TAG, false, array(), array('text_node'), SBBCodeParser_BBCode::AUTO_DETECT_EXCLUDE_ALL);
$parser-&gt;add_bbcode($bbcode);
</pre><p><span
id="more-133"></span><br
/> Currently included default BBCodes:</p><pre id="line1">b
i
strong
em
u
s
blink
sub
sup
ins
del
right
left
center
justify
note
hidden
abbr
acronym
icq
skype
bing
google
wikipedia
youtube
vimeo
flash
paypal
pastebin
gist
twitter
tweets
googlemaps
pdf
scribd
spoiler
tt
pre
code
php
quote
font
size
color
list
ul
ol
li
*
table
th
h
tr
row
r
td
col
c
notag
nobbc
noparse
h1
h2
h3
h4
h5
h6
big
small
br
sp
hr
anchor
goto
jumpto
img
email
url</pre>]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2011/09/sbbcodeparser-php-bbcode-parser-class/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>PHP recursive implode function</title><link>http://www.samclarke.com/2011/08/php-recursive-implode-function/</link> <comments>http://www.samclarke.com/2011/08/php-recursive-implode-function/#comments</comments> <pubDate>Sat, 20 Aug 2011 15:15:40 +0000</pubDate> <dc:creator>sam</dc:creator> <category><![CDATA[Code]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[function]]></category> <category><![CDATA[snippet]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=123</guid> <description><![CDATA[Recursive version of the PHP implode function]]></description> <content:encoded><![CDATA[<p>Recursive version of the PHP implode function</p><pre class="brush: php; title: ; notranslate">if(!function_exists('implode_r'))
{
	function implode_r($glue, array $arr)
	{
		$ret = '';
		foreach($arr as $piece)
		{
	    		if(is_array($piece))
	      			$ret .= $glue . implode_r($glue, $piece);
	    		else
	      			$ret .= $glue . $piece;
	  	}
	  	return $ret;
	}
}</pre>]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2011/08/php-recursive-implode-function/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>SCEmoticons</title><link>http://www.samclarke.com/2011/07/scemoticons/</link> <comments>http://www.samclarke.com/2011/07/scemoticons/#comments</comments> <pubDate>Sun, 24 Jul 2011 21:13:41 +0000</pubDate> <dc:creator>sam</dc:creator> <category><![CDATA[Uncategorized]]></category> <category><![CDATA[emoticons]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=95</guid> <description><![CDATA[Some emoticons that I made a long time ago. While not the best emoticons in the world they may be of use to someone. You can download them in a here. These emoticons are licensed under the Creative Commons Attribution-ShareAlike 2.0 UK: England &#38; &#8230; <a
href="http://www.samclarke.com/2011/07/scemoticons/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p><a
href="http://www.samclarke.com/wp-content/uploads/2011/07/index.png"><img
class="alignnone size-full wp-image-96" title="SCEmotions" src="http://www.samclarke.com/wp-content/uploads/2011/07/index.png" alt="" width="151" height="148" /></a></p><p>Some emoticons that I made a <em>long</em> time ago. While not the best emoticons in the world they may be of use to someone. You can download them in a <a
href="http://www.samclarke.com/wp-content/uploads/2011/07/SCEmoticons.zip">here</a>.</p><p>These emoticons are licensed under the <a
href="http://creativecommons.org/licenses/by-sa/2.0/uk/" rel="license">Creative Commons Attribution-ShareAlike 2.0 UK: England &amp; Wales License</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2011/07/scemoticons/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
