27 May 2005 - java_dev (original) (raw)

01:30 pm - banana - Sudoku UK newspapers are awash with Sudoku, a number puzzle. My paper carried this puzzle today:You have to fill in the blanks so that the numbers 1 to 9 appear once in each row, once in each column and once in each 3x3 square. You're meant to solve it by brain power, but I get bored too quickly. Writing Java code keeps my attention, though. I'm sure that what I did it could be improved in any number of ways, but it finds the solution pretty quickly by brute force (i.e. lots of guessing).**( My code here - don't peek if you want to try it yourself...Collapse )**Curiously, the puzzle above took more guesses than any other I've tried, but wasn't rated by the newspaper at the hardest difficulty level.Even more curiously, the compiler produces an anonymous inner class file (Sudoku$1.class) which I can't tie to any part of my code, and which doesn't seem to be required at run time (because if I delete it, nothing goes wrong).
08:39 pm - transmogrify - appletviewer problems i'm trying to test out a java applet via the UNIX environment using the appletviewer, however i receive this error message and i'd appreciate it if someone can direct me on how to get it to work properly:Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:125) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:63) at at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:125) at java.awt.Toolkit$2.run(Toolkit.java:499) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:492) at sun.applet.AppletCopyright.(AppletCopyright.java:28) at sun.applet.AppletViewer.mainInit(AppletViewer.java:1150) at sun.applet.AppletViewer.main(Compiled Code)//cross-posted