Friday, May 25, 2007

Ruby Screenshot of the Week #12: Improved Ruby Documentation

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


One of the things I did this week was to rewrite the code which extracts documentation for all the core Ruby APIs (which are defined in the C Ruby implementation). This fixes some bugs where a method here and there were missing its documentation.



In doing so, I started looking at the actual IDE presentation of the documentation as well, and thought I could make it a lot more appealing. Without further ado, here's how the documentation looks now:






The most interesting part here is that the IDE now figures out whether portions of the documentation corresponds to Ruby code, and then presents it with syntax highlighting right there in the documentation popup. (I've also improved the way the method signatures are displayed so it should use less space and be more readable now, although that's harder to spot than if you compare before-and-after shots.)



Heres another example. This shows a migration in a Rails application, where you're getting code completion on the create_table method.






One interesting aspect of this highlighting is that it's easier to spot mistakes in your comments. As I was testing this feature, I pulled up the documentation on the Rails send_file method - and the following code fragment looked wrong:






Sure enough, it looks like it's missing a single-quote right after 404.html. This is the kind of thing which will be a lot easier to spot and fix with the new enhanced highlighting!



P.S. You don't have to use code completion to get the documentation popup - just hit Ctrl-Shift-Space with the caret on the symbol you want to look up - or Command-Shift-Space on the Mac.



(P.S.2: If you're trying to download this, see my other blog entry on the current temporary download location.)


Where's nbextras.org?

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


Updated Monday May 28: The machine is back up and running (and much faster than before). You can grab up to date builds from the old location again (and the wik installationi page points back to it again). The latest builds have both a fix for the RHTML problem as well as support for encoding properties on projects, so the old file.encoding=UTF-8 system property workaround should no longer be necessary.





The deadlock.nbextras.org machine, which I've been pointing to regularly as the best place to get up to date builds of the Ruby support, is off-line. It is being replaced by a brand new machine, much faster and more reliable, and should be back up on-line on Monday (May 28th).



Apologies to those of you relying on deadlock.nbextras.org for regular updates. The service should be getting a lot better from now on. The reason it's taking several days to perform the migration is that this is a volunteer-driven effort, so there's a bit of cooperation necessary to get the machine picked up at the ISP, the disks mirrored over to the new machine and the machine taken back in to the ISP and get back up and running.



In the meantime, I've set up a temporary location where you can get up to date bits. The instructions and URL will be kept up to date on this wiki page.


Friday, May 18, 2007

Ruby Screenshot of the Week #11: Rails Debugging

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


First the screenshot - click for full resolution:








The NetBeans Ruby support now lets you debug Rails applications. As the screenshot shows, you can even step right through RHTML files! All the usual debugging features are there - breakpoints, stack view, local variables view - and balloon evaluation, where you hover the mouse over a variable and it displays the current value as a tooltip.



I can't take any credit for this; the debugger has been written by Martin Krauskopf, and uses the debug-commons library. Martin was my co-speaker for the Ruby talk (TS-9972) at JavaOne. If you missed it, Brian Leonard will be doing the same talk at RailsConf this weekend. One thing I want to clarify is that not everything I talked about in the type inference section is actually implemented yet in NetBeans. The talk represents everything I plan to do, not everything I've already done.



Note that the RHTML debugging feature is not present in the recent Milestone 9 bits. We've made a lot of improvements since then. Just this morning I integrated various fixes to make code completion work much better in Rails. You now properly get code completion in your model and migration files etc - as the following screenshot shows:






Another feature we added after Milestone 9 was some preliminary support for Auto Test - see the testing page for some screenshots and more info.



For now, I recommend that you use NetBeans Milestone 9 as your base IDE, and then use the trunk/daily Ruby bits with them. The easiest way to do that is to install Milestone 9, then follow the instructions in the RubyInstallation wiki page to blow away the ruby1 cluster in your M9 installation and replace it with a .zip download from deadlock.nbextras.org. Also be sure to nuke your userdir for any custom installed modules there (usually ~/.netbeans/dev). In the future, staying up to date with the Tools | Plugins manager will be easy, but with Milestone 9, it only displays branched Milestone 9 modules, and we aren't merging and rebuilding the Ruby stuff into the M9 branch at this point.



If all that sounded complicated, just go and download the Ruby-only IDE zip here. Get the zip containing rubyide in the name, unzip somewhere, and run nbrubyide/bin/nbrubyide. This will be daily-everything as opposed to a stable IDE + trunk Ruby, but - it will probably be okay.



Finally, if you're going to be debugging, make sure you first visit the RubyDebugging wiki page which will tell you some really important configuration information - like how to enable fast debugging.


Monday, May 14, 2007

It's Over!

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


JavaOne 2007 is over. I haven't been blogging lately, and I can truly blame that on JavaOne. It turned out really busy for me: Two keynote demos, one technical session, two Java Posse appearances (our BOF, and NetBeans Day), and a half hour demo at NetBeans day. In addition, the Java Posse got full press treatment this time around, so we had tons of interviews lined up. The picture below was taken right after the Friday keynote when we chatted with James Gosling - in full Posse regalia.






If that doesn't sound all that busy, remember that keynote demos have rehearsals as well as machine setup times, the technical session needed slide edits, etc. I haven't posted any Ruby feature updates recently, and that's partially because I've been busy preparing for JavaOne. That doesn't mean the time has been wasted, though - in actually using the Ruby support as opposed to just building it and testing simple scenarios to see whether a new feature works or not, I discovered lots of issues that have been fixed. Thus, the current trunk build is in much better state than the Milestone 9 bits. Somebody asked us after the Ruby Tooling talk whether the bits we were using are available. They are; get NetBeans 6 milestone 9, and then install the trunk Ruby bits. There are some new features to use as well - I will document those in a separate blog entry.



First however I need to go through my inbox and catch up on all those e-mails I've been ignoring lately. If you're one of them, I sincerely apologize.



Finally, let me end by saying that it was really fun meeting so many of you at JavaOne. To those of you who stopped by and just said thanks for either the Ruby support, or the Java Podcast podcast, I truly appreciate it. Knowing that people find it fun or useful really inspires me to keep going. And don't forget, the Java Posse is doing a live recording tomorrow night at the Silicon Valley Java Users Group, hosted by Verisign. There will be free pizza and beer - and we'll be summing up our impressions from JavaOne. Hope to see some of you there!