Installing TOra on Ubuntu

3 Dec

TOra’s 2.0 release has gone well so far. That is to say it’s been quiet. When it’s quiet that means people are going about getting work done and generally not complaining. It’s a good thing.

However, several people have been having trouble installing TOra with Oracle. Since it’s proprietary we’re not able to ship the Oracle client along with our binaries or add a package dependency like we do with the Open Source databases we support. Happily, installing Tora only requires a few simple steps.

Downloading

Firstly, you need to download and unpack the Oracle instant client. All of our builds have been compiled against the instant client. While they are generally compatible with the full Oracle installation (of the same version), there have been reports of crashes and odd errors. Even if you run a different version database, using the instant client works great. For example, I use the 10g instant client against an old 8i database daily. The client and server will agree on a protocol. TOra also has special support for using instant client connection strings. That means tnsnames.ora and setting ORACLE_HOME is not required.

Download the instant client version from Oracle that matches the version of the .deb package for your system. For example, tora_2.0.0-1-11g-intrepid_amd64.deb is built against 11g. For the -10g deb packages, make sure to grab the 10.2.0.4 zip. You only need the basic package for running TOra. Also, unless you need Oracle errors translated in another language, the basiclite package is much smaller.

Also download TOra while you’re at it (of course!). Actually go ahead and download it a couple times. Help out the stats.

Lastly, I had to disable Debian’s automatic dependencies to build TOra against proprietary software, and so I’d forgotten to add libqscintilla2-3 to the list. Please apt-get that, too.

Installing

Unpack the instant client folder wherever you like. Location doesn’t matter on a single-user system. To install system-wide, make sure to unzip somewhere all users can access.

If you do have the full Oracle installation, then the following instructions may conflict with your existing settings. You’d have two copies of the same or nearly same libraries. In that case, removing all Oracle entries from ld.so.conf and using LD_LIBRARY_CONFIG would probably make the most sense. Simply add `export LD_LIBRARY_PATH=/path/to/full/install` to the Oracleuser’s .bashrc. Add the same for your user account with the instant client path for TOra.

Otherwise, add the instant client folder to your /etc/ld.so.conf. The easiest way to do this is to create a new conf file in the /etc/ld.so.conf.d folder:

$ sudo bash# echo /path/to/instantclient > /etc/ld.so.conf.d/oracle# ldconfig

Double-click the .deb for TOra to install or run:

$ sudo gdebi tora_2.0.0-1-11g-intrepid_amd64.deb

Running

Before running make sure you don’t have an ORACLE_HOME set. This may also conflict with the instant client. Run `unset ORACLE_HOME` to make sure you don’t have this environment variable. While the full Oracle still needs it, the instant client doesn’t require any more setup.

Run TOra and have a lot of fun!

Docklets in TOra

30 Nov

Dockable windows are a great interface feature for advanced users. They let you quickly select a file, connect to a database or jump to a method declaration. They require no more screen real estate than needed and most can be configured to minimize on use, that way leaving the most room on the screen for code.

They’re popular, too. Netbeans and Eclipse use dockable windows nearly to the exclusion of all other types. KDevelop has had them and even my beloved Emacs has advanced syntax and window support with the ECB package.

Dockable windows are also convenient because rather

My Netbeans setup. The window is opened from the left now but will close when I click away.

than developers trying desperately hard to make sure the most used features are readily accessible, the user can simply move around the docks as they prefer.

Qt has some support for dockable windows using QDockWidget. Windows can be stacked together or tabbed. The can be drag ‘n dropped by the title bar to another dock area or floated on top of the main window. It gets a few things right like helpful animations that show you where the widget will go when the mouse button is released.

QDockWidget is unfortunately more limited than it is useful. Windows are docked and included in the main window layout or they’re floating. There’s no support for minimizing a QDockWidget. Calling hide() then show() on a dock widget will lose the size of the window. So if the user had resized it, the window can’t spring back to the previous size. There’s some support for this but the state of the entire QMainWindow must be saved and restored together. One also can’t simply restore the geometry manually since QDockWidget helpfully ignores QWidget properties.

QDockWidget also includes a default title widget that is sufficient for most uses, but titleBarWidget() returns 0 unless a custom widget has been set. There seems to be no way to connect to the close or float buttons it provides and no way to customize what they do for another purpose.

Also, the two modes dock widgets offer are lacking. Either they are shown in the main window, and thereby pushing the code editor out of the way or floating and blocking code instead. At first I’d tried to override the focusOutEvent method to hide the dock after it’s used. However, after much setting of properties and Googling, it appears QDockWidget doesn’t get focus events. It may be possible to do this in the child widget. Of course, that means every dock widget in TOra must provide it’s own event handling.

I think it was around this time I tried out my new heavy bag.

TOra with two docklets enabled.

I’m calling my dockable windows "docklets," and I’ve added a new abstract base class toDocklet that manages windows and enforces a common set of features. There’s also a class toDockbar, a subclass of QToolBar, that manages showing and hiding docklets.

Much of what I wanted to do has been stymied by the limited functionality of QDockWidget. I did manage to write a couple useful docklets, however. One, "Connections" reuses the toConnectionModel class to show the recent connections. I’d like to make this a QTreeView eventually and move a lot of features from the project manager there. I’ve also created "Directory" which shows the current directory. It updates to select the current file whenever toWorksheet signals a file has been opened.

These are already useful and there are many more docklets that could also be useful. I’m just deeply annoyed by the toolkit now and I’d like feedback before continuing. It could be that I’ve been spoiled by other tools and what I have now might be good enough. But I also don’t want to commit to a feature that is going to force a lot of custom work.

NoMachine and Netbeans

21 Nov

NoMachine offers a fantastic remote desktop product. If you need to perform serious work remotely, this is the best option I’ve found.

Unfortunately, I’ve been bitten by this bug that corrupted text while using Netbeans. Emacs worked fine, so I’ve been happily hacking away for some months. But the siren call of Java 6u10 finally drew me in and I had to find a work around. They don’t seem to have a forum or mailing list that I could find so I’m posting this here.

Simply add this to your ~/netbeans-6.*/etc/netbeans.conf:

-J-Dsun.java2d.pmoffscreen=false

The reference page was helpful. This option disables offscreen pixmaps.