Monday, July 21, 2008

Most simple XMLHttpRequest example.

For the ones need to get a quick start here goes a very simple XMLHttpRequest example with pure javascript. Note that this example works with the Firefox. For the Internet Explorer "xmlhttp = new XMLHttpRequest();" line should be changed with "xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");" although this usage varies with the Internet Explorer version.

At the server side you need a text.txt file which contains a partial html document such as:

<p> hello </p>

The code:

<html>

<head>

<script language="javascript" type="text/javascript">

function back_ajax()
{
if (xmlhttp.readyState == 4)
{
var o = document.getElementById('o');
o.innerHTML = xmlhttp.responseText;
}
}

function call_ajax()
{
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "test.txt", true);
xmlhttp.onreadystatechange = back_ajax;
xmlhttp.send(null);
}

</script>

</head>

<body>

<form name="f">
<input name="in"/>
<input type="button" onClick="call_ajax()"/>
</form>

<div id="o">
<ul>
<li> test 1 </li>
<li> test 2 </li>
</ul>
</div>

</body>

</html>

Thursday, July 10, 2008

subversion behind proxy

For the people who needs subversion access behind a corporate proxy, all you need to do is to append the lines below at the end of ~/.subversion/servers file. Unfortunately, this only works for subversion http access.
http-proxy-host = your.proxy.host.ip
http-proxy-port = port-number
http-proxy-username = your-user-name
http-proxy-password = your-password
http-proxy-exceptions = comma-seperated-list-of-internal-subversion-hosts
Have fun.

Label Cloud