Sunday, December 28, 2008

Atwood Did It

One thing I've noticed while trying to come up with consistent and solid blog posts for my blog is that, whenever I thought I had something interesting to say about coding, I would do a quick search and find that someone had already written about it. And usually, that someone was Jeff Atwood.

It happened enough times that I started hearing the voice of Professor Chaos (or more accurately: General Disarray) with each new idea: "Atwood Did It".
If you can stand South Park at all, do yourself a favor and go watch this full episode: http://www.southparkstudios.com/full-episodes/s06e07-the-simpsons-already-did-it

And if you like reading about coding, go check out this guy's archives...or maybe go buy the book version at this point:  http://www.codinghorror.com/blog/2012/07/coding-horror-the-book.html

I got into this guy's blog just before he and Joel Spolsky kicked off this little hobby project they called Stack Overflow (and I was one of the first/early listeners of the excellent weekly podcast they recorded while they built it).  How Atwood manages to churn out so many quality posts one-after-another is beyond me.

Thursday, December 18, 2008

Custom Shortcuts in Eclipse

In the past I've posted on my favorite built-in key-bindings.  But with Eclipse you can actually bind any key combination to any 'command' using the eclipse platform command framework.

Here are some of the custom ones I like to set:
control + ; => next view
control + shift + ; => previous view

control + alt + W => close view

control + tab => next editor
control + shift + tab => previous editor

control + O in Task View => Open Remote Task

control + shift + ?

Editing Templates

You can also write a plugin to offer your own commands and templates.  Here are a couple I've written in the past.  If I'm feeling adventurous one day, I'll try to get back to this post and update it with the details.

Creating a Custom Template

sysout proposal for selected text (wrap the selected string in a System.out.println() ).

Creating a Custom Command

control+alt+L hack => goto line and select it

Previously, this required 3 separate actions:
Goto Line
End => goto line end
Shift + Home => highlight to line beginning

Tuesday, December 16, 2008

Virtual Worlds, A Fantasy

Second Life, Playstation Home, MMORPGs

Folks at work seem to think "virtual worlds" are the next big thing.
From a very smart dude that I totally respected:  "The internet 10 years from now will be an immersive, 3-dimensional experience".

Color me skeptical.

Or, quoting our other team lead: "Its just a bunch of Porn."

Friday, November 21, 2008

XML Namespaces

