Dave Johnson on open web technologies, social software and software development
Dave Johnson in Links
01:55AM Mar 30, 2004
Comments [0]
Tags:
Links
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.
Dave Johnson in General
02:00PM Mar 29, 2004
Comments [11]
Tags:
General
Dave Johnson in Links
05:05AM Mar 29, 2004
Comments [0]
Tags:
Links
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.
Dave Johnson in Java
08:01AM Mar 27, 2004
Comments [3]
Tags:
Java
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.
Dave Johnson in Roller
07:37PM Mar 25, 2004
Comments [1]
Tags:
Roller
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:
Dave Johnson in Java
07:46AM Mar 25, 2004
Comments [1]
Tags:
Java
Dave Johnson in Links
05:44AM Mar 25, 2004
Comments [0]
Tags:
Links
Dave Johnson in Links
05:43AM Mar 25, 2004
Comments [0]
Tags:
Links
Dave Johnson in Java
05:45PM Mar 24, 2004
Comments [3]
Tags:
Java
Dave Johnson in Links
11:40AM Mar 21, 2004
Comments [0]
Tags:
Links
${var}
syntax instead of using "an embedded x:out tag within the href attribute". In theory, by validating your JSP source code as XML and by pre-compiling the JSP at build-time you can weed out a lot of potential errors.
Dave Johnson in Java
11:33AM Mar 21, 2004
Comments [6]
Tags:
Java
Dave Johnson in General
12:43PM Mar 17, 2004
Comments [3]
Tags:
General
Havic Pennington: Microsoft has set a clever trap by standardizing the core of the CLI and C# language with ECMA, while keeping proprietary the class libraries such as ASP.NET and XAML. There's the appearance of an open managed runtime, but it's an incomplete platform, and no momentum or standards body exists to drive it to completion in an open manner. Many interesting class libraries are clearly encumbered by Microsoft IP and nobody concerned about legal liability will want to ship them. The core may also be encumbered, though that remains uncertain. Aside from IP issues, Microsoft controls the .NET platform. They will always be ahead, and it will always be tuned for Windows. This is the wrong direction for free software, if we want to win the war, and not only some battles.That's from an interesting article by Havoc Pennington of the GNOME project, who is currently considering a move from C/C++ to Java or C#. Found via JRoller blogger Emil Eifrem
Dave Johnson in Microsoft
12:37PM Mar 17, 2004
Comments [0]
Tags:
Microsoft
Maybe I should explain why I'm wasting valuable late-night Roller development time with this continuations stuff. I'm experimenting with Control Flow because I'm frustrated with Struts (and other web-MVC frameworks) lack of support for building complex web applications where user-interactions extend over multiple pages. I'm tired of little ad-hoc tricks like session attibute here, request parameter there, breadcrumb stacks, and hidden fields that developers must remember to place on each page. There has got to be a better way and a continuations-based approach seems like it may be that better way. Ken McLeod explains the appeal of a continuations-based approach quite nicely:
Ken MacLeod: Continuation-based web frameworks let you write complex, modeless, interactive web applications in a top-down, linear fashion as simple as writing command-line based applications that prompt for input.
That sounds great, but I don't really want to switch to a new framework to take advantage of a continuations approach. I've got an investment in Struts and JSP and what I would really like to do is to learn from the continuations-based frameworks and, if possible, apply that knowledge to my existing webapps. What I would like to learn is:
There you have it. Please, leave a comment if you have any insight into any of the above questions.
Dave Johnson in Java
02:59PM Mar 16, 2004
Comments [10]
Tags:
Java
« Previous page | Main | Next page »