18 June, 2008

HowTo override and substitute document.write function in JavaScript (sample)

It is pretty simple to wrap document.write function in JavaScript.

For example - using closures:
<script id="source" type="text/javascript">
function wrapString(str) {
return "(" + str + ")";

document.write = function(w) {
return function(s) {
w.call(this, wrapString(s));


This "advanced piece of engineering" prints string: (Hello)(world)

How do you like it?

15 June, 2008

HowTo batch remove temporaty files from directory and subdirectories

Just create .bat file with this content:

@set path=
@for /R %%i in (*.tmp *.bak) do @del %%i

and update (*.tmp *.bak) section with your set of files or masks.