Roller hack: Highlighting Google hits in your referer list

Eugene Kuleshov shows how to do it on his JRoller blog Euxx.


Partnership, schmartnership.

It's great that Microsoft and Sun have finally settled their legal disputes, but do they have to patronize us with this nonsense fluff-talk of partnership, inter-operability, and technology sharing. What a crock'o. Microsoft needed some good PR and Sun needed some cash. Is there anything more to this story than Microsoft saying "you are right Sun, here is $2 billion dollars, now call off your dogs." If there is something more -- something of substance -- it is certainly not being reported in the trade rags (CNet, eWeek, ComputerWorld).


ObjectSpaces

via dsuspense

Of blogs and wikis

via Doc Searls

Java, Gtk and Mono

via Rarebit Fiend

New software.

This site is now running Tomcat 5 and MySQL 4. The site seems quite a bit faster, which is of course a good thing. Now that I'm running on MySQL 4, both at home and on this site, I would like to add referential integrity to the Roller database. To that end, I've been reading up on MySQL and playing around with DBDesigner4, an ERWin-like database modeling tool recommended by Scott Switzer on the Roller dev-list. DBDesigner4 is an impressive piece of software with a very slick user interface and, best of all, DBDesigner4 is free -- licensed under GPL.

Last week, I bought a copy of Dragon Naturally Speaking Prefered for Windows (about $150 including microphone headset). I'm using it to dictate this weblog entry and it is working very well. It took only about 10 minutes to train Dragon to understand my mumbly and lispy voice. Dragon works well, but to use it effectively you must think before speaking and you must speak very clearly. This is really not a problem because just about everybody, and especially mumbly me, needs practice thinking before speaking and speaking clearly.

I'm getting a new desktop machine at work and I'm trying to decide which Linux distribution to use. I'm going to use the machine for development work using Eclipse, Tomcat, and PostgreSQL. The guys down the hall like Gentoo, but the consensus among RTPBloggers is that Debian is a better choice -- much more mature, stable, and widely-supported. I'm assuming that Eclipse is stable on both Gentoo and Debian, please correct me if I'm wrong.

Rave beta

eWeek: Sun to Release Project Rave Beta

JSP Control Flow engine.

It's time for another installment in my ongoing series of articles on continuations in Java Web application development. In a previous installment I explained how I was able to rip the continuation-based Cocoon Control Flow engine free of Cocoon and make it work in a standalone unit test environment. For this installment, I have implemented a simple web application that uses that Control Flow engine for all application logic and uses JSP for presentation.

On the Cocoon web site, the Cocoon Control Flow tutorial uses the good-old Tomcat JSP number guess example to illustrate how the Cocoon Control Flow engine works, so I have done the same thing for my JSP Control Flow engine. There are five parts in my implementation of number guess: the numberguess.js JavaScript program that executes on the server side, a FlowServlet that starts and continues the JavaScript program, the Control Flow engine which runs the JavaScript program, the guess.jsp page which asks the user to guess, and the success.jsp page which informs the user of a successful guess.

I'm not going to go into any more detail on the FlowServlet or the Control Flow engine implementation at this time. The code is not yet packaged for release, but you can get it in the form of an Eclipse project here: JSPFlow-v1.zip (it's 2.4MB because it includes the way-too-many jars necessary for running MockRunner). I'll discuss FlowServlet implementation later, for now let's take a look at the JavaScript code for number guess.

function main(tray) {

  var random =  Math.round( Math.random() * 9 ) + 1;
  var hint = "No hint for you!"
  var guesses = 0;

  while (true) {

    // send guess page to user and wait for response
    forwardAndWait(tray, "guess.jsp", 
       { "random" : random, "hint" : hint, "guesses" : guesses} );

    // process user's guess
    var guess = parseInt( webapp.request.getParameter("guess") );
    guesses++;
    if (guess) {
      if (guess > random) {
        hint = "Nope, lower!"
      } 
      else if (guess < random) {
        hint = "Nope, higher!"
      } 
      else {
        // correct guess
        break;
      }
    }
  }

  // send success page to user
  forwardAndWait(tray, "sucess.jsp", 
     {"random" : random, "guess" : guess, "guesses" : guesses} );
}

As you can see, the code for my version of number guess is almost exactly the same as the code for the Cocoon version. There's no substantial difference. Now, let's take a look at guess.jsp. There are a couple of differences, but nothing major. Instead of the Cocoon ${thing} syntax, you see JSP syntax. Instead of making the continuation ID part of the POST URL as Cocoon Control Flow does, I've put the continuation ID in a hidden field.

<html>
<head>
  <title>JSPFlow number guessing game</title>
</head>
<body>
  <h1>Guess the Number Between 1 and 10</h1>
  <h2><%= request.getAttribute("hint") %></h2>
  <h3>You've guessed <%= request.getAttribute("guesses")%> times.</h3>
  <form method="post" action="/jspflow/FlowServlet">
    <input type="hidden" name="contid" value='<%=request.getAttribute("contid")%>' />
    <input type="text" name="guess"/>
    <input type="submit"/>
  </form>
</body>
</html>

Finally, let's take a look at the success.jsp. Again there is no substantial difference.

<html>
<head>
  <title>JSFlow number guessing game</title>
</head>
<body>
  <h1>Success!</h1>
  <h2>The number was: <%= request.getAttribute("random") %></h2>
  <h3>It took you <%= request.getAttribute("guesses")%> tries.</h3>
  <p><a href="/jspflow/FlowServlet">Play again</a></p>
</body>
</html>

Number guess is simple and not a very realistic. The input data is strings, all application logic is written in JavaScript, and the output data is also strings. In a real world application, we would probably want to call out to application logic written in Java and we would probably want to put some more complex objects into request scope for display on the JSP page. Despite that, I'm going to move on. I'll implement a more complex example once I've figured out how to make Control Flow work with Struts. In my next installment, I'll implement number guess again - this time using Struts and Control Flow.


Roller 0.9.8.2 bug fix release is available.

Roller 0.9.8.2 is the fastest and most stable version of Roller yet. It has been battle tested for over five months on JRoller.com.

Roller 0.9.8.2 includes a number bug fixes related to (somewhat embarrassing, I must say) database consistency problems and some additional database indexes for performance. See the change notes for the specifics. Download Roller 0.9.8.2 on SourceForge.

Don't miss the SourceBeat blogs.

Even if you don't buy into one of the "live" SourceBeat books, you can still subscribe to the excellent (and Roller-based) SourceBeat blogs. You can subscribe to the whole lot of them with one URL:

http://sourcebeat.com/roller/rss.

Win events to RSS

via James Robertson

Open source Java - NOT

via rc3.org

A welcome break in June - JavaOne and NFJS!

This deadline stuff is getting old. I've got another one tomorrow and I'm toiling away again tonight. On the bright side, today I registered for both the JavaOne conference and the No Fluff, Just Stuff Research Triangle Software Symposium.


Another JSTL quick ref

via java.blogs

« Previous page | Main | Next page »