another devin-inspired website
Ever really debugged before? It's a life changer. Forget dpm, dd, print_r, var_dump...
1) Install a debugger of your choice (NetBeans, protoeditor, Komodo, Eclipse...)
2) Install/Configure XDebug extension
pecl install xdebug
If you get errors regarding `pecl`, `phpize` or missing libraries, try installing the php-pecl and php-devel packages.
Go to /etc/php.d, or wherever your PHP configuration files live. If you see "xdebug.ini" move it to "00xdebug.ini". THIS IS THE MOST IMPORTANT PART. We have to rename it because XDebug has to run before all other extensions. If you have other extensions like datacache, other debuggers (Zend), or optimizers, you should disable them. Otherwise, XDebug will show as loaded but it won't work.
Edit 00xdebug.ini and put the following code in:
zend_extension=xdebug.so
;debugger
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.remote_autostart=0
xdebug.idekey=netbeans-xdebug ;change to same ide key in your debugger
;profiler
xdebug.profiler_enable=0
xdebug.profiler_output_dir=/tmp
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_name=cachegrind.out.%p.%R.%r
3) Check configuration
Check the output of "php -i" and paste it into http://xdebug.org/find-binary.php. It will yell at you if you did anything wrong.
4) Install the XDebug helper for Firefox or Chrome
This allows you to toggle debugging on and off for local sites.
Debugging
Figure out how to enable debugging in the debugger of your choice and set a break point at a function call. Open up the page in your browser and make sure you use the XDebug helper to set debugging on. Your debugger should halt at the line. Now you can see all your local variables and dive into function calls.
Profiling
XDebug also profiles. Making a web request with ?XDEBUG_PROFILE=1 in the URL will enable the profile and dump to xdebug.profiler_output_dir. You can take these dumps and use a program like cachegrind to analyze the request.
I use Fedora on a daily basis to debug using Zend Server as my stack, but this will also work on any other configuration (Debian, Mac) - just change the paths to what they are on your system.
This is Mary. Joe has gone dead and I have wonderful news for you at the Can. It's quite a bit fast. On October 8. You filled out the entry slip with my company Sundance return my call. Devin because I E M O I do have your wonderful and very exciting news. Waiting for you here in my office use of the entry slip out with my company Sundance.
PHPUnit has built in support for taking a screenshot with Selenium and storing it locally (as in, on the server that is running the firefox instance)
This doesn't work well when you're running selenium RC, because you won't know what server firefox eventually runs on.
Fortunately, PHPUnit also implements captureEntirePageScreenshotToString(), which will return a base64-encoded PNG that you can decode and store locally (for example, to provide to Jenkins as an artifact)
In this example, I want to capture the screenshot when the test ends, or when it fails.
require_once 'PHPUnit/Extensions/SeleniumTestCase.php'; class yourTest extends PHPUnit_Extensions_SeleniumTestCase { //// rest of your tests here /** * On teardown, capture a screenshot. */ public function tearDown() { file_put_contents('result.png', base64_decode($this->captureEntirePageScreenshotToString())); } }
You can implement this code elsewhere if you wanted to take screenshots on failure only, after each test, etc...
rebuilding a software raid array and stuck with this error? for example, I was rebuilding on a live array and the server took a dive.
try tricking the array into believing its clean, then try to add a new drive or start the array again.
echo "clean" > /sys/block/md0/md/array_state
mdadm /dev/mdN -a /dev/sdXN
or
mdadm --manage /dev/md0 --run
then do a cat /proc/mdstat
raid should be rebuilding!
Dolphin is still missing some features that I have set up in Konqueror.
But EVEN AFTER changing your preferred "file browsing" application to Konqueror under System Settings ->Default Applications, Dolphin still runs on mostly any folder operation. I found that the easiest way to get Konqueror to run instead was to symlink dolphin to konqueror. as root:
cd /usr/bin
mv dolphin dolphinx
ln -s konqueror dolphin
Now Konqueror runs for everything.
instead of doing
ssh customuser@hostname.com -p 12345
put some lines in your ~/.ssh/config file (create it if it doesn't exist)
Host hostname.com
Port 12345
User customuser
save some keystrokes, now you can do
ssh hostname.com