Atom Atom feed

My 5 Favorite IDEA Shortcut Key Combinations

Brian was showing David some neat shortcut key combinations in IntelliJ IDEA a moment ago.  I jumped into the conversation and asked Brian: "Close your eyes.  And name five of your most often used IntelliJ IDEA shortcut key combinations."  I didn't write down his answer, but here is my five favorite (not in the sense that I like them the most, but in the sense that when I close my eyes, these are the five that comes to my mind first because I use them regularly:

  • Control-n: find class
  • Control-q: quick Javadoc
  • Control-Alt-v: introduce variable
  • Shift-F6: rename
  • Control-Shift-Space: smart completion
Now that I think about it, I also use Alt-Enter a lot for intentional programming.

What are your favorite IDEA shortcuts?
Tags :

Upgraded To Pebble 2.0.1

I have upgraded the software that drives this blog to Pebble 2.0.1.  This version contains many improvements over the previous version.  The most notable is the new theme, and the WYSIWYG editor for creating blog entries and adding comments.  Many thanks to Simon Brown for his continued effort on improving the usability and core functionality of the product.

For those of you reading this from an aggregator, take a look at the new look here.

Please let me know if you encounter any difficulties.
Tags :

XQuery, XSLT 2 and XPath 2 Are W3C Recommendations

The World Wide Web Consortium: http://www.w3.org/—23 January 2007—Based on widespread implementation experience and extensive feedback from users and vendors, W3C has published eight new standards in the XML Family to support the ability to query, transform, and access XML data and documents. The primary specifications are XQuery 1.0: An XML Query Language, XSL Transformations (XSLT) 2.0, and XML Path Language (XPath) 2.0; see the full list below.

When I wrote my JNB article on XQuery 1118 days ago, the specs were in final call status. I didn't realize then that it would take another three years for them to become W3C Recommendations.

(: Well, better late than never. :)
Tags :

Kawa 1.9.0 Released

Per Bothner on the Kawa mailing list: I've released Kawa 1.9.0, and updated the web pages. Please try the .tar.gz and/or .jar and let me know of any problems. Here is the list of recent (and not-so-recent) changes. http://www.gnu.org/software/kawa/news.html

For people who are not familiar with it, Kawa is language development framework for the JVM together with an implementation of the Scheme programming language and an implementation of the XQuery language. It compiles these languages into Java bytecodes.

It is in Kawa that I first saw the technique of compiling scripts from the interactive shell into Java bytecode and then load and execute them.

Java Generics: Let The Other Shoe Drop

(Via the original GJ: Generic Java page)

Guy Steele on GJ: GJ is an excellent design and implementation for adding generic types to the Java programming language. It provides a workable and practical facility for the immediate future that can solve many of today's problems in programming and debugging. In the long term, I would hope to see it compatibly extended to carry run-time type parameter information in the manner that Robert Cartwright and I have proposed; but even if that does not occur, GJ as it is currently designed is a useful and workable tool that deserves widespread study and use.

Guy Steele (quoted from e-mail, with permission)

My recent reading of the O'Reilly book Java Generics and Collections convinced me that Java generics is too much trouble for too little gain for the average Java developer like me.

Eric commented "This is too hard. Sigh." And I agree. And in my frustration I posted a comment to the Java.net poll on What one feature would you most like to see in JDK 7?:

Me: My biggest wish for a future version of Java, not necessarily Java 7, is to have the other half of Java generics (runtime support for generic types) implemented, thus removing the need for erasure.

I believe I'm not alone in this desire.

Thinking that what I hoped might be just a common Java language user's fantasy that is not doable in reality, I did some search on The Google on the topic. And what did I find?:

  • That it's not a mere fantasy of a mere language user
  • That a run-time type parameter information proposal has been on the table since 1998
  • That one of its authors is none other than Guy L Steele, Jr.

I couldn't read the proposal but I did find the quote at the beginning of this post.

So I believe I'm standing on very firm ground when I yell:

ERASE ERASURE!!!

Tags :

Thursday Java Generics Quiz

