Add menu entry for XAMPP in Ubuntu 12.04

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
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;

Alternatively do the following:

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

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:

sudo ln -s ~/.themes /root/.themes
sudo ln -s ~/.icons /root/.icons
sudo ln -s ~/.fonts /root/.fonts

How to install Aptana Studio 3 on Ubuntu 12.04 LTS (Precise Pangolin)

1. Install the prerequisites

sudo apt-get install openjdk-7-jdk libjpeg62 libwebkitgtk-1.0-0 git-core

Although Aptana Studio doesn’t officially support OpenJDK, I’ve not encountered any problems, however I’ve not done extensive testing. Alternatively, to use the Sun JDK, do the following:

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
#source

libjpeg62 is important, without it you will get errors like this:

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)

2. Download Aptana Studio

You can download Aptana Studio 3 here. Select the “Standalone Version” if not selected and click download.

3. Extract Aptana Studio

sudo unzip [name of Aptana Studio ZIP file here].zip -d /opt

4. Add the menu shortcut

wget http://www.samclarke.com/wp-content/uploads/2012/04/AptanaStudio3.desktop
sudo mv AptanaStudio3.desktop /usr/share/applications/AptanaStudio3.desktop

For those of you which are security conscious, you can check the contents of AptanaStudio3.desktop here or by entering the URL above.

SCEditor Documentation

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 site, via GitHub or by just leaving a comment.

Setup

To set up the editor, first include the minified JS, CSS and, if needed, the language file.
e.g.:

<link rel="stylesheet" href="minified/jquery.sceditor.min.css" type="text/css" media="all" />
<script src="../minified/jquery.sceditor.min.js"></script>
<script src="../languages/nl.js"></script>

Continue reading

Fix Contact Form 7 “Failed to send your message. Please try later or contact administrator by other way.”

I updated the Contact From 7 plugin I’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’t help.

After looking at the code I managed to find what was causing my error, it was the WP-Super Cache plugin I’m using. The contact form plugin generates a unique token for each person who submits the form, presumably to stop CSRF attacks, which was being cached by WP-Super Cache which in turn caused the token to no longer be unique or valid.

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.

How to install Aptana Studio 3 on Ubuntu 11.10 (Oneiric)

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 – Aptana Studio doesn’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 & install xulrunner – Ubuntu 11.10 doesn’t include xulrunner so it must be downloaded.

If you are using Ubuntu 64 bit use:

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

If you are using Ubuntu 32 bit use:

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

3. Download the Standalone version of Aptana Studio 3 from the Aptana Studio website.

4. Unzip it to /opt/aptana-studio-3:

sudo unzip [name of Aptana Studio ZIP file here].zip -d /opt
sudo mv /opt/Aptana\ Studio\ 3 /opt/aptana-studio-3

5. Install the menu item:

wget http://www.samclarke.com/wp-content/uploads/2011/11/AptanaStudio.desktop
sudo mv AptanaStudio.desktop /usr/share/applications/AptanaStudio.desktop

That’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.

Adding custom commands to SCEditor

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’t. setCommand must be called before the editor is initialised otherwise the command may not show in the editors toolbar.

setCommand parameters:
Name (string): The name of the command, should be lower-case and not contain any spaces.
Exec (string or function): 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 execCommand function.
Tooltip (string): The commands tooltip text
Keypress: Unless the command needs to handle keypress events, omit this parameter. For an example of keypress handler see the emoticon command.

Continue reading

Incapsula vs. CloudFlare performance

To see how Incapsula and CloudFlare compared performance wise I’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 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. Continue reading

Install APC with XAMPP on Linux

If you don’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 -C /opt

Note: Change 1.7.7 in the above wget command to the latest version listed on the XAMPP website linked above. Continue reading

Incapsula Review

Incapsula, like CloudFlare, is free & 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 to CloudFlare (which I’m currently using). This review is of the new release of Incapsula which was released on the 21 September 2011.

Setup

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’t really matter.

The Incapsula control panel is easy to use and looks good with plenty of options available.
Continue reading