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++.
Posted in Links, PHP, Programming, Software | 3 Comments »
5th June 2009
Giovanni Dall’olio has recently posted a presentation on using make.
Although it has “bioinformatics” on the title page, this is a good and very easy to understand make intro.
Original post is here.
Posted in Bioinformatics, Links, Programming | 1 Comment »
30th May 2009
We are pleased to announce the release of GNAT GPL 2009, the Ada Toolset for Academic users and FLOSS developers. It introduces many new features including:
- Ability to generate byte code for the JVM
- Improved support for the .NET Framework
- Addition of the Ada-Java Interfacing Suite (AJIS) that enables native Ada code to be called from Java:
http://www.adacore.com/2008/06/17/ada-java_interfacing_suite
- Availability on the Mac OS X (64 bit) platform
- Automatic C/C++ binding generators
- Addition of the GNAT Component Collection (GNATcoll) providing new APIs that can be extended by the user community:
http://www.adacore.com/2008/06/17/gnat_component_collection
GNAT GPL 2009 comes with version 4.3.1 of the GNAT Programming Studio IDE and GNATbench 2.3, the GNAT plug-in for Eclipse.
It is available for the GNU Linux, Mac OS X (64 bit), .NET, JVM and Windows platforms.
GNAT GPL 2009 can be downloaded from the “Download” section on the new Libre website:
https://libre.adacore.com.
I wonder if the new JVM bytecode generation feature was frequently requested by Ada developers, or is just a move towards popularizing Ada as a highly capable programming language. Either way, it’s good.
Hopefully, I will find time and a matching project to finally learn Ada properly – since a couple of years I believe Ada is a very good programming language. And the D language is better than C and C++ (holy war, anyone? )
Posted in Ada, Links, Programming | No Comments »
29th May 2009
The Art-of-web has a good article on CSS3 border-radius property, and its support in Gecko/WebKit browsers.
Note: that article is not about using JS and/or tables and/or complicated CSS to make round borders – instead, the CSS3 border-radius property is reviewed.
Posted in Links | 1 Comment »
11th May 2009
SecuriTeam has an old, but still very useful article on SQL injection.
I’ve created a PDF of that article, containing some of the comments (all the ‘thank-you’ and ‘help-me-hack’ comments were removed): sql injection walkthrough pdf download.
Note: there were no specific license terms attached to the article; I believe that the word “free” on the SecuriTeam site logo refers to the “right of free use and copying”. If you know this is not the case – please let me know to remove this PDF from public access. (see Brian’s comment)
Posted in how-to, Links, Software, Web | 3 Comments »
7th May 2009
MC is a console file manager. It supports FTP connections, and in my experience is faster in FTP than both Krusader and Gnome Commander.
However, the default FTP connection format string [username[:password]@]hostname has a drawback of not allowing the use of usernames with ‘@’-symbol in them – which is very common for virtual hostings.
One of the solutions is (done in your home directory):
- if there is no .netrc file in your home directory — touch .netrc && chmod 600 .netrc
- mcedit .netrc (or use vi, nano, or any other editor you prefer)
- add the following line to the file (replace all-caps words with your actual credentials): machine HOSTNAME login USER@HOSTNAME password PASSWORD
Now, start MC, choose FTP connect, and enter only the hostname. You will be automatically logged in to the remote FTP.
This will also work for console ftp clients like lftp.
Posted in *nix, how-to | 1 Comment »
4th May 2009
Today I had a task of displaying random node in a Views-generated sidebar block.
This is how to do that in Drupal 7 (Views 3):
- edit the view which makes the block available (follow http://your.site/admin/build/views/viewname/edit)
- in the Sort Criteria section (under Filter), look for and add Global:Random.
This is how to do that in Drupal 6 (Views 2):
- edit the view which makes the block available (follow http://your.site/admin/build/views/viewname/edit)
- in the Sort Criteria section, add the Random criteria.
It can’t be simpler than that.
Posted in Drupal, Notepad, Software | 13 Comments »