Setup remote interpreter (virtualenv) in VM or container for PyCharm

If you are developing with a virtual machine or container, any modules installed by PIP will either be installed globally or potentially in a virtualenv location outside of the project root. Therefore you will need to tell PyCharm that the imported modules you’re using are located remotely, not locally. First you will need to go ...

How to reset/change expired MySQL 5.6 password in Homestead

MySQL 5.6 introduced password expiration, so the password on your Homestead Virtual Machine may expire at some point. SQLSTATE[HY000] [1862] Your password has expired. To log in you must change it using a client that supports expired passwords. To change this you will need to log into MySQL running on Homestead in order to change ...

No such file or directory for SSH authorized_keys in Homestead Vagrant VM

When configuring your Homestead VM you may encounter an SSH key issue when booting the Homestead Vagrant VM up /home/vagrant/.ssh/authorized_keys ==> default: : No such file or directory This can be fixed by nesting your mounted directory a level deeper under /home/vagrant/ as that is where the SSH keys of the box itself are stored ...

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 http://api.jquery.com/jquery.param 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 ...

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

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

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

Using strings in SQL select clause in CodeIgniter DB helper

If you need to use literal strings in your select clause (such as a date format) using the CodeIgniter DB helper, you will need to pass false as the second parameter $this->db->select( 'DATE_FORMAT(date, "%Y-%m-%d") as something_date', false );

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

Older posts