Archive for the 'Coding' Category

Oracle Core Dump Grapher

Thursday, March 20th, 2008

Anyone who has ever spent any significant amount of time working with an Oracle database has probably seen a ORA-600 or ORA-07445 “exception encountered: core dump” trace file.

Unfortunately, when you come across an Oracle core dump you can’t do much more than send the dump to Oracle and hope the issue is already resolved in a newer version, or that a patch is available for your current version.

This process usually consists of three steps:

  1. Collect the trace files related to the issue.
  2. Open a Service Request on Oracle’s Metalink site.
  3. Wait for a response

If you’re lucky, the first step is an easy one.
If you’re lucky you caught the first occurrence of the core dump and only need to shoot off a single trace file to the guys at Oracle.

On the other hand, if you’re not lucky, you might be handed 50-60 trace files spanning multiple weeks and be asked to sort them by distinct issue for reporting to Oracle.

I’m not lucky.

Sorting the trace files is a long process which involves searching the trace file for the dump, researching the issue on Metalink, finding similar issues on Metalink, and then sorting the trace files by those issues.

Two trace files into the process I knew there had to be a better way.
Well, what better way to organize trace files than by the stack trace that generated the dump?

From that idea TraceFileGrapher was born.

The TraceFileGrapher takes as input a directory of trace files, and creates a graph representing the call stacks of all of the trace files resulting in core dumps. The graph is then saved as any Graphviz compatible format of your choosing.

The graphs themselves are simple. The starting nodes of the graph are colored green. The ending nodes are colored red. For a stack trace graph, the end nodes are the names of the trace files in which the core dump appeared. For a PL/SQL Call stack graph, the end nodes are the final PL/SQL function or procedure call name.

Example Graphs

In addition to graphing core dump stack traces, TraceFileGrapher can graph PL/SQL Call Stacks as well.

The TraceFileGrapher requires Perl, the Graph::Easy Perl module, and the Graphviz open source graph visualization software.

Get the TraceFileGrapher here.

GoGeocode PHP Library Release

Tuesday, February 26th, 2008

Over the past two months or so I’ve been playing with an old pet project of mine that I tend to peck away at when I can’t think of a better to work on.

As part of this project I found myself needing to do a massive amount of geocoding in PHP.

After searching through the various PHP based geocoding libraries online I came to notice that none of them seemed to make use of the APIs ability to return multiple points as well as informational data about each point.

Thus GoGeocode was born.

GoGeocode is an extremely small set of classes for use in querying both the Google and Yahoo geocoding APIs.

I’ve released the code under the MIT License and posted the code at http://code.google.com/p/gogeocode/

Take and enjoy!

Update: The GoGeocode page has been updated with a description, example use case, and a tar.gz archive of the gogeocode-0.1 release tag from SVN.

FreeRice.com and Automaton

Monday, November 19th, 2007

I had recently become aware of a website named FreeRice.com. This site provides a vocabulary game where one identifies synonyms for words with an ever increasing difficulty. Since I could always use a better vocabulary the site intrigued me. I played the game for a few hours but was in no way satisfied with my progress. At roughly one correct answer every two seconds I’d rank up 18,000 grains of rice an hour. Unfortunately, once I reached the higher levels I was averaging only 3 out of every 4 questions right.

While 13,500 (75% of my estimated optimal efficiency) grains of rice is a lot, it was nowhere near satisfactory. After joking about my “horrible rice metrics” at work, I mused that I should write a Greasemonkey script which would play the game better than I could possibly hope to. As the rest of my work day rolled on I became more and more intrigued by the idea. There was absolutely no reason why I couldn’t write a very simple AI to play the FreeRice.com game.

Were there reasons why I shouldn’t?

I knew the most obvious reason:
This wasn’t a controlled experiment. If the script spun out of control and was allowed to play over and over I could risk exhausting FreeRice.com’s funds.

Because I didn’t want to be responsible for the downfall of a potentially lucrative source of food for impoverished children I initially abandoned my bot. Despite my fears, curiosity eventually got the best of me and I began implementing my bot. I started by implementing a simple timing method limiting page requests to once every 10 seconds for debugging purposes, just in case.

(more…)

More Fun with Greasemonkey

Tuesday, October 30th, 2007

The past month has been a difficult one. Between readying the apartment for winter, various chores, and social obligations, I’ve had little time for my own personal projects. Recently however I came across a few things that I just couldn’t pass up.

(more…)

Experts Exchange Part 2

Sunday, October 28th, 2007

It would seem that Experts Exchange has changed their free access strategy. Where they would once display the normal solutions to a question hidden under a weak rot13 encryption, they have finally chosen to hide the articles all out unless one signs up for an account.

I for one welcome the change. Since it was their intention to only provide answers to registered users in the first place, moving away from obfuscated text helps clarify the site’s goals.

As a result of this site change I’ve been asked by a number of anonymous visitors to my site to rewrite my script to fetch the answers to an article so they don’t have to log in. I would like to make it clear that given the sites new design, that a script to display the answers is no longer possible. As such no effort will be put forth to do so.

Sorry to anybody who had their hopes up, but you can’t un-hide what isn’t there.