jde-usages

I wrote a while ago about my stint of using IntelliJ and returning to emacs. More recently, I got an email from Suraj Acharya, saying that I should try jde-usages, which provides a set of extended functionality around method-usages and -overriding, and detecting the callers of a particular method. It also provides a jde-open-class-source-with-completion function, … Continue reading “jde-usages”

I wrote a while ago about my stint of using IntelliJ and returning to emacs. More recently, I got an email from Suraj Acharya, saying that I should try jde-usages, which provides a set of extended functionality around method-usages and -overriding, and detecting the callers of a particular method. It also provides a jde-open-class-source-with-completion function, which is awesome — very close to IntelliJ’s behavior. It’s my new binding for C-c n.

jyWebShell

After my efforts Friday to get jython working in swing, I set upon my real goal: HTTP/HTML access to a server-side jython session. The idea is that the jython session runs in the app-server container, and thus has access to the full runtime configuration and capability of the system. It is exposed to the user[s] … Continue reading “jyWebShell”

After my efforts Friday to get jython working in swing, I set upon my real goal: HTTP/HTML access to a server-side jython session. The idea is that the jython session runs in the app-server container, and thus has access to the full runtime configuration and capability of the system. It is exposed to the user[s] in a durable yet dynamic manner.

I’ve packaged up the results as jyWebShell 1.0. At 5MB, it’s a bit larger than a traditional .war file since it contains the full Jetty distribution, as well as Struts and jython.

I use the XMLHttpRequest object in the UI, which submits just the current python command, and updates the page in-place with the result of that evaluation; however, if the XMLHttpRequest doesn’t exist, a normal POST is done, and will work just fine.

I’ve also got a short Flash demo [read: “screencast”] of it in action; no audio, unfortunately … a project for another weekend.

simple swing jython shell

Today I created a little swing GUI shell to provide an interactive session with a Jython interpreter. It comprises two text areas — a larger area at the top for output, and a smaller text area at the bottom for input. It is not line-level interactive, as the normal console shell is; instead, you submit … Continue reading “simple swing jython shell”

Today I created a little swing GUI shell to provide an interactive session with a Jython interpreter. It comprises two text areas — a larger area at the top for output, and a smaller text area at the bottom for input. It is not line-level interactive, as the normal console shell is; instead, you submit complete expressions with Ctrl-ENTER.

There’s a bit of trick in there about two different methods on the PythonInterpreter API: exec and eval. Digging through the sources of the provided interpreters, I came up with the following, which seems to work well:

