Custom Tools

I was called by my boss to work on a tough problem. The previous developer spent a week on it and got nowhere. Great. Now the pressure was on. I was given a day to figure things out. So I got down to business. Had to try many things to replicate the problem in a development environment.

Sometimes I needed to update configuration data in the database. Most of the time I had to run some queries to figure out which values needed to be updated. Or I needed to run some specific pieces of some jobs, which turned out to be stored procedures. I figured there had to be a speedier way to do all this.

There is a better way. Create a tool to automate what I need done. What better language to implement this tool than Java? Figured I would use the easiest database access method I could think of. That would be JDBC. Unfortunately the last time I played with JDBC, I used it with a MySQL database that was running on my computer. Now I needed to access an Oracle database running on some huge server.

Luckily most of the ideas in JDBC transcend specific database choice. Just had to figure out the connect string. Turns out I could use an OCI driver that made use of a TNSNAMES alias. That was sweet. Took a while to get it working though. The real breakthrough came when I read the release notes for my Oracle 11g client that was installed locally. Turns out I needed to ensure a JDBC jar file was in my classpath.

My initial cut was a little slow for each action. That's becuase I was creating and closing out a session every time a task needed to be executed. Instead I need to refactor this to reuse one database connection that gets established when my tool starts up. That should be an easy enough fix. I wonder whether it is time to share my little tool with the other developers on my team?

Right Tool for the Job

I am dealing with this game system that cannot handle too many views to the ranking system. Sheesh. What is a developer to do? Scrape the screens, reengineer the data, and put up some new pages. That's what. I already grabbed the HTML output from a bunch of ranking screens. Now I need to parse through the heavy HTML and extract the raw data. Java is my tool of choice for this task.

I got a bunch of files. And I have studied them to learn the pattern of how the web pages are laid out. Now I need to go through the HTML, line by line, and grab the raw data. Luckily each page seems to fit a pretty well defined pattern. I just need to teach my Java code to read for the data like my own eyes can now.

Heck. Maybe I will even write the new implementation using Java. The original product was written in PHP. I suspect they have a MySQL backend database. For my first try, I plan to grab the data and stick it in an Oracle database. However it could just as easily work with a MySQL database.

The only question is that once I have an optimized replacement system, what language will I use to serve up the data? PHP? Java? Or maybe something else. For now Java seems best. I actually don't know PHP. So that is a main consideration.