Friday, May 18, 2007

Simple AJAX Process

Asynchronous Javascript And XML or AJAX is not a new technology.
You won't see anything that you haven't seen before.

AJAX is a way of thinking about web page design as a sum of parts from various sources.

Here is a simple example: http://www.papproth.com/Examples/AjaxTest.htm
Click on the link, and then select View/Source in the browser to review the Javascript code.

The basic function of this application is to open a web page, request input, and then refresh results from the originating server without requiring a round-trip back to the server for the entire page.

Saturday, April 08, 2006

It's been a while!

I ran into a former student the other day at a Software Development conference.
It reminded me of how long it's been (over a year) since I taught a class.
By the way, the student is doing fine! He's a successful Java developer and is very enthusiastic, articulate and knowledgeable on software development topics.

Wednesday, June 29, 2005

Selecting specific objects on a Hibernate Query Join

I ran into a problem when I was trying to select specific columns from multiple tables in a join. I was having trouble casting the returned fields into an object type.

I thought that I would share the two different solutions that I came up with when I found in the Hibernate documentation.

Let me know if you have questions...since I just found this, I may or may not be able to answer it, but I'll try.

Queries may return multiple objects and/or properties as an array of type Object[]

select mother, offspr, mate
from eg.DomesticCat as mother
inner join mother.mate as mate
left outer join mother.kittens as offspr


When this is done, you have to iterate over the Object array and cast it back into the object type that each one is and call the constructor of
the item you are using.

for (Iterator lIterator=lFamilyList.iterator();
lIterator.hasNext();)
{
Object[] lObjectArray = (Object[]) lIterator.next();
Family lFamily = new Family((String) lObjectArray [0],
(String) lObjectArray [1],
(String) lObjectArray [2]);
System.out.println("Mother: " + lFamily.getMother());
System.out.println("Mate: " + lFamily.getMate());
System.out.println("Offspr: " + lFamily.getOffspr());
}
or as an actual typesafe Java object

select new Family(mother, mate, offspr)
from eg.DomesticCat as mother
join mother.mate as mate
left join mother.kittens as offspr


When this is done, you just have to cast it back to it's appropriate class when you iterate.

for (Iterator lIterator = lFamilyList.iterator();
lIterator.hasNext();)
{
Family lFamily = (Family) lIterator.next();
System.out.println("Mother: " + lFamily.getMother());
System.out.println("Mate: " + lFamily.getMate());
System.out.println("Offspr: " + lFamily.getOffspr());
}
assuming that the class Family has an appropriate constructor.

Thursday, February 17, 2005

Accessing an Access Db using JavaScript

<SCRIPT LANGUAGE="text/javascript">
var conn = new ActiveXObject("ADODB.Connection");
var connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:/sabe/Sabe.mdb; Persist Security Info=False";

conn.Open(connectionstring);

var rs = new ActiveXObject("ADODB.Recordset");

rs.Open("SELECT [itemname] FROM item", conn);

while(!rs.eof)
{
alert(rs(0));
rs.movenext;
}

rs.close;
conn.close;
</SCRIPT>

Thursday, December 30, 2004

HTML Tutorials from Microsoft (MSDN)

Follow this link to several interesting tutorials:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/dhtml_overviews_entry.asp?frame=true

Sunday, September 12, 2004

Simple tutorial on using CSS Style Sheets

The World Wide Web Consortium (W3C) is an excellent source for information on the standards used to develop Internet technologies.

Here is a great tutorial on using style sheets (in place of in-line tables):
http://www.w3.org/Style/Examples/011/firstcss.en.html


Tuesday, August 31, 2004

Simple Java Application Source

public class SimpleJava
{
    public SimpleJava()
    {
      // default constructor
    }


    public static void main(String args[])
    {
      System.out.println("Simple Java Application!");
    }


}

Simple HTML page source

<html>
    <head>
        <title>
          Simple HTML Page
        </title>
    </head>
    <body>
        <h1>
          Simple HTML Page
        </h1>
    </body>
</html>