Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    Debugging PHP: Eclipse PDT + XDebug + XDebug helper

    8th June 2009

    Stimulated by a bug in a complex and unfamiliar web PHP application with heaps of custom tweaks by other programmers, I decided to try a more professional approach to PHP programming and debugging than the standard var_dump() and family.

    As a result, I’m now using Eclipse PDT with Xdebug and Xdebug Helper (Firefox extension). Now I don’t understand how I used to debug my PHP programs before!

    After proper configuration (I’m using local Apache, but it is also possible to debug remotely), my work flow is rather simple:

    • use my web-app as usual, e.g. tweaking and testing here and there
    • if something server-side goes wrong: click the XDebug helper icon in Firefox, and perform some server-request action (e.g. load a page)
    • debugging is started in Eclipse PDT, where I can step through the code, set breakpoints, and examine all variables
    • as soon as the problem is fixed – click the XDebug helper icon again to continue using the site normally (w/o invoking the debugger)

    It takes some time to get used to, but then it’s a breeze.

    Some advice:

    • don’t use apt-get/aptitude to install Eclipse; it will be much easier both in the short and long run to use some all-in-one package from the Eclipse PDT site; all you need to do – download, extract, run!
    • before actually starting to do anything, tweak the eclipse.ini file by increasing heap size from 40 MiB (default) to some larger value (I used 128MiB). If you don’t do this, then at some point your debugging will become painfully sloooow, and then you’ll start getting tons of “out of heap memory” errors, each one suggesting that you quit Eclipse immediately
    • install XDebug with apt-get/aptitude – worked perfectly, and there’s /etc/php5/conf.d/xdebug.ini not to mess with php.ini
    • do read XDebug guide for PDT 2.x (I’m assuming you got the 2.x version); it should be the only document you will really need to configure everything

    I only wish Eclipse was faster – that is, written not in Java but e.g. C or C++.

    Share

    Posted in Links, PHP, Programming, Software | 3 Comments »

    Gallery2 with URL Rewrite and DHTML Album Select and Statistics module produces two forward slashes instead of the album select

    25th February 2008

    Problem report at menalto forum. Another one, also with no solution.

    I can confirm – URL rewrite + DHTML Album Select produces two forward slashes in the Matrix theme, in my gallery 2.2.4 setup, after a single use of the Recalculate button in Disk statistics tab in Statistics plugin from Community repository.
    Read the rest of this entry »

    Share

    Posted in Software, Web | No Comments »

    IE (Internet Explorer) margin doubling bug fixes

    27th September 2006

    In Internet Explorer for Windows (tested with version 6 SP2), if you write CSS code similar to this:

    1. #floatbox
    2. {
    3.   float: left;
    4.   width: 150px;
    5.   height: 150px;
    6.   margin-left: 100px;
    7. }

    and put your “floatbox” inside a container (such as DIV), you will actually see 200px of the left margin instead of the expected 100px. This problem is known as “IE margin-doubling bug”.

    In this post I collected solutions you can use to avoid this problem. The solution I’d recommend is at the end.
    Read the rest of this entry »

    Share

    Posted in Notepad, Programming, Web, XHTML/CSS | 2 Comments »