Tuesday, May 22, 2007

Migrating XMLDocument to XMLHttpRequest aka web 2.0

on

after function handleResponse() {}
request.responseXML in firefox returns emply
the request.responseText does bring something...

I am ditching xmlDocument in favor of xmlhttprequest

i will keep things updated.

Update: 5.24.2007
There may not be an unified xmlhttprequest handler.

node1.firstChild.nodeType
on IE: returns 1
on Firefox, returns 3

Monday, May 14, 2007

google map latititude and longitude finder

This is how you get the latitude and longitude from google map api...


var map = new GMap2(document.getElementById("map"));
var geocoder = new GClientGeocoder();
var latitude, longitude;

function showAddress(address) {
geocoder.getLatLng(
address,
function(point) {;
if (!point) {
alert(address + " not found");
} else {
latitude= point.lat();
longitude = point.lng();
}
}
);
}
showAddress("123 Main Street 00000");
this example requires three div stag for the getElementById call within google map api.
google format doesn't allow me to post HTML contents
but... there are three DIV tags with id of map, side_bar, demographics, and message. They are all indepedent.
I would do
document.getElementById("").style.display="none"
for the IDs.

Wednesday, May 9, 2007

select option add

for the select tag on html.
instead of trying to appendChild.

select needs .add(element, reference)

example of code

selectTag=document.forms[0].selectTag
option1= document.createElement("option")
option1.text = "mama";
option1.setAttribute("value","mama");
selectTag.add(option1);

Tuesday, May 8, 2007

iframe location denied access

Windows DOM can be such a bitch.

if you do iframe.location = URL... it gives you access denied. you can't cross location on iframes.
what you can do is..

iframe = document.getElementById("iframe_ID_TAG");
iframe.setAttribute("src",fileURL);

Thursday, May 3, 2007

xmldom in html

you can do xmldom.load("http://...../.nsf/....?OpenAgent") then tranform the nodes. then place inside the .innerHTML

this is a neat trick that works pretty seamlessly.

you can do ?OpenAgent&Key=something

you can then parse Query_String(0).

of course with an agent, you can do all kinds of stuff at the backend..

Wednesday, May 2, 2007

Agent?OpenAgent XML Output

Here is the LotusScript

Dim key as string


key = "something"

Print "Content-type: text/xml" ' <--- this makes the output text/xml type
XMLTree = || + Chr(13)
XMLTree = XMLTree + || + Chr(13)
XMLTree = XML
Tree + || & key &|| + Chr(13)
XMLTree = XMLTree + |2nd Node| + Chr(13)
XMLTree = XMLTree + ||

Print XMLTree

above code outputs



B03201AF03E0309230E....
2nd Node

QSParser - Query_String parser

Class QSParser

'Private member vars

session As NotesSession
doc As NotesDocument
strQS As String
vntQS As Variant
intCount As Integer
arrQSName() As String
arrQSValue() As String

' ---------------------------------------------------------------------

Sub New

'Instantiate our objects, retrieve the querystring from the
'context doc and call the parsing routine.

Set session = New NotesSession
Set doc = session.DocumentContext

strQS = doc.QUERY_STRING_DECODED(0)

Call Me.ParseQS

End Sub

' ---------------------------------------------------------------------

Private Sub ParseQS

'Split the querystring into an array
vntQS = Split(strQS,"&")

'Loop throught the array and create name / value arrays. I am
'starting the loop at one and not zero so that we ignore the 'openagent'
'parameter in the querystring.

For intCount = 1 To Ubound(vntQS)

Redim Preserve arrQSName(intCount - 1)
Redim Preserve arrQSValue(intCount - 1)

'Store the name / value pair in seperate arrays using strtoken
arrQSName(intCount - 1) = Strtoken(vntQS(intCount),"=",1)
arrQSValue(intCount - 1) = Strtoken(vntQS(intCount),"=", 2)

Next

End Sub

' ---------------------------------------------------------------------

Public Function GetQSVal (strQSName As String) As String

'Given the Query String name, return it's associated value
'by finding its index in the arrQSName array.
Dim vntIndex As Variant

vntIndex = Arraygetindex(arrQSName, strQSName, 5)

If Not(Isnull(vntIndex)) Then
GetQSVal = arrQSValue(vntIndex)
End If

End Function

' ---------------------------------------------------------------------

End Class


Usage

Dim objQS As New QSParser
Dim key As String
key = objQS.GetQSVal("key")