martedì 27 settembre 2011

Excel determinare le difference tra due fogli

Tramite una formula di Excel che confronta celle corrispondenti di una stessa riga è possibile determinare se una riga è stata variata
eseguendo la seguente formula :   

lunedì 29 agosto 2011

OCPJP SCJP CX-310-065 Certification Exams examples sources.


In attatchment zip with some source example for OCP JP SCJP.

Zipped as ecplise project.

lunedì 22 agosto 2011

Clear content of users tables reviewd with exception handling

begin for t in (select table_name from user_tables) loop BEGIN execute immediate 'TRUNCATE table '||TRIM(t.table_name); EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line (' ERROR '); END; end loop; end;

venerdì 19 agosto 2011

Oracle total size of tables


Using the fooling SQL command in SQL Plus or TOAD:

SELECT SUM(BYTES) FROM USER_SEGMENTS WHERE SEGMENT_TYPE='TABLE';

this is the result


giovedì 21 luglio 2011

Clear content of users tables

begin for t in (select table_name from user_tables) loop execute immediate ' truncate table '||t.table_name; end loop; end;

Retrieve and set Oracle Charset


Retrieving

SELECT value$ FROM sys.props$ WHERE name = 'NLS_CHARACTERSET' ;


Settiing

ALTER DATABASE CHARACTER SET WE8ISO8859P1;


Usefull in exp imp command beetwen differente oracle databases with different charset.


 

mercoledì 29 giugno 2011

redirect jsp response to pdf file in file system

<%@ page import="java.io.*" %>
<%@ page language="java" session="false" %>
<%@ page contentType="application/pdf" %>
<%
String file = request.getParameter("file");
String filename = request.getParameter("filename");
response.setContentType("application/pdf");
response.addHeader("Content-Disposition","inline; filename=\""+filename+"\"" );
BufferedInputStream buf=null;
ServletOutputStream myOut=null;

try{

myOut = response.getOutputStream( );
File myfile = new File(file);

//set response headers


response.setContentLength( (int) myfile.length( ) );

FileInputStream input = new FileInputStream(myfile);
buf = new BufferedInputStream(input);
int readBytes = 0;

//read from the file; write to the ServletOutputStream
while((readBytes = buf.read( )) != -1)
myOut.write(readBytes);

} catch (IOException ioe){

throw new ServletException(ioe.getMessage( ));

} finally {

//close the input/output streams
if (myOut != null)
myOut.close( );
if (buf != null)
buf.close( );

}


%>Example of calling is :

pdf.jsp?file=C:\temp\a.pdf&filename=a.pdf