Central Lookup: Creating a central repository and lookup for an application context in a NetBeans RCP application

I have been working on a NetBeans RCP project where I needed a central place to register different interfaces and allow different views to operate on these regular POJOs one would use in a regular Swing application and to be able to listen to changes to them from the standpoint of some kind of an Application Context where different instances will come and go. A good example is a desktop application requiring a login. You will have user information and want to be able to track a global login or validation token.

I create a simple class and API in a NetBeans module and called it CentralLookup. This is all the code for such a simple thing (please ignore the formatting of the code...maybe I can update it later, but it seems blogger isn't wanting to format it correctly when posted):

package org.netbeans.modules.centrallookup.api;

import java.util.Collection;

import org.openide.util.Lookup.Result;

import org.openide.util.lookup.AbstractLookup;

import org.openide.util.lookup.InstanceContent;

* Class used to house anything one might want to store

* in a central lookup which can affect anything within

* the application. It can be thought of as a central context

* where any application data may be stored and watched.


* A singleton instance is created using @see getDefault().

* This class is as thread safe as Lookup. Lookup appears to be safe.

* @author Wade Chandler

* @version 1.0


public class CentralLookup extends AbstractLookup {

private InstanceContent content = null;

private static CentralLookup def = new CentralLookup();

public CentralLookup(InstanceContent content) {
this.content = content;

public CentralLookup() {

this(new InstanceContent());

public void add(Object instance) {


public void remove(Object instance) {


public static CentralLookup getDefault(){
return def;

The nice thing about this code is that it is real simple. The strange thing for me is that there hasn't been something already implemented in the base RCP. It seems pretty common a thing. For instance, the normal global lookups deal with Actions, Services, and Nodes (which are part of the NetBeans data model), and that is fine until one needs to work with generic interfaces and classes from a global perspective.

Regardless, I can now write code to listen to changes in this global context or Lookup in this case. The code doesn't have to know about any implementation except for the code which does the injection, and the code in other places can just setup a result and a listener. The following illustrates this a bit, and of course it is just a sub-set of the code:

final class CentralLookupTest1TopComponent extends TopComponent {

private static CentralLookupTest1TopComponent instance;
private Lookup.Result userInfoResult = null;
private CentralLookupTest1TopComponent() {

Lookup.Template template = new Lookup.Template(UserInformation.class);

CentralLookup cl = CentralLookup.getDefault();
userInfoResult = cl.lookup(template);
userInfoResult.addLookupListener(new UserInformationListener());

private javax.swing.JTextField name;
private javax.swing.JTextField pwd;
private javax.swing.JTextField token;
private javax.swing.JTextField uid;

private class SetterRunnable implements Runnable {
UserInformation ui = null;

public SetterRunnable(UserInformation ui) {
this.ui = ui;

public void run() {

private class UserInformationListener implements LookupListener {

public void resultChanged(LookupEvent evt) {
Object o = evt.getSource();
if (o != null) {
Lookup.Result r = (Lookup.Result) o;
Collection infos = r.allInstances();
if (infos.isEmpty()) {
EventQueue.invokeLater(new SetterRunnable(new DefaultUserInformation()));
} else {
Iterator it = infos.iterator();
while (it.hasNext()) {
UserInformation info = it.next();
EventQueue.invokeLater(new SetterRunnable(info));

Notice we have a result. The result has attached to it a listener. The listener knows about DefaultUserInformation and the UserInformation interface, and that is it. It then knows it needs to listen for instances of UserInformation and act accordingly. It doesn't know how it got there, but knows what it must do with it. We then have some other code in another class which will inject the instances into the CentralLookup based on some user input removing any previous:

private void buttonActionPerformed(java.awt.event.ActionEvent evt) {
//ok we need to remove any user information from the central lookup
//and then we need to add this new one

CentralLookup cl = CentralLookup.getDefault();
Collection infos = cl.lookupAll(UserInformation.class);

Iterator it = infos.iterator();
UserInformation info = it.next();

DefaultUserInformation info = new DefaultUserInformation();


You can get a good idea from here the possibilities. This is a rather simple example, but it certainly shows it working. This can be used for any other services which need to use regular POJOs and not much else. Why add more overhead of class wrappers etc when they are not needed for everything? Sometimes one just needs a dynamic application context which can breakup the application into a more modular framework of simple classes and interfaces without major restrictions.

I have an AVI video formatted video of this in action. It is a very simple example, but it shows it working. The one piece of code doesn't know anything other than the fact that user information will appear magically in the CentralLookup in the form of the UserInformation interface.


Have to say it: What Sun is doing with the JCK (Java Development Kit and runtime TCK/compatibility kit) license seems pretty dirty

The part which seems dirty is the way the license is obviously being extended to OpenJDK based projects to allow OpenJDK project contributors to be able to use the TCK without any encumbrances on their builds fields of use while keeping other, from scratch, open-source efforts from being able to do the same. The obvious part: if developers were not able to use the TCK, it would hurt the OpenJDK effort as contributors would not be able to distribute any builds and call them Java as they would not have passed the TCK. Passing the TCK is part of the rules for being able to implement the Java specifications, claim adherence, and distribute the end result.

If the goal is to support open source Java and to be fair, then any open-source Java implementation regardless of the license would be able to use the TCK in the same manner. So, as a pretty open Sun supporter, I do not like what they are doing with the TCK at all, and it damages my view of them as a corporation as it specifically relates to honesty. I think if they are going to go about it this way they should at least have the honor and guts to say exactly what they mean and the reason for doing it instead of dancing around the issue by talking about license terms, not open-sourcing the TCK because they want to protected what it means to be "compatible" (which I totally understand), and not being able to please everyone. These reasons are pretty weak as a reason for the terms of the license only being given to OpenJDK based projects.

The fact is they could just as easily let anyone use the TCK for free to certify any open-source implementation. The TCK does not have to be open sourced for this to happen. I think if the reason, which to me it can only be, is to protect corporation investments and only support those efforts which directly support their interests then they should just say it. Personally I don't think this is outside the bounds of what corporations try to do; I mean lets face it, they have to make money, but the JCP (http://www.jcp.org) member agreement and processes clearly state what can and can not exist in limiting anyones right to fully implement JCP specifications, and the scholarship TCK license itself does encumber ones ability to create clean and independent implementations of the Java specifications, and this is the only free license organizations or individuals creating open-source Java implementations can obtain unless they are based on Suns OpenJDK and also use the GPL license. This is against the agreement of the JCP as I have read it as it imposes restrictions beyond the ones stated in the agreement, and the agreement specifically states that no more restrictions beyond those listed within the agreement can exist which hinder anyones ability to create independent implementations of any JCP specification.

So, Sun employees, don't take this personal. I happen to work with a few of you on different open-source projects, and you know who you are :-D, and I know you don't have anything to do with these decisions. The law department and which ever managers approved this however, this seems pretty darn dirty, at least what I have seen so far. Maybe someone has a good explanation, but for now I'm calling it what it looks like.


I have updated my "Java Text Copy Paste Module/Plugin"

The Java Text Copy Paste Module/Plugin now works in NetBeans 6.0. I tested it and am using it in 6.0. The module helps copy and paste text from and to Java source code. This module works well with SQL or HTML or XML which needs to be embedded in Java source code or needs to be extracted from Java source code. Look for the "Java Text Copy and Paste" context menu inside Java source files. There are no default hot keys for the functionality. I suggest playing around with the different actions to get a feel for how they work. + signs are pre-pended at the beginning of lines of source to make hand editing of generated code easier.

This module allows source code to be selected then formatted back into the text format it was before converted into Java source. It also allows one to select XML, HTML, or SQL in their favorite tool (as text) and then paste into the NetBeans Java editor where it is automatically formatted as Java source code. I find I use it all the time and comes in very handy.

Version 1.1 added a new way to copy the text from the editor which keeps newlines in the selected text yet removes any newlines fromJ the actual Java sources.

Version 1.2 adds tested support for NetBeans 6.0 and corrects a bug which deals with concurrent access of the edited document. The bug has not shown any issues yet, but possibly could as concurrent access could have unknown results.

Version 1.3 fixes an issue dealing with the context menu sorting and NetBeans 6.0.



Sharing classes with modules and non-module based JARs in a NetBeans RCP Application

Sometimes, such as when using JPA or Hibernate from more than one module, it is necessary to share classes between any number of modules and non-module based libraries/JARs in a NetBeans RCP/Platform based application. The reason this solution is needed is because some libraries, and even at times modules, need to be able to see classes from other libraries and modules at runtime to use certain patterns and these classes and modules have a cyclic dependency because of the type of classes being used. JPA or Hibernate are perfect examples where the entity manager will reside in one library and needs to be able to create instances of classes from another library or module, which also references other JPA or Hibernate classes themselves, using annotations or XML descriptors. This usually happens dynamically at runtime in these type situations.

In NetBeans the module system provides good separation. The problem is this can at times be too strict. To work around this issue you need to create a custom platform and then find the platform#/core directory under the platform directory and put the libraries and JARs in it. I will update this later to explain how to setup a custom platform.

Once you have the libraries in the core directory they can be used by any module or other library at runtime. These JARs can be copied to the core folder at build time and before distribution using ANT, so it is a good idea to make this custom platform reside relative to your project. Another good reason to have them reside relative to the project is that these common JAR files will have to be referenced by your module projects. To reference these JARs from your module projects you will have to edit project.properties and add a property:

which is a colon delimited list of JAR files needed for the classes the particular module needs to reference. Once cp.extra is setup, any errors you may see in the Java editor, related to these classes, should disappear and you can actually compile your project.

It is best to avoid doing this if possible as it removes the ability to use different versions of the same libraries by different modules while also removing the ability to auto-update these libraries, but when it is not possible to avoid such things then they are certainly needed. You wouldn't shoot yourself in the foot for spite, nor do I suspect you would not complete your project just because it best to not step outside the bounds of the regular module class loaders.


Eclipse 3.3 Europa SPAM, regular emails, and magazine articles related to simultaneous project releases

Not wanting to start a flame war, but I want to talk about this. I have been getting "alot" of SPAM from places like bzmedia and ZD (Ziff-Davis) about Eclipse 3.3 Europa. I have also been getting emails from my magazine subscriptions such as eWeek and SD Times. I have also seen articles in my different magazines about it.

The main talking point in the articles and emails I'm referring focuses on the simultaneous release of 21 projects in the Eclipse IDE. These are the core Eclipse projects, so I'm not talking about 3rd party projects. This means the plug-ins/projects will all run with Eclipse 3.3, so you don't have plug-in Z supported in 3.3 yet X and Y are only supported up to 3.2.

It is no secret I'm a member of the NetBeans community. I certainly don't try to hide the fact. Anyways, NetBeans has been doing this for years. JSP, Web, EE, Swing UI, Mobile developer, NetBeans RCP, etc have always been released together and work in the current version of the IDE. I think it is good that Eclipse is doing this now, but I also think the apparent amount of resources going into highlighting this fact, promoting it, and that it took this long for it to happen is funny.


American Internet Connections

I'm driving back from the beach early so I can get back home and get some work done. It is a long drive, so I stopped for a Subway grilled chicken sandwich at a truck stop in the middle of the interstate with no large city near.

I thought I would check email to try to wake up a bit before getting back on the road. Of course, for this, I will need an internet connection. I am happy to say I have one and I am writing this from an exit with nothing around but this one Shell fuel and truck station. The connection is great.


Tie that binds Sun, NetBeans and Java criticized

A friend told me about this article. I read it. I was immediately peeved:

One paragraph from this article reads:
Roth argued that Sun Microsystems Inc. has tied the NetBeans IDE to Java in a way that takes unfair advantage of Sun's custodial relationship to the Java language and ignores the developers working with the Eclipse IDE. "I think what they're doing is morally reprehensible," he said.

Personally, I first want to see what it is Mr. Roth is exactly talking about. I am not a Sun employee, and I haven't seen anything in NetBeans I do not have access or which isn't being converted for me to access, and I certainly have not seen anything in Java which is specific to NetBeans other than IDE features.

NetBeans is a Java IDE. Of course the IDE project is going to ignore Eclipse IDE users. They are not NetBeans users. It would be like us Americans going up and voting in Canadian elections and not paying Canadian taxes and getting Canadian benefits. What flipping sense would that make.

If he is talking about features, then I'm not sure how there can exist multiple IDEs and them have the same exact feature sets. Otherwise, why even have more than one. I for one do not like Eclipse nor SWT; that does not mean others don't, but I believe I have the right to choose. I'm glad I have an alternative.

There are many things like the mentioned paragraph in this article. I find many of them to be extreme contradictions of their own words. How can one have an autonomous project if it is exactly like another one (Eclipse)? NetBeans is not Java. NetBeans is not Eclipse. It is a Java IDE, so of course it supports Java features. Instead of telling Sun to contribute to Eclipse, these people could just as easily contribute to NetBeans as it is an open-source project.

For instance:
Jason Bloomberg, senior analyst with ZapThink LLC., strongly supports the criticism, saying, "Bill Roth from BEA is right on the money."

OK, so what exactly are you talking about? It still eludes me. I have yet to see anyone quoted as saying what it is specifically Sun is doing to give NetBeans an unfair advantage...repeated...enough said on that front...waiting for answers.

I'm a member of the NetBeans Dream Team. I have been around the NetBeans project for years, and I contribute as much as I can. I love the IDE, and around 4.0 I started playing with the Rich Client Platform; I help other users among other things and is why I'm part of the team. I have at times voiced my concerns in our community about community involvement and Sun.

That doesn't mean I think Sun runs NetBeans as some kind of totalitarian project. I strongly believe differently. I have never been a Sun employee, and I have a good community relationship with many Sun folks, and it stays good even when in disagreement.

Like any project I have seen, there are some who are easier to work with than others. It doesn't mean they are bad folks; they are simply people. Different people see things differently. Just like people, different projects are run differently and in turn behave differently. That should be no surprise to anyone involved in an open-source project.

It seems to me the folks complaining are not complaining about Sun, Java, and NetBeans specifically though this is what they say. Their comments seem to allude they want Sun to contribute to Eclipse, have NetBeans go away, and that be it. To me it is about like asking SuSE developers to contribute to RedHat or Ubuntu or vice versa and the others go away.

Those Linux projects all contribute to the Kernel just as all IDE and Java projects at times will contribute to patches and common APIs and tools for Java. That doesn't mean all projects for a technology should be merged into one. Different people love these products and projects. Eclipse users and developers: Imagine Eclipse going away and being stuck with NetBeans. NetBeans users and developers: Imagine NetBeans going away and being stuck with Eclipse.

Obviously if Sun is working on a JSR they can add features to their IDE to gear up for supporting the API or specification. This is what BEA or any other company will be doing with their products if they are worth having investors or customers. I, as a user and community member, expect it. That doesn't mean an API was designed specifically for their projects, but it will always (for any company) play a part, and if any CEO or VP tries to tell you different, they are lying.

It seems we have a few classes of folks when it comes to issues like these. I call the ones I read here whiners. Some seem to be commercial entities and employees looking for anything FUD or sound bite related to make their own case, and others are those who seemingly don't know and understand the daily ongoings of open-source projects and the intermingling of commercial and community contributions.

NetBeans is just as open-source as anything else. If there is a feature these guys want in Eclipse they can take the code and use it. Many people in the NetBeans community do every day for their own projects. If they just want Sun to contribute to their IDE instead of NetBeans, they should just say it in those terms, and they should be asking instead of telling Sun how morally reprehensible they are for support their own open-source community. Regardless, will all those quoted in the article contribute to NetBeans as they are asking Sun to do for Eclipse?


OpenSuSE 10.2, Fedora Core 5, Kubuntu Fiesty Fawn, Vista, XP, VMWare, Windows Development, Open-Source, Java, Computer Forensics, and Everything Else

In the screen shot below, the black space on the bottom of the left comes from the image having to be rectangular. My screen ends where the black begins on the left. The black on the right is where I have Windows resolution set smaller so I don't have scroll bars on the outside of my screen. I have a newer resolution I'll post more images of once I get them. I'll have to think of something cool to show you like developing Windows, Linux, and Java applications at the same time.

My employer targets Microsoft platforms. I also have to create ISAPI Web Applications and Windows Desktop Software (using Windows APIs). However, I end up writing Java source more than anything as part of some of our contracts.

Personally, I have always loved Linux and all the utilities and flexibility which comes with it; the entire operating system is built for computer work and application development/software engineering. The reality is no matter where I work, even for myself, I will run into Windows development, so, no matter what, I can never (in the foreseeable future) do away with Windows development and Windows.

I do a lot of different computer related things in the software field. I have recently been working on becoming a certified computer examiner and getting into computer forensics. I have been using Linux a lot for forensics. Unix class systems such as Linux offer a lot for forensics as there are many ways in which to access data without mounting a drive and altering time stamps or data; one can even see exactly what much of the source code is doing if something comes into question. Windows makes this much harder.

My development laptop's screen started acting weird, so I decided I needed to get another backup computer so I could fix it. My current computer was my last backup. This time I went to Best Buy and bought a Toshiba Satellite P105-S6177.

It has some decent (not awesome) hardware built in. However, it is not without issues. Even while running Vista, the operating system which came pre-installed, it could not hibernate without blue screening. I know it was blue screening because the error message in the log said it was, but the screen would just go black any time I tried to hibernate; the patch Vista found on the Microsoft web site did not remedy the issue. One certainly wonders why they pay 299.99 for an Ultimate Upgrade with noticeable issues such as this. I have used hibernate ever sense it became possible. It seems to save me a lot of time as I use it daily unless forced to reboot.

After the computer seemed to be having a few issues with Vista, I decided to try a new method for development. I have used virtualization for different things such as testing on different versions of operating systems, and the company uses virtualization for web servers. I have not tried to use it, until now, to run a mutli-OS desktop development environment.

I have used dual and triple booting, but I wanted to be able to work on different projects in different contexts at the same time and on the same machine for multiple operating systems, and I have been wanting to see what it would be like to get to use Linux all day every day, setup a multi-monitor X system, and contribute more to a Linux distro.

OpenSuSE 10.2 seemed promising and I have used 10.1 on another system for some time, so I ended up going with it. I downloaded CentOS 5 (which is Red Hat Enterprise for free), but it could not detect the graphics card and monitor. I even gave Kubuntu Fiesty Fawn a test drive, but I didn't like it as much as I like SuSE. I have used CentOS for different things and like it a lot, but I needed to get going as fast as possible and had hardware issues from the beginning, and I find the SuSE administration tools extremely useful. The YaST tools are not 100% perfect but what is.

I have used Linux off and on since 1996. I had all kinds of cool features when consumers thought Windows 95 was cool. Through the years I have given different distributions a shot including different Debian based ones. Mostly I have been back and forth with Red Hat and SuSE, and I have always had a place in my heart for Slackware even though I don't use it any more (nothing personal...I'm not using Red Hat or Fedora at the moment either). I think mostly I love the word slack :-). I also use Helix and Knoppix for specialized tasks.

I think it is important to make sure everyone knows this is not my first time with Linux as it wasn't like I just installed this from a CD or DVD and all was good without some manual labor. It took a week or so to get this computer just right.

The issues:
  1. Dual Monitor Support:

    Sax2 setup the main screen fine. It could not setup dual monitor support correctly. Even cloned display was incorrect. I had to edit the xorg.conf file by hand. Once configured I noticed the support works better than the dual monitor support under Windows XP. I didn't even have to have extra software to have a taskbar on each screen.

    I had to read and figure out exactly how the X configuration files work. Once I spent the time to learn the files, I quickly learned I could use Sax2 to get the initial file created. Then, by reconfiguring for my specifics I could get it working correctly. I can use Xinerama which lets me drag from screen to screen or is one giant desktop, I can use the normal view which is an X server on each display, thus each has its own sepearte taskbar and I can not drag between the two, or I can use a cloned display which isn't very useful for anything except maybe a cash register, kiosk, dual developers on the same machine during a code review, or something similar to these.

    The big gotcha on my system is that the two screens are not the same size and resolution. They are even different aspects. One is a wide screen laptop display capable of 1280x800 and some higher resolutions and the other a LCD monitor capable of 1280x1024.

    I noticed to really test the X configuration I had to completely reboot, otherwise it didn't look as it should and I would keep changing the file with no good result. I'm not sure if this is some type of a bug in X or something to do with a buggy ACPI system in the Toshiba or some other firmware issue. The LCD monitor is a zero configuration monitor which I push a button and it auto configures the screen layout based on its input.

    The display related sections below show some of the things. Notice I have the one mode for the external monitor. This might not be so good for other external monitors, but it is the only resolution,I have found, which works well with this monitor (a Samsung SyncMaster 960BF).
  2. Sound Support:

    I had issues with sound. I also had some other issues with USB device removal and certain devices not working once they were plugged in again. I had a suspicion these were ACPI errors. I could disable ACPI:
    apm=off acpi=off noapic
    and things worked correctly except for anything ACPI specific and no dual core support on my dual core CPU.

    I had decompiled my DSDT and had looked it over. I noticed it had a determination for the OS, so I set the boot parameter acpi_os_name="Windows 2006" per the decompiled Intel DSL code. This had no affect. So, I thought maybe this was an issue with something else. I had seen talk about ICH7 and the Conexant codec. I saw another post where the individual had completely hard coded the DSDT setting of OSYS, and was replacing ALSA with a newer version. So, I started to work through his steps. Turns out the first step, hard coding the DSDT setting of OSYS the Windows 2006 value (0x07D6). was all I needed.

    In total:

    I downloaded and built the Intel ACPI tools and compiler iasl and added them to the PATH.

    I then extracted my DSDT to my project folder using (you have to have started with ACPI enabled even if with bugs):
    cat /proc/acpi/dsdt > dsdt

    Next, I decompiled the code:
    iasl -d dsdt

    I then found the following code and changed it by commenting out the OS checks and hard coding the Windows 2006 value:
    If (CondRefOf (_OSI, Local0))
    /*If (_OSI ("Linux"))
    Store (0x03E8, OSYS)
    Store (0x07D1, OSYS)
    If (_OSI ("Windows 2001 SP2"))
    Store (0x07D2, OSYS)

    If (_OSI ("Windows 2001.1"))
    Store (0x07D3, OSYS)

    If (_OSI ("Windows 2001.1 SP1"))
    Store (0x07D4, OSYS)

    If (_OSI ("Windows 2006"))
    Store (0x07D6, OSYS)

    If (LAnd (MPEN, LEqual (OSYS, 0x07D1)))
    TRAP (0x3D)
    Store (0x07D6, OSYS)

    Then, I compiled the code using:
    iasl -tc -f dsdt.dsl

    There will be errors and warnings, but the -f forces the dsdt.aml file to be created even though there are compiler errors. If you try to fix the errors you get from this code it will not work. I have already been down that path. Apparently the _T_0,_T_1,etc variable/storage names are required even though the Intel compiler says they are reserved words which I could find no documentation. I assumed they were just variable names, but this must not be the case for these particular storage identifiers with these names.

    Next, you need to be root:
    su -
    enter your password, and you'll be back at a prompt. Now cd back to your project directory.

    Next I copied this to the etc directory.
    cp dsdt.aml /etc/DSDT.aml

    I then started YaST. I then went to System|/etc/sysconfig Editor|System|Kernel|ACPI_DSDT. I set it to /etc/DSDT.aml. I clicked Finish.

    Next, we have to tell the Kernel where to find it (after setting the ACPI_DSDT in YaST SuSE now knows where the DSDT we want to use is):

    Then reboot your system. Either use the user interface (Restart) or type:

    You should now be able to configure your sound card and it work. If the card is already configured, even if no sound was coming out previously, you should notice sound upon reboot. This was my experience.
  3. IRQ Balancing:

    Looking in /proc/interrupts, I noticed that CPU 0 was the only CPU getting interrupts. The irqbalance start up script was not starting irqbalance even while telling it to manually on the command line. Looking in /etc/init.d/irq_balancer (the script which runs it), I noticed this code:
    echo -n "Starting irqbalance "
    if [ $PHYS -gt 1 ] || [ $PROC -gt 1 -a $PHYS -eq 0 ] ; then
    startproc $IRQBALANCE_BIN
    # Remember status and be verbose
    rc_status -v
    rc_status -u

    where PHYS and PROC are set by:
    PHYS=$(grep '^physical id' /proc/cpuinfo | sort -u | wc -l)
    PROC=$(grep -c '^processor' /proc/cpuinfo)

    So, any system must have at least 1 CPU, so the test:
    $PHYS -eq 0
    will always fail, so I changed it to:
    $PHYS -eq 1

    and now irqbalance is actually started, and works correctly on a multi-core system versus only working on a true multi-processor system. The only bottle kneck now should be the CPU cache locking and serialization.
  4. Installing and Configuring VMWare:

    The free version of VMWare I'm using doesn't work directly on SuSE. I had to make sure I had all the source packages for SuSE and dependencies for VMWare installed. Once I had the dependencies installed I had to run vmware-config.pl and allow it to build the modules for my kernel. Once I did this VMWare seemed to run fine.
  5. VMWare Sound Issues:

    VMWare sound doesn't work exactly the best. Actually, without doing a couple things it would make VMWare lockup while it had input control, so while it was locked up I could not operate my system until it unlocked. I found a VMWare forum message which mentioned adding a serial port to the virtual machine and in the same message mentioned setting sound.smallBlockSize and sound.maxLength to some value other than the 512 default.

    I found on my system this required setting the values to 64 and also adding a serial port which output to a file. Anything else and I still had the issue, though if I had a real serial port on my system I'm sure hooking it up to the virtual machine would have had the same effect as the fake one. Sound still has some issues, but the performance is not hindered and doesn't lock up the virtual machine and it doesn't break up all the time. I tried to use 128, 32, 48, 256, etc, but 64 was the only one to work correctly.

    Some of my issues may come from using Napster. I have a paid Napster account, and it says it only runs on XP, and Napster crashes quite frequently on Vista. So, I can't be sure if the issues are all VMWare.
Now that I'm past the issues, everything seems to be fine. It is a really awesome environment, and I think everyone should have one. I can program just about anything I want. I figure if I ever upgrade to VMWare Desktop I can even install MacOS, but I have not confirmed this as being supported, but it would be cool to be able to developer for all these different OS using Linux and virtual machines. When and if Xen (Linux Virtualization) gets to the point it can support Windows and MacOS and others such as Solaris, I'll give it a shot, and hopefully, I'll have a reason to get an even bigger drive!

If any of you go to setup a system like this let me know your experiences. It isn't the easiest thing the first time you run into new issues such as ACPI or try new things such as Xinerama with different monitors and resolution, but in the end, at least for me, it is worth it. Have fun!

Update 2007-05-24
I found out I had an issue with USB and VMWare as SuSE 10.2 and many other Linux distros no longer support usbfs. I downloaded the 30 day trial for VMWare Desktop 6, and it is amazing. It works so much better. I still have some sound issues, but everything else works so much better; even the display is faster. VMWare Tools is also a life saver. I definitely recommend this setup to others. I can even run Vista or XP as a large desktop which covers both my X terminals running in Xinerama. Good stuff! I'm going to purchase a commercial license for VMWare.

Update 2007-06-01
Multiple monitors and independent taskbars
I decided to post a new screen shot. I have setup my desktop with some new panels. KDE is amazingly configurable. You have to play around with it a bit. Once you figure it out, it is just awesome. I have, on both monitors, a similar taskbar, and each taskbar is independent yet shows the same windows. Check out the window floating between both monitors.

Notice the same titles are showing on the bottom. I can easily drag between the monitors, yet I have both showing all processes. I also have different applets and panels in each taskbar panel. On the right I have a color picker, the weather, and even a world clock. On each I have a trash can which makes it easy to move files to the trash bin.

Here is one I like: Linux and Vista side by side thanks to VMWare
The new VMWare Desktop does much more than the free version I was trying to use. For instance, I can full screen VMWare on a single monitor. I can then move my cursor freely between the two without pressing a key. I can also copy and paste from the virtual machine to my host operating system. In this case OpenSuSE 10.2. I can't drag a file or text across the boundary, but I can copy the file then paste it. I can do the same with similar data flavors as long as the target accepts the value.

finally, I can have VMWare allow the guest OS (Vista in this case) to use both monitors. This is so cool, and so flexible.

Anyways, I finally figured out my sound issue was only with Napster. Windows Media Player itself works fine. I can jam out to WMA and MP3 files easily using Windows. I get the flexible programming world of Linux. It is really powerful.

The only issue I now seem to have is that many Windows programmers seem to have crazy ideas about how to use file names. Seems they believe if they use filename in one location they should use FileName in another and FILENAME in another. Well, let's just say, sharing file systems is hard with software developers inconsistencies. I need to figure out a good case-insensitive file system to use or I need to be able to tell Samba to do this for me, so expect at least one more update to this blog post.

Update 2007-10-14
I finally have suspend/hibernate working correctly. Apparently it all had to do with the SuSE version of s2ram (suspend to ram) not knowing my machine (the actual hardware identifiers). I had to go into:

and set:

or "force" and this not only made suspend to ram from the applications menu work correctly, but apparently suspend to disk also requires suspend to ram to function properly. If suspend to ram fails then apparently suspend to disk doesn't just quit and leave the computer system running, it does something and then writes it to disk. You restart your computer, it will run for a few minutes, then it will just turn off completely without any warning forcing you to lose anything you were working on :-(.

I am very pleased now. I can truly hibernate this hardware, and it seems to work correctly. Even the wireless NIC starts itself correctly without me having to turn it off and back on and even reconnects itself. Previously , when hibernate was working incorrectly, I would notice that s2disk apparently didn't store the hardware state correctly as the wireless NIC would always have to be turned off, with the physical switch, then turned back on after 10 seconds (and you did have to wait the 10 seconds...any less and it just wouldn't work at all) just to be able to connect to the internet or network. Previously that was all futile as the computer would shutdown after it had been running for a few minutes. Now all seems well, and it has made life so much nicer with this system.


OSGi, JSR 291, and JSR 277 misinformation

The problem with the referenced eWeek article is the author apparently chose only quotes which try to promote OSGi as the end all be all to everyone and everything and attempt to bash JSR 277 and Sun Microsystems. JSR 291 and 277 are not actually competing. 277 will actually make its way into standard Java, and will be part of the standard runtime used by the SE and EE platforms, where as 291 isn't a new specification. It is another location which points one to OSGi. It isn't a real specification of the JCP, so why is it even an actual JSR? That doesn't seem to make much sense outside of commercial politics.

291 can not even be contributed to by JCP members without first joining the OSGi Alliance (291 means OSGi in this case). Individuals such as you the reader or myself can join the JCP for free. Individuals can pay the OSGi Alliance $3,000 US. This seems strange to me, considering IBM, the main OSGi Alliance member (Eclipse Funding), was the loudest critic of Sun Microsystems open-sourcing Java. I believe the OSGi Alliance needs to take their own advice and move this initiative completely to the JCP. I get Sun used to be an OSGi Alliance member, and I don't really get why this wasn't first run through the JCP, but it needs to be now.

I agree with the sentiment of some, and I have been a proponent myself of modularizing the entire JRE/JDK, that a module system needs to remain a separate entity from the JRE/JDK itself. This allows the module system to be separately upgraded without waiting for a new JDK release. However, we need JVM level support for better partitioning of ClassLoaders and variable and static visibility. This allows better optimizations and other language and technology hooks which can have greater benefits than a single layer approach. Both ideas have their place.

A good point of view is expressed by Glyn Normington (JSR 291 lead and JSR 277 member) in this blog post with regard to both JSRs. If you are reading through an RSS reader you may need to use:

If OSGi were to fall under the JCP process I could get more behind it. Currently it is one more thing to be dependent which is not as easy to contribute to or influence by small startups or individuals. I would feel the same way if the JCP process is changed to be more closed in the future.


I'm a Netbeans Dream Team member

I'm a member of a new Netbeans group called the Dream Team. We are all supporters of the open-source Netbeans project. We work to promote and improve Netbeans. See www.netbeans.org which has a RCP package and a Java IDE. To me it is the best Java development environment available with many out of the box features. Best of all: it's free. I also contribute patches and modules/plug-ins to the project.

New Netbeans Module for copying and pasting text formats to and from Java source code

I created this module when I finally became tired of having to un-format large SQL queries I did not have a copy of any where other than Java source code. I ran into this large query from the past which used many many joins from this huge database. I was hours into trying to figure out what I had missed in the un-format process because Oracle's error message was more confusing than looking at the SQL. I finally decided it would be easier to write a Netbeans modules to just copy the formatted Java source code SQL String and paste it as un-formatted SQL into TOAD my SQL tool. After an evening of hacking at the module I have something which works great. It also does the reverse operation. I have been using it for a month now and it works great. I submitted it to the Netbeans contrib site hoping it might help someone else. I'll upload it the new Netbeans Plug-in Portal site when it goes live. Look for http://plugins.netbeans.org/ to go live soon.