Sunday, October 28, 2007

Wolfram 2,3 Turing Machine Research Prize

A prize winner, Alex Smith, proved that the Wolfram 2 state 3 color Turing machine is universal. There is a 49 page proof of that this can be found on this website...

http://www.wolframscience.com/prizes/tm23/

Nice job!

Tuesday, October 16, 2007

Java Interview Questions

I know there are a lot of mock Java interview questions out there. Heres a good java questionnaire from one of the Java bloggers I regularly follow...

Java Mock Interview Questions


Yakov Fain has several Java books out on Amazon and is a J2EE / Adobe Flex RIA guru.


120x60 iTunes

Wednesday, October 10, 2007

Getting Started with Script.aculo.us and AJAX

I like the script.aculo.us library of JavaScripts, but really the guys over there REALLY need to put more effort into their documentation. I have always subscribed to the theory that a low entry barrier is good for any product. This holds true especially in the Java / JavaScript world and also should hold true for any open source project.

The "Getting Started" page is particularly heinous for someone that is trying to just take a dip into the Java Script libraries. Here's my re-write of that page and I hope to offer it as help for anyone trying to get started with the Java Script libraries.

First, download the script.aculo.us libs and drop them into a local javascripts directory. You should have the following libraries...
  • builder.js
  • controls.js
  • dragdrop.js
  • effects.js
  • scriptaculous.js
  • slider.js
  • unittest.js
Alright, here's the part that isn't in the instructions. You must also download the prototype.js library and also drop this library into java scripts/. You can download the prototype.js here.

NOTE: prototype.js is in the /lib directory and IS in the script.aculo.us zip JavaScript library file. Thanks Gregg B. for your feedback (see comments section)!

If not, you may see the following error:

uncaught exception: script.aculo.us requires the Prototype JavaScript framework >= 1.5.0

Next, add the following links into your html...

<script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/scriptaculous.js" type="text/javascript"></script>


Next, try the html reference in the example. Did it work? Of course not! Try adding the following reference to your html. NOTE: I leave the experimentation of trying the JavaScript example up to the reader. I may have received errors because I downloaded the latest prototype.js vs. using the prototype.js in the lib/ directory.


<div onclick="new Effect.CloseDown(this, arguments[1] || {});">

Click here if you've seen enough.

</div>


Your html should then look something like this...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<script src="javascripts/prototype.js" type="text/javascript"></script>

<script src="javascripts/scriptaculous.js" type="text/javascript"></script>

</head>

<body>

<div onclick="new Effect.CloseDown(this, arguments[1] || {});">

Click here if you've seen enough.

</div>

</body>

</html>


I recommend also reading
this article written by Michael Heilemann, and realize that the script.aculo.us documentation is not your friend. Thankfully, there are many articles that help the beginner get started with this JavaScript library.



iTunes_RGB_9mm

Monday, October 8, 2007

Java NetBeans 6 Beta Preview


I have been using Java IDE NetBeans 6 Beta on Java 5 for a week or two now. This release is a definite improvement over the 5.X NetBeans. Here's a list of some of the new features that I ran into...

  • Highlights - Yay!
  • Ruby / Rails support - This includes a rails engine embedded in the full release. Project templates are created quickly and run from the IDE.
  • Swing GUI development - Uses the new Java Desktop Application project template.
  • Application profiling.
  • Better JavaScript support.
  • AJAX enabled Java Server Faces (JSF) components - Includes Project Woodstock component library.
  • Graphical Java WSDL editors
  • And my favorite - it seems less buggy! I was able to import J2EE projects without all of the issues I would experience in NetBeans 5.X. No code obfuscation!
For a full list of features added to NetBeans look here...

http://www.netbeans.org/community/releases/60/

Friday, October 5, 2007

Java Conversions of HTML to XML

I recently ran into this error in my browser while trying to convert html to xml via a java parser application. Apparently, html entities which are handled fine in most browsers, do not translate so nicely into xml. The reason is that most xml parsers do not handle "&nbsp" or any of the other 1000's of special characters out there.

XML Parsing Error: undefined entity
Location: http://localhost:8080/rssFeed.xml
Line Number 255, Column 16:href="r/3t">360°

---------------^

Here's a couple of options...

Option 1. Download the following entity definitions.

http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent

http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent
http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent

I concatenated the files together, but this is not necessary.

cat xhtml* >xhtml-pac.ent

Then in your xml file include a reference to the entities in your external file. You will need to describe an external entity as seen here...

http://www.w3.org/TR/REC-xml/#sec-external-ent

Example:
<!--ENTITY spec-chars  SYSTEM "resources/xhtml-pac.ent"-->
This inclusion of the entity file converts special characters to unicode. The unicode will always be processed by the xml processor.

Also take a look at the Java library JTidy. The JTidy Java API provides a method in their Tidy Java class that will automatically do the above work for you. You also get cleaned xml automatically. The Java method is setNumEntities and will convert those special HTML characters into unicode.