Archive for February, 2008

Stupid Eclipse Tricks

Thursday, February 28th, 2008

I’ve done this so many times…

Today I downloaded the Ganymede M5 release of Eclipse for RCP/Plug-in Developers and did what I always do:

  1. Create a link of the eclipse executable, using the handy icon.xpm graphic, and drag the combination onto my desktop for easy launching; and
  2. Open the eclipse.ini file and make the following changes:
...
-Xmx1024m
-XX:MaxPermSize=128

Do you see it? I do this about every other time I install Eclipse (which, with all the development leading to up Ganymede is quite often). I forgot the darned “M” on the “MaxPermSize” directive. It should read:

...
-Xmx1024m
-XX:MaxPermSize=128M

128 megabytes of MaxPermSize is much better than 128 bytes. In the words of the Best Buy robot, “Megabyte me” (that’s what he means by it, right?)

The symptoms are frustrating… You start Eclipse and it appears to be doing something just before it complete disappears.

If you’re curious about why the heck I’d do this, check out Tuning Eclipse for Performance.

Writing a bundle-based server application

Thursday, February 28th, 2008

Building server-based applications with Equinox is getting easier. The Equinox project’s server team has created a short tutorial that describes how to get a servlet up and running using a handful of bundles on the Equinox framework. The best part is that everything you need to run the tutorial is already included in the Ganymede M5 release of Eclipse for RCP/Plug-in Developers (previously, you had to load a bunch of prerequisite bundles). The tutorial is a little short on details, so I thought I’d take a stab at expanding on them a bit.

