Archive for February 2009

Renicing processes for better performance

Friday, February 27th, 2009 by tburns

I was asked to write a script that could be run from cron that would prioritize processes running on an application server running Oracle Unbreakable Linux v.5. The intention was to increase application performance.

I wrote a simple script to ‘re-nice’ select processes. Nice and Renice operate on the principal that the lower the value of the process (the scale is from -20 to +19), the higher the priority the process has on CPU time. In other words, a process that is nice to others, is +19. One that isn’t so nice is at -20. In function then, a process that requires lots of immediate CPU time such as an RTP-specific application running voice-related services (as was the case in this example), may benefit from running at a higher priority (thus as a negative on the niceness scale) than, say, sendmail, which can queue and resend without, necessarily, a degradation in service.

Read more »

date conversion using the linux command line

Saturday, February 21st, 2009 by tburns

Here’s an alternative to finding an online resource to do all your unix time stamp conversions (e.g. Online Conversion). Frequently, I find myself needing to convert time stamps from database dumps or sql logs or Call Manager CDR/CMR dumps. The linux command line is your friend.

Simply use the ‘date’ command to do all the work. If the time entry is ‘1235264470′, and you want to convert that to human readable day-month-date-time format, use the ‘-d’ switch and prefix the string with an ‘@’ sign:

[tburns@localserver ~]$ date -d @1235264470
Sat Feb 21 19:01:10 CST 2009

Read more »

Simple Logging Class for PHP

Tuesday, February 10th, 2009 by Joyce Johnston

I hate using “echo” statements in PHP for debugging. Instead, I prefer to tail a log file. I wrote this little logging class that I can include in whatever project I’m working on.

(For Windows users unfamiliar with the tail utility, tail allows you to see data being written to a file in real time when set with the -f (follow) flag. See the manual page for details.)

To use the logger class, add the following to your script:

<?php
    include 'logger.php'; //include the logger class
    $logger = new Logger(); //instantiate a logger object
?>

If you like, you can pass the logging level of your choice and the path to the log file to the constructor.

Once you’ve done that, you can call any of the class methods on the logger object to write to your log file. I’ve set up the class so you can use four different levels of logging. There are also methods to log the session and the request.

Read more »

Directing calls in and out a specified fxo port

Tuesday, February 10th, 2009 by tburns

I was asked to install a new analog circuit on a UC520 system to add to the several existing analog lines already on the box. The company was adding a new product line, and wanted the new line, with the new number to display a different caller-id than the company had been displaying when placing outbound calls. In other words, there were no new employees in Company ABC, they simply wanted a different visual presence to show their customers when working the phones for the new product line which they were calling, Company XYZ.

To do this, I created a new trunk group via a global config command:

!
trunk group  xyz
 description outgoing xyz calls
!

Read more »

Mootools 1.2 Menu Slider

Sunday, February 8th, 2009 by Joyce Johnston

This elegant menu slider effect was inspired by Sliding Javascript Menu. I’ve recreated it in Mootools 1.2.

Take a look at the demo, then read on for the HTML, CSS and Javascript to create your own.

Read more »