Lyrics:: Mone pore by Warfaze

Thursday, November 18, 2010 Posted by Md. Monjurul Hasan 0 comments
One of my fav bangla song...

mone pore shei raater kotha
tumi ami nodi tire eka boshe
koto je gaan koto je shur koto je kotha
mone pore ki tomar o
bolo na amay tumi bolona hmm

mone pore shei diner kotha
kedechhile amito kokhono chaini
tomay koshto dite
tumi ki ta jano na
bolo na amay tumi bolona hmm

jani ami tumi je amar
tobu keno dishehara
bhabi ami timi je pashey
tobu keno achho dure
mone pore

jani ami emonee jibon
tobu jaage mone asha
hoyejabe shofol ey jibon
jodi tumi thako paashe

mone pore shei raater kotha
tumi ami nodi tire eka boshe
koto je gaan koto je shur koto je kotha
mone pore ki tomar'o
bolo na amay tumi bolona hmm

কালবৈশাখীর পূর্বে

Thursday, April 29, 2010 Posted by Md. Monjurul Hasan 1 comments

Known as kalboishakhi, the thunder storm...at its very best! love this wild side of nature...

Intranet in a box

Wednesday, April 21, 2010 Posted by Md. Monjurul Hasan 0 comments
While searching for drupal based application, I have found Open Atrium and it looks to me very useful for different team based works. Open Atrium is an intranet in a box that has group spaces to allow different teams to have their own conversations. It comes with six features - a blog, a wiki, a calendar, a to do list, a shoutbox, and a dashboard to manage it all. Enjoy drupal!

http://openatrium.com/features

GP AloAshbei Platform

Friday, March 19, 2010 Posted by Md. Monjurul Hasan 0 comments
Just being successful using GP Aloashbei 'SMS send' API with PHP. This API is in beta version and not released yet. This is really a nice and futuristic approach by grammenphone (in collaboration with Microsoft). SMS can be easily send to a gp number from a web application, all you need is to register your number at first at gp aloashbei site. I will upload my code and class soon. visit https://www.aloashbei.com.bd for details.

Working with Flickr API

Saturday, January 23, 2010 Posted by Md. Monjurul Hasan 0 comments
Just wrote a program to fetch image from Flickr using Flickr API and watermark text on it by PHP. There are many applications for transferring flickr images to facebook, but found no application for transferring facebook images to flickr. Soon going to work on it.

Export RRD Values to MS Excel

Sunday, November 1, 2009 Posted by Md. Monjurul Hasan 0 comments
I have used a nice, simple script to export the rrd values into excel using PHP 5. You can find the script here:

http://code.google.com/p/php-excel/

