Wednesday, November 26, 2008

Windows 3.1 Lives On Through Vista

If you're anything at all like me, then you were deeply saddened to learn that Microsoft has recently discontinued the licensing of Windows 3.1.

Hey now, cheer up! A little part of Windows 3.1 is still with us. You could even say that it will always be a part of us -- living on in our hearts and nostalgic memories of simpler times. You could also say that it lives in in the form of this dialog box that I found in Vista when trying to install a new font:

Friday, November 14, 2008

JAX-RPC Client in Netbeans 6.5RC2 vs Eclipse Ganymede

I'm not certain, but I think there's something goofy with the JAX-RPC client support in Netbeans 6.5 RC2 using the JAX-RPC Web Services plugin version 0.2.

I'm attempting to interface with a Liferay 5.1.2 instance so that I can add and modify users from an external application. Nothing too difficult. After installing the JAX-RPC plugin in Netbeans, I chose New->Web Service Client and pointed the dialog to the WSDL URL that Liferay provides. For example: http://10129:password@liferayserver:8080/tunnel-web/secure/axis/Portal_UserService?wsdl . Note that I'm passing a Liferay user-id and password and specifying /secure/ in the URI. This Liferay user-id happens to correspond to an administrator in my portal instance. While it is possible to get the WSDL without going through authentication (just omit /secure/ and don't pass credentials), I wanted to give Netbeans all the hints I could to make this easy on myself.

At this point Netbeans went about creating a massive number of files to consume the service. Seriously, a boatload. Once the client was created I tried testing the service using the functionality in Web Service References, but kept getting deserialization errors about an "invalid boolean value". No matter which function I tried to call I got the same error. Interestingly enough, by making a few intentional mistakes and watching the Liferay logs I could see the actual calls were making it to the server just fine, and I guess that makes sense since the errors are during deserialization of the returned data.

I tried sticking a client invokation on a JSP in my project by right-clicking in the open JSP file and choosing Web Service Client Resources->Call Web Service Operation. Specifically, I'm trying for getUserById(LiferayID) from which I should receive a Liferay User object, and from that I'm going to display the user's email address on my page.

No luck. Same damn deserialization error, this time reported in the Glassfish V2 output. It looks something like this:

java.rmi.RemoteException: Runtime exception; nested exception is:
deserialization error: invalid boolean value:
at com.sun.xml.rpc.client.StreamingSender._handleRuntimeExceptionInSend(StreamingSender.java:348)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:330)
at com.sgmbiotech.liferay.client.UserServiceSoap_Stub.getUserById(UserServiceSoap_Stub.java:1432)
...
Caused by: deserialization error: invalid boolean value:
at com.sun.xml.rpc.encoding.SOAPDeserializationContext.deserializeMultiRefObjects(SOAPDeserializationContext.java:107)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:256)
... 35 more

Awesome. I stepped through the code with the debugger and while I can see the exception occuring, I don't really understand why it's occuring. I did some searching online and couldn't find much except some complaining about Netbeans JAX-RPC support in general.

On a hunch that the problem was with Netbeans' code generation, I decided to fire up Eclipse (Ganymede, full EE install) and use it to generate the appropriate classes. I created a new web project and then did a New->Other->Web Services->Web Service Client, turned the slider down to "assemble client", and pointed the service definition at the Liferay WSDL file. Note: I recommend copy / pasting the URL to the WSDL file into the service definition field in this dialog, because using Browse and typing it in is an experience much like falling off a moving truck into a giant pile of cheese graters. I won't go into it.

Eclipse generated the client for me which consisted of only six class files, unlike the 312 that Netbeans produced. It even used good package names. I believe it Eclipse in this case is just calling out to WSDL2Java from the Axis project, because I've done it by hand once or twice and got very similar results if memory serves me.

I manually imported the Eclipse-generated client into my Netbeans project, added some necessary jar files, hand-wrote the call in my jsp file and voila - IT WORKED.

The invocation code in the JSP file looked like this:

com.liferay.portal.service.http.UserServiceSoapProxy proxy = new com.liferay.portal.service.http.UserServiceSoapProxy();
((javax.xml.rpc.Stub)proxy.getUserServiceSoap())._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, "10129");
((javax.xml.rpc.Stub)proxy.getUserServiceSoap())._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, "test");
((javax.xml.rpc.Stub)proxy.getUserServiceSoap())._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, "http://liferayserver:8080/tunnel-web/secure/axis/Portal_UserService");
com.liferay.portal.model.UserSoap user = proxy.getUserById(10129);

response.getWriter().write(user.getEmailAddress());


Note that setting username, password, and the endpoint is required.

The Netbeans code that didn't work looked like this:

try {
client.UserServiceSoapService userServiceSoapService = new client.UserServiceSoapService_Impl();
client.UserServiceSoap portal_UserService = userServiceSoapService.getPortal_UserService();
((javax.xml.rpc.Stub)portal_UserService)._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, "10129");
((javax.xml.rpc.Stub)portal_UserService)._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, "test");
((javax.xml.rpc.Stub)portal_UserService)._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, "http://liferayserver:8080/tunnel-web/secure/axis/Portal_UserService");
response.getWriter().write(user.getEmailAddress());
} catch(javax.xml.rpc.ServiceException ex) {
java.util.logging.Logger.getLogger(client.UserServiceSoapService.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch(java.rmi.RemoteException ex) {
java.util.logging.Logger.getLogger(client.UserServiceSoapService.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch(Exception ex) {
java.util.logging.Logger.getLogger(client.UserServiceSoapService.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}

Note that the calls look almost identical here, it's just that the client generated by Netbeans has deserialization issues for whatever reason.

Sorry about the bad code formatting, I don't know how to fix it with this crappy blogger editor.

Sunday, October 26, 2008

Eclipse Ganymede WTP Can Bite Me

****
I am an idiot.

The J2EE module dependencies of my project were reset when I did the renaming business. It took me an embarrassingly long time to figure this out, but I wasn't exactly helped much by Eclipse's awesome "Preferences" pages.
****

Approximately seven hours down the tubes tonight fighting with Eclipse WTP (Web Tools Platform). Everything was working fine earlier, but then I used Eclipse's own refactoring tools to rename a few projects and the whole thing went belly up. For some reason it's no longer publishing my projects properly to tomcat and I'm getting persistent ClassNotFound exceptions for classes that are not in the project that I'm actually publishing.

Build environment seems ok, all of my unit tests run fine, including tests of the Dynamic Web Project in question which references classes another Utility project, which are ultimately not found... everything works except for the publishing & running part. I can successfully create a new test client via Web Services and the client JSP pages load and fire, but when I hit the Invoke button: blammo, ClassNotFoundException: com.you.are.an.idiot.Haha not found.

I went so far as to completely wipe Eclipse and reinstall. I then re-created my workspace and projects and imported the source. I even ditched Tomcat and let Eclipse install a new one for me. Nothing. It's all hosed and I'm mad as hell.

Welp, I get to look like an ass in the morning because my working code isn't demonstratable. Sure wish I knew what happened, but don't really care. I'm giving JDeveloper a download. Sorry Eclipse, I appreciate the vision and hard work, but most of the stuff I've tried outside of the core featureset has been way too fragile.

Eclipse... *snif* ... what really chaps my ass is that this crap was working this afternoon and I was just starting to dig in and refine the interface for this project. If only I hadn't decided to friggin RENAME some projects... By now I would likely be finished.... but here I am, without a clue how to proceed without launching in to a completely different environment.

If anybody knows of a secret "clean up everything related to Eclipse and every damn piece of configuration it's ever puked up and start over from scratch" button, I'm all ears. I'm pretty sure I covered everything when I started over, but I must've missed something.

Monday, October 20, 2008

Dear AJAX, Stop That

I want my browser's STOP button back!

Or maybe I should be directing this complaint at my browser? Hey Firefox, why can't the STOP button stop AJAX requests?

Or maybe I should just stop using Google Reader for my homepage. Hey Google, enough already with the "our web page is really a web application" business. I'm damn sick of having to make sure that the Google Reader page loads up before trying a search in Firefox. If I don't wait then Reader hijacks the browser when it finally gets its results back from AJAXville, which can take up to half a minute at times.

Tuesday, September 30, 2008

Is Auto-Hiding THAT Hard?

For Blod's sake, why can't anyone make "auto-hide" work on task bars. It hasn't worked well on any version of Windows from '95 through Vista. The Downloads window in Firefox or IM notifications in MSN Messenger, as for-instances, will not allow the task bar to auto-hide properly - it'll just sit there, unhidden, waiting for you to figure out which window is trying to notify you of something or other that you don't care about.

I happen to like the task bar to be on the top of the screen, so when it doesn't auto-hide, I lose the tops of any windows up there which usually means I lose the ability to easily move them around and such. This happens to me every single day in Vista. Right now it's up there not auto-hiding and I have no idea which window is causing the problem, and whether it's just a matter of giving the offending window focus, or completely closing it to regain auto-hide functionality. I've got 3 SSH sessions via Putty, one instance of Word, three file explorer windows, one remote terminal, two Windows shells, one instance of FreeCommander, one instance of Notepad, one instance of Eclipse, an instance of Sage MAS90, 14 Firefox windows, and Outlook all running and I'll be damned if I'm going to start closing them all until the stupid Task Bar starts working right again.

This happens to me with Gnome panels also, but thankfully they do such a terrible job of "hiding" that I rarely use that feature when I'm running a Gnome desktop.

Friday, September 26, 2008

Top 10 Linux FOSS Keys

Linux and FOSS "top whatever" lists are all the rage these days on the blogoweb, so I figured I might as well cash in.

I've been using Linux and Free Open Source Software for many years now, and have developed my own set of preferences and tastes in this regard that work well for me. I thought I'd share some of them in hopes of helping out newbies or perhaps even inspiring some of the old-timers.

Specifically, I'd like to talk about some of the keys available on Linux. I realize that many of these keys might also be available on other operating systems, and I should also note that I haven't used every single key -- so if I miss an important one, let me know.

  1. The A key.

    Not the most important key, surely, but a big dog no less. The king of the alphabet. The first letter of "Alphanumeric" and "A-Team". When used in conjunction with the CTRL key it will Select All in most of your favorite FOSS programs. Without the A key, there's no way you could view processes belonging to All users using `ps aux`, or see All sockets using `netstat -a` -- hell, you couldn't even spell netstat.

    The A key. With it we can achieve the center, the essence, the heart of `man`.

  2. The Semicolon (;) key.

    Ah the semicolon, a personal favorite of mine. With the semicolon key I can look grammatically smart to people more stupider than I; of whom are many. Without the semicolon key getting a C or Java program to compile would be a miserable experience, and you can forget about your cute little PHP app with the Javascript front-end.

    The semicolon key -- keeping FOSS lovers' right pinkies in shape for over 30 years. Or more, or less. I dunno, how old are keys?

  3. The Backtick key.

    Oh! the anguished, misunderstood, misrepresented backtick key. Ask a typical Windows user to press the backtick key and you'll have a good reason to chuckle arrogantly to yourself, just loudly enough so that they'll see it. "Why would I ever use that", they'll ask, full of stupid.

    Often overshadowed by the tilde who found fame in mathematics, the backtick waits patiently on your FOSS keyboard, just above the Tab and just to the left of 1 -- waiting for you to need to exec something in your scripting language. Or waiting, perhaps, to be used covertly in a parameter sent to your poorly-written PHP script... but let's not generalize, not all backticks are bad just because most of them are.

    Oh backtick, you kick so much ass!

  4. The Backspace key.

    The cleaner. The remover of bad. Where would be without the backspace key? We'd be arrowing around and using the delete key, that's where we'd be. What a nightmare! The delete key is one of the most overrated, poorly conceived keys on your FOSS keyboard, yet somehow it has historically taken precedence over backspace, who in some circumstances is reduced to coughing out a bunch of useless ^H^H^H characters.

    Without the backspace key I wouldn't be able to remove the mistake I'm about to make.

  5. The Spacebar.

    Perhaps the spacebar should have been at the #1 spot on my list. After all, it's freakin GIGANTIC! It's so god damned enormous that it's not even called a key -- it's called a BAR. And it's a bar because it's so dang useful. Here's how your code might look without the spacebar:

    intmain(){return1;}

    Compile THAT! Ha!

    And what a perfect name, rich with double meaning. When future earthly entrepreneurs start opening merry little establishments on space stations around the universe, you can bet there will be more than a small shake of cool joints called "The Space Bar."

  6. The ellameno keys.

    Reduced to a single letter in the minds of many by an unfortunate, cruel children's song, the l, m, n, and o keys deserve a mention. Thanks for the ls, the more, the nslookup, and the almost-middle letter of the acronym FOSS.

  7. The Print Screen key.

    A dumping ground for homeless functions, the Print Screen key has remained a part of FOSS-compatible keyboards since its early beginnings when it would actually "print the screen." Now nobody really knows what to make of it. It might take a screenshot, sure, that's cool. On some non-FOSS keyboards it might INSERT, causing your cursor to type over everything in front of it, and I guess that's manageable. But what if it SysRqs???? What the hell is that? What if it SysRqs whiles taking a screenshot of your cursor changing behavior!?

    Typically located near the Scroll Lock and Pause / Break keys, the Print Screen key is made even more ominous by the unsavory company it keeps. They're there, they're proud, and it's best if you just leave them the hell alone. But if you get yourself in with this selective crowd, they might just open up a whole new level of functionality that you never knew existed. But I dunno, I don't push on them.

  8. The Esc key.

    Let's face it, the escape key is losing relevance. Rarely does the esc key actually perform any useful function -- just what does it mean to "escape" in a modern operating system anyhow? Richard Stallman completely redefined the key when he wrote Emacs, turning into some kind of freakishly meta bastard, and nobody even noticed! Nobody stopped to think, "hey, if I press M-c, an awesome feature to capitalize the first letter of a word, won't it cause me to 'escape' from Emacs?" No, no it won't.

    Look, the esc key might not have any functional relevance when it comes to your FOSS software, but it does have one very important function in the physical world. It gives you something to beat on when your FOSS programs that aren't supposed to crash suddenly stop responding. As if it were the controls to a time machine, we beat the hell out of the escape key every time something goes wrong. It is the avenue through which we allow our abusive tendencies to escape.

    Escape key, I salute thee.

  9. The Arrow keys.

    "Hey, we're hear to stay, so just use us already!!"

    Poor arrow keys. Everyone always hijacking other letters or even the number pad to perform the function that the arrow keys were specifically designed for. Twenty years ago it wasn't a given that a keyboard would have arrow keys, but now-a-days I challenge you to find one without. So knock it off with this Num Lock crap and forget about your WASD and HJKL. We're never going to convince our proprietary brothers and sisters to make the switch to FOSS if we can't even reduce ourselves to using keys with arrows on them to move things in directions.

    Arrow keys. Easy is good.

  10. The Windows key SUCKS.

    In blog-style top-ten FOSS fashion, I completely bail when I run out of ideas and add something completely irrelevant. Open-Apple and Closed-Apple are stupid too.

Thursday, September 18, 2008

Viewsonic WPG-150 "Wireless Presentation Gateway"

"Hey, I thought this blog was about software, what gives?"


Well, Mr. Anonymous Strawman Setup Guy, it is.  This post is about the Viewsonic WPG-150 Wireless Presentation Gateway -- a little box that allows a person to connect wirelessly to any VGA projector.  I'm not going to focus on the WPG-15o's hardware, as it seems to work just fine;  its firmware on the other hand...

The way the WPG-150 works is this: it broadcasts its SSID over wireless which you connect to via your Windows-based PC or laptop.  Once connected, you simply open a web browser and you'll be instructed to download the software required to actually send video to the device, which it then sends out via VGA to the projector.  The client software consists of video and audio capture drivers necessary to send your display to the WPG-150, and a simple control-panel type application.

All that crap works just fine.  No issues whatsoever.  The problem is this: "what if I want to connect to the network while I'm making my presentation?  What if my presentation involves showing a live website?"  Hey, have no fear, the WPG-150 solves this problem for you as well by including a network jack allowing you to plug the device into your network.  It's then smart enough to handle your network requests while still projecting your display.

Here comes the FAIL!

The wireless adapter inside the WPG-150 is hard coded with an IP address of 10.0.0.1, and the device has a built-in DHCP server that will assign the computer that connects to it an address of 10.0.0.2.  Interesting choice of IP addresses there, since 10.0.0.0/24 is a common subnet used in private corporate networks, and 10.0.0.1 and 10.0.0.2 are very likely to be used by gateways or servers.  Can you guess my network configuration?  Yup.

The WPG-150 only allows you to change the LAN IP, so using it on a 10.0.0.x network would require the additional purchase of a router.  The website BCCHardware.com has a review of the WPG-150 in which they seem to imply that the 10.0.0.1 address can be modified via the default web page that the device serves up when you connect to the device without the client software.  I was able to locate an embedded Java control on this page, but it errored out with a class not found exception.  I even rolled back to Java 1.4 and used several different browsers.  My hunch is that this is a left-over from a previous incarnation of the device.

So I emailed Viewsonic technical support via their online support form.  No response for over a week.

So I broke down and called them up.  You can get their tech-support phone number after going through a little online support questionaire in which you click "no this did not solve my problem" about fifteen times.  Thankfully I was able to speak with a representative within a few minutes of making my call.  I made the mistake of trying to explain why the device wasn't working on my network, which just seemed to confuse the matter.  Finally I just flat out asked, "just tell me this: how do you change the 10.0.0.1 address on the wireless interface?"

"You can't.  It's hardcoded into the firmware."

"Is there an older version of the firmware I can roll back to or something?"

"No."

"Fail!"

"huh?"

"Nevermind.  Thanks."

I called up my favorite sales rep and setup a return for the device, and at the same time put in an order for the InFocus LiteShow II, another Wireless Presentation Gatway that's a few dollars more expensive.

When the LiteShow II arrived I felt a little pang of panic as the device looks almost identical to the WPG-150.  It even comes configured with the wireless interface set to 10.0.0.1!!  Clearly there is an outfit out there private labeling these things.  The firmware, to my relief, is not a copy of the WPG-150 and has several networking options available.  I was able to configure the device in Access Point+ mode (or something) which basically turns the thing into a router.  The LiteShow documentation sucks, so it took a while to figure this out, but essentially I was able to give the hard wired LAN interface an IP on my private network, and the wireless interface an address in a different range and it routes between the two successfully.  WPA (TKIP or AES) encryption and RADIUS support on the wireless interface makes it a useable access point in a corporate setting.