I'm going through O'Reilly's Java Generics and Collections by Maurice Naftalin and Philip Wadler to gain the necessary understanding of Java generics to effectively use it. I mentioned this book 53 days ago.

Here's something that surprised me. Can you guess if the following two classes will compile? And why?

import java.util.*;
class Foo {
  public Integer foo(List list) {
   return null;
  }
  public String foo(List list) {
    return null;
  }
}
import java.util.*;
class Bar {
  public Integer bar(List<Integer> integers) {
    return null;
  }
  public String bar(List<String> strings) {
    return null;
  }
}
Tags :

Innovation Through Polls Considered Meaningless

John O'Conner: I have nothing technical to add to the debate. However, I have been monitoring the recent java.net poll that asks "How important is it to you that JDK 7 offers a new property syntax?" The results so far seem to indicate that almost two-thirds of the voters just don't need a new syntax. A minority, just 15%, think it's "very important" to the Java platform. They're a small but vocal group.

The poll may have flaws. It may not be scientifically valid or useful. However, it does provide some anecdotal evidence, and I'll take any evidence I can get. A new syntax for properties? I don't particularly need it, and so far the poll results suggest that most of you don't need it either.

The problem about polls such as this one is that it is almost always innertia driven. If Java.net did a poll in 1994 on whether a new object-oriented language such as Java is needed, I bet a majority of OO programmers then will say no.

First class properties and events go hand-in-hand in providing an important abstraction for component based programming, something that we can do in the current version of Java through conventions, Just like C++ supported the definition of interfaces as classes with nothing but pure virtual functions.

By elevating the property and event constructs onto the language level, we are promoting a different style of design and programming. Not everyone is using this style of design. But for the people who are using it, the addition will make their design more clear. Think how Java's elevation of the C++ interface convention into a language construct promoted interface based design to a whole new level.

Tags :

Tomcat 5 on Fedora Core 6: In Five Easy Steps

Have you noticed anything different about this blog in the past 24 hours?

I moved it to my newly upgraded Fedora Core 6 workstation yesterday. And I'm happy to report that setting Tomcat up on a Fedora Core 6 is extremely easy. I'll outline the steps I took to set up a functional Tomcat 5 server:

Install FC6 and Apache Web Server

Stick the Fedora Core 6 DVD in and reboot. Then follow the instructions. I took all defaults where I can, including letting it "delete all Linux partitions" and automatically partition the disk. I choose to install "Web Server" and "Development Tools" when offered the chance. This installs the Apache Web Server 2.2.3 on the box.

Install Tomcat

Tomcat 5 is included in Fedora Core 6, but not installed by default. So I have to bring it in from the repository:

[root@gao]# yum install tomcat5 tomcat5-webapps tomcat5-admin-webapps

This installs Tomcat 5.5.17 and a lot of their dependencies onto the system.

Hook up Tomcat 5 with Apache Web Server

Since I don't want my users to have to type ":8080" all the time, I went ahead and hooked up Tomcat 5 to httpd. In the past, this step had been the most confusing. I remember spending days browsing through Tomcat's website trying to figure out which one of the three alternatives offered there is the one that worked. I still have the mod_jk.so that I compiled from CVS source somewhere on by backup CD-ROMS.

In Fedora Core 6, things are quite straightforward because the version of httpd included contains mod_proxy_ajp which allows httpd to talk to Tomcat 5 through the AJP protocol, which Tomcat 5 listens to on port 8009. To make the connection, I edited /etc/httpd/conf.d/proxy_ajp.conf so that it reads (excluding comments):

[root@gao]# cat /etc/httpd/conf.d/proxy_ajp.conf
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
ProxyPass /blog ajp://localhost:8009/blog

Turn on the services

To have httpd and Tomcat 5 start automatically upon reboot, I went to the System->Administration->Services menuitem and enabled both the httpd and tomcat5 services.

Now I have a working Tomcat 5 server. It's webapps directory is at /usr/share/tomcat5/webapps.

Install Sun JDK

So far we have been using the default Java package that came with Fedora Core 6, which is a Free Software implementation of Java based on GNU Gcj, GNU Classpath, and the Eclipse compiler. To run the widest set of Java applications and servlets, I need to install the Sun JDK.

