Monday, November 08, 2010 at 12:01 AM.

system.verbs.apps.uBASE.examples.allNightStates

<<run this overnight to watch for memory leaks

local (fnum);
bundle { <<start up uBASE, open the file
	local (ubasefolder);
	ubase.launch ();
	ubasefolder = file.folderFromPath (ubase.appinfo.path);
	fnum = ubase.openFile (ubasefolder + "States Database")};

bundle { <<visit all the records in the database
	local (key, x);
	loop {
		key = states.nthState (random (1, 50));
		if not ubase.lookupRecord (fnum, key, @x) {
			scriptError ("there is no record for " + key + ".")};
		msg (key + "; " + x.capi + "; " + x.abbr);
		ubase.deleteRecord (fnum, key);
		ubase.addRecord (fnum, key, @x);
		if random (1, 50) == 35 {
			msg ("Validating file...");
			msg (ubase.validateFile (fnum));
			clock.waitSeconds (3)}}}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.