One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com
Using 89% of the same design the blog had in 2001.
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike,
always wear white.
As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green.
Google has finally figured out how to leverage their search dominance into a more successful social media ecosystem: Give Google+ Profile holders an unfair advantage with Google search results by putting images next to their hits!
How do you set things up? Start here. Enjoy. There's some fiddling with your Google Profile and the text of your blog page, but it's pretty easy. If you'll add G+ icons to your posts, you can do it on a by-post basis as well.
With Gravitar and Google+, etc, it appears to be the Age of the Self-branding Headshot.
I was recently at a blog I wanted to add to the the RSS roll, but I couldn't find an RSS or XML link, nor could I immediately figure out what brand o' blog it was, as a number have standard ways of accessing feeds if you massage the URL a bit.
So I figured, what the heck, let's paste the home URL into Google Reader and see what happens.
POOF. Took a while, but it's in the roll. That's how an RSS reader should work.
I've been a little neglectful keeping on top of Java 6, but my recent trip to the Java Tutorial, which has in my experience been one of the best "how to" programming sites on the net, shows me that the marketing guys have infiltrated this once idealistically perfect site.
The TextAreaDemo example introduces an editable text area with a special feature โ a word completion function. As the user types in words, the program suggests hints to complete the word whenever the program's vocabulary contains a word that starts with what has been typed.
That's exactly what I needed. I'd been looking at some solutions with more functionality, where you start typing a word and a number of possibilities appears in some sort of select-list below, including the Netbeans editor and a few examples from weblogs. Each was more overhead than I wanted, and just short of writing some simplistic autocomplete code, I stumbled over this.
So where's the marketing? How about the stuff that's Java 6 only, like the incredible overkill of the Java 6 only GroupLayout? Sure, you can add GroupLayout to your 1.5 and possibly 1.4 application, but why do I need this for a form with a single label and single text area?
Let's look at the code. Here's the layout jive necessary with GroupLayout.
GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout);
//Create a parallel group for the horizontal axis ParallelGroup hGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); //Create a sequential and a parallel groups SequentialGroup h1 = layout.createSequentialGroup(); ParallelGroup h2 = layout.createParallelGroup(GroupLayout.Alignment.TRAILING); //Add a scroll panel and a label to the parallel group h2 h2.addComponent(jScrollPane1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE); h2.addComponent(jLabel1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE);
//Add a container gap to the sequential group h1 h1.addContainerGap(); // Add the group h2 to the group h1 h1.addGroup(h2); h1.addContainerGap(); //Add the group h1 to hGroup hGroup.addGroup(Alignment.TRAILING,h1); //Create the horizontal group layout.setHorizontalGroup(hGroup);
//Create a parallel group for the vertical axis ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); //Create a sequential group SequentialGroup v1 = layout.createSequentialGroup(); //Add a container gap to the sequential group v1 v1.addContainerGap(); //Add a label to the sequential group v1 v1.addComponent(jLabel1); v1.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); //Add scroll panel to the sequential group v1 v1.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE); v1.addContainerGap(); //Add the group v1 to vGroup vGroup.addGroup(v1); //Create the vertical group layout.setVerticalGroup(vGroup); pack();
Now here's what I need to get the same form, give or take, with layout code that'll work with every version of Java since Swing was released as an add-on jar. (Why bother? Mac OS X 10.4 has Java 1.5, not 6, and no GroupLayout by default. Sounds like a decent reason to me.)
BorderLayout layout = new BorderLayout(); getContentPane().setLayout(layout);
That's right, the code becomes more readable and compatible. Mr Pibb + Red Vines = Crazy Delicious!
Maybe I'm an old-school idealist, but I don't believe in including a single extra line of code, much less a major code concept, in a tutorial than is absolutely necessary. Tutorial code should be designed to be written by hand, and should encourage its users to make small changes to see how those changes influence what happens. With GroupLayout, it's very difficult to add another few GUI widgets, difficult enough that the Tutorial itself tells us so on its page regarding how to use GroupLayout. Don't miss the Netbeans pimp in the following quote.
Note: This lesson covers writing layout code by hand, which can be challenging. If you are not interested in learning all the details of layout management, you might prefer to use the GroupLayout layout manager combined with a builder tool to lay out your GUI. One such builder tool is the NetBeans IDE. Otherwise, if you want to code by hand and do not want to use GroupLayout, then GridBagLayout is recommended as the next most flexible and powerful layout manager.
That last sentence is particularly bad marketing speak. See how they ignore the fact that saying "if you want to code by hand" is a superset of "do not want to use GroupLayout," the latter left in solely to deaden the [admittedly small] shock of what they just told you -- GroupLayout is for IDEs, not text editors. And the pseudo-objective tone of "One such builder tool is the NetBeans IDE," is borderline obnoxious.
For older school programmers, that paragraph would read, "GroupLayout was created to help support GUI RAD in Netbeans, and works best in concert with that IDE. GridBagLayout is the most flexible and powerful layout manager created with hand-coding GUIs in mind." Alternately, for even older school folk, the text would be, "GroupLayout is not for hand-coded GUIs. Use GridBagLayout or BorderLayout instead." And a comment in the TextAreaDemo example saying, "This code intended for use in Netbeans," or something similar explaining why the horribly unwieldy layout manager was used, if it has to be there, would have been nice.
Tutorials should present simplest case information that allow an informed programmer to learn a new trick in a simplest case, clean room environment, and then have the tools to figure out how to best integrate that into his or her work flow and environment. Pimping a specific Java IDE has absolutely nothing -- no, I hear your argument, and trust me. They have nothing to do with one another -- to do with learning to use JTextArea. Learning how to introduce JTextAreas using Netbeans is Netbeans' business. Doing it in Eclipse is Eclipse's business, etc.
I don't care to see the IDE wars inserted into my tutorials. It's painful to see that Sun now prefers the opposite.
Okay folks, it's going to remain pretty quiet on my blogging front, enough so that I'm not even shelling out for "fast access" of any sort, but I should, in fairness, pimp VTISP.com as a great dialup provider for $3.95 a freakin month. Kinda puts PeoplePC and NetZero to shame, eh? Granted, you "only" get 150 hours a month, but at worst you just shell out another $4 for 150 more. I haven't run over yet.
Most importantly, the customer service has been incredible. Though they only offer help via email (kinda a catch-22 there, admittedly, but hopefully you can scare up some WiFi), the replies I've gotten are in-depth, well-written, and quite helpful. At $4 a month, I'm not sure how they do it.
Very impressive. If you use dialup or would like it while you're traveling, I hightly recommend that you make this your ISP.
The postings on this site are [usually] my own and do not necessarily reflect the views of any employer, past or present, or other entity. About Our Author