Something annoying about Red Hat/CentOS/Fedora I had forgotten after years of Debian, Ubuntu and SuSE (or something that they’ve introduced recently, I’m not sure) is that cp is an alias to cp -i, as in it is interactive by default. Therefore the following will still prompt you for overwriting: cp * -Rf /var/somewhere/new_location To get around this just use the cp binary directly...
iPhone simulator (emulator) on Mac OS X Lion
Quick way to get easier access to the iPhone Simulator that comes with XCode
ln -s \
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ \
Simulator.app /Applications/iPhone\ Simulator.app
Extract slugs from URL’s in MySQL
So, say for a database update, which for some reason you cannot script using your normal scripting language, you need to extract a part of a URL (a slug for example) from a complete URL
SELECT TRIM(BOTH '/' FROM SUBSTRING(TRIM(LEADING '/' FROM link_url),
locate('/', TRIM(LEADING '/' FROM link_url)))) FROM page_links
Update findutils locate database on Mac OS X
In Mac OS X the locate.updatedb command isn’t located on a path by default, so the easiest way to access it I’ve found is to symlink it:
sudo ln -s /usr/libexec/locate.updatedb /usr/sbin/updatedb
Then you can run updatedb from anywhere, as you would on Linux. Then locate should work as expected.
updatedb
locate something.txt
Add a Git repository as a package using Composer for PHP
There isn’t much documentation on how to setup PHP libraries using Composer that are not in Packagist; one way to do this is as a package. If you specify the version number of the library (or other code) that you want you can fetch them from zip files, Subversion or Git. This way you don’t need to add any Composer files (such as composer.json) to the library itself, which is handy if...
Install Zend Framework 2 and Doctrine 2 using Composer
Since the installation instructions aren’t overly clear (I don’t find) for how to install more than one package to a project, you need a composer.json that looks akin to the following: { "require": { "doctrine/orm": "*", "zendframework/zendframework": "2.0.*" } } What caught me out is that all the packages you want need to be in the...
Install Composer for PHP with detect_unicode = Off as a php.ini file does not exist
If you are having problems installing Composer, using the method mentioned on their website: curl -s | php You may get an error like the following (which will be because PHP CLI may have a different php.ini or not be present at all) #!/usr/bin/env php Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again: The...
Apache not starting in Zend Server with Mac OS X 10.8 Mountain Lion upgrade
After upgrading to Mountain Lion, it’s likely that Apache won’t start in Zend Server. Re-installing Zend Server should fix any MySQL/Lighttpd issues you have, but you may get the error below: dyld: lazy symbol binding failed: Symbol not found: _xsltInitGlobals Referenced from: /usr/lib/libexslt.0.dylib Expected in: /usr/local/zend/lib/libxslt.1.dylib dyld: Symbol not found:...
Persisting Zend controller variables whilst forwarding actions
Quick tip for when you’re trying to persist variables in a controller using Zend Framework, if you’re using a class property for your action controller then it’s because using the _forward action helper will actually re-instantiate the controller class, so your member variables (properties) will be reset. Thus if you declare them static then they will persist between _forward...
Numeric range queries using Zend_Search_Lucene, working around the bugs
Zend_Search_Lucene is a PHP implementation of the Lucene full-text searching engine. Whilst some of it works well, other bits don’t quite, such as performing range queries. The most common error for range queries is along the lines of an Zend_Search_Lucene_Search_QueryParserException that states Range query boundary terms… This, as may have guessed, is that queries that work fine in...