JavaScript: build table dynamically


<script type="text/javascript">
function buildTable(n_rows,n_columns) {

var the_body = document.getElementsByTagName("body")[0];

var new_table = document.createElement("table");
var new_tbody = document.createElement("tbody");

var new_row, new_col, new_text ;

for(row=1;row<=n_rows;row++) {
new_row = document.createElement("tr");
new_row.className = "tr"+row ;
for(col=1;col<=n_columns;col++) {
new_col = document.createElement("td");
new_col.className = "td"+col ;
new_text = document.createTextNode("text:" + row + ":" + col );

new_col.appendChild(new_text);
new_row.appendChild(new_col);
}
new_tbody.appendChild(new_row);
}

new_table.appendChild(new_tbody);
new_table.setAttribute("border", "2");

the_body.appendChild(new_table);

return new_table ;

}
</script>
<body>
Example:
<script type="text/javascript">
buildTable(4,3)
</script>
</body>

There is also interesting article on oreillynet.com, discussing performance improvement for such operations.

Creation and using of Sybase DBCCDB database

Planning:

sp_plan_dbccdb '{dbname}'

Creation:

create database dbccdb on ... log on ...

isql -U sa -i $SYBASE/$SYBASE_ASE/scripts/installdbccdb

DBCCDB Configuration:

sp_configure "number of worker processes", {value_from_sp_plan}

-- create named cache for dbccdb
sp_cacheconfig "dbccdb_cache", "{cache_size}M"

-- Size is at least 40 * 16K * (number of working processes)
sp_poolconfig "dbccdb_cache", "{pool_size}M", "16K"

Working space configuration:

sp_dbcc_createws dbccdb, "default", scan_{dbname}, scan, '{size_from_sp_plan}'
sp_dbcc_createws dbccdb, "default", text_{dbname}, text, '{size_from_sp_plan}'

sp_dbcc_updateconfig {dbname}, 'max worker processes', '{value_from_sp_plan}'
sp_dbcc_updateconfig {dbname}, 'dbcc named cache','dbccdb_cache', '{size}'
sp_dbcc_updateconfig {dbname}, 'scan workspace','scan_{dbname}'
sp_dbcc_updateconfig {dbname}, 'text workspace','text_{dbname}'

dbcc checking:


dbcc checkstorage ({dbname})
dbcc checkverify ({dbname})

dbcc report:

sp_dbcc_summaryreport
sp_dbcc_configreport
sp_dbcc_statisticsreport
sp_dbcc_faultreport ['short'|'long']

-- all above
sp_dbcc_fullreport

Fixing the errors
Warning: just some tips here. See Sybase documentation for the complete description of the repair action

100035, 100025, 100021 - dbcc checktable ( %s , "fix_spacebits")
forwarded rows errors - reorg compact %s with resume , time = '%d'
Others:
Index code == 0 - dbcc tablealloc ( %s , "full" , "fix")
Index code != 0 - dbcc indexalloc ( %s , %s , "full" , "fix")

System tables require special processing - see Sybase documentation for the details