The best way of installing Sun JDK on Fedora Core 6 is to follow the JPackage.org method. I wrote an Introduction to JPackage.org 782 days ago. Things haven't changed much since then (except that now Fedora Core includes a bunch of Java packages, which makes my life easier).

To follow the JPackage.org method, I need to make sure that the following packages are installed:

[root@gao]# yum install jpackage-utils rpm-build libXp unixODBC unixODBC-devel

The first two were already installed when I checked. The others are needed by the JDK.

Then I need to download the JDK (Linux self-extracting file) from Sun's website.

Now we are five command lines away from success:

[root@gao]# rpm -ihv http://mirrors.dotsrc.org/jpackage/5.0/generic/\
non-free/SRPMS/java-1.5.0-sun-1.5.0.10-2jpp.nosrc.rpm
[root@gao]# cp jdk-1_5_0_10-linux-i586.bin /usr/src/redhat/SOURCES
[root@gao]# rpmbuild -ba /usr/src/redhat/SPECS/java-1.5.0-sun.spec
[root@gao]# cd /usr/src/redhat/RPMS/i586
[root@gao]# for x in java-1.5.0-sun-*.rpm; do rpm -ihv $x; done

[Update (Thu Apr 26 06:10:52 CDT 2007)] As Sun makes update releases of the JDK, JPackage.org updates their nosrc.rpm version number that is available from their archive. Since Sun does not cordinate its JDK release with JPackage.org, their will be some lag time before a new nosrc.rpm appears in the JPackage.org archive after each Sun release. As of yesterday, the first two of the above five commands should be updated to

[root@gao]# rpm -ihv http://mirrors.dotsrc.org/jpackage/5.0/generic/\
non-free/SRPMS/java-1.5.0-sun-1.5.0.11-1jpp.nosrc.rpm
[root@gao]# cp jdk-1_5_0_11-linux-i586.bin /usr/src/redhat/SOURCES
Tags :

This One Is For Brian, Brian, Brad and David And Anyone Who Bought AppleTV Last Week

Jim Allchin (Co-President, Platforms & Services Division, Microsoft): I would buy a Mac today if I was not working at Microsoft.

Scott Davis: Real World Web Services

It was St. Louis JUG night last night. The new year brought us Scott Davis from the No Fluff Just Stuff symposium tour. And the bigger than usual audience (about 45) were treated to an hour and a half presentation on Real World Web Services.

Our sincere thanks to Jay Zimmerman and the NFJS tour. The NFJS 2007 tour will start up again in March, and St. Louis will play host to this excellent tour on the third weekend in March (March 16–18). A free pass to the symposium as well as a copy of the NFJS book were raffled off yesterday.

After discussing the meaning of various TLAs such as SOA using Wikipedia as a guide, Scott presented the fundamentals of several popular ways of making and using web services.

Scott emphasized the importance of the language/vendor/platform neutrality as the most important characteristics of web services. He defined web services as "Make a request on port 80, get XML back. Oh, wait, ... but you get the idea." He also described the current popularity of web services as a "perfect storm" of ideas.

He then went on to explain in detail some of the specific technologies:

  • SOAP
  • REST
  • JSON

JSON? JSON is the JavaScript Object Notation. It started out as an alternative of XML as a data interchange format when the destination of the data is a browser. However JSON parsers are available in many languages now.

Scott mentioned that Yahoo! is JSON enabling most of their web services.

In a talk like this where I've heard some of the things before while other things are new to me, I tend to focus my attention to the new things. Here's some of the things that got my attention:

  • I need to get and read Small Pieces, Loosely Joined by David Weinberger
  • I need to get and read Loosely Coupled: The Missing Pieces of Web Services by Doug Kaye
  • I need to get on top of this Atom and Atom Publishing Protocol thing. GData is based on it and it's more than RSS.
  • ROME works with RSS and Atom.
  • SOAP is on the decline. Google deprecated theirs.
  • UDDI is all but dead.
  • There are popular REST. And there are pure REST. The Servlet API gives you REST.
  • Apache HttpClient is all you need to access REST web services.
  • Use a proxy on the server side to access web services on other servers. It can be done in five lines of JSP.

