<?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>Sun, 06 May 2012 00:41:07 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>Add menu entry for XAMPP in Ubuntu 12.04</title><link>http://www.samclarke.com/2012/04/add-menu-entry-for-xampp-in-ubuntu-12-04/</link> <comments>http://www.samclarke.com/2012/04/add-menu-entry-for-xampp-in-ubuntu-12-04/#comments</comments> <pubDate>Sun, 29 Apr 2012 18:58:14 +0000</pubDate> <dc:creator>Sam Clarke</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[XAMPP]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=409</guid> <description><![CDATA[You will need to install python-glade2 for the XAMPP control panel to work: sudo apt-get install python-glade2 Then create a file called XAMPP-Control-Panel.desktop in /usr/share/applications/ and put the following in it: [Desktop Entry] Version=1.0 Encoding=UTF-8 Name=XAMPP Control Panel GenericName=Control Panel &#8230; <a
href="http://www.samclarke.com/2012/04/add-menu-entry-for-xampp-in-ubuntu-12-04/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>You will need to install python-glade2 for the XAMPP control panel to work:</p><pre>sudo apt-get install python-glade2</pre><p>Then create a file called XAMPP-Control-Panel.desktop in /usr/share/applications/ and put the following in it:</p><pre>[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=XAMPP Control Panel
GenericName=Control Panel
Comment=XAMPP Control Panel
Exec=gksudo "/opt/lampp/share/xampp-control-panel/xampp-control-panel"
Icon=/opt/lampp/htdocs/favicon.ico
StartupNotify=true
StartupWMClass="xampp-control-panel.py"
Terminal=false
Type=Application
Categories=Developer;</pre><p>Alternatively do the following:</p><pre>wget http://www.samclarke.com/wp-content/uploads/2012/04/XAMPP-Control-Panel.desktop
sudo mv XAMPP-Control-Panel.desktop /usr/share/applications/XAMPP-Control-Panel.desktop</pre><p>By default (in Ubuntu 12.04) the control panel will not be themed as it needs to run as root. To set the root users theme to your current theme, simply do:</p><pre>sudo ln -s ~/.themes /root/.themes
sudo ln -s ~/.icons /root/.icons
sudo ln -s ~/.fonts /root/.fonts</pre>]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2012/04/add-menu-entry-for-xampp-in-ubuntu-12-04/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>How to install Aptana Studio 3 on Ubuntu 12.04 LTS (Precise Pangolin)</title><link>http://www.samclarke.com/2012/04/how-to-install-aptana-studio-3-on-ubuntu-12-04-lts-precise-pangolin/</link> <comments>http://www.samclarke.com/2012/04/how-to-install-aptana-studio-3-on-ubuntu-12-04-lts-precise-pangolin/#comments</comments> <pubDate>Sun, 29 Apr 2012 01:01:52 +0000</pubDate> <dc:creator>Sam Clarke</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=399</guid> <description><![CDATA[1. Install the prerequisites sudo apt-get install openjdk-7-jdk libjpeg62 libwebkitgtk-1.0-0 git-core Although Aptana Studio doesn&#8217;t officially support OpenJDK, I&#8217;ve not encountered any problems, however I&#8217;ve not done extensive testing. Alternatively, to use the Sun JDK, do the following: sudo apt-get &#8230; <a
href="http://www.samclarke.com/2012/04/how-to-install-aptana-studio-3-on-ubuntu-12-04-lts-precise-pangolin/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p><strong>1. Install the prerequisites</strong></p><pre>sudo apt-get install openjdk-7-jdk libjpeg62 libwebkitgtk-1.0-0 git-core</pre><p>Although Aptana Studio doesn&#8217;t officially support OpenJDK, I&#8217;ve not encountered any problems, however I&#8217;ve not done extensive testing. Alternatively, to use the Sun JDK, do the following:</p><pre>sudo apt-get install libjpeg62 libwebkitgtk-1.0-0 git-core
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
#<a href="http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html">source</a></pre><p>libjpeg62 is important, without it you will get errors like this:</p><pre>An internal error has occurred.
No more handlesNative code library failed to load. (java.lang.UnsatisfiedLinkError: /opt/Aptana_Studio_3/plugins/com.aptana.swt.webkitbrowser.linux.x86_64_1.0.0.1295409059/os/linux/x86_64/libcefjni.so: libjpeg.so.62: cannot open shared object file: No such file or directory)</pre><p><strong>2. Download Aptana Studio<br
/> </strong></p><p>You can download <a
href="http://www.aptana.com/products/studio3/download">Aptana Studio 3 here</a>. Select the &#8220;Standalone Version&#8221; if not selected and click download.</p><p><strong>3. Extract <strong>Aptana Studio</strong></strong></p><pre>sudo unzip [name of Aptana Studio ZIP file here].zip -d /opt</pre><p><strong>4. Add the menu shortcut</strong></p><pre>wget http://www.samclarke.com/wp-content/uploads/2012/04/AptanaStudio3.desktop
sudo mv AptanaStudio3.desktop /usr/share/applications/AptanaStudio3.desktop</pre><p>For those of you which are security conscious, you can check the contents of <a
href="http://www.samclarke.com/wp-content/uploads/2012/04/AptanaStudio3.desktop">AptanaStudio3.desktop here</a> or by entering the URL above.</p> ]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2012/04/how-to-install-aptana-studio-3-on-ubuntu-12-04-lts-precise-pangolin/feed/</wfw:commentRss> <slash:comments>17</slash:comments> </item> <item><title>SCEditor Documentation</title><link>http://www.samclarke.com/2012/04/sceditor-documentation/</link> <comments>http://www.samclarke.com/2012/04/sceditor-documentation/#comments</comments> <pubDate>Fri, 13 Apr 2012 19:37:40 +0000</pubDate> <dc:creator>Sam Clarke</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[Documentation]]></category> <category><![CDATA[SCEditor]]></category> <guid
isPermaLink="false">http://www.samclarke.com/?p=379</guid> <description><![CDATA[SCEditor Documentation SCEditor is designed to be a small, lightweight BBCode and HTML WYSIWYG editor. Hopefully this documentation will cover most things needed but if you find something missing or have any questions/concerns please feel free to contact via my &#8230; <a
href="http://www.samclarke.com/2012/04/sceditor-documentation/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<h1 align="CENTER">SCEditor Documentation</h1><p>SCEditor is designed to be a small, lightweight BBCode and HTML WYSIWYG editor.</p><p>Hopefully this documentation will cover most things needed but if you find something missing or have any questions/concerns please feel free to contact <a
href="http://www.samclarke.com/contact/">via my site</a>, <a
href="https://github.com/samclarke">via GitHub</a> or <a
href="http://www.samclarke.com/2011/07/sceditor/">by just leaving a comment</a>.</p><h2>Setup</h2><p>To set up the editor, first include the minified JS, CSS and, if needed, the language file.<br
/> e.g.:</p><pre>&lt;link rel="stylesheet" href="minified/jquery.sceditor.min.css" type="text/css" media="all" /&gt;
&lt;script src="../minified/jquery.sceditor.min.js"&gt;&lt;/script&gt;
&lt;script src="../languages/nl.js"&gt;&lt;/script&gt;</pre><p><span
id="more-379"></span>Then, to setup the editor on all textareas, simply do:</p><pre>&lt;script&gt;
	$(document).ready(function() {
		$("textarea").sceditor({/* options here */});
	});
