It bugged me (ChristianRamseyer aka. rc@networkz.ch) that there was no Java candidate for the ShortestWikiContest. So, although it was clear that most of the other languages would beat java hands down, I invested an hour or two to come up with a 16 lines, 1212 bytes platform-independent JSP Wiki. WjKj lives at http://www.networkz.ch/wjkj [broken link] While writing the code, it came to my mind that there must be some Ents (the "Shepherds of the Trees" from "Lord of the Rings") sitting in the Java design team. It takes really really long to say something in JavaLanguage compared to PerlLanguage. Here's an example: File f=new File(c+p); if (!f.exists()) f.createNewFile(); Data''''''Output''''''Stream o=new Data''''''Output''''''Stream(new File''''''Output''''''Stream(f)); vs. open F,">$&"; ''Like data compression, one encoding may express some things in a compact way, but it will have to express other things in a more verbose way to make up for it. Perl is tuned for "compressing" text manipulation, but it will be bad at compressing some other things. And of course, the Java version is easy to read for someone who doesn't know Java. To someone who doesn't know Perl, you may as well have run the Java version through a zip algorithm. -- MichaelSparks'' ---- This source is from http://web.archive.org/web/20050502223553/www.networkz.ch/wjkj/ -- MarkusSrank *compacted "competition" version: <%@page import="java.io.*,java.util.regex.*"%>wJkJ<% String c="/tmp/wiki/";String p=request.getQueryString();if(p==null||!(p.matches( "^[A-Z][a-z]+.*")))p="Home''''''Page";out.print("wJkJ: "+p+"

");File f=new File (c+p);if(!f.exists())f.createNewFile();if(request.getMethod().equals("POST")){ Data''''''Output''''''Stream o=new Data''''''Output''''''Stream(new File''''''Output''''''Stream(f));o.writeBytes( request.getParameter("in"));o.close();}File[] d=(new File(c)).listFiles();String b="";Z:for(int i=0;i0){if(s.readLine().matches(".*"+p+ ".*")){b+=d[i].getName()+" ";continue Z;}}}out.print(b.replaceAll("((?:[A-Z]"+ "\\w+){2,})","$1")+"

");Data''''''Input''''''Stream i=new Data''''''Input''''''Stream(new File''''''Input''''''Stream(f));String t="";while(i.available()>0)t+=i. readLine()+"\n";out.print(t.replaceAll("(ht''''''tp:\\S+)"," $1"). replaceAll("(?m)(^| )((?:[A-Z]\\w+){2,})"," $2").replaceAll( "\\\n","
")+"


");%>
*(somewhate) editable version: <%@page import="java.io.*,java.util.regex.*"%>wJkJ <% String c="/tmp/wiki/"; String p=request.getQueryString(); if (p==null||!(p.matches("^[A-Z][a-z]+.*")) ){ p="Home''''''Page"; } out.print("wJkJ: "+p+"

"); File f=new File(c+p); if (!f.exists()) f.createNewFile(); if (request.getMethod().equals("POST")) { Data''''''Output''''''Stream o=new Data''''''Output''''''Stream(new File''''''Output''''''Stream(f)); o.writeBytes(request.getParameter("in")); o.close(); } File[] d=(new File(c)).listFiles(); String b=""; Z: for(int i=0;i0) { if (s.readLine().matches(".*"+p+".*")) { b+=d[i].getName()+" "; continue Z; } } } out.print(b.replaceAll("([A-Z][a-z]+[A-Z][a-z].*?\\b)","$1") +"

"); Data''''''Input''''''Stream i=new Data''''''Input''''''Stream(new File''''''Input''''''Stream(f)); String t=""; while (i.available()>0) t+=i.readLine()+"\n"; out.print(t.replaceAll("(ht''''''tp:\\S+)"," $1") .replaceAll("(?m)(^| )((?:[A-Z]\\w+){2,})"," $2") .replaceAll("\\\n","
") + "


" + ""); %>
License: GNU GPL ---- CategoryWikiImplementation