HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML
 

When I sat down to write this month's column I tried desperately to come up with something. I was beginning to panic, as nothing seemed to come to mind. Then I took a wee walk and munched down on some pizza. Suddenly, BANG! The whole month's activities came flooding back to me. So kick back, take some time out and lend me your eyes for, oh, I don't know, 10 minutes.

Now that I think back, it was a fun-filled month with huge amounts of goings-on. If you remember last month's column you'll know that, of late, I haven't been very impressed with what's happening at Sun. I essentially hinted at the fact that we ought to keep an eye on Scott McNealy. Ironically, this month I discovered a wee piece of information that makes my concerns even more relevant.

Will Sun Eclipse Linux?
Ask anyone which operating system is capturing the headlines. Unless they've been hidden away in the darkest corners of the Redmond campus, the answer will usually be Linux. Why? One of the main reasons is its cost - the damn thing is free. Another reason is performance - it works extremely well with very little hardware. Couple these two excellent advantages and you lock out most of the competition.

But what if the competition gave away their operating system? That would definitely weaken the justification to move to Linux. Well, guess what our friends at Sun have just gone and done? Beginning this month, Solaris 8 will be free for both Sun and Intel platforms. Quite a bold move when you think about it, and one that I believe will hit Linux very hard.

I suspect many of the large companies that are dithering over whether or not to install Linux will probably hang back and wait for Solaris 8.0. Solaris is held in high regard by many developers around the planet, and I know my company will be installing the beast and measuring it against Linux. So watch this space. One good thing: now that Solaris will be freely available, we won't have to wait for popular ports to Linux from the large vendors that have already developed Solaris ports. I'm interested in watching this one and seeing where it heads. Let me know what you think through our discussion list (details of which are given later).

StringTokenizer
This month I've been wrestling with the core class java.utils.StringTokenizer, and spent a bit of time trying to get it working the way the documentation suggests. (Anyone on our mailing list will know this story, so if that includes you, skip past and move on to the next section. I won't be offended, honest.) My problems started when I wanted to spot fields with empty tokens. Let's consider the following, for example:

StringTokenizer ST = new StringTokenizer( "this,is,a,test", "," );
int x = ST.countTokens();

A standard use of this class, and you'd be correct in assuming that x would be 4. This use of StringTokenizer has no problems. Consider the following example, however, and have a think about what the value of x would be. No cheating or reading ahead!

StringTokenizer ST = new StringTokenizer( ",is,,test", "," );

Notice the empty tokens. This scenario is not too untypical, especially if you're parsing CSV files produced from, say, Microsoft Excel or some other export routine. An empty token generally denotes an empty column, so it's a scenario we need to know about. Well, sadly, StringTokenizer returns back 2 in this instance, which poses a potential problem for any parsing algorithm.

Another problem with this class is its inability to cope with nonstandard delimiters. Try parsing a string that's delimited by, say, the ">>" sequence. It won't work. However, if you follow the documentation, the constructor for StringTokenizer accepts a String instance for the delimiter and nowhere suggests that you can't use any nonstandard delimiter. If indeed this class is meant to use standard delimiters, the constructor should only be accepting a flag or something that forces the developer to use it. For example:

StringTokenizer ST = new StringTokenizer( "this,is,a,test",
StringTokenizer.COMMA );

...which would make far more sense than what happens now. At least this takes the guesswork out of it. We discussed the problem at great length on the mailing list, and I believe it was Blair Wyman who highlighted the fact that strtok in C operates along the same lines. It could be argued that StringTokenizer merely provides an easy transition path, but I don't accept that. This is Java, not C. Java has an opportunity to get all the quirks ironed out once and for all, presenting the developer with a clear, concise library of tools.

I submitted this to the official bug report, and asked that they either change the functionality of StringTokenizer or update the documentation to warn developers that it doesn't do what you might expect it to. As part of the bug report, I sent an alternative implementation to StringTokenizer, which we use as part of our n-ary core library set. Ours works. If you want to vote for this bug, or check out its latest status, the bug ID is 4133287. The official response from Sun on a number of other StringTokenizer-related bugs is: "It's not meant to be a fully functional string scanner." What sort of answer that is, I have no idea. I'll keep you updated on this one.

Support Award of the Month: Hall of Shame
This month we recruited a couple more developers to our team here in Scotland. This meant that we had to purchase a couple more development machines for them to use. We usually purchase from either Gateway or Dell, depending on who's offering the most for the lowest price. Nine out of 10 times there's little difference between the two, and this time we plunked for Dell. What a painful choice this turned out to be!

