The Source for Java Technology Collaboration
User: Password:



Jayson Falkner's Blog

July 2006 Archives


Apple: Java, JDBC, and JSP Course

Posted by jfalkner on July 17, 2006 at 02:47 PM | Permalink | Comments (0)

This is a blog page for the folks at Apple in Sacramento. We had a good time talking about Java, and here are some of the things that we've done.

Interesting Links and Info

Anagram Challenge Example

If you rearrange the names of "Al Kaline", "Al Green", "Eric Clapton", "Liam Brady", "Lou Reed", "Tom Cruise", what words from the English dictionary can you make. Each name will make at least one word.

Text Twist Challenge

The Tuesday morning challenge is to modify your Anagram code to find all words that you can make, i.e. all the scrabble words that you could play or all of the words needed to win at Text Twist.

If you send in a screenshot of your high-score I'll put it on this page for others to see. We'll keep the best score posted on-line as the winner.

Current Text Twist High Score: Bill Newcomb

texttwist-highscore.jpg

Tuesday Scrabble Challenge

We're getting closer to playing a full game of scrabble. For today's challenge you are asked to write code that attempts to find the highest scoring word from a rack of scrabble letters. You'll be given a full bag of scrabble letters, and your code will be tested to see how highly it can score using those letters.

Wednesday Scrabble Challenge

We're now playing real scrabble. Your class must return an array of PlacedScrabbleLetter objects, which represents both a word and the location on the board that the word is placed. Several helper method have been added to the ScrabbleBoard class, and be sure to take a look at the two example scrabble players: ChooseFirstWordScrabblePlayer and ExtendUsingFirstWordScrabblePlayer.

Note that the board now also has letter and word multipliers same as a normal scrabble board. Finding the longest word is no longer the best bet! Be sure to consider what placed word would score the highest using the ScrabbleBoard class's calculateRealWordValue() method.

Results from Wednesday scrabble are here. Out of 1000 games played John Morgan dominated, winning 84% of the matches. Here is a summary of the results and here is a link to a log of all 1000 games (~1MB download).

Average Scores:
  Morgan: 195
  Andy Masuo: 119
  DukeNukem: 43
Win Percentage:
  Morgan: 845 out of 1000; 84%
  Andy Masuo: 146 out of 1000; 14%
  DukeNukem: 9 out of 1000; 0%

Friday Links: JDBC, JSP, and Servlets

Here are a bunch of links for the last day of class. These are all related to JDBC, JSP, and Servlets.



Blarg #25: A JSP that shows Request Headers

Posted by jfalkner on July 03, 2006 at 06:32 PM | Permalink | Comments (1)

This code as been shown many times before, including in my book. This is exactly what the title says: a JSP that will display the request headers sent by your browser. It is also a good example of how to use the JSP EL and the JSTL core tags to make an incredibly simple JSP.

Here is the code. Simply copy and paste it in to a JSP, ideally one that you are editing in Netbeans. You must have the JSTL JARs in your classpath.

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head><title>HTTP Request Headers</title></head>
<body>
<h2>This is a list of the HTTP request headers sent by your browser.</h2>

<c:forEach var="v" items="${header}">
    <b>${v.key}</b>: ${v.value}<br />
</c:forEach>

</body>
</html>




Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds