A little ditty on how to find the caret position in a JTextComponent, and display a JPopupMenu near that position. This is one of those things that may not be 100% correct, but it works until someone finds a better way.
Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X
Java caret position FAQ: How do I get the Java caret position in a JTextComponent, such as a JTextArea or JEditorPane?
Wow, this was a bear to find anything about. Everyone always wants to show you how to use a JPopupMenu with a mouse click, such as a right-mouse click, but nobody ever shows you how to display a JPopupMenu when someone uses a keystroke, or keyboard accelerator.
So, using a little Java mojo, here is how I get the caret position in a JTextComponent (JTextArea, etc.) to display a JPopupMenu near the current caret position:
I'm about to take a look at a tool (an Excel spreadsheet) named "XP Tracker" that may help track progress on a current XP project. I'll try to put updates here on this tool as I work with it. At work we use the Twiki a lot and Bugzilla, so this tool may not be perfect, but I'm on a quest for something like this.
(Personal stuff) Kim is having some teeth pulled out today, Kenny has been in the hospital since last Wed or Thu and the doctors think he has pancreatitis (sp) or worse, and we had a big ice/sleet storm over the weekend. Yikes! On a bright note, I ran/walked/biked for 80:29+ last night, followed by a couple of sets of "god-dammits", my least favorite exercise.
The minority report by pkd is becoming a bit too real ... right now I'm an itchy finger away from buying a Tablet PC, which led to finding this page from IBM about "natural interaction" and "dream space". Combine that way of interacting with computers, add a touch of multiple instances of Joseph McMoneagle, and you have the reality of the minority report. (At least the computer part supplies the vision of the computer interaction in the movie version.)
While reading a book on TDD (Test Driven Development) from Kent Beck, I ran across a reference to Jester, which is apparently a JUnit test tester. Like many things lately, I haven't tested it yet myself, but it claims to "find code that is not covered by tests". If it works, that would be pretty cool.
Here are a few places on the web that I might read/visit in the future. None are weeded out yet, so reader beware. I'm going to start with this list, and weed out the weak.
In the spirit of the old song from "The Fixx", One Thing Leads to Another, here are several links today that have nothing to do with my original ambition, which was to get some more spam out of my email:
Find of the day yesterday: probably nothing new to others who are familiar with the spam industry, but while working on a different problem, I noticed yesterday that spammers are embedding HTML comments in the middle of almost every word in some of the spam email I receive! (At some point, why don't these people look in the mirror, and see that they're stooping so low, and doing something so wrong?)
Looking at the raw text of one message I received, sent to my "unix" email account, the raw text looked like this:
I ran into the perfect situation this week that defines why you should not put UI assumptions in Use Case (or task) documentation. A customer decided that they really wanted to change a UI from the proposed tabular approach (with potential popup windows) to a tree view. If the use case mentions things like "double-click", "press OK", and UI phrases of that nature, the use cases would need to be re-written. Without those UI assumptions they should be fine.
A thousand years ago -- December, 2001 to be exact -- Wired magazine had a story about Asperger's Syndrome that I thought was pretty fascinating. The story was about autism, and a specific form of it that is common in Silicon Valley. A few days ago I read a sci-fi story by Philip K. Dick titled "Null-O", and I am struck by what he saw when he wrote that story ... in 1958.
Here's some sample Java code on how to generate a list of files in a directory. Also, today is the big day -- the merger of the city of Louisville and the Jefferson County government, making Louisville the 16th largest city in the U.S.
Java file directory list FAQ: How do I create a list of files in a directory using Java?
Here's a quick example of a Java class that demonstrates how to create a list of all files in a directory using just the Java File class. Specifically, this example shows how to list all the files in a directory, store those filenames in a String array, and then print the array.
Stupid Windows trick of the day: For a few months now I've been working on the same project, so I created a Windows Explorer icon that I wanted to start in the same directory every time I opened the Explorer. After a little testing and rooting around on the web here is the Properties -> Shortcut -> Target command I use to start the explorer, getting it to start in the desired sub-directory, showing the Folders Panel on the left side:
I'm a ruby newbie (and not yet a fan), so forgive the obviousness of the links below. Once I get my bookmarks app over here I'll probably quit putting links in here like this:
Too busy with work, I missed the news that Borland purchased TogetherSoft, and that TogetherSoft had earlier purchased WebGain. Doing a little simple math, this seems to mean that Borland now owns the rights to their own product, JBuilder, as well as their former competitor, VisualCafe. While this means little to the rest of the world, I find it amusing, in that I officially started my Java career writing for two Ziff-Davis publications, Inside JBuilder and Inside VisualCafe.
The last few weeks I've been looking at ways of estimating software development projects using "Use Cases". I'm all over Use Cases -- I think they represent a good way to document the flow of an app, but a significant problem with them is that your use case is not the same as my use case, even for the same subset of an application. This leads into many problems estimating how much it's going to cost to develop a software app.
I recently ran into a problem where I had about 50 individual HTML documents, with each document was about 2 pages long, that I wanted to merge into one big HTML document. After merging all of these into one big document, I wanted them to print with their pages numbered 1-100.
Some times things that seem pretty bad at the time can work out very well. About a month ago I checked into the hospital, with my heart rate bouncing around 120-150 beats per minute, and pounding so hard it felt like my blood must have been as thick as cold car oil on a winter day. I was diagnosed with an irregular heart beat and something called SVT.
Taking a little break from the normal programming discourse, here's some good pitching (baseball) info from Mike Marshall, a heckuva relief pitcher from 1967-'81. (Interesting side note: I almost pursued a career in anatomy and physiology back in the college days based on this guy, and did take an anatomy course in high school.)
The online book and q&a stuff is pretty good. Ahh, if I were young again, or I had a kid interested in pitching, I'd cough up the $100 for the video.