Wednesday, September 12, 2012

JQuery Time Picker

Hi guys,

Dynamic web applications make use of the date frequently but there certain moments when there is need to pick the time as well, e.g. online booking for appointments at a clinic, restaurant etc. I came across this wonderful jquery control for picking up the time. I thought its worth sharing, so here is the link:



Source : http://haineault.com/media/examples/jquery-utils/demo/ui-timepickr.html

Collection of Awesome PSD Buttons


20 Fantastic PSD Web Button Packs

Buttons add a ton of personality to your site, so much so that they can often define much of the impression of the aesthetic quality of the page. One way to start off in the direction of a solid design is to grab some high quality button graphics.

Collection of Awesome PSD Buttons

Free Button Collection


Collection of Awesome PSD Buttons

Chunky 3D Web Buttons


Collection of Awesome PSD Buttons

38 “Call to Action” Button Templates That Really Stand Out

Make it big, make it clear, make it delicious. That’s the primary rule of successful “call to action” button, a button that leads your site visitor to your defined target such as product purchase or site conversion. While there is in-depth article that briefs about guidelines, best practices and examples to create a deadly effective “call to action” buttons, few might failed to achieve it due to issues like insufficient design skill or time.

Collection of Awesome PSD Buttons

Web Buttons in PSD (Pack of 60)


Collection of Awesome PSD Buttons


Source : http://superdit.com/2011/05/19/58-freebies-psd-web-button-packs/

How to calculate CPU usage of a PHP script


There are many PHP scripts that calculate it’s execution time, memory usage and even the number of queries sent to databases.

All of these indicators are extremely important when testing the code to optimize it later. For me, however, there is still one parameter missing: the percentage of time the processor spends on execution of the PHP script itself!

Solution
In most cases, the calculation is very simple. Just use the built-in getrusage() function:


function onRequestStart() {
 $dat = getrusage();
 define('PHP_TUSAGE', microtime(true));
 define('PHP_RUSAGE', $dat["ru_utime.tv_sec"]*1e6+$dat["ru_utime.tv_usec"]);
}

function getCpuUsage() {
    $dat = getrusage();
    $dat["ru_utime.tv_usec"] = ($dat["ru_utime.tv_sec"]*1e6 + $dat["ru_utime.tv_usec"]) - PHP_RUSAGE;
    $time = (microtime(true) - PHP_TUSAGE) * 1000000;

    // cpu per request
    if($time > 0) {
        $cpu = sprintf("%01.2f", ($dat["ru_utime.tv_usec"] / $time) * 100);
    } else {
        $cpu = '0.00';
    }

    return $cpu;
}

?>

Instruction for this script is fairly simple. You have to call the onRequestStart() function during the start of application. Then later in the code you can call the getCpuUsage() function any time you want to get the current CPU usage of your program (preferably you should do this by the end of the script).
Source : http://php.webtutor.pl/en/2011/05/13/how-to-calculate-cpu-usage-of-a-php-script/