&lt;script&gt;</pre><p>or for the BBCode editor do:</p><pre>&lt;script&gt;
	$(document).ready(function() {
		$("textarea").sceditorBBCodePlugin({/* options here */});
	});
&lt;script&gt;</pre><p>You can change &#8220;textarea&#8221; to any <a
href="http://api.jquery.com/category/selectors/">jQuery selector</a> (jQuery borrows from CSS selectors, most of which will work) to convert only specific textareas .</p><p>To only convert a textarea with a specific ID you can do “#id-of-textarea” or to convert all textareas with the specified class you can do “.class-name-here”;</p><h2>Options</h2><p>Options should be passed in the editor&#8217;s constructor.<br
/> e.g.:</p><pre>&lt;script&gt;
	$(document).ready(function() {
		$("textarea").sceditorBBCodePlugin({
			// option 1
			toolbar: "bold,italic,underline|source",
			// option 2
			locale: "no-NB"
		});
	});
&lt;script&gt;</pre><p><strong>toolbar</strong> <em>string</em></p><p
style="padding-left: 30px;">A comma separated list of commands. To separate into groups, use the bar character (|) instead of a comma.<br
/> e.g.:</p><pre style="margin-left: 30px;">bold,italic,underline|source</pre><p><strong>locale</strong> <em>string</em></p><p
style="padding-left: 30px;">The locale to use, e.g. en-GB, en-US, no-NB, ect. The language file for the specified locale <em>must</em> be included before the editor is used and after the editors main JS file. e.g.</p><pre style="margin-left: 30px;">&lt;script src="../minified/jquery.sceditor.min.js"&gt;&lt;/script&gt;
&lt;script src="../languages/nl.js"&gt;&lt;/script&gt;
// setup the editor here</pre><p><strong>charset </strong><em>string</em></p><p
style="padding-left: 30px;">The charset to use. Defaults to utf-8.</p><p><strong>style</strong> <em>string</em></p><p
style="padding-left: 30px;">The stylesheet used to style the HTML content of the WYSIWYG document, normally it should be jquery.sceditor.default.css. This dose not style the editor, the editor is styled by a separate stylesheet which is normally jquery.sceditor.css.</p><p><strong>fonts</strong> <em>string</em></p><p
style="padding-left: 30px;">Comma separated list of fonts. There is no way to check if the fonts are installed on the users PC, so the fonts on the list should be kept to the few fonts that are included on most PC&#8217;s and Macs. The default list should be adequate for most uses.</p><p><strong>colors</strong> <em>string</em></p><p
style="padding-left: 30px;">Comma separated list of HEX colours. Use the bar character (|) to signify a new column. If set to null a list of colours will automatically be generated</p><p><strong>emoticonsCompat</strong> <em>boolean</em></p><p
style="padding-left: 30px;">If compatibility is enabled it will require emoticons to be surrounded by whitespace or EOL characters meaning if you have :/ it will not be replaced in http://. This mode currently has limited As You Type emoticon conversion support.</p><p><strong>emoticons</strong> <em>map</em></p><p
style="padding-left: 30px;">Map in the following format:</p><pre style="margin-left: 30px;">emoticons:
{
    // emoticons to be included in the dropdown
    dropdown: {
        ":)": "emoticons/smile.png",
        ":angel:": "emoticons/angel.png"
    },
    // emoticons to be included in the more section
    more: {
        ":alien:": "emoticons/alien.png",
        ":blink:": "emoticons/blink.png"
    },
    // emoticons that are not shwon in the dropdown but will be converted ATY
    hidden: {
        ":aliasforalien:": "emoticons/alien.png",
        ":aliasforblink:": "emoticons/blink.png"
    }
},</pre><p><strong>width</strong> <em>int|string</em></p><p
style="padding-left: 30px;">Should either be an int which will set the width of the editor in px, or a percentage string (e.g. “100%”). If set to null the width will be set to that of the textarea it is replacing.</p><p><strong>height</strong> <em>int|string</em></p><p
style="padding-left: 30px;">Should either be an int which will set the height of the editor in px, or a percentage string (e.g. “100%”). If set to null the height will be set to that of the textarea it is replacing.</p><p><strong>resizeEnabled</strong> <em>bool</em></p><p
style="padding-left: 30px;">If to allow the editor to be drag resized by the user. Defaults to true.</p><p><strong>resizeMinWidth</strong> <em>int</em></p><p
style="padding-left: 30px;">Minimum width in px that the editor can be resized to. Set to null for half textarea width or -1 for no minimum.</p><p><strong>resizeMinHeight</strong> <em>int</em></p><p
style="padding-left: 30px;">Minimum height in px that the editor can be resized to. Set to null for half textarea height or -1 for no minimum.</p><p><strong>resizeMaxHeight</strong> <em>int</em></p><p
style="padding-left: 30px;">Maximum height in px that the editor can be resized to. Set to null for double textarea height or -1 for no maximum.</p><p><strong>resizeMaxWidth</strong> <em>int</em></p><p
style="padding-left: 30px;">Maximum width in px that the editor can be resized to. Set to null for double textarea width or -1 for no maximum.</p><p><strong>getHtmlHandler</strong> <em>function</em></p><p
style="padding-left: 30px;">This is called to filter the HTML before being shown in View Source or set as the textareas value. The function should take two arguments, the first being a string containnig the HTML the second being the DOM body node.</p><p><strong>getTextHandler</strong> <em>function</em></p><p
style="padding-left: 30px;">This function will be called when switching from View Source mode back to WYSIWYG mode, or when loading the value from the textarea. The function should 1 argument, a string containing the content from the textarea.</p><p><strong>dateFormat</strong> <em>string</em></p><p
style="padding-left: 30px;">Date format to use, specified with the strings year, month &amp; day e.g. &#8220;year-month-day&#8221;. The year, month and day strings will be replaced with the users current year, month and day.</p><h2>Functions</h2><p>To get a reference to the editors instance, simply do:</p><pre>$("selector used").data("sceditor").functionnamehere();.</pre><p><strong>createDropDown</strong> (menuItem, dropDownName, content, ieUnselectable);</p><p
style="padding-left: 30px;">Creates a menu item drop down</p><p
style="padding-left: 30px;"><strong>menuItem</strong> <em>HTMLElement</em><br
/> The HTML button to align the drop down with</p><p
style="padding-left: 30px;"><strong>dropDownName</strong> <em>string</em><br
/> Used for styling the dropown, the will be a class sceditor-dropDownName</p><p
style="padding-left: 30px;"><strong>content</strong> <em>string</em><br
/> The HTML content of the dropdown</p><p
style="padding-left: 30px;"><strong>ieUnselectable</strong> <em>bool</em><br
/> If to add the unselectable attribute to all the contents elements. Stops IE from deselecting the text in the editor</p><p><strong>closeDropDown</strong> (focus);</p><p
style="padding-left: 30px;">Closes the current drop down</p><p
style="padding-left: 30px;"><strong>focus</strong> <em>bool</em><br
/> If to focus the editor on close</p><p><strong>wysiwygEditorInsertHtml</strong> (html, endHtml, overrideCodeBlocking);</p><p
style="padding-left: 30px;">Inserts HTML into WYSIWYG editor. If endHtml is defined and some text is selected, the selected text will be put in-between html and endHtml params. If endHtml isn&#8217;t defined and some text is selected it will be replaced by the inserted HTML.</p><p
style="padding-left: 30px;">The HTML can have only one root node, if it has more than one only the first will be inserted. e.g. with: “&lt;b&gt;test&lt;/b&gt;&lt;i&gt;test2&lt;/i&gt;” only “&lt;b&gt;test&lt;/b&gt;” will be inserted. To fix this you can do: “&lt;span&gt;&lt;b&gt;test&lt;/b&gt;&lt;i&gt;test2&lt;/i&gt;&lt;/span&gt;”</p><p
style="padding-left: 30px;"><strong>html</strong> <em>string</em><br
/> The HTML to insert</p><p
style="padding-left: 30px;"><strong>endHtml</strong> <em>string</em><br
/> If specified instead of the inserted HTML replacing the selected text the selected text will be placed between html and endHtml. If there is no selected text html and endHtml will be concatenated together.</p><p><strong>wysiwygEditorInsertText</strong> (text);</p><p
style="padding-left: 30px;">Like wysiwygEditorInsertHtml except it converts any HTML to text</p><p
style="padding-left: 30px;"><strong>text</strong> <em>string</em><br
/> The text to insert</p><p><strong>getWysiwygSelectedHtml</strong> ();</p><p
style="padding-left: 30px;">Gets the currently selected HTML</p><p><strong>getWysiwygEditorValue</strong> (filter);</p><p
style="padding-left: 30px;">Gets the WYSIWYG editors HTML between the body tags</p><p
style="padding-left: 30px;"><strong>filter</strong> <em>bool</em><br
/> If to filter the value through the getHtmlHandler</p><p><strong>getTextareaValue</strong> (filter);</p><p
style="padding-left: 30px;">Gets the view sourse value from the textarea</p><p
style="padding-left: 30px;"><strong>filter</strong> <em>bool</em><br
/> If to filter the value through the getTextHandler</p><p><strong>setWysiwygEditorValue</strong> (html);</p><p
style="padding-left: 30px;">Sets the value of the WYSIWYG editor</p><p
style="padding-left: 30px;"><strong>html</strong> <em>string</em><br
/> The HTML to set</p><p><strong>setTextareaEditorValue</strong> (text);</p><p
style="padding-left: 30px;">Sets the value of the View Source editor</p><p
style="padding-left: 30px;"><strong>text</strong> <em>string</em><br
/> The text to set</p><p><strong>updateTextareaValue</strong> ();</p><p
style="padding-left: 30px;">Updates the value of the textarea the editor is replacing, this is called before the form is submitted.</p><p><strong>toggleTextMode</strong> ();</p><p
style="padding-left: 30px;">Toggles the editors mode between WYSIWYG and View Source modes.</p><p><strong>focus</strong> ();</p><p
style="padding-left: 30px;">Focuses the editor.</p><p><strong>execCommand</strong> (command, param);</p><p
style="padding-left: 30px;">Executes a command on the WYSIWYG editor. The command can be any of the DesignMode/ContentEditable execCommands that browsers support.</p><p
style="padding-left: 30px;"><strong>command</strong> <em>string</em><br
/> The command to execute</p><p
style="padding-left: 30px;"><strong>param</strong><br
/> The commands parameter</p><p><strong>_</strong> (string, arg1, arg2, arg3, ect.);</p><p
style="padding-left: 30px;">Translates a string into the current locale being used. Replaces {1}, {2}, {3}, ect. With arg 1, arg 2, arg 3, ec.t</p><p
style="padding-left: 30px;"><strong>string</strong> <em>string</em><br
/> The string to translat</p><p
style="padding-left: 30px;"><strong>args</strong><br
/> The args to be replaced in the string</p><h2>Styling</h2><p>The editor has two style sheets, one to style the editor and it&#8217;s toolbars, and one to style the content inside the editor.</p><h3>Styling the editor</h3><p>The editors default styling is all in jquery.sceditor.css.</p><p>Outline of the editor&#8217;s classes:</p><pre><strong>div.sceditor-container</strong>
    The container for the whole editor
    <strong>div.sceditor-toolbar</strong>
        The container for the whole toolbar
        <strong> div.sceditor-group</strong>
            A toolbar group
            <strong> a.sceditor-button</strong>
                A toolbar button
            <strong> a.sceditor-button-*</strong>
                Same as the previous class but * is replaced with the buttons
                command name, e.g. .sceditor-button-bold, .sceditor-button-italic, ect.
                <strong> div</strong>
                    Div containing the buttons accessibility text and normally has the
                    background image is set to the button's icon too
    <strong> iframe</strong>
        Iframe containing the WYSIWYG editor
    <strong> textarea</strong>
        Textarea used in the view source mode
    <strong> div.sceditor-grip</strong>
        Grip used to resize the editor
    <strong> div.sceditor-resize-cover</strong>
        Div which covers the editor during resizing
    <strong> div.sceditor-dropdown</strong>
        Div containing the dropdown</pre><p>The file jquery.sceditor.css should act as a good example of styling the editor.</p><h3>Styling the editors content</h3><p>Styling the editors content should be much easier than the editor, there are no special classes used just plain HTML. The default content styling is kept in jjquery.sceditor.default.css.</p><h2>Adding Commands</h2><p>There are two functions for adding commands, they are $.sceditor.setCommand which is used to set a HTML command and $.sceditorBBCodePlugin.setCommand which is used to set a BBCode convertion command.</p><p><strong>$.sceditor.setCommand(</strong>name, exec, [tooltip], [keypress])</p><p
