Showing posts with label scripting. Show all posts
Showing posts with label scripting. Show all posts

2008-01-08

Complete

Go to the Javascript Console, type rhi and press <Tab>. The command line now says rhino.

If you now type a . (after the rhino) and then <Tab> twice. The first time around, there'll be a beep, and the second time, there'll be a list of possible completions.

People seem happy about this feature when I show it to them. Myself, I'm even happier because I got to implement the (top secret) mechanism that does this under the hood. I could tell you more, but I would have to kill you.

Update: I forgot to say that this goes for Bioclipse 2 only, but I've now backported the feature to Bioclipse 1 too.

Update2: Tab completion now in the Ruby Console, too.

2007-12-14

R, matey

Try this: launch Bioclipse 2 (after the usual updating of all plugins you can think of), open up the Javascript Console, and type this:

js> R
R> x <- matrix( c(9, 9, 0, 1, 3, 2, 0, 7, 6), 3 )
R> y <- matrix( c(4, 7, 2, 1, 1, 0, 1, 6, 5), 3 )
R> x * y
[,1] [,2] [,3]
[1,] 36 1 0
[2,] 63 3 42
[3,] 0 0 30

R> q()
js>

Shiver me timbers! That's R, matey! Big kudos to kaskelot++ for making it work this far.

Support is still a bit spotty. If you happen to aggravate R in any way, it walks the plank and does not come back, and you're going to have to relaunch Bioclipse. But things can only get better from here. Expect some Bioclipse/R integration soon, for example.

Update: Thanks to some impressive C hackery from kaskelot++, R no longer crashes and goes away forever when input is less than syntactical.

2007-12-13

A first stab at echoing

Update: After a suggestion from olas++, this feature is now called "echoing", to distinguish it from actual logging. Please revise your subjective histories.

Last week, after pondering how to structure the consoles around echoing, and receiving a fair bit of help with listeners from jonalv++, I got my reward: a big fat SWTException (Invalid thread access).

Now all this is fixed, and you can experience the joys of echoing in Bioclipse 2 at home if you want:

  • Update all your checked-out Bioclipse plugins, or at least net.bioclipse.core (where the console echoer is), net.bioclipse.scripting (where we've put scripting nowadays) and net.bioclipse.ui (where you'll find the scripting console).

  • Open net.bioclipse.core.Activator in the Eclipse Java editor.

  • Find the method start and add the following code:


public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;

new Thread() {
public void run() {
for (int i=0; ; i++) {
try {
Thread.sleep(5000L);
} catch (InterruptedException e) {
}

CONSOLE.echo("Now is the time");
CONSOLE.echo("for all good men");
CONSOLE.echo("to come to the aid");
CONSOLE.echo("of their country");
}
}
}.start();

}

  • Start Bioclipse.

  • Make sure the Javascript Console is opened.


The famous phrase, used in the early 20th century when demoing typewriters, should now appear on the Javascript Console every five seconds. In the above example, we've put the echoing code into net.bioclipse.core.Activator, but generally it would of course go in Your Favorite Module in need of echoing something to the consoles.

I'd be happy to hear about bugs or oddities related to the consoles or echoing that you may find.