Q: Why is an empty String unethical or immoral?
A: Because it does not have any character! wah wah! wah wah!
Tuesday, December 20, 2005
Tuesday, December 13, 2005
Javascript sleep() or wait()
While thinking on a solution for handling javascript "alerts" in Sahi, it suddenly occured to me that a sleep() or wait() method can be implemented in javascript with the help of a synchronous XMLHttp request to the server.
It goes like:
The url http://localhost:9999/dyn/sleep?ms=1000 does a Thread.sleep(1000);
Of course there is the network delay which makes the time out slightly greater than 1000 ms;
[Dec 20 2007] NOTE: This method can give you a way to invoke a sleep on the browser, but it will also kind of freeze the browser which may not be what you want. I solved this problem in a different way for Sahi. (javascript-sleep-or-wait-in-sahi.html)
It goes like:
<script>
function sahiIsIE(){
var browser = navigator.appName;
return browser == "Microsoft Internet Explorer";
}
function sahiCreateRequestObject(){
var obj;
if(sahiIsIE()){
obj = new ActiveXObject("Microsoft.XMLHTTP");
}else{
obj = new XMLHttpRequest();
}
return obj;
}
function sahiSendToServer(url){
try{
var http = sahiCreateRequestObject();
var url = url;
http.open("GET", url, false);
http.send(null);
return http.responseText;
}catch(ex){throw ex;}
}
function sleep(ms){
sahiSendToServer("http://localhost:9999/dyn/sleep?ms="+ms);
}
var start = new Date();
sleep(1000);
alert((new Date()) - start);
</script>
The url http://localhost:9999/dyn/sleep?ms=1000 does a Thread.sleep(1000);
Of course there is the network delay which makes the time out slightly greater than 1000 ms;
[Dec 20 2007] NOTE: This method can give you a way to invoke a sleep on the browser, but it will also kind of freeze the browser which may not be what you want. I solved this problem in a different way for Sahi. (javascript-sleep-or-wait-in-sahi.html)
Labels:
browsers
Friday, December 09, 2005
Covered two-wheelers (with AC?) for Bangalore
While walking to office at 9 AM, I observed that out of 96 cars that I counted, 72 had just the driver in it! Of the 24 left, only 6 had more than 2 persons! Every Scorpio(6) and Innova(2) had only the driver in it!
Could covered two-wheelers (with AC?) do the job?
And Scorpios and Innovas should not start if the load is less than that of 3 passengers!
Could covered two-wheelers (with AC?) do the job?
And Scorpios and Innovas should not start if the load is less than that of 3 passengers!
Tuesday, December 06, 2005
Tiger Numbers
I was in Panna Tiger Reserve last week and came across something quite disturbing.
While the official figures for the number of tigers in the Park is around 35, locals and forest guides who track tigers say that only 6-7 have been sighted/presence ascertained in recent times. Liberal estimates place the number of tigers in the Park at around 15.
While I have no authority on reporting these numbers, one of the reasons for these figures not being reported from other directions, seems to be this:
* Forest officials are posted to a particular reserve for a fixed amount of time (3 years?). During this period, if they report any change in tiger numbers, they are liable to be questioned and pestered by the media and law enforcement officials. So even if an official inherits a reserve with lesser tigers than documented, he is not likely to report it.
* Researchers in the park depend on the forest officials for permits and for access to the forests. They cannot go against the forest officials by reporting this.
So that leaves nobody to actually report figures, which is disturbing.
The law and media somehow, convolutedly, seem to right now act as a deterrant in the conservation process. What tigers have gone, have gone. The need of the hour is to preserve what is left rather than punish those who have erred.
If there was some way of emancipating the forest officials once, so that figures are voluntarily disclosed truly (with the guarantee that no action will be taken against them), we may be able to get the correct numbers, and remedial measures can be undertaken with speed. Right now, the problem areas never come to light until past the time of debacle.
Additionally, researchers should not have to depend on forest officials for their permits. I think there is already something being done in this direction, though I do not have the details.
While the official figures for the number of tigers in the Park is around 35, locals and forest guides who track tigers say that only 6-7 have been sighted/presence ascertained in recent times. Liberal estimates place the number of tigers in the Park at around 15.
While I have no authority on reporting these numbers, one of the reasons for these figures not being reported from other directions, seems to be this:
* Forest officials are posted to a particular reserve for a fixed amount of time (3 years?). During this period, if they report any change in tiger numbers, they are liable to be questioned and pestered by the media and law enforcement officials. So even if an official inherits a reserve with lesser tigers than documented, he is not likely to report it.
* Researchers in the park depend on the forest officials for permits and for access to the forests. They cannot go against the forest officials by reporting this.
So that leaves nobody to actually report figures, which is disturbing.
The law and media somehow, convolutedly, seem to right now act as a deterrant in the conservation process. What tigers have gone, have gone. The need of the hour is to preserve what is left rather than punish those who have erred.
If there was some way of emancipating the forest officials once, so that figures are voluntarily disclosed truly (with the guarantee that no action will be taken against them), we may be able to get the correct numbers, and remedial measures can be undertaken with speed. Right now, the problem areas never come to light until past the time of debacle.
Additionally, researchers should not have to depend on forest officials for their permits. I think there is already something being done in this direction, though I do not have the details.
Labels:
wildlife
Monday, December 05, 2005
Subscribe to:
Posts (Atom)