style="padding-left: 30px;">If you use $.sceditor.setCommand with a name that already exists, it will update that command instead of creating a new one.</p><p
style="padding-left: 30px;"><strong>Name </strong><em>string</em><br
/> The name used in the toolbar string, e.g. source, link, ect.</p><p
style="padding-left: 30px;"><strong>Exec</strong> <em>function</em><br
/> The function called when the button is pressed. The keyword this will be set to the editors instance.</p><p
style="padding-left: 30px;"><strong>Tooltip</strong> <em>string</em><br
/> The translatable tooltip shown when the use hovers over the button, e.g. View Source, Insert a link, ect.</p><p
style="padding-left: 30px;"><strong>Keypress</strong> <em>Function</em><br
/> The function called each time a key is pressed</p><p>Example of adding a heading command:</p><pre>&lt;script&gt;
	$(document).ready(function() {
		$.sceditor.setCommand(
			"headers",
			function(caller) {
				var	editor    = this,
					content   = $("&lt;div /&gt;"),
					clickFunc = function (e) {
						editor.execCommand("formatblock", "&lt;h" + $(this).data('sceditor-hsize') + "&gt;");
						editor.closeDropDown(true);
						e.preventDefault();
					};
				for (var i=1; i&lt;= 6; i++) {
					content.append(
						$('&lt;a href="#"&gt;&lt;h' + i + '&gt;Heading ' + i + '&lt;/h' + i + '&gt;&lt;/a&gt;')
							.data('sceditor-hsize', i)
							.click(clickFunc));
				}
				editor.createDropDown(caller, "header-picker", content);
		 	},
			"Format Headers"
		);
&lt;/script&gt;</pre><p><strong>$.sceditorBBCodePlugin.setCommand(</strong>name, tags, styles, format, html)</p><p
style="padding-left: 30px;"><strong>Name </strong><em>string</em><br
/> The BBCodes name</p><p
style="padding-left: 30px;"><strong>Tags</strong> <em>map</em><br
/> A map of all the tags this BBCode applies to with which attributes and attribute values, e.g.:</p><pre style="margin-left: 30px;">img: null</pre><p
style="padding-left: 30px;">will apply to any img tags.</p><pre style="margin-left: 30px;">img: {
	src: null
}</pre><p
style="padding-left: 30px;">will apply to any img tags with a src attribute.</p><pre style="margin-left: 30px;">img: {
	src: ['localhost/test.png', 'localhost/orange.png']
}</pre><p
style="padding-left: 30px;">will apply to any img tags with a src attribute that has a value of “localhost/test.png” or “localhost/orange.png.”</p><p
style="padding-left: 30px;"><strong>Styles</strong> <em>string</em><br
/> Like tags it should be a map of all the styles this BBCode applies to, e.g.:</p><pre style="margin-left: 30px;">"font-family": null</pre><p
style="padding-left: 30px;">will apply to any font-family styling.</p><pre style="margin-left: 30px;">"font-family": ['Arial', 'Gill Sans']</pre><p
style="padding-left: 30px;">will apply to any font-family styling with the value “Arial” or “Gill Sans”..</p><p
style="padding-left: 30px;"><strong>Format</strong> <em>Function|String</em><br
/> A string for format the matching tags with. Should contain {0} which will be replaced with the tags content, e.g. “[b]{0}[/b]”.</p><p
style="padding-left: 30px;">It can also be a function taking 2 parameters element and content, and returning a BBCode string.</p><p
style="padding-left: 30px;"><strong>HTML</strong> <em>Function|String</em><br
/> Identical to except this should be the HTML version of the BBCode, e.g. “&lt;b&gt;{0}&lt;/b&gt;”.</p><p
style="padding-left: 30px;">It can also be a function which takes 4 parameters, instance, bbcode, attrsMap, content.</p><p
style="padding-left: 30px;">Instance will be the converters instance, BBCode will be the BBCode string being converted, e.g. b for [b], ect., attrsMap will be a map of any attributes, content will be a string containing any content of the BBCode.</p><p>Example of adding custom BBCodes:</p><pre>$.sceditorBBCodePlugin.setCommand("h1", { h1: null }, null, "[h1]{0}[/h1]", "&lt;h1&gt;{0}&lt;/h1&gt;");
$.sceditorBBCodePlugin.setCommand("h2", { h2: null }, null, "[h2]{0}[/h2]", "&lt;h2&gt;{0}&lt;/h2&gt;");
$.sceditorBBCodePlugin.setCommand("h3", { h3: null }, null, "[h3]{0}[/h3]", "&lt;h3&gt;{0}&lt;/h3&gt;");
$.sceditorBBCodePlugin.setCommand("h4", { h4: null }, null, "[h4]{0}[/h4]", "&lt;h4&gt;{0}&lt;/h4&gt;");
$.sceditorBBCodePlugin.setCommand("h5", { h5: null }, null, "[h5]{0}[/h5]", "&lt;h5&gt;{0}&lt;/h5&gt;");
$.sceditorBBCodePlugin.setCommand("h6", { h6: null }, null, "[h6]{0}[/h6]", "&lt;h6&gt;{0}&lt;/h6&gt;");</pre>]]></content:encoded> <wfw:commentRss>http://www.samclarke.com/2012/04/sceditor-documentation/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <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 Clarke</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>1</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 Clarke</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[Update: An updated version of these instructions for Ubuntu 12.04 LTS (Precise Pangolin) is available here. 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 &#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><strong>Update:</strong> An updated version of these instructions for <a
href="http://www.samclarke.com/2012/04/how-to-install-aptana-studio-3-on-ubuntu-12-04-lts-precise-pangolin/">Ubuntu 12.04 LTS (Precise Pangolin) is available here</a>.</p><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>25</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 Clarke</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 Clarke</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>6</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 Clarke</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 Clarke</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 Clarke</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> </channel> </rss>
