Setting Up an IDE for Drupal Development

I founded a group in Kansas City called Make:KC in July 2009 inspired by Make Magazine, their Maker Faires, and the www.makezine.com web site. I started with a MakeKC WordPress blog using WordPress’ free blogging site. Then I registered our www.MakeKC.org domain name and started using Drupal in December 2009. Make:KC is a non-profit organization.

I’ve tried setting up an Integrated Development Environment (IDE) using Eclipse and then NetBeans. Both seem to work well as editors but I was having trouble getting a debugger working that would allow me to step through the PHP commands on our web site. Most of the time these tools have not been needed while using Drupal’s menu style configuration. But I’m wanting to work on developing some modules too.

NetBeans and xdebug

I tried to get debugging working for Drupal sometime last year. At that time I tried Eclipse and NetBeans. I’m spending more time learning to develop in Drupal so I need this to work. It helps to step through commands with a debugger and learn what takes place in Drupal’s code; learning why, how, and when commands are executed.

I’m sure Eclipse is a great IDE to work with but I managed to get debugging working in NetBeans first. I had an older version already on my computer but installed the newer NetBeans 7.0 version today and now I have debugging working on the server side.

I had already downloaded the xdebug program but setting it up to work with the IDE was my problem. I found this web site with some answers I needed: http://2bits.com/articles/setting-up-xdebug-dbgp-for-php-on-debian-ubuntu.html
The section about adding the following instructions to my /etc/php5/apache2/php.ini file seemed to make things work:

zend_extension=/usr/lib/php5/20051025/xdebug.so

[debug]
; Remote settings
xdebug.remote_autostart=off
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000

; General
xdebug.auto_trace=off
xdebug.collect_includes=on
xdebug.collect_params=off
xdebug.collect_return=off
xdebug.default_enable=on
xdebug.extended_info=1
xdebug.manual_url=http://www.php.net
xdebug.show_local_vars=0
xdebug.show_mem_delta=0
xdebug.max_nesting_level=100
;xdebug.idekey=

; Trace options
xdebug.trace_format=0
xdebug.trace_output_dir=/tmp
xdebug.trace_options=0
xdebug.trace_output_name=crc32

; Profiling
xdebug.profiler_append=0
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=0
xdebug.profiler_output_dir=/tmp
xdebug.profiler_output_name=crc32

I need to read the article “Introducing xdebug”, it looks like it has some really good information: http://devzone.zend.com/article/2803-Introducing-xdebug

 About SomeoneKnows 
(c) 2011 Vince Thompson

Preserving Formatted Source Code in HTML

I’m switching some of my WordPress blog content over to other web sites and reorganizing them into logical book type formats. One nice thing about the WordPress blog is the plugin that helps to format my C source code for Arduino programs and Processing.

I’ve tried copying and pasting the Arduino code into an OpenOffice document but the source code’s color formatting gets lost. I haven’t found a way of using the Arduino and Processing environments to save the source code with the formatting intact.

I started looking into ways of capturing the displays and saving them in Rich Text Format (RTF) documents then possibly writing a program to create the proper HTML formatting. Luckily I didn’t have to go that far. I have three different Integrated Development Environments (IDE) loaded on my computer in addition to the Arduino and Processing language IDEs. Since switching to Ubuntu from Windows a couple of months ago I’m experimenting with several new programming tools at the same time.

I loaded up some sample source code into the Code::Blocks IDE. Formatting based on the source code language shows up in the display. I tried the Save As feature but didn’t see alternate document formats listed. Then I noticed the Export feature. Under the menu item File->Export setting there are four options including HTML, RDF, ODT, and PDF. My goal was to produce the souce code in an HTML document anyway so I chose that option and it worked nicely.

After that I tried Eclipse. I didn’t find an export option and the Save As just used the standard dialog function to save the file with a different name. Eclipse is a great editor to work with and I hope to find a way to make this work.

The third IDE I’m getting to know is NetBeans. NetBeans didn’t offer an Export function but it does provide a File->Print to HTML feature that works nicely too. I found a plugin for NetBeans on the Processing web site. I am going to try the NetBeans Processing Template plugin to see how it works.

There seems to be some good articles about using Processing with Eclipse. I hope I can find an already developed function to create HTML from the formatted display. Also, I’m hoping the NetBeans plugin helps by including more formatting and keyword recognition to more closely match the Processing IDE display.

Anyway, I seem to have found an off the shelf way of adding line numbers to the source code display. The color coded formatting is being preserved and white space is not being smashed when converting into the HTML format.

About SomeoneKnows
(c) 2010 Vince Thompson