cmd = input.getText(); output.write( “>>> ” + cmd + “\n” ); try { res = interp.eval( cmd ); output.write( res.toString() + “\n” ); } catch ( PyException exec ) { if ( Py.matchException( exec, Py.SyntaxError ) ) { try { interp.exec( cmd ); } catch ( PyException exec2 ) { output.write( exec2.toString() ); //exec2.printStackTrace( new PrintWriter(output) ); } } else { output.write( exec.toString() ); //exec.printStackTrace( new PrintWriter( output ) ); } }

Here is the whole swing jython interpreter shell program; compiled against Jython 2.1,

html.py

As a side-effect of a recent programming exercise, I’ve developed a simple html-generation library in python. It takes advantage of python’s built-in lists [and list-comprehensions] in order to allow you to generate a HTML object, and str(it) out; you can also str(out)any sub-fragment, naturally. The examples below assume an from html import *; the domain … Continue reading “html.py”

As a side-effect of a recent programming exercise, I’ve developed a simple html-generation library in python. It takes advantage of python’s built-in lists [and list-comprehensions] in order to allow you to generate a HTML object, and str(it) out; you can also str(out)any sub-fragment, naturally.

The examples below assume an from html import *; the domain is a music collection interaction web-app.

While I like this library, it’s incomplete — I lazily implemented only what I needed to work as I needed it. I’d rather use something more maintained and fleshed out, but what retains the same expressive-simplicity. Any suggestions?

Anyways, if there’s not, you might want it, too: html-0.1.py. If you fix or extend it, please contribute back the changes.

M-x return-to-emacs

The last time I was out in California for work, my coworkers ganged up on me… “You just have to try IntelliJ. It’s so good. Check out this and this and that and the-other. It’s heaven.” I bit the bullet and grabbed a license key from a departed colleague, and fired it up, I had … Continue reading “M-x return-to-emacs”

The last time I was out in California for work, my coworkers ganged up on me…

“You just have to try IntelliJ. It’s so good. Check out this and this and that and the-other. It’s heaven.”

I bit the bullet and grabbed a license key from a departed colleague, and fired it up, I had someone show me the 3 important things I’d need to know, and grabbed the alpha-geek to show me how to get the servers up and running.

I spent the remainder of the week getting used to the environment, and have spent the last two weeks exclusively using IDEA. This morning, I switched back to emacs.

IDEA rocks

There’s no doubt that IDEA is simply the best IDE for Java projects. It’s really astounding. The keybindings are pretty well done, and it has an impressive wealth of features. The level of semantic “understanding” … especially around the configuration files for common frameworks like Struts is quite useful. In the end, I found it to be an approachable and easy-to-use masterpiece, with very little detracting from it’s excellence.

But, frankly, there are a lot of features that I didn’t have call to use. The quite extensive refactoring support — which seems great — just doesn’t enter into my day-to-day writing. I’m sure it works well and is productive when called for, but I’m not considering it compelling.

The features I ended up using day-to-day are:

  • C-n : open class by partial-name
  • C-S-n : open project file by partial-name
  • C-b : jump to appropriate thing for current token.
  • C-<SPC> : contextual complete
  • A-<RET> : auto-import, auto-cast, auto-…
  • C-7 : current class structure
  • C-q, C-p: in-line javadoc + method-signature popups
  • C-A-h : show method callers
  • JSP-parsing
  • debugging

emacs rolls

At the same time, there’s one area where emacs is simply better: editing text. Especially for someone who’s used it for many years, now, and has worked to patiently and effectively extend my emacs-fu … I believe emacs may be the best raw text-editor in existence. Moreover, it really is an operating system unto itself, which isn’t quite so silly … for instance, I’m only mildly curious about, say, any of the three emacs jabber clients, but having a simple calculator is pretty nice when it is.

But perhaps the most compelling reason for me right now is that I’m not strictly a Java programmer; I’ve been doing some fun python hacking in the evenings, and I still try to work on the Scheme + C beast that is GnuCash from time to time. As well as random text files, &c…

JDE

So I’ve re-embraced JDE, and found that pretty much all the major functionality I’ve grown used to is available…

  • C-n becomes C-c n, jde-open-class-source … doesn’t do the partial-value completion … but that sounds like a fun weekend hack … :)
  • C-b becomes C-c C-v C-g, jde-open-class-at-point … which also jumps to the appropriate method, too.
  • C-<SPC> becomes C-c <SPC>, jde-complete-minibuf
  • A-<RET> becomes C-c C-v C-z, jde-import-find-and-import
  • C-7 becomes C-c . l w, ecb-toggle-ecb-windows
  • C-A-h becomes jde-xref-display-call-tree

Now, for those playing along at home, those are the big ones anyways … complete, auto-import, “jump”, structure and show-callers. But that leaves a few things unaccounted for… specifically:

  • C-S-n : open project file by partial-name
  • this would be real nice, but also smells like a weekend hack.
  • A-<RET> : auto-cast, auto-…
  • I can cast myself, thanks. Fucking java, anyways…
  • C-q, C-p: in-line javadoc + method-signature popups
  • JdeDocIndex seems somewhat promising, but not exactly right either.
  • debugging
  • I haven’t tried JDE’s debugging support in a while, but I did have problems with it in the past. At the same time, I pretty generally want to ForgetTheDebugger … I’m just not of the UseTheDebugger school.

Which leaves the one major standout: first-order JSP support.

Now, I’ve tried … really tried … to use mmm-mode in order to switch between, say, nxml-mode and JDE. It just doesn’t work, primarily because the new-file parsing latency of JDE is so high. But that also sounds like a good weekend hack to craft some sort of a startup-effort caching into JDE, which would generally be beneficial.

Summary

IntelliJ is awesome. Emacs — and especially JDE [+ ECB + semantic + … ] — is good enough, and fits better into my world. The Emacs Development Environment tools could all stand to get better, and in many cases would find benefits across mulitple languages. So that’s where I’m headed.