Saturday, October 04, 2008

OpenOffice.org 3 Release Candidate 2 on Mac OSX

Just installed OpenOffice.org Release Candidade 2 on my Mac, where I am running Leopard 10.5.5. I was really surprised when it starts just within 4.03 seconds! In compare to Microsoft Office 2008, it takes really a long time to make it start and open some document.

Check it out: http://porting.openoffice.org/mac/download/aqua-Intel.html

Friday, October 03, 2008

Proxy And Java Web Start

When running on client environent, Java Web Start is using JavaScript PAC file (proxy auto-config), completely ignoring system environment settings, for example, like "(protocol).nonProxyHosts" etc. In my case, users are not authorized to change their own default proxy settings and everybody are enforced to use some specific address.

The problem occurs, when you need something, like a different port for a web service that is running with SSL. In that case Proxy server will return an error, encouraging client to connect only through defined ports.

Here is a cure how to turn off proxy settings within Java Web Start, having no deal with the system configuration (including javaws.cfg):

ProxySelector.setDefault(new ProxySelector() {
@Override
public List<Proxy> select(URI uri) {
List<Proxy> proxyList = new ArrayList<Proxy>();
proxyList.add(Proxy.NO_PROXY);
return proxyList;
}

@Override
public void connectFailed(URI uri,
SocketAddress socketAddress,
IOException ioException) {
}
});

The object ProxySelector is a global object that is used by all the handlers. Now in this case it will return a default Proxy object that is DIRECT connection. It is equivalent to setting javaws.cfg.proxy.setting=NONE in javaws.cfg file.

Friday, September 26, 2008

Writing a Standalone Client For Secure Web Service

Today I was puzzled writing a standalone Java client (going to be Swing app) that "talks" to the remote server, which serves a secure Web Service. Looking around various blogs and other stuff, I made it. It even works as expected. :-) 

But I want now put it all together to make it very clear and up to date. The process is all undocumented properly and successfully allows everybody hit the wall with the forehead. Therefore, to avoid others had the same sad experience googling around for a half a day, soon I am going to make a end-to-end document with a screenshots and detail explanations.

Uugghhh... Now is Friday and 8:30PM. Maybe tomorrow...

Thursday, September 25, 2008

Writing a Secure Swing Client For a Web Service

Using NetBenans IDE, I've tried to write a Swing GUI client for a secure web service that I've made. While web-based servlet works great, Swing standalone application spits weird errors and won't even run. One of the interesting exceptions is:
javax.xml.ws.soap.SOAPFaultException: ERROR: No security header found in the message
...
The problem is that NetBeans is using "old" JAX-WS libraries instead using WSIT. Solution is to remove all the JAX-WS jar libraries that NetBeans added automatically, when created Web Service Client reference and replace them with the libraries from GlassFish application server.

To those, who need step-by-step instructions:
  1. In NetBeans IDE, right-click on the client project and select "Properties". "Project Properties" dialog appears.
  2. From the "Categories" tree at the left side of the dialog, select "Libraries" item.
  3. Remove all the JAX-WS libraries—do not worry, your project is completely broken anyways. :-)
  4. On the right side of the dialog, click on "Add JAR/Folder" button. "Add JAR/Folder" dialog appears.
  5. Browse to $GLASSFISH_HOME/lib folder (and subfolders) in order to select all the libraries, listed below.
  6. Click OK.
  7. Have fun. :-)