Here is my code for the rrd export (here you'll find two functions - calculate_rrd() and format_bits(), these are described in my previous blog):

/*
Author: Md.Monjurul Hasan

Description
- RRD data exporter - output values into excel file
*/
/***************included files*******/

#include the export-xls.class.php file
require('export-xls.class.php');

$filename = 'rrd_export'.rand(0,10000).'.xls'; // a random filename chosen
#create an instance of the class
$xls = new ExportXLS($filename);

//read config file and get variables
$rrd_array = array ('rra/test1.rrd', 'rra/test2.rrd');
//export to excel
$header = " RRD Export"; // single first col text
$xls->addHeader($header);

#add blank line
$header = null;
$xls->addHeader($header);

#add 2nd header as an array of 3 columns
$header[] = "RRD Name";
$header[] = "Cur In";
$header[] = "";
$header[] = "Cur Out";
$header[] = "";
$header[] = "Avg In";
$header[] = "";
$header[] = "Avg Out";
$header[] = "";
$header[] = "Max In";
$header[] = "";
$header[] = "Max Out";
$header[] = "";
$header[] = "95% In";
$header[] = "";
$header[] = "95% Out";
$header[] = "";

$xls->addHeader($header);

$count = 0;
for ($c = 0; $c < count($rrd_array); $c++) {
$ret = calculate_rrd($rrd_array[$c], $graph_type); // graph type is daily/weekly/yearly and monthly
$row = array();
$row[] = $rrd_array[$c];
$result = format_bits($ret['current_in']);
$row[] = $result[0];
$row[] = $result[1];
$result = format_bits($ret['current_out']);
$row[] = $result[0];
$row[] = $result[1];
$result = format_bits($ret['average_in']);
$row[] = $result[0];
$row[] = $result[1];
$result = format_bits($ret['average_in']);
$row[] = $result[0];
$row[] = $result[1];
$result = format_bits($ret['max_in']);
$row[] = $result[0];
$row[] = $result[1];
$result = format_bits($ret['max_out']);
$row[] = $result[0];
$row[] = $result[1];
$result = format_bits($ret['percentile_in']);
$row[] = $result[0];
$row[] = $result[1];
$result = format_bits($ret['percentile_out']);
$row[] = $result[0];
$row[] = $result[1];
$xls->addRow($row);
}
//output the excel file
$xls->sendFile();

?>

Percentile Calculation using PHP, RRDTool API

Posted by Md. Monjurul Hasan 1 comments
I needed the rrd values in tabular format rather than graph. So i fetched the rrd values using rrd_fetch() function of PHP-RRDTool API. Then I calculated the required Current, Average, Max and 95th Percentile using the following function which may save time of others:

/***
Function RRD Calculation

@input param1: rrd filename with location e.g /var/lib/mrtg/test.rrd
param2: graphtype e.g daily, weekly, monthly,yearly etc
@output array containing current_in, current_out, average_in, average_out, max_in, max_out, percentile_in, percentile_out values (in bits)

***/
function calculate_rrd ($rrd, $graphtype) {

$data_bits_in = array();
$data_bits_out = array();
$data = array();

if($graphtype == "daily") {
$timelength = "-1d";
$endtime = "-5min"; //endtime is required to avoid last nan values
}
else if ($graphtype == "weekly") {
$timelength = "-1w";
$endtime = "-30min";
}
else if ($graphtype == "monthly") {
$timelength = "-1m";
$endtime = "-120min";
}
else {
$timelength = "-1y";
$endtime = "-1440min";
}
$rrdparams = array ("AVERAGE","--start", $timelength, "--end", $endtime,);

//fetch rrd values using API
$ret = rrd_fetch($rrd, $rrdparams, count($rrdparams));

//start calculation
$data = $ret ['data'];
$data_limit = count ($data)-2;
$data_bits_limit = $data_limit/2;

for ($i = 0; $i < $data_limit;$i++) {
if ($i%2 == 0) {
if (is_nan($data[$i])) $data_bits_in[$k] = 0;
else $data_bits_in[$k] = (int)($data[$i]*8); $k++;
} else {
if (is_nan($data[$i])) $data_bits_out[$j] = 0;
else $data_bits_out[$j] = (int)($data[$i]*8); $j++;
}
}

//get current/average/max value from rrd data

$result['current_in'] = $data_bits_in[$data_bits_limit-1]; $result['current_out'] = $data_bits_out[$data_bits_limit-1]; $result['average_in'] = array_sum ($data_bits_in)/$data_bits_limit; $result['average_out'] = array_sum ($data_bits_out)/$data_bits_limit; $result['max_in'] = max ($data_bits_in);
$result['max_out'] = max ($data_bits_out);

//percentile calculation
sort($data_bits_in);
sort($data_bits_out);
$pos = round($data_bits_limit*0.95);
$result['percentile_in'] = $data_bits_in[$pos];
$result['percentile_out'] = $data_bits_out[$pos];

//return the result
return $result;
}
For percentile calculation, I followed the following article:
http://forums.cacti.net/post-95140.html&highlight=

To represent the values in bps/kbps/Mbps, you can use the following function:

/***
Function format value from bit to bps/kbps/Mbps

@input : bits
@output array: array[0] = value
array[1] = bps/kbps/Mbps

***/
function format_bits ($bits) {
$round_precision = 2;
if ($bits < 1000) {
$result[0] = round($bits,$round_precision);
$result[1] = "bps";
}
else if ($bits >= 1000 && $bits < 100000) {
$kbits = $bits/1000;
$result[0] = round($kbits,$round_precision);
$result[1] = "kbps";
}
else {
$mbits = $bits/(1000*1000);
$result[0] = round ($mbits, $round_precision);
$result[1] = "Mbps";
}
return $result;
}

Lyrics :: Rupok by Artcell

Friday, September 11, 2009 Posted by Md. Monjurul Hasan 0 comments
Rupok (Ekti gaan)
Kotha: Rumman

Moner vitor juddho chole amar sharakhon
Neshar moto thomke thake
Klanto a jibon
Dhongsho smritir parey boshe amar ahoban
Dhukkho vule notun kore
Likhchi tomar a gaan

Michil vanga nirjonotay dariye eka
Alor nicher ondhokare smritir dekha
Char deyaler shobdo gula ekhon shudhoi chai
Meghe Dhaka shohor tate tui kebol nai
Moner vetor changa ghorar adim ayojon
Shunnotay dube thake amar sharakhon
Niyom vangar mogoz jure ekhon shudhoi chhok
Tepantor er nirbashone hariye geche rupok

Monei juddho amar nijer shathey lori
Smritir deyal chuye hazar murti gori
Chokher dekhay ja dekhi
Aar hoyni ja dekha
Ovimaaner nodir teer a
Datiye thaki eka

Vul jonme koshto amar lekhar aposhe
Odekha ek shorgo vashe ochena akashe
Moner vetor juddho ekhon
Amar shararaat
Ondhokarer kolahole dhorchi
Tomari haat

Ekla vishon amar ghore
Smritir hahakar
Aloy chaichhi niviye debo
Molin ondhokaar
Moner vetor juddho chole amar sharakhon
Mohakale miliye geli hothat kokhon
Labels: ,