Monday, April 27, 2009

Weekend Coding

Got a couple of neat things done on the weekend.

Wrote a function to log database calls to FirePHP. Every query now logs time to execute, rows returned/affected, SQL string, function performing the call. 3 lines of code needed for each SQL call. Very nice.

EDIT - this is mainly for debugging purposes. The App itself has an internal audit trail of who changed what, and when...

Finally got around to making the app create groups automatically, based on network segment. For example, if you audit a PC that is on 192.168.0.50 255.255.255.0 the app checks if there is a group that fits these criteria (192.168.0.0/24). If it exists, the PC is added to that group, if it doesn't exist it's created and the PC added. I just have to finish the assigning of User rights to the newly created group.


As an aside, I installed Ubuntu 9.04 (Jaunty Jackalope) on the weekend. I also re-installed Windows XP. It amazes me that people say Linux is difficult to install. Obviously they haven't tried it for years. Ubuntu install == 1 hour (installed, patched, configured). Windows XP install == 4 hours (installed, patched, configured + some additional apps). Windows, with the need to install drivers and reboot, install patches and reboot and install additional applications to get a functional system, is so much slower and more difficult. I implore anyone reading this - go download Ubuntu and try it. You can do so without affecting your installed system (Ubuntu has what's called a "Live CD" - boot from it and you can try the OS without affecting your Windows install).

Ubuntu user since 5.04 and loving it more with every release. [/Zealot rant] :-)

2 comments:

  1. Why not log in the database itself?

    Is easy with PostgreSQL at least to enforce automatic logging of insert/update/delete ops with a single log table, triggers (one per monitored table) and a simple stored procedure. I've also added create/modify timestamps to my tables, and the procedure updates these along with the log table.

    ReplyDelete
  2. I suppose you could - but it's more for debugging and I wouldn't envision it running all the time (at all, in Production). The App itself logs any user initiated changes, along with user details. It has an "audit trail" feature - user, time, changes made - inside the app.

    ReplyDelete