Category: Development

Finding sensitive data in a heap dump

What is below proves the card holder PAN is in the clear in the dump… public class memSecurity { public static void main (String args[]) throws Exception { String c = “1234567887654321”; Thread.sleep(180000); } } Compile and run what is…

Calculating gaps between full CMS cycles

While troubleshooting a performance issue, we had a need to graph the number of seconds between full collections. We used what is below. This assumes you have added -XX:+PrintGCDetails and -XX:+PrintGCDateStamps as well as a file location for -Xloggc: to…

Dump heap programatically

This is one way you can dump the heap of a running JVM from within a page. This is not something you would place in a running production system, as you don’t want random GET’s to keep dumping the heap…

JDBC batch re-processing

I have always wanted to duplicate how GoldenGate handles batch failures. In GoldenGate, you can set the parameter “batchsql BATCHTRANSOPS 2000”, for example, to send 2000 statements at a time to the database for execution. In general, this is far…

Querying Active Directory from java

This is just a stub I often use when configuring AD authentication for various applications. Invariably, I can use this to quickly determine why a given application configuration may be failing. import java.util.Hashtable; import javax.naming.*; import javax.naming.directory.*; class TestAD {…

Python, cookies, and session management

While working with an external vendor, we had a need to understand how to manage HTTP session cookies with python. This is simply how we did it… import urllib, urllib2, cookielib, re cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) home =…