Showing posts with label netbeans. Show all posts
Showing posts with label netbeans. Show all posts

Wednesday, August 4, 2010

NetBeans and Xdebug

Finally, I was able to setup xdebug with NetBeans.

Client:
Operating System: Windows 7 Enterprise [version: 6.1.7600 ]
Administrator privileges: No
Product Version: NetBeans IDE 6.9 (Build 201006101454)
Java: 1.6.0_21; Java HotSpot(TM) Client VM 17.0-b16

Server:
nginx/0.7.67 - not relevant
Apache/2.2.13 (Unix) with mod_php - not relevant
PHP 5.2.13 (cli) (built: Jul 21 2010 14:56:47)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

Steps:
Install Xdebug via PEAR. I got version 2.1.0.

Enable Xdebug extension in php.ini:
zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so ; <=- can be different
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host = 2.1.1.11 ; <=- your client ip here
xdebug.remote_port = 9000
xdebug.remote_mode = req
xdebug.idekey = "netbeans-xdebug" ; <=- default netbeans id
xdebug.remote_log = /path/to/your/logs/xdebug.log 
xdebug.extended_info = 1

Check installation in CLI:
php -m | grep xdebug
php -i | grep xdebug 

Restart Apache.

Check firewall settings that "C:\Program Files\NetBeans 6.9\bin\netbeans.exe" is allowed in proper network locations.

Open NetBeans. Go to your project properties > Run Configuration.
Setup "Project URL" and other if need.

Open "Advanced..." settings, check everything there.

I was able to run into debug mode but without execution line highlight.
So I got back to advanced settings of the project, setup path mapping.
Example:
/usr/local/lib/php/Zend > C:\tmp\ZendFramework-1.10.7-minimal\library\Zend

After that, I saw that Zend files were mapped successfully, but part of project files on network storage not. You can see that in a "Call Stack" window.

It turns out, that NetBeans don't likes network in debug mode.
To fix that, open "My Computer" > "Map network drive" to some letter.
Now, use the new drive for path mapping instead of direct network path.

And voila - it works! ;-)

Notes:
By default NetBeans will break on the first line of the script (you can change this behavior in the PHP / General section of the NetBeans Preferences).

Sources:
NetBeans wiki - HowToConfigureXDebug
Path Mapping In PHP Debugger
PHP 5.3 + XDebug + NetBeans + Mac OSX Leopard

See also:
Xdebug - Debugging with multiple users
Be careful with "Ask Every Time" debug URL

Update:
Upgrade to NetBeans 6.9.1 that fixes double ask for debug URL and other improvements.

Wednesday, July 14, 2010

NetBeans 6.9 and Lenovo TrackPoint in Windows 7

Problem
Recently I installed new NetBeans 6.9 on my Lenovo X61s and found that TrackPoint is not working for scrolling with middle button.

Solution
You need to find TrackPoint file tp4table.dat where programs mappings listed.
Under my Windows 7 Enterprise 32-bit I found it in C:\Program Files\Lenovo\TrackPoint\.
Use file search, if you have a trouble finding it there.
Now open file with write permission (if you non-privileged user, use admin account) and add following to the programs section.
; NetBeans
*,*,netbeans.exe,*,*,*,WheelStd,0,9

Don't mess with [AutoScrollTable] section at the end of the file were syntax goes like this
*,*,iexplore.exe,*,smooth
NetBeans fix should be inserted before auto scroll table part. Believe me, I tried that for two days asking myself a lot of "why this not working" :-)

To apply settings, open Windows Task Manager, find process named tp4serv.exe (PS/2 TrackPoint Daemon) and end it. As it run as your user, you don't need administrator to rerun it again. Go to C:\Program Files\Lenovo\TrackPoint\ and run tp4serv.exe again.
If that doesn't help to apply settings, try to restart Windows or check other related precesses: SynTPEnh.exe and SynTPLpr.exe; restart SynTPEnh.exe.

Tested on
Product Version: NetBeans IDE 6.9 (Build 201006101454)
Java: 1.6.0_21; Java HotSpot(TM) Client VM 17.0-b16
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)

More info
"Mouse wheel scroll" not working on Touchpads
Thinkpad Scrolling fixed for Safari and IntelliJ
Trackpoint Scrolling with Java
Google on tp4table.dat

Bonus
Firefox fix
; Mozilla Firefox
*,*,firefox.exe,*,*,MozillaWindowClass,WheelVkey,0,11

Other Java programs fix (if not works by defaults)
*,*,*,*,*,SunAwtFrame,WheelStd,0,9
*,*,*,*,*,SunAwtDialog,WheelStd,0,9
*,*,*,*,*,SunAwtCanvas,WheelStd,0,9
*,*,*,*,*,SunAwtFrame,WheelStd,0,9

Window names can be found with free AutoIt tool, kudos for tip to Andy.