web analytics

JavaScript: build table dynamically

<script type="text/javascript"> function buildTable(n_rows,n_columns) { var the_body = document.getElementsByTagName("body")[0]; <code>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); } […]

Oracle: transpose data table (rows into columns)

CREATE TABLE MAIN_TBL ( magazine VARCHAR2(10), region VARCHAR2(5), quantity int ); INSERT INTO MAIN_TBL VALUES ( ‘Playboy’,  ‘Nord’, 1 ); INSERT INTO MAIN_TBL VALUES ( ‘Playboy’,  ‘East’, 2 ); INSERT INTO MAIN_TBL VALUES ( ‘AutoWeek’, ‘Nord’, 3 ); INSERT INTO MAIN_TBL VALUES ( ‘AutoWeek’, ‘West’, 4 ); INSERT INTO MAIN_TBL VALUES ( ‘Wired’,    ‘Nord’, […]