When I was first learning XML namespaces, one of the things that confused me most was the use of URLs (eg. xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200712"). For some reason, I was convinced that this is how an XML document pointed to its XML schema for validation. It took me a while to realize that the fact the namespace is [usually] a URL makes NO DIFFERENCE whatsoever to the XML document. In fact "anyStringWhatsoever" would work just as well, so long as it is universally unique. In fact, the concepts of XML namespaces and XML Schema aren't even defined by the same spec (http://www.xml.com/pub/a/2005/04/13/namespace-uris.html vs http://www.xml.com/pub/a/2005/04/13/namespace-uris.html).

So how do XML instance documents identify their XML Schema?
From www.w3.org/TR/xmlschema-1:

Schema Representation Constraint: Schema Document Location Strategy
Given a namespace name (or none) and (optionally) a URI reference from xsi:schemaLocation or xsi:noNamespaceSchemaLocation, schema-aware processors may implement any combination of the following strategies, in any order:
1 Do nothing, for instance because a schema containing components for the given namespace name is already known to be available, or because it is known in advance that no efforts to locate schema documents will be successful (for example in embedded systems);
2 Based on the location URI, identify an existing schema document, either as a resource which is an XML document or a element information item, in some local schema repository;
3 Based on the namespace name, identify an existing schema document, either as a resource which is an XML document or a element information item, in some local schema repository;
4 Attempt to resolve the location URI, to locate a resource on the web which is or contains or references a element;
5 Attempt to resolve the namespace name to locate such a resource.
Whenever possible configuration and/or invocation options for selecting and/or ordering the implemented strategies should be provided.


A couple of observations: First of all, why do they use an ordered list here if the order is not supposed to matter? Secondly, at least my preconceived notion of the link between namespaces and schema made the list (coming in at #5).

So why is it that just about every namespace in use is defined by a URL?

http://www.w3.org/TR/uri-clarification/

The XML Schema spec actually defines the namespace string to be a "Universal Resource Identifier" (URI). A URI is then further broken into 2 types: Universal Resource Locator (URL) and Universal Resource Name (URN). The reason most (certainly not all) schemas use URLs is because they are dereferenceable(aka you can go there). Basically, a dereferenceable URI gives us 2 main benefits:
1) Creating UUIDs is hard...especially UUIDs that have a shot of being meaningful/informative to human readers. The web's address system (IP, DNS, and whatnot) is a scalable, performant, and proven solution in this space.
2) Providing a URL gives the document reader a place (docs.oasis-open.org/ns/opencsa/sca/200712) and method (http) to check for more information...or even look for a schema (eg. #5 above).

For this reason, if you are defining your own namespace, please use a URL, preferably in a domain you control, and pretty please put page up at that location to describe the namespace (links or text describing what it is and what its intended to be used for). Dumb users like me will probably go there to find the schema.

http://www.xml.com/pub/a/2005/04/13/namespace-uris.html

Thursday, November 6, 2008

Mylyn Tip

Use lots of workspaces? Tired of creating mylyn queries for each workspace? Try using a shared mylyn folder by setting the Data directory under the Advanced section of the Tasks Preference page.




More fun with p2

It's been a few months since I performed my pooled Eclipse Ganymede installations and since then the Eclipse train has continued to roll with the 3.4.1 Maintenance Release as well as the first three milestones of the 3.5 stream (Galileo).

One of the touted benefits of the new provisioning system is that it allows users to upgrade from one Eclipse release to another (in place). However, I had a few problems with my work install (leaving it in a seemingly endless cycle of unresolved dependencies) and so I have decided to see if I could recreate them in a more controlled environment (and document that process here of course).

When I tried to upgrade from my Ganymede install to the latest 3.5M3, I was hit with the following error:

Cannot complete the request. See the details.
Eclipse SDK is already installed, so an update will be performed instead.
Cannot find a solution satisfying the following requirements Match[requiredCapability: org.eclipse.equinox.p2.iu/org.eclipse.ltk.core.refactoring/[3.4.100.v20080806-1800,3.4.100.v20080806-1800]].

When I tried installing the same IU to the other (minimal) eclipse 3.4 instance, I received to errors/warning but hit the following error during downloads:

An error occurred while collecting items to be installed
No repository found containing: org.eclipse.ant.core/osgi.bundle/3.2.100.v20080721
A quick retry seemed to get past this one and the update quickly finished without error.

Friday, October 17, 2008

Software Modeling with UML in Eclipse

IBM has Rational Rose, now Software Modeler, and probably tons of other stuff, but the open source Eclipse UML stack is looking more interesting each day.
  • EMF
  • GEF
  • GMF
  • UML2
  • UML2Tools
Wonder if the IBM stuff will get on top of this?

Quote from the Obeo homepage: "Using GMF to do this is 10,000 hours of work"

My notes:
  • The .uml model is the source of all truth
  • Associations, navigability, and end ownership
  • To edit cardinality from view you can type "role [0..1]" and it will be magically parsed into 2 labels
Areas that need improvement:
  • provide shortcuts for common tasks
  • using properties view is a royal PITA

Tuesday, September 30, 2008

Whiteboarding: A form of torture?

The whiteboard pattern is a pretty well-known "best practice" in the OSGi community. For this reason, I was somewhat surprised to hear from a co-worker (echoed by a couple folks at EclipseCon) that not everyone considers this pattern a blessing. Unfortunately, I have never seen this argument laid out in writing before, so I thought I would give it a shot in this blog entry--apologies if I do it no justice.

The whiteboard pattern is basically a modification on the standard listener pattern in which the content publisher looks up its consumers in the service registry instead of the consumers hooking themselves into the publisher. For a deeper understanding, there is lots of good info available including this whitepaper. This pattern purportedly works much better (fewer lines of code, less prone to error, etc.) in the dynamic world of OSGi services...so why wouldn't everyone love that?

The answer (and I suspect this is an eye-of-the-beholder thing) is simplicity. Although the code presented in the whitepaper makes it pretty clear that using the basic framework to implement the traditional listener pattern can be quite burdensome, I am not convinced it must be this way. With the improvements in service frameworks like Declarative Services, it is becoming easier and cheaper to develop a system based around service interactions. So if the programming complexity becomes similar, in what way does the whiteboard pattern introduce additional complexity?

I can say from first-hand experience that the loosely-coupled nature of OSGi services can be a dual edged sword...powerful yes, but also difficult to follow. When you step into a large project with lots of service dependencies, it can be hard to untangle the interactions and see how the pieces fit together. This effort is made even more difficult in code which uses the whiteboard pattern. The registry becomes entangled with a bunch of listener objects, which have no clear indication of who should call them or what service they are providing to the system. Additionally, the developer is expected to know that they can hook into a particular producer by implementing some standard interface and publishing it to the registry. This type of hidden interaction model can be very tricky to find and needs to be well documented to be effective...or else it can start to feel a bit too 'magical'.

The beauty of the service registry is that it gives us a single place for safe, dynamic, loosely-coupled bundle interaction. So what we would really like to see in the registry is the "service" a particular bundle is offering to the other bundles in the system. On the one hand we have a pool of content consumers offering only a "listen" service, while on the other we have a content publisher who allows you to register your interest with its content. Now which of these bundles do you think more accurately fits the average developer's notion of "service"? I wonder why we don't see this type of "whiteboard" pattern in distributed SOA systems...

Friday, September 5, 2008

Keyboard Shortcuts - Others

In my previous post I covered my favorite Eclipse shortcuts fairly extensively. Here are some of my favorites in other programs:

Browsers/Apps

Most folks know that Firefox, IE7, Chrome and some other tabbed interfaces provide the following shortcuts for working with tabs:
  • Ctrl + T => New Tab
  • Ctrl + Tab => Next Tab
  • Ctrl + W => Close Tab
You can also hold the Ctrl key when following a link to open it in a new tab in the background. Similarly, you can hold the Shift key instead to have it open in a new window altogether.

Perhaps a bit less known is
  • Alt + D => Goto the Address Bar
While there are similar shortcuts to do the same thing, this one will work across Firefox, Chrome, Internet Explorer, Windows Explorer (the Windows File Manager) and most other apps I've used with a similar layout.

I have begun to use this Alt + D shortcut in combination with the Quick Search feature in Firefox. This is a feature that allows you associate a keyword in the address bar with a particular type of search. Firefox comes preloaded with a number of useful ones, including "wp" for wikipedia (though my Linux version of Firefox 3 seems to be missing these for some reason). To try this out, simply navigate to the address bar and type "wp firefox". This should pull up a page with the results of the wikipedia search. You can even set your own Quick Searches (much like setting a bookmark). For more info on this nice little feature, check out http://lifehacker.com/software/geek-to-live/geek-to-live-fifteen-firefox-quick-searches-129658.php

Finally, there are the page search shortcuts (at least in Firefox).
  • / => Find As You Type Text
  • ' => Find As You Type Link
I still tend to use the Find shortcut Ctrl + F for text searches instead of / because you can more easily toggle through multiple hits. However, the ', search_string, Enter sequence is a very useful one for quickly finding and following a link on the page.

Finally, some new-fangled, web 2.0, RIA, Ajax-enabled, Software-as-a-Service webpages provide their own shortcuts. The only ones I know of and use are the Google shortcuts (especially for Gmail and Reader). In particular, I find the use of j/k and n/p to navigate lists/items quite useful. For a useful reference list, be sure to type '?' while in one of these services.

Operating Systems

Operating systems usually provide some useful shortcuts for managing the desktop and the running applications.
  • Alt + Tab => Switch between applications
If you continue to hold the Alt key (and have multiple apps running), pressing Tab multiple times will cycle you through a list of the running applications. Interestingly, there is a lesser known Alt + Esc shortcut which can be used to switch between applications in-order (queue) as apposed to the last used (stack).

On my work computers I use Windows XP and have gotten familiar with a number of the special windows shortcuts (many involving that silly little "windows" key between Ctrl and Alt on the keyboard). Of these shortcuts, perhaps my favorite is:
  • Winkey + D => Show Desktop (Toggle)
However, for some reason, this shortcut doesn't work on my T60p Thinkpad! For more shortcut-related info on the Windows Key, be sure to check out http://www.codinghorror.com/blog/archives/000378.html

Well that is enough for now. I will have to write new posts or update these ones as I find particularly useful shortcuts which I have missed.

Friday, August 29, 2008

Keyboard Shortcuts - Eclipse

Whether you call them Keyboard Shortcuts, Key Bindings, Hotkeys, or what-have-you the Eclipse IDE contains a great number of useful keyboard shortcuts...from general navigation to coding/editing and running/debugging. In fact, beneath the surface lies an entirely extensible command and binding framework, which I have only briefly investigated.

One simple shortcut for displaying a list of these shortcuts is
  • Ctrl + Shift + L => Show Key Assist
This same feature is available in some Eclipse RCP products as well, including Lotus Notes 8. Unfortunately, I don't find such a list all that useful...especially if I am looking for one binding/command in particular. Fortunately, in the Eclipse IDE at least, hitting Ctrl+Shift+L again will open the key binding preferences page, found in Preferences under General->Keys. This page contains a long list of all the key bindings in your system and is also equipped with a fancy filtering search function which is VERY useful for finding both commands and shortcuts...as well as letting you set your own custom bindings.

Here is a list of some of the most useful Eclipse shortcuts I use:
Disclaimer: my shortcuts are very Java(JDT)/Plug-in(PDE) focused. Similar shortcuts are probably available in CDT or other packages, especially given the ongoing work to provide JDT-like functionality via projects such as the DLTK.

Common
There is something to be said for de facto shortcuts which work across all types of programs. Eclipse does a good job in this respect by implementing some shortcuts that are common to many programs. Such shortcuts include
  • [update: I thought Ctrl+Tab was used to tab through the open editors, but I see now the default for this command is Ctrl+F6. Another command I would find useful is a next tab command for navigating the bottom tabs found in editors such as the Plug-in Manifest Editor.]
  • Ctrl + W => Close Tab
  • Ctrl + N => New (Other...)
Navigation
One of the tasks which led to my constant use of the mouse in Eclipse was the simple navigation between views/perspectives/editors/etc. While each of these tasks has its own set of commands (Alt+Shift+Q was particularly useful for me to open/navigate to different views), I recently discovered the master of all shortcuts
  • Ctrl + 3 => Quick Access
Or as I like to call it, the "find whatever I'm looking for" command. This one command will give you a filtered search for perspectives, views, wizards, command, etc. The thing that makes this command even more useful is that it caches your command choice to provide a customized list of your common commands. While I still use Ctrl+E to activate an editor and Ctrl+N to launch the New->Other... wizard (I find it tricky to filter between those options), this is definitely one of my favorite shortcuts.

Most people I know are familiar with some common navigation shortcuts such as
  • F3 => Open Declaration
  • F2 => Open Tooltip
but they are nonetheless worth mentioning. Similar functionality is available using Ctrl+click.

Eclipse provides some useful views for navigation, including the type hierarchy and outline views, but instead of letting these views clog your precious screen real-estate, you can use their quick command options instead:
  • Ctrl + O => Quick Outline (x2 to toggle show/hide inherited members)
  • Ctrl + T => Type Hierarchy (x2 to toggle between supertype/subtype hierarchies)
In additional to the normal Find/Replace (Ctrl+F) command, Eclipse provides an advanced extensible search feature, which provides customizable scoped searches for particular resources such as Java Search, Plug-in Search, and standard global search.
  • Ctrl + H => Search
Although this feature provides powerful queries for all sorts of resources, I primarily use it for doing global/workspace file searches based on text and file type. It is also worth pointing out that the file search provides a global Replace... button as well if you look for it. For Java-specific searches, I usually find myself using some other useful bindings instead:
  • Ctrl + G => Declarations in Workspace
  • Ctrl + Shift + G => References in Workspace
Somewhat related, the call hierachy view is a very useful way to figure out who calls a method
  • Ctrl + Alt + H => Call Hierarchy
Another command I use religiously, is the open resource command
  • Ctrl + Shift + R => Open Resource
Similarly, the open type and open plug-in artifact commands are very useful when you know which type of resource you are looking for.
  • Ctrl + Shift + T => open type
  • Ctrl + Shift + A => open plug-in artifact*
Editing
Eclipse also provides some useful commands for use while programming. Perhaps the best know example would be the content assist (Ctrl+Space) feature. This binding will also rotate through a list of (customizable) templates/proposals if you press it more than once.

Another prevalent shortcut is the quick fix. This command seems to get better with each version of eclipse (especially for OSGi-related issues). I also use the lesser know quick assist command for assigning statements to fields (Ctrl+2, F) and local variables (Ctrl+2, L).
  • Ctrl + 1 => Quick Fix
  • Ctrl + 2 => Quick Assist (Assign To)
Another useful editing shortcut is the formatting command
  • Ctrl + Shift + F => format
For the longest time I used Ctrl+I to fix indentation issue, in part because I found the format option too extreme. However, after investing a little time in learning the formatting preferences, I now tend to format just about everything.

Eclipse is also chock full of refactoring/source assistance. Although each of these menus is available via shortcut (Alt+Shift+T and Alt+Shift+S), my favorite refactoring shortcuts are:
  • Alt + Shift + R => Rename
  • Alt + Shift + Z => Surround With
  • Alt + Shift + M => Extract Method
Both Surround With (try/catch, loops, etc) and Extract Method are quite useful for optimizing common tasks. However, the Rename shortcut in particular has been a real time-saver for me.

Run/Debug
Finally I would be remiss to list my favorite run/debug shortcuts, though I think these are fairly self-explanatory:
  • F11 => Run
  • Ctrl + F11 => Debug
  • F5 => Step Into
  • F6 => Step Over
  • F7 => Step Return
  • F8 => Resume
  • Ctrl + R => Run to Line
  • Ctrl + click => Step Into Method
  • Ctrl + F2 => Terminate
One thing worth noting here is that the F11 run/debug command used to always launch the previously launched app...but it will now default to whatever project is associated with the selected resource/active editor. To edit this preference, check out the Launch Operation section of Preferences->Run/Debug->Launching.

Conclusion
The combination of key bindings and filtering text boxes is awesomely powerful.
Learning to use Alt, Ctrl, and Shift on both sides of keyboard is vital (maybe its just me, but I previously used my left hand for all these keys...proving problematic for bindings like Alt+Shift+R).
In general, I am not a big fan of Fx (x=1-12) shortcuts as I find them awkward to type (though I do use them and have even listed a few).

Here is a slightly condensed list of the most useful bindings I've seen people miss:
  • Ctrl + Shift + L (x2) => Key Bindings Preferences
  • Ctrl + 3 => Quick Access List
  • Ctrl + O => Quick Outline (x2 to toggle show/hide inherited members)
  • Ctrl + T => Type Hierarchy (x2 to toggle between supertype/subtype hierarchies)
  • Ctrl + H => Search (File Search)
  • Ctrl + G => Declarations in Workspace
  • Ctrl + Shift + G => References in Workspace
  • Ctrl + Alt + H => Call Hierarchy
  • Ctrl + Shift + R => Open Resource
  • Ctrl + Shift + T => Open Type
  • Ctrl + Shift + F => Format
  • Alt + Shift + F1 => Plug-in Spy
  • Alt + Shift + R => Rename
  • F11 => Run
  • Ctrl + F11 => Debug
  • Ctrl + R => Run to Line
There are also a couple of custom bindings I usually set, but I will leave those for another day. There are PLENTY of commands which I left off this list, so let me know if I missed one of your favorites!

*new in Ganymede

Thursday, July 24, 2008

Keyboard Shortcuts

Perhaps it was my use of emacs in college. Or maybe the fact I was using my trackpoint mouse so much that it was making my hand hurt. No matter the reason, I have recently been kindling a healthy obsession with keyboard shortcuts. For the most part, quality programs will ship with useful shortcuts. Mastering these can go a long way toward boosting your productivity.

One tell-tale sign that you may benefit from investing some time in learning keyboard shortcuts is if you find yourself using the mouse to perform the same tasks over and over throughout the day. In my case, I noticed that I was using the mouse for just about everything...even in the programs I use constantly (e.g. Eclipse and Firefox).

However, when I investigated the available shortcuts for these programs, I found the majority of shortcuts marginally helpful at best (obviously this would be the case given the diverse user bases for such programs). There are just too many, and staring at or even printing off the list of all shortcuts is quite painful. And the thing about shortcuts is that you really need to internalize them. If you have to look them up, if you even have to think about them, then they may be more of a hassle than they are worth. To cope, I have developed a little system for internalizing them (similar to many others I'd imagine)...each time I read/hear about a potentially useful shortcut (aka a shortcut for some task I often perform, or sometimes even for a new task that seems useful) I write it on the whiteboard above my desk. This way, each time I want to perform that task I can quickly glance up to see the shortcut...and after a few times, I find I no longer need to look up and can remove it from the board (and transfer the shorcut to my notebooks for when my memory fails next). Alternatively, infrequently used shortcuts (which I had mistakenly presumed useful) will waste precious space for a short time until I erase them (from both board and mind).

Although I believe this system is improving my productivity, I find myself getting frustrated while watching friends and colleagues use these same programs without the added benefit of shortcuts. In fact, particularly in Eclipse, I find that most users have a very limited subset of shortcuts which they have deemed worthy to internalize. Often times, these same users will be astonished at the power of a few commands which they haven't yet discovered. Even now, I will hear of some new shortcut (new to me that is), and a week later be wondering how I ever lived without it.

For this reason, I plan to document my favorite shortcuts here...hopefully without creating yet another long list of marginally helpful entries. Admittedly, a blog is probably not the proper forum for such a list, so my intent is to provide a bit more context/narration for each shortcut than you might otherwise find. Stay tuned...

Sunday, July 13, 2008

Bug Reporting

If you use open source software...its your duty.

As I have become more involved with open source, one of the largest revelations I've had is the usefulness of bug reporting. When I first started contributing, I was very nervous about opening a new bug...often neglecting to do so and sometime forgetting the problem altogether until I hit it the next time. For bugs which occur frequently, these annoyances tend to build up and significantly detract from my overall experience with the product.

I think there were a number of factors for this apprehension,
  • I assumed all the problems I hit were probably already reported
  • I didn't want to sound stupid for reporting something that wasn't really a bug, or had been dealt with in the past
  • I felt that opening a bug was like asking the developers for a favor
  • I assumed the amount of time it would take me to properly research the topic and investigate all similar problems would probably outweigh the limited loss of time/productivity from the bug in question
I realize that this issue likely varies by personality (I tend to be a bit shy before I have established relationships), but from talking with friends and coworkers I think that my feelings are shared by many.

One of the things which helped me most is the leadership I've received from coworkers at IBM. In particular, I recall one such coworker speaking with me on the importance of bug reporting...this was the first I had heard of this referred to as my duty. You are not asking for a favor when you open a bug, you are documenting a known limitation or problem and helping to make a better product for everyone.

Another important factor in my progress has been the ease with which I can produce high quality bug reports. For this reason, the Mylyn bug reporting feature (since Eclipse 3.3) has long been one of my favorites. I am not sure when they started including this in the main Eclipse Packages, but I am very happy to report it is included with at least the Ganymede JEE and RCP/Plug-in packages (I feel it should be in every Eclipse IDE package). If it isn't included in your build, you can get it from the Ganymede update site by installing Mylyn Connector: Bugzilla and Mylyn Bridge: Eclipse IDE.
When installed, the dialog can be found at Help->Report Bug or Enhancement...

Included with Ganymede, Mylyn 3.0 provides a nice improvement on this feature. Namely, when you create a new bug report, it will automatically be placed in the "Unsubmitted" category in your task list. This simple feature drastically improves my productivity and effectively lowers the barrier to bug submission (in older releases I don't think it was possible to save working drafts of bugs). In an open source community, I feel this 'lowering of the walls' is one of the most important keys to success. After all, this user involvement is one of the keys to cultivating a strong community (active users beget contributors beget committers).

With the latest feature I can open a new report every time I encounter a problem or think of a neat enhancement. If I do not have the time to investigate at present, the issue is at least documented for me so that I can finish my investigation when I do have the time. For me, this process usually looks something like:
  1. Hit a bug or think of a cool enhancement and open a new report
  2. Forget about it for a while
  3. Come back to my list of bugs/enhancements
  4. Try to reproduce the problem and document the steps in the bug
  5. Perform a google search for others with the same problem/workarounds
  6. Perform a bugzilla search on all open bugs for that component/project
  7. Search the list and open all related bugs in tabs
  8. Browse throught the tabs and copy the most relevent ones to my bug report
  9. Finish filling in the details and submit the report
  10. Respond to addition questions/responses on the bug report

Now that I have been able to get beyond my initial fears, I have been most impressed with the speed and quality with which most Eclipse projects (and most other high-quality open source projects for that matter) respond to my issues. This level of involvement has helped me to feel included in the Eclipse community and greatly improved my experience with the Eclipse Platform.

There certainly is a delicate balance between properly researching a suspected bug and blindly submitting every subtlety you find (otherwise committers would be hit with endless streams of duplicates and low-quality bugs). For me, this balance has trended toward submitting reports early and often...what process do you use to submit high quality bugs with minimal investment?

Thursday, July 10, 2008

Fun With p2



This walkthrough is intended chronicle my experiences with the Equinox provisioning platform Admin UI. I was able to glean most of the info needed from the Admin UI wiki at http://wiki.eclipse.org/Equinox_p2_Getting_Started_Admin_UI.
I tried http://wiki.eclipse.org/Equinox_p2_Admin_UI_Users_Guide
first, but it wasn't very helpful.

Download the equinox p2 agent and unzip to a good location (I used /opt/p2). Note that due to p2 limitations it is painful to move the agent around after provisioning multiple profiles.
It seems to take a few moments [too long] to start up (and why does it add a workspace directory to my Desktop?!).
It is also possible to run the Admin UI from within Eclipse by installing the Equinox Provisioning Agent Feature.

Add Metadata and Artifact Repositories for at least http://download.eclipse.org/releases/ganymede/ and http://download.eclipse.org/eclipse/updates/3.4milestones/.
Whoa, it looks like the first add gets displayed many times (see picture) [1].
Where is that nice drag and drop from the Software Update... feature [2]?

Drill down into the Metadata Repositories.
I find it nicer to group the Installable Units (IU) by category (Window->Preferences).

In the Profiles view there is an EquinoxProvisioningUI profile corresponding to the agent itself. Add a new profile for the Eclipse SDK and set the location and bundle pool location.
"/home/lee/user" seems like a poor default [3].
I would have like to set a global bundle pool for all users, but didn't want to run as root, so the bundle pool location I chose was /home/lee/.p2 [4].

Drag and drop the org.eclipse.sdk.ide feature from install list.
I tried installs with org.eclipse.platform.ide and org.eclipse.platform.sdk and they both installed but failed to start.

Approve the installations and proceed to Finish.
Check out some of the improved equinox security features at http://wiki.eclipse.org/Trusted_Bundles.
I had some problems taking a screen shot of the downloads, possibly due to my humble AMD Sempron 2800+ 1.6GHz CPU being pegged.
After about 10 minutes (for my 6.6 Mb/s connection--according to http://speedtest.net/) the install should complete and the IU should be displayed in the profile.

Navigate to the install location and launch your new Eclipse instance.
If you select Help->About Eclipse and click the Configuration button, you will notice one of the limiting factors of the agent...for some reason each install points back to the p2 agent for their p2 metadata [5].

Create a new profile in the Admin UI with the same bundle pool location (/home/lee/.p2) and install the Eclipse SDK IU to this profile.
Notice that this time, the install is only 4KB and will take about 10 seconds.
Way cool.

Launch your new Eclipse instance and open Help -> Software Updates...
You will notice the only Installed unit listed is the Eclipse SDK itself.
Lets install a new feature (the SCA tools feature from the STP project looks pretty interesting).
Using the filter list to narrow down installable units would be useful but it seems very slow [6].
The SCA tools install took me about 4 minutes.
Looks like the install button is missing its uppermost pixels, but that seems to have gone away now.

Restart Eclipse and be sure the plugins were properly installed
If you installed the SCA tools like me, create a new SCA example project using the wizard and note that the errors will go away when you point the tooling at an apache tuscany distribution.

Next, install the same feature to your original Eclipse Profile instance and you should see that it finds the plugins from your bundle pool.
My SCA Tools install took about 15 seconds this time

Back in the Admin UI, you can refresh the Profiles view but for some reason it can't see the newly installed features (after a quick restart they will magically appear) [7].
Next, lets install another Ganymede IU for good measure.
This time I went with the JavaScript Development Toolkit

Notice that directly after the install, the new IU shows up under "Installed Software" from you Eclipse instance. However, like installing plugins normally, it may require a restart to take effect.
At least you can use File -> Restart now instead of a manual stop and start (I used Switch Workspace -> Other for this in previous releases).
If you open the other Eclipse Profile installation, you can verify that it does not contain the newly installed feature.

Now suppose we would like to remove the SCA tooling feature from one of our profiles. In the Admin UI, there is no way to uninstall features.
This was very annoying when I installed the org.eclipse.platform.sdk feature and it wouldn't work...basically I had to remove the whole profile and delete the files manually.

However, if you have a working Eclipse install, it should still be possible to revert to a previous configuration by selecting the Revert Configuration... button in the Update Software... dialog.
Once again, the Admin UI will require a restart to notice the change in profile.

Overall, the p2 experience is very promising, despite the numerous annoying bugs left to solve. I am impressed with how this all came together, especially given some of the p2 criticism I heard near the end game for Ganymede.

[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=240472
[2]https://bugs.eclipse.org/bugs/show_bug.cgi?id=240600
[3]https://bugs.eclipse.org/bugs/show_bug.cgi?id=229699
[4]https://bugs.eclipse.org/bugs/show_bug.cgi?id=222130
[5]https://bugs.eclipse.org/bugs/show_bug.cgi?id=240601
[6]https://bugs.eclipse.org/bugs/show_bug.cgi?id=240603
[7]https://bugs.eclipse.org/bugs/show_bug.cgi?id=240602

Tuesday, July 1, 2008

Eclipse Ganymede Review

The latest Eclipse release train, Ganymede, has arrived(on time as usual) and comes loaded with 23 projects and a whole host of improved features (even for the Platform project alone) that I have been looking forward to since EclipseCon. Tops on my list are:
  1. The OSGi and Eclipse run configurations are sporting a shiny new filter box. This alone was worth the upgrade for me...no more hunting through the hundreds of bundles in my target to add a bundle that was missing and not "required" (target platforms are still the way to go to limit the number of bundles in this list).
  2. PDE has added a spiffy feature called the plug-in spy...simply click ALT+SHIFT+F1 over any active window and it will pop up with useful info like the active View class and the contributing plugin. This is so useful I retrofitted it to my 3.3 instance as well.
  3. The Plug-in Registry view now allows you to start/stop, enable/disable, and diagnose individual bundles (toggle the Show Advanced Operations menu item to turn them on).
  4. Improved String matching in Find/Replace dialog (esp. with newlines). That used to drive me nuts.
  5. Improved Share Project wizard. It was a real pain to share each of my projects individually in the past, and the addition of the "use the project name as the module name and place it under the selected module" option would have been really handy for me last month :-) update: I just tried this out and it wasn't that special...still have to share each project individually, you just have a nicer wizard to tell you that.
(I was hoping to add links from these items to their location in the New and Noteworthy doc, but it doesn't seem to offer anchors for that purpose)
update: this was an oversite on my part

Overall I have been very impressed with the stability of the new release...even after loading it with all kinds of Ganymede plugins it seems to be performing splendidly on my underpowered (1.6 Gh, 512MB) Linux box.

However, the project/feature I am most excited for is the new provisioning platform (p2). I have read an interesting review at Ekkes Corner and also began to play with the new "Software Updates..." feature. I was also able to set up a working pooled Eclipse install using the p2 admin ui agent (as apposed to the installer) to provision my SDK. I hope to document this experience here shortly...