As some of you know, I'm no fan of Microsoft's ASP technology, which I've dubbed "A Severe Pain!" - I prefer the much more portable Java Servlet solution. Anyone who actually advocates any Microsoft solution for a high-traffic Web site requires a complete brain-bios update. Dell is a great example of a site that should really rethink its back-end technology, and do it fast. To cut a long story short, I set out to order two machines - and ended up getting six!

The Web order failed right at the end where you submit your confirmation of the transaction. A wonderful "ASP scripting error" page comes up. Okay, not a problem, methinks. I'll report it to them so someone can fix it. The least I can do. I quickly locate the Customer Services section and proceed to fill out the form indicating my problems, only to have another ASP error when I hit the submit button. Argh! The whole site is based on ASP! Disaster. I spent a long time looking for a page with normal e-mail and after 20 minutes I found one. But I'm still waiting for a response. Having ventured unsuccessfully into the world of e-commerce, I reached for the tried and trusted phone and placed my order with a sales representative. You ring up Dell and a phone menu is read out to you. If you press Business Sales, you're put through to someone instantly. But, oh, boy, it's a different story when you want to speak to Customer Services!

Dell is being a little too clever with their database, and before I knew it I had ordered the machines for the company that used to be in the building, with the actual machines being shipped to our old (three years old) London address, 400 miles away. Go figure! The fax confirmation indicated that you should simply ring up your sales representative and they'll make any corrections. Oh, if only it were that simple!

We phone, and after 45 minutes we get through to someone new. They say they can take the corrections and e-mail them to our sales representative. Eh??? Oh, well, who am I to criticize Dell's well-oiled engine. Another fax confirmation comes through, but this time it's for four machines, but two of them are being delivered to our new address, so I guess it's an improvement.

We ring again. Wait for about the same amount of time - and get through to yet another lady, who takes around 25 minutes to fix our problem. Remember, it took only 10 minutes to place the order in the first place! She said she couldn't update the original order as only our sales representative had access to that. She said she'd e-mail him with the changes. Oh, here we go again.

I said, "Can you cc me into that e-mail?" The answer, I think, will go to the grave with me. She said that this wasn't possible as they worked on an internal e-mail system that wasn't available on the open Net. Dell, one of the largest companies in the world, not able to send e-mail? I think this was a wee fib to discourage customers from e-mailing their sales representatives directly.

Our sales representative eventually called back - four days after the original order was placed - and got it all fixed, but we'll never purchase from Dell again. As regular readers know, I warned last month that I'd be starting this feature, and I'm proud to nominate Dell for this month's Hall of Support Shame.

A classic case of being too quick to get the sale and not really worrying about the actual delivery. This award scheme is out to expose some of these companies and improve the overall customer service we Java people have to put up with.

Mailing List
I think most of you are now aware of the new address for the mailing list server. But I'm still getting requests for the old system, so I guess a lot of you keep your JDJ's and read them over again. Which is good. The topics of conversation are varied and entertaining. We talk about anything that comes into the mind of our developers. So stop by and join in the fun. To sign up, or even to just stop by and have a look at what's being posted, head on over to http://listserv.n-ary.com/mailman/listinfo/straight_talking.

Our radio show is gaining in popularity too ( http://radio.sys-con.com/). I, with my cohost, Keith Douglas, present a daily 15-20 minute Straight Talking show. We play music, talk Java, talk mailing list - and with the Riddler offering prizes for anyone that answers his riddles correctly, what have you got to lose?

Salute of the Month
This month I'd like to acknowledge my radio cohost, Keith Douglas. This poor man has had, I think, the most stressful month in his life and he has coped admirably. We have had to deal with a particularly awkward project manager who, to be frank, really hasn't a clue about anything technical. Which makes it even more ironic when that person has been placed in a position of responsibility for a software project. I'm sure you've had to put up with similar people. You know the sort, the ones who have no real idea what the cc field in an e-mail is all about and manage to cc everyone and their dog when something goes wrong. Just a shame. The actual fault was on their end, not ours, so lots of red faces. But Keith dealt with her very well and I thank him.

.   .   .

The time has come for me to bid you farewell. My wonderful Java-touting girlfriend expressed concern over my recent music tastes ranging from Neil Diamond right through to Dolly Parton. Well, the good news is that it's not quite as bad as it used to be. I'm now moving to more mainstream pop, with Geri Halliwell providing this month's entertainment. So with that I say, "Look at Me," and am off! [email protected]

 

All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.