Tuesday, April 5, 2011

Monday, January 31, 2011

Changing Blogs

I've changed Blogs for now. Please note the new address...

http://www.crediblesolutions.net

Thanks for reading!

Eric

Thursday, December 30, 2010

CPU Utilization

Every way possible to dice CPU utiliztion on *nix.

http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html

I learned that sar is great! ( but sars is bad )

Monday, December 20, 2010

How do I do that Java 101 task again?...

I find that every new Java project I'm on, I run into a situation where I want to translate an InputStream to a String or vice versa. This is frequently in a unit test where I've read an input file or expected output file in using getClass().getResourceAsStream() and need to convert to Strings for use in my test.

It's a simple boiler plate task, yet darned if I can remember the most an effecient way to do it every time. I always re-google and always tend to refer to this one to jog my memory..

Thought I'd link out to it this time.

Wednesday, December 8, 2010

POM Search Site

I know this is obvious, but adding it I can reference in the future...

Get dependency tags for dependencies.
http://mvnrepository.com/

Friday, December 3, 2010

Hibernate shows SQL to log4j too

Log hibernate queries and more without using the show_sql = true setting in your hibernate config. This way you can see them in your log4j configured log files, not just in your STDOUT log.

# Hibernate logging
# Log everything (a lot of information, but very useful for troubleshooting)

log4j.logger.org.hibernate=FATAL
# Log all SQL DML statements as they are executed
log4j.logger.org.hibernate.SQL=DEBUG
# Log all JDBC parameters
log4j.logger.org.hibernate.type=INHERITED
# Log all SQL DDL statements as they are executed
log4j.logger.org.hibernate.tool.hbm2ddl=INHERITED
# Log the state of all entities (max 20 entities) associated with the session at flush time
log4j.logger.org.hibernate.pretty=INHERITED
# Log all second-level cache activity
log4j.logger.org.hibernate.cache=INHERITED
# Log all OSCache activity - used by Hibernate
log4j.logger.com.opensymphony.oscache=INHERITED
# Log transaction related activity
log4j.logger.org.hibernate.transaction=INHERITED
# Log all JDBC resource acquisition
log4j.logger.org.hibernate.jdbc=INHERITED
# Log all JAAS authorization requests
log4j.logger.org.hibernate.secure=INHERITED

Monday, April 19, 2010

Oracle Query Analysis

This is the best thing since sliced bread...

set autotrace on exp;
Run Some SQL!

It shows me the bottle necks in my SQL statement, where indexes might help, and give me a pretty accurate estimate on the time the statement will take to run. This is all done within a second for so.

Example output..



Elapsed: 00:00:00.01

Execution Plan
----------------------------------------------------------
Plan hash value: 1080733679

--------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 21 | 2 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 21 | | |
| 2 | NESTED LOOPS | | 1 | 21 | 2 (0)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| NG_FILES | 1 | 16 | 2 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN| PK_NG_FILES_ID | 1 | 5 | 0 (0)| 00:00:01 |
--------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

3 - filter("DATE_FILE_RECEIVED">=TIMESTAMP' 2009-12-16 00:00:00' AND
"DATE_FILE_RECEIVED"<=TIMESTAMP' 2009-12-17 00:00:00')
4 - access("NG_FILE_ID"="NG_FILE_ID")