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...
Delete directories only and not files in a directory on Linux
If you need to delete all the directories only and not files in a directory in Linux, you can do it with the “rm -r */” command
Icinga Web, Could not send command. Check if your webserver’s user has correct permissions for writing to the command pipe.
If you are getting this error when trying to perform actions on services or hosts in Icinga Web, most forum posts point to the configuration being correct, etc. Firstly make sure that the command pipe referenced in access.xml points to a valid place, and has icinga-cmd:icinga ownership vim /usr/local/icinga-web/app/modules/Api/config/access.xml <!-- allowed to be written to -->...
Icinga Web, Uncaught AgaviLoggingException thrown, Cannot open file “log/debug.log”
When trying to get Icinga Web to work, you may run into issue with the log directory not being writable Uncaught AgaviLoggingException thrown Cannot open file "log/debug-2014-01-28.log", please check permissions on file or directory. It doesn’t appear to be referencing the core directory, or any other relative directory, so the easiest fix is to create an absolute path to where...
Icinga Web, Set correct write permissions for directory “/usr/local/icinga-web/app/cache”
If you have followed the Icinga install procedure through as per the installation documentation, and are having difficulty getting Icinga Web to install, you may eventually get an Agavi error saying that the cache directory is not writable (if you find the PHP errors) AgaviCacheException Failed to write cache file "/usr/local/icinga-web/app/cache/config/config_handlers...
Add URL query parameters to links using view helper in Zend Framework 2
There are 2 ways to add query parameters using the URL view helper in Zend Framework 2, either using Segment route placeholders, or adding them as normal query parameters (e.g. url?id=1&name=barney) Which one you need to use depends on what route the view helper is being used on; since all URL’s in Zend Framework 2 need to be route-aware (even if you’re mimicking ZF1 routing) it...
Sports Points on DailyProgrammer
Here is my solution to the Sports Points code test on r/dailyprogrammer You must write code that verifies the awarded points for a fictional sport are valid. This sport is a simplification of American Football scoring rules. This means that the score values must be any logical combination of the following four rewards: 6 points for a “touch-down” 3 points for a “field...
Mock a JSON HTTP API response in a PHPUnit unit test for Zend Framework 2
In order to mock an API in a unit test, you need to be able to mock the response that comes back from the API request. Therefore you need to specify in the test what JSON (for example) would come back from the HTTP client. To do this in Zend Framework 2, you need to mock the Zend\Http\Client so that it always returns a mock response, and have the mock Zend\Http\Response always return the JSON...