A site devoted mostly to everything related to Information Technology under the sun - among other things.

Tuesday, December 18, 2007

A Silly and Pleasant Game

The automobile driving manual says the average driver's reaction time is:> .75 seconds or 1 car length for every 10 mph; try this:

http://www.bbc.co.uk/science/humanbody/sleep/sheep/reaction_version5.swf

Tuesday, December 11, 2007

Web-comic

A web-comic of romance, sarcasm, mathematics, and language @ http://xkcd.com

Saturday, December 8, 2007

A Web Application Using Only Java

There has always been an issue in J2EE Web development in that there are more than one way of skinning the cat when it comes to developing a Web application. One could do some, either, or all of the following in the same application:

• put the code right in the page.

• put the code in plain-text page libraries that are included in the main pages.

• use tag libraries.

• write the code inside a Servlet.

• use JSTL

One can instead use Google Web Toolkit (GWT) which is a Java to JavaScript compiler. You write code in Java, and GWT compiles it into JavaScript that works in a standard browser. One of Google’s biggest issues seems to have been to create a common way of writing code that would be browser agnostic. They’re not there yet, but I like to think that write-once-run-anywhere has been moved a couple of steps forward.

Consider coding the follwoing page:



Here is the code to build it using GWT - All Java, All of the Time!


signupButton = new Button();
flexTable.setWidget(6, 1, signupButton);
signupButton.setTabIndex(7);
signupButton.setText("Signup");



signupButton.addClickListener(new ClickListener()
{



public void onClick(Widget sender)
{
if (signupButton.isEnabled())
{
if (validating)
validateSignup();
else
beginSignup();
}
}
});

And

SignupRemoteService.Util.getInstance().signup(
signupInfo, new AsyncCallback()

{

public void onFailure(

Throwable caught)

{

showErrorMessage("There seems to be a problem" +

" with the data you entered." +

" Please check the information" +

" and try again.");

signupButton.setEnabled(true);

}

public void onSuccess(

Object result)

{

String errorMessage =

(String) result;

if (errorMessage != null)

{

showErrorMessage(errorMessage);

signupButton.setEnabled(true);

}

else

{

flexTable.getRowFormatter().setVisible(

5, true);

showInfoMessage("Almost there." +

" Please check your email" +

" and copy and past the " +

"Authentication Code into" +

" the box above.");

validating = true;

signupButton.setEnabled(true);

cancelButton.setEnabled(true);

}

}

});

Google supplies an emulator that allows you to run the code, set breakpoints and even do on-the-fly changes.

In addition to debugging, unit testing works like any other Java application. Since all of the code is standard Java, you can simply write unit tests against any of the code and run it using the standard Java Runtime Environment. If you need the ability for your unit tests to run against the hosted code, Google made that possible using the emulator and a special test case class from GWT.

GWT works with Eclipse. It ships with a tool to create an Eclipse GWT project and for less than $50 you can get GWT Designer, which among other things allows you to create Eclipse code using a WYSIWYG designer.

For server side code GWT ships with two solutions. You can either use standard JavaScript Notation Object (JSON) or use GWT Remote Procedure Calls (RPC), which works with Servlets. This means that you end up with two code bases--a client code base and a server code base. The client code base becomes JavaScript and the server code base is deployed as a Servlet. In practice, you simply wrap it all up in a Java Web Archive (WAR) and deploy it on Tomcat or another standard Servlet container.

Since the GWT server side is just standard Java deployed on a Servlet container, you can use all your favorite Java libraries like Hibernate with Annotations, Spring, Log4J, Jackcess (to import access files) and so many other mature Java libraries on the server side.

.mobi

.mobi is the Internet extension for Web sites that are designed for mobile devices such as cell phones from the ground up.

Suppose you are building a site with a number of options on it that are rendered as html links. On a regular Web page, you may need to scroll down to the link you are interested om and then to select it.

On a .mbi site, you will be using Access Keys which allow a user to quickly to navigate to a link on a page by assigning one of the mobile device's (say a smart phone) keypad keys to that link. The HTML code to execute this is a as follows:

[1]<a accesskey="1" href="link1.html">Link 1</a>


[2]<a accesskey="2" href="link2.html">Link 2</a>



And if you wish a phone call to be made (in an anlogous way to sending an email) by clicking on a hyperlink you would write:

<a href="tel:XXXXXXXXXX"> Call Us! </a>

Columnar Databases

As the name implies, columnar databases are organized by column rather than row: that is, all instances of a single data element (say, Customer Name) are stored together so they can be accessed as a unit. This makes them particularly efficient at analytical queries, such as list selections, which often read a few data elements but need to see all instances of these elements. In contrast, a conventional relational database stores data by rows, so all information for a particular record (row) is immediately accessible. This makes sense for transactional queries, which typically concern one record at a time.

Mathematica & Sculpture

Various artists have been using Mathematica to produce artistic structures:

http://www.georgehart.com/sculpture/sculpture.html

and

http://www.bathsheba.com/

I clicked on the http://www.bathsheba.com/gallery/interp.html link and I noticed that the structures created by Mathematica are pleasing if they are the size of ornamental jewelry or house-hold goods; i.e. much smaller than the size of a human being.

But they do not "work" when their scale is large (comparable or larger than the size of a human being). They do not look pleasing as "stand-alone" sculptures for the most part; there is too much regularity and therefore they look boring since there is nothing beyond structure.

I am intrigued by this dependence of the sense of beauty on the scale of the work of art and the typical size of a human being.

It reminds me of what Protagoras is purported to have said in 485 B.C., "Man is the measure of everything."

Hyperseeing

An interesting magazine published by the International Society of the Arts, Mathematics, and Architecture @ http://www.isama.org/hyperseeing/

Friday, December 7, 2007

SAGE

SAGE is an open-source mathematical software package developed at the University of Washington.

It won first prize in the scientific software division of Les Trophées du Libre, an international competition for free software.

It is available @ http://www.sagemath.org/

An Active Coder

Philip Nelson's Web log @ http://xcskiwinn.org/community/blogs/panmanphil/default.aspx

Why Python?

Fredrik Lundh's Python site: @ http://www.ferg.org/index.html

Wide Finder Project

Check out the Wide Finder Project @

http://www.tbray.org/ongoing/When/200x/2007/09/20/Wide-Finder

which presents a simple problem typical of administrator-level development - analyzing a Web log to find the most popular pages - and uses Regular Expressions to solve it.

And @ http://effbot.org/zone/wide-finder.htm

About Me

My photo
I am a senior software developer working for General Motors Corporation.. I am interested in intelligent computing and scientific computing. I am passionate about computers as enablers for human imagination. The contents of this site are not in any way, shape, or form endorsed, approved, or otherwise authorized by HP, its subsidiaries, or its officers and shareholders.

Blog Archive