Small Javascript, great annoyance

What happens if a browser loads an HTML page like this one?

<html>
<head>
<title>Test 1</title>
<script language="JavaScript">
while(true);
</script>
</head>
<body>
</body>
</html>

Or this one?

<html>
<head>
<title>Test 2</title>
<script language="JavaScript">
while(true)
    alert("free porn movies one click ahead ;) ");
</script>
</head>
<body>
</body>
</html>

Or this one?

<html>
<head>
<title>Test 3</title>
<script language="JavaScript">
var x = new Array();
var y = x;
while(true) {
	y[0] = new Array();
	y = y[0];
}
</script>
</head>
<body>
</body>
</html>

Continue reading

Keeping things in (partial) order

I this thread I will discuss about making order in our life… well… at least in a long vector of objects… OK, just a small part of that vector.

This is a fundamental aspect of search engines: you are interested in getting only the k most relevant results, whatever the size of the collection you are searching on is.
The k value is usually very small with respect to the collection size, e.g. on the Web one is likely to look at just the first ten-twenty results. Search engines typically set a z value of maximum returned results that is designed to be larger than the largest part of possible k values, e.g. Google returns at most one thousand results.
Continue reading