The first step (after downloading and installing Eclipse for RCP/Plug-in Developers) is to create a new Plug-in Project (File > New > Project > Plug-in Project). Next, navigate to the “Dependencies” page in the new plug-in’s Manifest Editor and add the org.eclipse.equinox.http.registry and javax.servlet bundles as “Required Plug-ins”. Next, navigate to the “Extensions” page and add an extension to org.eclipse.equinox.http.registry.servlets. Be sure to pick a suitable class name and alias (the alias is what you’ll use to access the servlet; e.g. for http://localhost/hello, the alias is “/hello”).

manifest.png

Clicking on the “class*:” label will open the “New Class” wizard:

Here, change the superclass to javax.servlet.http.HttpServlet, remove the suggested interface (javax.servlet.Servlet is implemented by javax.servlet.http.HttpServlet anyway), and click “Finish”. In the body of the resulting class, use code-completion (CTRL+1) to override the doGet method.

servlet-code.png

All that’s left is to run it. Right click on the bundle in the Package Explorer, and select “Run As > OSGi Framework”. Use a browser to navigate to your servlet; the URL will look something like “http://localhost/alias” (replace “/alias” with the alias you used when you created the extension).

The first time I ran the results of the tutorial, the server wouldn’t start. Diagnosing the problem can be a challenge if you don’t know where the log is. When you run an Equinox application, the logs end up in *.log files in the [workspace]/.metadata/.plugins/org.eclipse.pde.core/OSGi Framework directory. You can also add the -consoleLog switch in the “Program Arguments” of your launch configuration which will cause logging information to be dumped onto the OSGi console.

It turns out that the port that the HTTP Server wanted to use, 80, was already in use. I opted to use a different port. There are several VM arguments that you can use to tune the settings of the HTTP Server, in particular
-Dorg.eclipse.equinox.http.jetty.http.port=8080
specifies the port on which to run. Adding this entry to my launch configuration got everything up and running on port 8080, requiring me to change the URL in my browser to “http://localhost:8080/alias”.

launch.png

I’m planning to record these steps a short demo that I’ll post on Eclipse Live. I’m also planning to write this up a little better as an Eclipse Corner Article. In the meantime, comments, criticisms, and concerns are invited.

Services, services everywhere!

Wednesday, February 27th, 2008

I’ve spent a few hours over the last few days reworking parts of my Eclipse Organizer example that I intend to contribute to the Eclipse Examples Project. Mostly, I’ve been working on introducing OSGi Services into the mix. Frankly, I’m totally in love with services. Yes—if I could—I’d marry them.

The Eclipse Organizer is modeled after applications like Evolution or Microsoft Outlook. FWIW, it’s intended to serve as an example of how one might go about building an application using Eclipse technology; it’s not intended to be a “real” product.

I’ve reworked the guts of the mail support to be almost entirely based on OSGi services using declarative services. I’ve got services that provide connectivity to a POP3 mail server, services that provide credential management (i.e. take care of obtaining and storing userids and passwords), services that provide repositories that hold mail, services that manage a Derby database instance, and services that let me play with all of the above through the OSGi console. It’s all very cool.

One of the things that I’ve been trying to do is to make all these services interchangeable. Everything is very loosely coupled and a service providing a bit of functionality can be very easily taken out and replaced with an alternative. I’ve also been trying to make the services as focused as possible: that is, I’ve been trying to build services do one job and defer other bits of functionality to other services. For example, the service that holds local copies of mail is separate from the service that gets mail from the server.

In the process of building this, I reminded myself of an experience I had a few years back as a services consultant. My job was to review the work done by another consulting company. The application was running on a J2EE application server and was almost completely composed of Enterprise JavaBeans. In fact, they had well over 5,000 different bean types defined. All of them session beans, most of them stateful. In their wisdom, this consulting organization had decided to make every object in their system a enterprise bean because they had some “great tools for building beans” and using them “made it easier”. The funny/sad part was that they had pretty quickly run into some limitations of the current version of the specification and made a few local “optimizations” to work around the limitations (which had a rather dramatic impact on things like data integrity and server stability).

Oh the horror.

I was reminded of this because OSGi services seem similar conceptually to stateless session beans, but far lighter-weight, more dynamic, and generally more useful.

EclipseCon 2008 BoF Schedule is up

Wednesday, February 27th, 2008

The EclipseCon 2008 Birds of a Feather schedule is now available for your viewing pleasure.

There is still space available if you want to schedule a BoF of your own. We’re still taking them on a first-come, first-served basis so don’t wait any longer than you need to.

Be advised that I’ve been taking a careful look at the content of the abstracts. BoFs are intended to be n-way conversations among like-minded individuals; they’re not presentations, lectures, or product demonstrations. There’s been a few somewhat ambiguous abstracts that I’ve asked the submitters to revise. Also in this spirit, the rooms are not necessarily going to be outfitted with projectors and microphones. Some of the rooms may have these things, but I don’t know which ones.

Don’t forget to register for EclipseCon 2008. Do it today.

A very simple report on collected usage data

Tuesday, February 19th, 2008

I’ve put together a very simple report on the data collected so far by the Usage Data Collector (UDC). The report itself is static, as querying the database can get quite expensive. I’ve set it up to show a fourteen day period of results. I haven’t setup an automated process for updating the report yet; until I sort out how to do that, I’ll manually update it every day or so.

The report shows command, perspective, editor, and view usage. I’ve limited the various tables to show only the top 100 entries; this seems to only be limiting for commands at this point. You can view the report here.

Command Horse Race

Friday, February 15th, 2008

Things are heating up and the excitement is building with the the usage data collector (UDC). It seems that debugging is making a play…

The five most popular commands over the past 14 days are:

  • org.eclipse.ui.file.save (8436)
  • org.eclipse.ui.edit.delete (5289)
  • org.eclipse.ui.edit.text.contentAssist.proposals (4983)
  • org.eclipse.ui.edit.paste (4645)
  • org.eclipse.debug.ui.commands.StepOver (4573)

I thought that it might be interesting to show some actual numbers. The value shown beside the name is the number of times the command has been invoked by all of our participants over the past 14 days. If everybody can just use “step over” a couple more times each day than paste, we can make this sucker move…

The most popular non-Eclipse project command is org.eclipse.wst.sse.ui.format.document with 97 uses over the past 14 days, and org.eclipse.wst.server.publish with 89 hits (both from Web Tools). After Web Tools, comes C/C++ Development Tools (org.eclipse.cdt.ui.edit.opendecl x 34) and Mylyn (org.eclipse.mylyn.tasks.ui.command.deactivateAllTasks x 11).

How to install the Usage Data Collector

Thursday, February 14th, 2008

The Usage Data Collector (UDC) is included in the Eclipse Packaging Project’s (EPP) “Eclipse IDE for…” packages for the Ganymede M4. More specifically, they are included the packages marked “UDC”. You can find them here.

The UDC is included in all the M5 packages. Nightly builds of M5 are available here. The official, “Public Access” release of the EPP packages will occur on February 26th (according to the Ganymede Simultaneous Release page).

If you download the Eclipse top level project’s SDK, the UDC is not included. You can add it to any Eclipse 3.3 or 3.4 configuration by pointing the update manager to http://download.eclipse.org/technology/epp/updates/testing to get a nightly build or http://download.eclipse.org/technology/epp/updates/0.5milestones for an integration build.

Most used bundles

Thursday, February 14th, 2008

A lot more of you are participating with the Usage Data Collector (UDC). We’ve tried to make it very robust, and as low impact on your experience with Eclipse as possible. That said, it’s hard to get things exactly right, so please report a bug if you run into problems.

By far the most active bundle is org.eclipse.ui.workbench. This should be a surprise to no-one. It seems that most current participants are building (org.eclipse.jdt.ui) and debugging (org.eclipse.jdt.debug.ui) Java applications using the JDT. The Web Tools XML editor (org.eclipse.wst.xml.ui) and PDE (org.eclipse.pde.ui) are getting used relatively heavily, followed closely by Mylyn (org.eclipse.mylyn.tasks.ui), and the Web Tools HTML editor (org.eclipse.wst.html.ui).

Activations of views and editors, invocations of commands, and switching of perspectives, all record the bundle that defines them. This is what I’m querying, so it’s no surprise that UI bundles far surpass the others in terms of use which is why bundles from projects like EMF (org.eclipse.emf.ecore)—which is still rather heavily used—will always appear relatively low on this query.

With the flurry of recent participation, the top five commands used over the last 14 days has changed:

  • org.eclipse.ui.file.save
  • org.eclipse.ui.edit.text.contentAssist.proposals
  • org.eclipse.ui.edit.delete
  • org.eclipse.ui.edit.paste
  • org.eclipse.ui.edit.text.goto.lineEnd

Content assist proposals is making its move!

It was Wayne’s Fault

Wednesday, February 13th, 2008

Today, as I was looking over the BoF submissions for EclipseCon, I decided to decline one of the redundant submissions (Chris must have hit submit twice). I then hit what I thought was a “commit changes” button. Long story short, Karl is now restoring the database from backups and we’re trying to figure out how to withdraw the 513 erroneous emails delivered to speakers. Karl said he’d draft a nice note explaining what happened. For the foreseeable future, Karl doesn’t pay for beer if I’m in the room…

So, if you’ve gotten a message about your talk at EclipseCon that seems a little wacky, don’t panic. Karl’s sorting out my mess. Feel free to chastise me in whatever way you feel suitable.

I’ll be more careful next time. Honest.

Too many of us work on the Weekend

Monday, February 11th, 2008

It seems that about half of those of us who have opted to submit data gathered by the Usage Data Collector were working this weekend. Working hard it seems: there seems to be, on average, more events gathered per user working on the weekend (there was a bit of a drop on Saturday, but a spike on Sunday). Sadly, one of those users was me…

The top five most-used commands over the last 14 days are:

  • org.eclipse.ui.file.save
  • org.eclipse.ui.edit.delete
  • org.eclipse.ui.edit.paste
  • org.eclipse.ui.edit.text.contentAssist.proposals
  • org.eclipse.ui.edit.text.goto.lineEnd

Curiously, it seems that people paste 1.25 times as much as they copy or cut…

You are currently browsing the Eclipse hints, tips, and random musings weblog archives for February, 2008.

  • Pages

  • Archives

  • Categories