Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    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 »

    Iceweasel/Firefox 3: how to work-around random/erratic right-click action

    19th July 2008

    Update: as of FireFox/IceWeasel 3.0.14, this bug appears to be fixed.

    When right-clicking many links in FF3/IW3, it quite often happens so that a random action is performed instead of opening the context menu (bug report).

    One of the solutions work-arounds (suggested by Andre Pirard) is to slow-right-click, that is to hold the right mouse button down until the menu actually appears, then – and only then – release it. Or, you can even slow-right-click, move the pointer over the desired menu item, and then release – that will perform the desired action in a single long right click (instead of more common single right click with a following single left click.)

    Alternative workaround (found at the bug report page): install the mouse gestures add-on, and restart firefox. Tested: works for me.

    This bug/behaviour is otherwise unsolved.

    Share

    Posted in Misc, Web | 8 Comments »

    Gnome, NetworkManager, and FireFox/IceWeasel 3 starting in Offline mode (also: Pidgin Waiting for network connection)

    19th July 2008

    For some reason, my IW 3 is now starting in Offline mode each time, despite my attempts to remove that checkbox every time. Also, Pidgin says “Waiting for network connection” in the status drop-down.

    Update: as suggested by Donny Kurnia (based on the recent post by Hobgoblin), the simplest and the most correct way to fix the problem for FireFox/IceWeasel is to go to about:config and set toolkit.networkmanager.disable to true.

    The simplest workaround for Pidgin is to open Accounts -> Manage, then remove and then set again the checkbox near the account you wish to get connected. This has to be done every time you start pidgin :( .

    Below you will find other (worse and obsolete – for FireFox/IceWeasel, but good for Pidgin) solutions.
    Read the rest of this entry »

    Share

    Posted in *nix, Web | 19 Comments »

    Vivid, cheerful, funny FireFox theme: ColorGnome

    19th October 2007

    Get it here. If you haven’t used any other theme except for default, and if you’re Firefox user for a long time – it’s time to try something new! I suggest you try ColorGnome – it’s bright, clear, vivid, cheerful and even funny! I’m using it for several days already, on all but one of my computer workplaces – and find it good enough to write about.

    If you want something more strict/official-looking, try maxfox II or maxfox II graphite – I enjoyed these two a lot, currently maxcfox II is on the only computer which doesn’t have ColorGnome :)

    Share

    Posted in Links, Misc, Web | No Comments »