Category: Python

Unexpected end of file from server

The “java.net.SocketException: Unexpected end of file from server” exception is thrown in the HTTPClient class, as well as others. This article simply provides an example of how to generate it for testing purposes. We start with a client class that…

Market Basket Analysis with python

Very elegant example at http://blog.derekfarren.com/2015/02/how-to-implement-large-scale-market.html. What is below is just a complete script with what the link above provides, along with example of our output. Our file was formatted slightly differently, so we had to change the split command. We…

Weblogic stuck thread printer

This is a useful script for crawling the Weblogic domain logs and printing threads that have been stuck, as well as the duration they were stuck. It doesn’t include the initial ten minute (default) window before a log entry is…

What is the most likely dice roll?

Probably common sense, but this statistically supports the most common roll of the dice. Of course, this assumes physical normalcy of the die, not loaded, etc. 🙂 [root@cmhlcanlyodb01 ~]# cat rand.py import random d = dict() for i in range(1,100001):…

Reading random lines with python

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…