Christian Gross

Author
+ Follow
since Feb 20, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Christian Gross

Is it possible to send to me via private message your sources and what you want to do? I will give it a shot...
Hi,

First let me say to all who participated: Thank-you. You put me through my paces and made me think about what Ajax represents in the bigger scheme. Lots of food for thought.

Second as promised I create a summarization of the topics posted during the period Feb 21, 2006 to Feb 24, 2006.

The topics covered were less technical related, and more Ajax theory, higher level technical, etc. The document is at the url http://www.devspace.com/~cgross/ajaxpatterns/ajaxqa.html. This is version 0.5, and is a first stab. If you do end up reading the document and find errors or missing topics send me a private message or email and I fill fix it up.

Thanks again... I will though keep lurking in this forum because it was fun.

Christian
[ February 26, 2006: Message edited by: Christian Gross ]
Yes I have already started. The framework is very similar to the pattern implementations except that the framework implementation is complete. The patterns are used to illustrate that the patterns work, less flexible (eg the patterns do not read most of their information from a configuration file for explanation purposes).
Try the following

<a href="/whatever" onclick="return false" />


Christian
If you have three text boxes, then they would be parsed as follows.

var day = parseInt( document.getElementById( "day").value);
var month = parseInt( document.getElementById( "month").value);
var year = parseInt( document.getElementById( "year").value);

The only field where you will have a problem is month because month is displayed as Jan, Feb, etc, but the values are 1, 2, 3. So you will have to create a lookup table.

Christian
Hmmm, I don't know if this is your case... BUT

I was digging around using Google search "applet crashes Firefox". It seems that you are in company of an applet crashing Firefox. One thing that people seemed to keep mentioning was checking to make sure that only one version of Java was installed. Do you have multiple versions of Java?

Christian
Just a hunch here...
I think you might want to replace the div tag with span?
Though could you not detect a browser refresh with a little help from the server side? This is what I did with the State Navigation pattern. I implemented the onload, and onunload events to pull and push the state of a page.
To manipulate XML in JavaScript you have to deal with the different instantiation methods in XML.

To create an XML document in IE:

var xmlDoc = new ActiveXObject( "Microsoft.XmlDom");

To load something in the document you can load it by referencing the file
xmlDoc.load( URL), or
xmlDoc.load( str) where str is a valid XML document.

The result is an XML DOM document that can be manipulating like the XML DOM.

In Mozilla you need the following line
var xmlDoc = document.implementation.createDocument( namespace, rootElement, null);

The result is an XML document with namespace, and rootElement that can be manipulated using the standard XML DOM methods.

For exact details of the methods I would reference the XML DOM documentation.

Then to save the XML to a string, for IE you use the xml property associated with a node, and for Mozilla you use the XMLSerializer object.

Christian
[ February 24, 2006: Message edited by: Christian Gross ]
Just off the top of my head here... There are the body events preunload, or unload? I know for the State Navigation pattern I used those events to detect when a page was reloaded or URL changed.
Performance issues? Ah yes...

I had to double check your question because initially in my response I ran on about this how if performance were an issue we would not be talking about Java. But then I reread your question and saw what you were really asking.

Since JavaScript is slower, and you are thinking about terminals, what happens? I would say, you should test it. In fact I am thinking, I SHOULD TEST it as its a valid question.

Here is what I do know:
1) JavaScript does not have a jitter. So that means every script is executed as if it were seen for the first time.
2) Browsers like IE tend to keep several pages stored in the background without releasing the resources. Firefox does not do this, but have not tried all combinations
3) Browsers when executing multiple HTML pages tend to be resource hogs. It gets worse if your machine has more memory because the browser seem to think it belongs to them!
4) Mozilla, and Firefox have a very nasty bug that every now and then will cause the browser to grab 100% CPU. Mozilla knows about this and they are trying to figure out what the problem is. The only way to stop it is to exit the browser.
5) If you use a browser and allow individuals to surf to other sites advertisements these days think that the CPU belongs to them. I have often seen Flash advertisements grab 25% of my CPU because the advertisment thinks it is cool to have snowflakes falling!

If you plan on deploying Ajax applications on a terminal server I would do it under very controlled circumstances! Things could get very quickly out of control, especially if you let the operators "surf".
I will be posting a QandA for the past four days that should help you? I will have it ready Monday

Christian
In the thread https://coderanch.com/t/117513/HTML-JavaScript/Basic I posted a bit of source code that uses Ajax to decouple the request process from the browser.

So instead of posting or the likes do a get as Asynchronous has a get method, and wait until you get a successful message. In the oncomplete method you cannot use location.href as the content will be sent to you, and you will need to replace the HTML body.

OK?
When defining the log for JS interface you need to define an appender. Use either the XML or JSON appender to send a server message. Then, take Liyaquat's advice on receiving and processing that request.
I looked at your code and decided to create a simple little example using Ajax.

<html xmlns="http://www.w3.org/1999/xhtml"; >
<head>
<title>Untitled Page</title>
<script language="JavaScript" src="/lib/factory.js"></script>
<script language="JavaScript" src="/lib/asynchronous.js"></script>
<script language="JavaScript" type="text/javascript">

var asynchronous = new Asynchronous();

asynchronous.complete = function( status, statusText, responseText, responseXML) {
if( status == 200) {
location.href = responseText;
}
else {
window.alert( "Error (" + statusText + " " ;
}
}

function DoPost( link) {
var buffer = "clickedLink=" + link.href;
asynchronous.post( "/ajaxjavascript/postprocessor", "application/x-www-form-urlencoded", buffer, buffer.length);
return false;
}

</script>


</head>
<body>
<a href="/link/to/send/to/server" onclick="return DoPost( this)">Some link</a>
<a href="/another/link/to/send/to/server" onclick="return DoPost( this)">Another link</a>
</body>
</html>

In the example what happens is that Ajax is used to POST the data to the server, and in the response you navigate the page that the server returns.

The sequence of events are as follows:
1) User clicks on link
2) onclick event of link is activated calling the function DoPost passing the link element as parameter.
3) Function DoPost creates an HTTP POST request using form encoding by creating the form variable clickedLink. The value of clickedLink is the link.href property.
4) Data is sent to the server using an HTTP POST to the servlet URL /ajaxjavascript/postprocessor that is encapsulated by the Asynchronous class defined by the file /lib/asynchronous.js located at the URL http://www.devspace.com:8080/lib/asynchronous.js as well as http://www.devspace.com:8080/lib/factory.js for the XMLHttpRequest factory.
5) The server receives the HTTP POST and extracts clickedLink that contains the href information of the received request.
6) Server processes the data and generates data that consists of a single line representing the URL that the browser will navigate to.
7) Client receives the HTTP POSTED data from the server in the asynchronous.complete method and verifies that the POST was successful. If successful reads the received link and assigns to location.href causing the browser to navigate to the next HTML page.

This process is a little bit more than you want, but it gives you the flexibility on how and what your want to process, ok? Or did I miss the mark?

Christian