netbeans debug rails 3.0

Posted by wxianfeng Sun, 31 May 2009 22:09:00 GMT

环境:ruby 1.9.2 + rails 3.0.3 + nb 6.9.1 + ubuntu 10.10

nb debug rails 3.0 还没有跟上,不可以debug rails 3.0项目了,网上也有很多人遇到,可能出现下面这个异常:

Uncaught exception: no such file to load -- script/rails

我有一个解决办法,把你要debug的项目path直接写进去,

需要用到的gem:

ruby-debug-base19 (0.11.24)
ruby-debug-ide (0.4.9)
linecache19 (0.5.11)

如果是debug test file 的话,还需要 test-unit

wxianfeng@ubuntu:~$ gem list ruby-

*** LOCAL GEMS ***

ruby-debug-base19 (0.11.24)
ruby-debug-ide (0.4.9)
wxianfeng@ubuntu:~$ gem list line

*** LOCAL GEMS ***

linecache19 (0.5.11)
wxianfeng@ubuntu:~$ gem list test

*** LOCAL GEMS ***

test-unit (2.1.2)

当前rvm环境;

wxianfeng@ubuntu:~$ rvm info

ruby-1.9.2-p0:

  system:
    uname:       "Linux ubuntu 2.6.35-22-generic #33-Ubuntu SMP Sun Sep 19 20:34:50 UTC 2010 i686 GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 4.1.5(1)-release (i686-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.1.0 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p0"
    date:         "2010-08-18"
    platform:     "i686-linux"
    patchlevel:   "2010-08-18 revision 29036"
    full_version: "ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]"

  homes:
    gem:          "/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0"
    ruby:         "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0"

  binaries:
    ruby:         "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0/bin/ruby"
    irb:          "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0/bin/irb"
    gem:          "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0/bin/gem"
    rake:         "/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0/bin/rake"

  environment:
    PATH:         "/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0/bin:/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0@global/bin:/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0/bin:/home/wxianfeng/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/system/mysql/bin:/usr/local/system/jdk1.6.0_22/bin"
    GEM_HOME:     "/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0"
    GEM_PATH:     "/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0:/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0@global"
    MY_RUBY_HOME: "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0"
    IRBRC:        "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

注意把netbeans的 gem_home , gem_path 设置为 当前 rvm 对应的 gem_home , gem_path , 设置gem_path 时 nb 默认 .rvm 目录不显示,需要直接在 对话框中输入路径

最后修改

/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0/gems/ruby-debug-ide-0.4.9/lib/ruby-debug-ide.rb

大概 110 行

      path = "/usr/local/system/projects/entos/ent_os/script/rails"
      bt = debug_load(path, options.stop, options.load_mode)
      #      bt = debug_load(Debugger::PROG_SCRIPT, options.stop, options.load_mode)

注释一行,添加两行

把你需要调试的项目 set as main project ,然后 debug main project !

ok~!

如果你需要debug 单个ruby 文件 , 那么 需要改回来 , 这里注意.

see:
http://forums.netbeans.org/topic31103.html


英文环境下 netbeans 无法输入中文问题

Posted by wxianfeng Tue, 02 Nov 2010 22:23:00 GMT

环境:ubuntu 10.10 + ibus + netbeans 6.9.1

这个问题老早就遇到了,就是一直没解决,今天算是找到一个完美的办法了,用过fcitx ,scim ,ibus 输入法,都会有同样的问题,以前遇到的解决办法

1,重启netbeans
2,重启输入法

完美解决办法:

在桌面上新建一个shell文件,然后拖到你的panel上,每次启动netbeans的时候,点击panel上的这个shell文件就ok了

相当于 终端上执行了 >LANG=zh_CN.UTF-8 /bin/sh “/usr/local/system/netbeans-6.9.1/bin/netbeans” —locale en_US

>vim nb.sh
#!/bin/sh
LANG=zh_CN.UTF-8 /bin/sh "/usr/local/system/netbeans-6.9.1/bin/netbeans" --locale en_US 

>chmod +x nb.sh

or

>vim nb.sh
#!/bin/sh
/bin/sh "/usr/local/system/netbeans6_9/bin/netbeans" --locale zh_CN.UTF-8

>chmod +x nb.sh

终端 daemon 执行:

nohup  /bin/sh "/usr/local/system/netbeans6_9/bin/netbeans" --locale zh_CN.UTF-8  &

see:
http://www.linuxsir.org/bbs/thread370506.html