The audience members were pretty engaged last night. And there were some sharp questions, such as "All this Web 2.0 stuff is nicer than the Web 1.0 pages. But we can already do this stuff in Swing. Why deal with a horrible language like JavaScript?"

To which the answer is GWT—The Google Web Toolkit. (Scott had to miss a GWT talk by David Geary at the Boulder JUG to fly to St. Louis.) Other higher level JavaScript tool kits as well as DWR were mentioned. Someone also mentioned that Adobe is developing a technology that will let you create first-class Flex (or was it Flash, I don't remember) applications independent of the browser.

The slides of Scott's talk is available here.


Another theme that crawled into the talk is Groovy. Maybe it's because we just had a Grails talk by Jeff Brown last month. Maybe it's because Scott is the force behind aboutGroovy.org. Maybe it's because Groovy just had a 1.0 release and the NFJS (and its parent organization) sponsored the final push. Somehow the "2007 is going to be a break out year for Groovy" idea took root in my brain.

We'll see.


Off the talk, here's some of the things we chatted about:

  • Scott worked on a product that had 100,000 lines of Groovy code, and they are very happy with the language.
  • Many people are taking notes of JSON at this moment. I joked that JSON is going to gain a set of WS-JSON-* specifications.

I got to meet Scott Delap, currently the Java editor for InfoQ and also a fellow St. Louisian. And I didn't get a chance to say "InfoQ rocks" to him. Well, there is always next time.

GMail Fun

Those GMail people. They are very considerate. I've always liked their gentle subliminal suggestions.

But this one I'm not so sure.

Tags :

Sun Java Designers Distancing From Property Syntax

It took 34 days since the initial posting (and my reporting), but it seems that some of the Java language designers and other Sun folks (Ahé, Buckley, Muller) are moving away from the syntax for properties.

I believe Hans Muller's post asked the most fundamental question: What are properties for?

And if I remember correctly, the properties concept came into Java through the JavaBeans specification in JDK 1.1. It was supposed to be an abstraction layer of the underlying mechanisms for GUI builders, like Microsoft's COM. Properties, together with the concept of methods and events form the foundation of a GUI component system. And of particular utility are a couple of combinations of properties and events: the bound properties and constrained properties.

So properties, in that context, does something useful. For example, when you set the text property on a Label, it will have go find the appropriate glyphs from its font and erase the old text and paint the new text.

Somewhere along the line, the concept of properties were subverted. It became a mindless chant:

// Exhibit A
public int foo;
is not OO! Change it to
// Exhibit B
private int foo;
public void setFoo(int value) {
  this.foo = foo;
}
public int getFoo() {
  return foo;
}
to make it OO. And along the way, we, with our favorite IDEs as accomplices, managed to bloat the world total Java code base by about 10% (maybe more).

It is these IDE-generated, boilerplate, pointless bloat that most people hate. And we wish we can do

a.foo = b.foo;
instead of
a.setFoo(b.getFoo());

Well, there is an obvious solution to this (minor) gripe. Can you guess what it is? You're right. You can accomplish this goal without addition to the Java programming language. You can simply turn all instances of Exhibit B into Exhibit A. There should be a refactoring called "Remove frivolous getters and setters" that does it automatically.

Go ahead and do it. Should take about ten minutes.

You done? Did it break your app? Probably not.

Do you have any getters and setters left? If not, you're done. And you can go home now.

The remaining getters and setters are the true properties. Now stare at them for a minute. (Here's an example from the JDK:

public void setNextFocusableComponent(Component aComponent) {
  boolean displayable = isDisplayable();
  if (displayable) {
    deregisterNextFocusableComponent();
  }
  putClientProperty(NEXT_FOCUS, aComponent);
  if (displayable) {
    registerNextFocusableComponent(aComponent);
  }
}
from javax.swing.JComponent.)

Still feel like some syntactic sugar for properties? Go ahead and add some. (Here's a tip: the Microsoft folks have property support in C# for six years. I wouldn't mind that syntax!)

Tags :

Finally Upgraded To Fedora Core 6

It has been 79 days since Fedora Core 6 was released. I finally got a chance to upgrade my work station from FC5 to FC6.

As in the past, I downloaded the FC6 x86_64 DVD using Bittorrent, and started my "try upgrade first, if that doesn't work, do a fresh install."

The upgrade worked. It took about 2 hours for all the new packages to be installed from the DVD to the hard drive. And then it took a full day to pull down all the accumulated updates using "yum update" from the Fedora mirrors. As in the past, I relied upon the Fedora Core 6 Tips & Tricks website to get the multimedia stuff installed.

Improvements that I've noticed include:

  • The Istanbul Desktop Session Recorder is improved tremendously. Last time I tried it, it was very primitie. The version in FC6 feels a lot smoother, and did not use a huge amount of memory or CPU as the FC5 version did.
  • I just noticed the Cups-PDF printer driver that allows one to print anything to a PDF file. (This might be already present in FC5.)
  • The GL-accelerated desktop effects are cool. My windows wobble when moved, and my workspaces are on a cube (that rotate in 3D) now. It also has something similar to the Mac OS X Expose.
  • The Gobby collaboration editor looks like it should be useful. It supports distributed file editing with chat.
  • I switched to 32-bit Firefox just to get Flash working. I can watch videos on YouTube now.
  • And as you can see in the screenshot below, Qemu still works.
Tags :

Beatles Songs Come To iTunes Music Store

Eliot Van Buskirk and Sean Michaels: [...] Almost lost in the shuffle, though, is another piece of huge news—the fact that the Beatles catalog is now (or soon will be) available the iTunes store. Congratulations, Steve, I know you've wanted this for a long, long... long time.

Tags :

AJaX Ruined My User Experience...

...on Bloglines.

Something bothersome has been happening to Bloglines—the on-line Blog aggregator I have been using for more than three years.

It has to do with the left-nav pane, where my subscriptions are listed and ones with new posts are shown in boldface with the number of new posts displayed in parentheses, much like in any standard email client. As I work through the blogs by clicking on each subscription, the posts would show up on the right pane, and the boldness would go away. Again, like in typical email clients.

In the old days. The left-nav pane would refresh itself every so often, with updated information reflecting any new posts made since the last refresh or my last interaction, whichever is more recent. During the, maybe, 200 microseconds of the refreshing, I simply can't click on the left-nav pane.

Some time during 2006, Blogline introduced AJaX to the left-nav pane. Instead of refreshing itself, the left-nav pane automatically updates itself with information that it apparently has gotten from the Blogline home asynchronously.

This, by itself, is a good thing. It reduces the server load on Bloglines. And it also reduces the overall internet bandwidth usage.

Except when it clashes with me, the user, clicking on a subscription, which is a daily occurrence. And it goes like this:

I saw a subscription with new posts:

Weiqi Gao's Observations (3)

I click on it. The new posts show up on the right pane. But, instead of seeing the subscription turn to:

Weiqi Gao's Observations

The line flickers a bit and returns to the pre-click state of:

Weiqi Gao's Observations (3)

Apparently an AJaX packet arrived right after I clicked on the subscription. And it tells the left-nav pane that there are 3 new posts in the subscription.

Now the left-nav pane, contains wrong information. If I was in one of my rapid scan mode, the wrong false positive new post information could occur for a dozen subscriptions.

I'd rather not have wrong information displayed.

This is not something that would drive me to another service provider. And I know it is not good form to gripe about a fantastic free service. But I simply cannot hold it in me any longer.

The problem should not be hard to fix: simply discard any asynchronous updates if I have interacted with the left-nav pane within the last two (or one or three) seconds. I hope someone at Bloglines is listening.

Tags :

I Bet You Haven't Seen Java.com For A While, ...

... and now there is a button that'll take you there:

Java Get Powered

Don't those games look wonderful?

Tags :

Thursday Java 6 Quiz

Fill in the blanks:

As of Java SE 6.0, the deprecated ____________________ have been removed, instead ____________________ are to be used.

Tags :

Happy New Year

Happy New Year 2007!