devadutta.net

bash emulation using Mootools

We recently posted our 500th question on Boiledbeans and to celebrate, we conducted a Live Quiz Contest.

I built a neat bash like interface for the quiz using Mootools ( and of course, Javascript and HTML ) and people really liked it!

Take a look at it here!

Screenshot:
bbterm

I am planning to make the code public in a while. Since the quiz is still alive, I cannot release it immideately.

Happy New Year!

Wish you a very happy and prosperous new year!

I was at my friend’s place yesterday for new year celebrations and we needed a random number generator to play bingo. Instead of writing numbers on chits and picking them up, I hacked together a random number generator using Javascript in about 15 minutes, which looked like this:

bingobaby

I used a simple hash to see that numbers did not repeat and It actually worked pretty well.  I was delighted at Javascript’s utility at non geek parties!

Here is the code:

<!-- Devadutta Ghat, last piece of code written in 2008 ;) -->
<html>
	<head>
		<title>Bingo Baby!</title>
<script type="text/javascript">
var gblHash=new Array();	
function getNewRand()
{
	return (Math.floor(Math.random()*99)+1);
}
function getRand()
{
	var ilm=getNewRand();
	var i=0;
	while(gblHash[ilm]==1)
	{
		i++;
		ilm=getNewRand();
		if(i>=100)
		{
			alert("All numbers done!");
			return;
		}
	}
	gblHash[ilm]=1;
	document.getElementById('randomNumber').innerHTML=ilm;
	document.getElementById('drawnNumbers').innerHTML
		+=(" "+ilm);
}
</script>
</head>
<body>
	<div id="randomNumber" style="font-size: 150pt;">-1</div>
	<input type="button" onClick="getRand();" value="Clicky!">
	<div id="drawnNumbers"></div>
</body>
</html>

And here is a demo

Enjoy 2009!

 
c++ ge incrementa?