If everything else is correctly configured (e.g. your X509 and/or SSL cert's etc) then it should work now fine. Here a full list of the libraries you want to add (some of them are in lib/endorsed subfolder):
  • activation.jar
  • appserv-deployment-client.jar
  • appserv-launch.jar
  • appserv-admin.jar
  • appserv-ext.jar
  • appserv-rt.jar
  • javaee.jar (oh my...)
  • webservices-rt.jar
  • webservices-tools.jar
  • webservices-api.jar
It will eat you 34 megabytes of disk space and 40 megabytes when running. While it looks fat, still I am much more satisfied using Swing over Java Web Start (JNLP) rather than use web browser based DHTML pages (current buzzword for DHTML now is "Ajax"). Ajax UI "eats" much more memory actually. It is significant performance problem on the Enterprise, when terminal servers for lots of users are in use.

Sunday, September 21, 2008

16 Million Of Terabytes On a Laptop

Apple did great OS! Mac OSX supports 16 million of terabytes of virtual memory on... single small laptop! I am serious. Here is the evidence:


Awesome, isn't it? :-)

Thursday, August 07, 2008

Java Swing Balloon Tip

I am developing a GUIs with Java Swing. Awesome, everything fine. Now, today I needed something like tool-tip or balloon pop-up to show various messages. In particular, I find that there are no standard form validation framework, so I created one, ripping off ideas from Zope Formulator. And the validation trigger suppose to pop-up a balloon tip when something wrong and focus the widget. That's fine, validation works perfect, unless you need a balloon tip.

I found one "decent" balloon tip on https://balloontip.dev.java.net/ site. Here how it looks like in Windows with Metal L&F: (pic is taken from the site directly):

Well, it's OK. It's Windows and mostly everything looks ugly there even in Vista, so a combination of blue frame on bluish gray with a squarish hint might be OK for environment that lacks taste and design. But what about Mac? — yeah, I am snob-like a--hole here, sorry. OK, what about Gnome or KDE on Linux and/or Sun Solaris? Windows is not the only OS these days anymore. So here how the whole thing looks like in Mac:


Notice ugly corners and quite crappy close button, not mention that a close button does not fits into a balloon tip paradigm. Well, my double-advice to all Java developers who sticks on Windows platform (there are two messages in one):

People, PLEASE install Linux and/or Solaris to make sure you are NOT providing funny things!..


*sigh*

So and now this is how it should look like (took for me less than two hours to rework entire source code, throwing lots of things):


Now I am happy. :-)

P.S. And yes, it does not need a close button — just click on it...

Wednesday, July 23, 2008

Crippled Apple LaF for Java Swing

Recently I found very-very unpleasant thing with Apple Look & Feel for Swing on OSX. On JDesktopPane, to get all the internal frames getAllFrames() is called. Works fine everywhere except OSX: it does not returns iconified frames. The reason, because they are not JInternalFrame.JDesktopIcon instances as normally everybody else in the World does, but are apple.laf.CUIAquaInternalFramePane.Dock instead. WTF?.. At first, I wanted to abandon OSX LaF and use something else instead. But "Substance" release that works on Java 5 is hell buggy and still very ugly on the same Java 5. New Nimbus LaF is really cool, look great, works and feels awesome, but... looks like an alien in OSX reminding me all this GTK things with X11. Additionally, it does not run on Java 5 at all.

Why Java 5? Yes, it is old, but thanks to (inaudible) Apple, there is no Java 6 on Tiger that the whole thing should also run. In fact, Apple LaF is the best for Java 5, allows font anti-aliasing, behaves correctly as OSX app should and overall looks great, so I do not really want to abandon entire LaF either.

Thus ss a consequence, to get code working everywhere without tweaks and if/else uglyness to detect what platform it runs on, I had to implement my own window tracker.

* * *

Works fine, but still pisses developers off, when everybody have to have dozen workarounds or class extensions to fix here/there various "broken bones".

Apple wants to go Enterprise? Steve, which object of your body you use when you are thinking about Java versions interoperability (an enterprise industry standard, no matter somebody wants to accept it or not) between OSX versions? So what should I do if I have heterogeneous environment with various Macs and PCs and want to go with less old stuff (soon we will have Java 7, while Apple is enforcing me to use Java 4 or even 4)?.. Right: throw macs away from the Enterprise, because they are not compatible between each other, install PCs and bite yourself for other things they brings to you... But to get rid of most advanced desktop OSX workstations is what I definitely do NOT want to do either.

Very stupid.