Latest stories

Javascript redirects double-encoding GET query parameter such as arrays [] %255B %255D

If you are passing query parameters such as arrays, Apache may double-encode them so that %5B and %5D becomes %255B and %255D for URLs that are submitted such as: ?a[b]=1&a[c]=2&d[]=3&d[]=4&d[2][e]=5 If you are making Ajax or API calls from a Javascript library (such as via jQuery or Angular) then it will encode the URI initially, then the web server (such as Apache) will 301 or...

Use Homebrew PHP with Mac OS X built-in Apache

To use the version of PHP you installed with Homebrew, you will need to change the PHP extension that Apache is loading. If you are using the built-in version of Apache this will use the built-in version of PHP even after you have installed PHP with brew. brew install php56 You need to edit the Apache config file /etc/apache2/httpd.conf and search for libphp5.so vim /etc/apache2/httpd.conf Then...

Use CORS for REST API via XDomain proxy in IE8, IE9 for JavaScript/Angular

Because Internet Explorer 8 and 9 don’t support CORS properly (no custom headers such as an API key, only GET/POST, etc.) you may have problems using a modern REST API. However Jaime Pillora came up with a great solution called XDomain which acts as a pure JavaScript proxy for your API calls to get around CORS. This will only work if you have control over both the API you’re consuming...

Show SQL statement from CodeIgniter DB Query Builder

If you need to see (for whatever reason) the SQL being generated by CodeIgniter’s DB Query Builder, you can call last_query() on the helper
$sql = $this->db->last_query();
If you are using version 3 however, you should be able to use get_compiled_select() as mentioned in the CodeIgniter documentation

Quick way to enable MySQL General Query Log without restarting

If you want to quickly enable the MySQL General Query Log without restarting MySQL Server, you can run these couple queries to start outputting all queries to a file located on disk You can then run a command like “tail -f /var/log/mysql/all.log” to see the queries appear as your application runs. Note never enable this on anything other than a development environment, and make sure...

How to solve file exceeds GitHub’s file size limit of 100 MB

You may encounter a problem with GitHub if you are using it as a new remote (or a pull request for a different remote) whereby a file in the history is over 100MB. This means that although your working copy doesn’t have the file, it was there at some point in time remote: error: File dump.sql is 221.82 MB; this exceeds GitHub's file size limit of 100 MB Therefore you will need to find...

Example of how to use Symfony Config component standalone

Whilst there is some good documentation on the Symfony Config component there isn’t an obvious example to get you started. Here is a simple way (there is much more you can do) to get started using the component as a standalone, without Symfony for example.

Selenium Server on your desktop controlled by Virtual Machine/remote server via SSH tunnel

If you are running your development environment on a virtual machine (whether by Vagrant, a custom local Virtual Machine or a server elsewhere in vSphere or in the cloud) you may want to run Selenium tests on your code, but have no way to do it as your development environment is headless. On the other hand, you have Selenium Server on your desktop/workstation, but it does not have the software...