This simple network trace shows the essential elements of a network interaction between a client and a server. For our test, we use the following for the client… import sys, socket, time remote_ip = socket.gethostbyname(socket.gethostname()) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #s.setsockopt(socket.IPPROTO_TCP,…
Category: Development
Loading compressed data into MySQL in batches from python
We used what is below to load 12 million rows into a laptop MySQL database in 48 minutes. I’m sure it can be improved, but we were initially OK with this result. import gzip, os, sys, string, mysql.connector fd =…
Connection Reset – What does it mean?
Generally, it indicates your client successfully connected to the server. A subsequent attempt to use the client connection failed after the server closed the socket, or had been disconnected for any reason. You can prove this with what is below,…
ORA-01002: fetch out of sequence in ATG BCC
We had an issue during a deployment in which an ORA-01002 was thrown. The interesting part is when we compile and run what is below… import java.sql.*; public class test { public static void main (String args[]) throws Exception {…
Simple camel project with full maven instructions
Generate maven project stub directory… mvn archetype:generate -DgroupId=com.yourcompany.it.arch.poc.esb -DartifactId=esbpoc -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false …then create the single class in our POC… package com.yourcompany.it.arch.poc.esb; import javax.jms.ConnectionFactory; import org.apache.activemq.*; import org.apache.camel.*; import org.apache.camel.builder.*; import org.apache.camel.component.jms.*; import org.apache.camel.impl.*; public final class App { public static…
Printing java command line flags
Just a quickie as I often forget this for some reason. If you need to obtain a particular switch, whether the default or as configured in a running process, what is below will get it for you. Normally, outside of…
Creating a barcode in java
Nice little library to do this is located at http://www.barcodelib.com/java_barcode/main.html… import com.barcodelib.barcode.*; public class MyBarCode { public static void main (String args[]) throws Exception { Linear barcode = new Linear(); barcode.setType(Linear.UPCA); java.util.Random r = new java.util.Random(); String str = new…
“Unable to find valid certification path to requested target” exception
In a JBOSS environment, the issue was the connector in the server.xml file is only used for *inbound* connections, not ones out from JBOSS to another SSL enabled service. If you compile and run the following test class below… [sa-jboss@cmhldecomecm01…
Birthday paradox in python
I love things like this. Earlier, we produced a working example of the Monte Hall problem. In this post, we show something similar for the birthday paradox… c:\Python27>type c:\Users\showard\bday.py from random import randint cnt = 0 for k in range(2000):…
Verifying an SSL certificate expiration with java
We came up with this as a one-off to alert us when a certificate was close to expiration (we were burned one too many times)… import java.net.*; import java.security.cert.*; import javax.net.ssl.*; public class GetCertDates { public static void main(String []…