Archive for April, 2011

Intercept HTTP requests with Squid

Posted in Systems Administration on April 20th, 2011 by Jeff – Be the first to comment

On one of my projects we had some questions about how much bandwidth was being used by requests to a third party service but we didn’t have any a view beyond general traffic on the network interface. I hit upon the idea of using a transparent proxy to log requests then use log analysis to break out data transfer amounts per third party service. And since we already had squid as part of our infrastructure applications it seemed like a good choice.

The tricky part of this setup is that everything is hosted on the same hardware node and we also have some web services that needed to be left untouched. These requirements implied some network configuration using iptables to force outbound web requests through the proxy.
read more »

MySQL udf_median on Windows

Posted in MySQL on April 19th, 2011 by Jeff – 1 Comment

A few years ago I had to get a MySQL UDF (User Defined Function) working on my Windows workstation for a project I was working on. I had the benefit of a couple of other folks to help me get my environment set up and a .dll compiled. I was recently contacted about my project files and realized I had an orphaned link out on the Internet so I thought I’d better fix that up.

read more »

“select count” with Generics, Spring and Hibernate

Posted in Software Development on April 18th, 2011 by Jeff – Be the first to comment

In a recent project, we introduced Generics and Spring into an application. In developing the Generic DAO implementation I was trying to find a way to get a record count from the database. It’s a simple enough task with HQL or Spring’s JdbcTemplate.queryForInt(String sql), however the Generics made it a little tricky. The solution I came up with was using HibernateCallback. A reference to the persistent type is a member of GenericDAOHibernate as is the SessionFactory and an instance of Spring’s HibernateTemplate.

read more »