Technically, this isn’t random, but it met my needs. I wanted to read an arbitrary number of lines from a 4GB text file to spot check data we had loaded. What is below does the following: 1) get the file…
Author: Steve
JAAS with Client/Server socket example
What is below is a hack on the same example floating all around the internet for using JAAS with Kerberos (Active Directory, in this case). This extends the example to send the ticket over a network socket to the server.…
Healthy socket activity shown in wireshark
I am a TCP/IP neophyte. I know just enough wireshark to muddle my way through a conversation, and am always looking to stretch that knowledge. Below is a screenshot of a java program that simply opens and closes a socket.…
Weblogic simple Queue publish and subscribe
This is a total rip from the oracle site, but sometimes other sites content changes. As such, I wanted to post it here after I worked through it and enhanced it a bit. I created the queue using the admin…
Determining the order of java classes called
I thought this was pretty interesting, and perhaps incredibly useful. While attempting to understand the call stack (and being too lazy to read through reams of source code), I found that calling a java class will result in stat() system…
Hadoop HA namenode example
In earlier versions of hadoop, the namenode was the Achilles heel. While there was the option of failing over to a secondary namenode, this required manual intervention, or heavy scripting at best. Even then, failover wasn’t instantaneous. With Hadoop 0.23…
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 {…
PURGE DBA_RECYCLEBIN taking a long time
Just check DBA_SEGMENTS for SEGMENT_NAME like ‘BIN%’, and it should be dropping in number… SQL> select count(*) from dba_segments where segment_name like ‘BIN%’; COUNT(*) ———- 2307 SQL> select count(*) from dba_segments where segment_name like ‘BIN%’; COUNT(*) ———- 2297 SQL> select…
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 =…
HBase Phoenix JDBC example
Phoenix is an apache project that attempts to provide an ANSI SQL standard interface to HBase data. This is just a quick implementation of it. Notice it has transactional semantics. Code below… import java.sql.*; import java.util.*; public class phoenixTest {…