lunedì 31 gennaio 2011

Oracle objects determine creation date

<code type="sql">
select OWNER, OBJECT_NAME, to_char(CREATED,'MM/DD/YYYY HH24:MI:SS')
created, status from dba_objects
where OWNER in ('MYSCHEMA') and OBJECT_TYPE='VIEW'
order by OWNER,OBJECT_NAME
</code>

giovedì 20 gennaio 2011

Java StackStrace to String

<code type="java">
catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
System.out.println(sw.toString().toUpperCase());
}
</code>

martedì 11 gennaio 2011

Return Userdn form a LDAP search

<code type="java">
SearchResult searchResult = null;
if (namEnum.hasMore()) {
searchResult = (SearchResult) namEnum.next();

// Build the User DN
userDN = searchResult.getName() + "," + sAPPEND_BASE_DN;
} else {
// User not found
throw new NamingException(" Invalid Username ");
}
System.out.println("User DN="+userDN);
</code>