• Subscribe to this RSS feed
  • Receive updates as soon as they are posted.
  • Subscribe to this RSS feed
  • Receive updates as soon as they are posted.

Mediawiki tutorials coming soon…

March 23 , 2008 In: MediaWiki

Currently I am working with Mediawiki version 1.11 and lots of things have changed and new things emerged during last 1 year. So i feel that my book “Mediawiki administrator’s tutorial guide” requires some additional writings as well. From April 2008, i will be writing new tutorials every week on Mediawiki including some hacks, extensions and template design.

I hope it will be helpful for all Mediawiki users and administrators :)

Installing CodeIgniter on IIS

November 29 , 2007 In: Code Igniter

I faced a serious problem during deploying one of my CodeIgniter application to a windows server running on IIS. After installing CodeIgniter the index.php page was not visible at all. I tried many ways to configure it but it does not show anything. A problem with SEF (search engine friendly) URL CodeIgniter follows. I searched the internet but couldn’t find a suitable solution or answer to the problem. After two day I found a very good and step by step solution for this problem.  You can have a look at it in the following URL.

Installing CodeIgniter on IIS

Bangla Currency (Taka) Formatting

November 28 , 2007 In: PHP

Today i wrote a simple code to convert a number to Bangladeshi currency (taka) format. the php format_number puts a comma (”,”) after every 3 digits which is not same for Bangladeshi currency. here is the simple function to do the job for yo. it can handle integer and decimal numbers.

function taka_format($amount = 0)
{
$tmp = explode(”.”,$amount); // for float or double values
$strMoney = “”;
$divide = 1000;
$amount = $tmp[0];
$strMoney .= str_pad($amount%$divide,3,”0″,STR_PAD_LEFT);
$amount = (int)($amount/$divide);
while($amount>0)
{
$divide = 100;
$strMoney = str_pad($amount%$divide, 2,”0″,STR_PAD_LEFT).”,”.$strMoney;
$amount = (int)($amount/$divide);
}

if(substr($strMoney, 0, 1) == “0″)
$strMoney = substr($strMoney,1);

if(isset($tmp[1])) // if float and double add the decimal digits here.
{
return $strMoney.”.”.$tmp[1];
}
return $strMoney;
}

an alternate way of doing this is via substr

function taka_format($amount = 0)
{
$tmp = explode(”.”,$amount);  // for float or double values
$strMoney = “”;
$amount = $tmp[0];
$strMoney .= substr($amount, -3,3 ) ;
$amount = substr($amount, 0,-3 ) ;
while(strlen($amount)>0)
{
$strMoney = substr($amount, -2,2 ).”,”.$strMoney;
$amount = substr($amount, 0,-2 );
}

if(isset($tmp[1]))         // if float and double add the decimal digits here.
{
return $strMoney.”.”.$tmp[1];
}
return $strMoney;
}

Downloading PHP 6.0 from CVS :)

November 27 , 2007 In: Uncategorized

just downloaded the php 6.0 files from php.net cvs . i am really curious to see what’s going on with the new development. It is expected that the unicode support will be improved a lot in this version of php. Going to build it and have a look with the new version.

updates to be followed.

Code Igniter & maani.us

November 17 , 2007 In: Code Igniter, PHP

Many of us feels that a report without a graph is totally incomplete. I also agree with it completely. We need to represent the data in reports to be meaningful and also representable. A table with rows of data does not give the reader a clear idea about what is actually happening. So it is better to show a chart or a graph to the user before showing the long tables of data.

In PHP, one of the most popular graph tool is php/swf charts from maani.us. This tool provides some cool looking graphs with easy to integrate with your application. The integration becomes much easier if you are using Oode Igniter. In this article I am going to describe you, how to integrate maani.us php/swf charts with your Code Igniter application.

Detail Steps to Install the application:

1. download php/swf charts from http://www.maani.us

2. Create a directory named charts or any appropriate name in your root folder (not inside the Code Igniter system folder). it is better if you keep the CI system folder and charts folder on same level.

3. put the unzipped content (except the charts.php) file of the downloaded file in this folder.

Writing Code Igniter code:

You can integrate the maani.us code by either creating a library in Code Igniter or by simply creating a helper. I am going to show you the process by creating a helper file. In order to create a helper file in Code Igniter, you can either create a helper file in system\helpers or system\application\helpers file. In the later case you have to create the directory as Code Igniter does not create it by default. It is always better to keep the core files and folders of Code Igniter to be intact. Code Igniter gives you the flexibility to extend any of its helpers, libraries, plugins etc to be extended from the application folder.

here are the detail steps for creating and showing graph in a view:

1. first create a helper named graph_helper.php and copy paste the content of charts.php in this file. save the file.

2. now load the helper file from your controller where you want to show the graph. there are two parts in the helper file. One for inserting the chart and in order to show a chart, we need to define the data and chart properties. the SendChartData function defines the properties of the chart and InsertChart shows the Data. in InsertChart function we have to define few things

  • location of the flash file (.swf) , in our case in the charts folder in base directory.
  • location of the charts library, in our case in the charts folder in base directory.
  • PHP source location for ChartData or SendChartData function, in our case a controller.
  • width, height, background color, transparency and license information

here is the code inside a controller looks like.

$this->load->helper(”graph”);
$url = site_url().”/reports/showsummary/”;
$charturl = base_url().”/charts/charts.swf”;
$chartlib = base_url().”/charts/charts_library”;

$data['chart'] = InsertChart( $charturl, $chartlib, $url ,650,300,”cccccc” ); // passing the chart information to view.

$this->load->view(”reports/dashboard”, $data);
now we have to define the controller which will send the data for the graph.

function showsummary()

{

$this->load->helper(”graph”);
$chart[ 'axis_category' ] = array ( ‘font’=>”arial”, ‘bold’=>true, ’size’=>16, ‘color’=>”000000″, ‘alpha’=>60, ’skip’=>0 ,’orientation’=>”vertical” );
$chart[ 'axis_ticks' ] = array ( ‘value_ticks’=>false, ‘category_ticks’=>false, ‘major_thickness’=>2, ‘minor_thickness’=>1, ‘minor_count’=>1, ‘major_color’=>”222222″, ‘minor_color’=>”222222″ ,’position’=>”centered” );
$chart[ 'axis_value' ] = array ( ‘font’=>”arial”, ‘bold’=>true, ’size’=>10, ‘color’=>”000000″, ‘alpha’=>50, ’steps’=>6, ‘prefix’=>”", ’suffix’=>”", ‘decimals’=>0, ’separator’=>”", ’show_min’=>true );

$chart[ 'chart_border' ] = array ( ‘color’=>”000000″, ‘top_thickness’=>0, ‘bottom_thickness’=>0, ‘left_thickness’=>5, ‘right_thickness’=>0 );

$chart[ 'chart_grid_h' ] = array ( ‘alpha’=>10, ‘color’=>”000000″, ‘thickness’=>0 );
$chart[ 'chart_grid_v' ] = array ( ‘alpha’=>10, ‘color’=>”000000″, ‘thickness’=>20 );
$chart[ 'chart_rect' ] = array ( ‘x’=>50, ‘y’=>50, ‘width’=>540, ‘height’=>200, ‘positive_color’=>”ffffff”, ‘positive_alpha’=>30, ‘negative_color’=>”ff0000″, ‘negative_alpha’=>10 );
$chart[ 'chart_type' ] = “line”;

$chart[ 'chart_data' ] = array ( array ( “”, “2004″, “2005″, “2006″, “2007″ ), array ( “region 1″, 48, 55, 80, 100 ), array ( “region 2″, -12, 10, 55, 65 ), array ( “region 3″, 27, -20, 15, 80) );

$chart[ 'chart_value' ] = array ( ‘prefix’=>”", ’suffix’=>”", ‘decimals’=>0, ’separator’=>”", ‘position’=>”cursor”, ‘hide_zero’=>true, ‘as_percentage’=>false, ‘font’=>”arial”, ‘bold’=>true, ’size’=>12, ‘color’=>”000000″, ‘alpha’=>100 );
$chart[ 'draw' ] = array ( array ( ‘type’=>”text”, ‘color’=>”000033″, ‘alpha’=>25, ‘font’=>”arial”, ‘rotation’=>0, ‘bold’=>true, ’size’=>30, ‘x’=>0, ‘y’=>5, ‘width’=>650, ‘height’=>295, ‘text’=>”Statistics”, ‘h_align’=>”right”, ‘v_align’=>”bottom” ) );
$chart[ 'legend_label' ] = array ( ‘layout’=>”horizontal”, ‘font’=>”arial”, ‘bold’=>true, ’size’=>13, ‘color’=>”000000″, ‘alpha’=>50 );
$chart[ 'legend_rect' ] = array ( ‘x’=>25, ‘y’=>10, ‘width’=>600, ‘height’=>5, ‘margin’=>3, ‘fill_color’=>”ffffff”, ‘fill_alpha’=>10, ‘line_color’=>”000000″, ‘line_alpha’=>0, ‘line_thickness’=>0 );
$chart[ 'series_color' ] = array ( “ddaa41″, “88dd11″, “4e62dd”, “ff8811″, “8A2BE2″, “FF1493″, “F0E68C”, “DDA0DD”,”8B4513″,”FFFF00″,”FF6347″,”708090″,”B0E0E6″,”808000″, “20B2AA”, “FF8C00″, “338833″ );
$chart[ 'series_gap' ] = array ( ‘bar_gap’ => 0, ’set_gap’ => 35 );

SendChartData ($chart);
}

You can copy paste this part from maani.us graph examples according to your graph choice. Just copy the first line

$this->load->helper(”graph”);

when you run the changes, you will see that the graphs are generated and it is shown in the view as expected. I have shown how to put a chart in a variable and pass it to view. It is a good way to show more than one graph if required.

I hope that shows how easily you can add a cool featured graph tool in your Code Igniter application. Let me know any comments, questions regarding Code Igniter and PHP.

GMAIL new version is painfully slow!!!

November 13 , 2007 In: PHP

Recently GMAIL released its new version and using for few days i found it really annoying as the system is very slow compared to the previous version. So, I have shift back to the old version. Few of the problems of the new GMAIL:

1. very slow in loading in both IE and Firefox.

2. worst with firebug enabled in firefox (GMAIL’s known issue)

3. Anchors in Email page does not work. It opens in a new page and huh!! the content is not loaded. I found it completely irritating. I have to scroll my mails to read that particular section.

4. Another annoying fact is if you are using older version and login next time,  you are logged into the new version. Kind of enforcement!!!!

Usually people goes for performance improvement everyday. Seems that Google taking a step backward. Hope they will solve the issues asap.

I forgot to mention, GMAIL is still in Beta ;)

www.phpmytips.com coming soon

October 29 , 2007 In: Code Igniter, PHP

for last few days i am working on my next project www.phpmytips.com, a complete question and answer site. after getting very good positive response from my php mysql interview question sections in this site, i have decided to build phpmytips.com for everyone where everyone can participate and contribute. here are the rough features i have in my mind to implement

1. anyone can add or answer question

2. ratings on answers and questions to decide popularity.

3. user ranking system

4. ability to tag question

5. watch a particular question or category

6. add tips (you will give the tips) to the site

7. favorite question, top answers, unanswered section.

8. ability to add in social book marking sites

9. rss feeds.

10. group question and answers or tips such as interview tips or questions (can be be hundreds)

11. email a friend functionality

12. pdf export (still thinking about it)

13. comments on pages.

so if you guys have anything else to add then please feel free to append on this post. i will prioritize them and implement them accordingly. i have a plan to release the beta version with minimum functionality within mid November. btw, i am using PHP, MySQL, CodeIgniter, jQuery, XHTML

so the countdown begins..

A night at somewhere in…

August 10 , 2007 In: Me

Its 3:30 am in the morning and we three (me, lavlu da and morshed) are still working as we have a release of our group bangla blog tomorrow. we are running against time but having lots of fun. We are doing pair programming, reviewing each other work done so far and finding bugs and solving them. Don’t know when we will go to bed, our office will start 8:00 am in the morning. so planning for a quick nab for atleast 3 hours. Music is very loud and fueling our engine to work so late in the night. We are all having coffee and tea to fight with our sleep.

lets hope we can finish up our target task and make this effort successful.

My First Day at somewhere in…

August 7 , 2007 In: Me

I have forgotten when I last wake up 6:30 am in the morning to prepare myself for office. Actually last two years I used to go to bed at 7:00 am every morning after working whole night and get ready for office around 2:00 pm. It’s just like reversing my daily routine now. But I am happy to change my daily routine for a good purpose. At last I am going to get more time for my family and friends.

So let me get in to the details how my first day at “somewhere in…” went:

I woke up at 6:15 am in the morning and finally get out of the bed at 6:45 am. I started for office at 7:30 am and after having my breakfast at a restaurant nearby, I reached “somewhere in…” at 8:10 am. Though I was the first member of my R&D team to attend the office but I could not beat Arild on arrival. My day started with a discussion about the business model of somewhere in.. and the core objective of the R&D team. Around 11:00 in the morning Arild called a meeting for the new R&D team with 10 members including Me, Hasan, Lavlu, Morshed, Emon, Rossen, Rhythm, Yameen, Mishu and Ajanta. I must say this team just rocks. In a single day we came so close that it gave me the comfort level I was always looking from my team. I also received warm reception from everyone in the company. It is nice to be a part of the BOBs (Best Of Bangladesh).

We had a two hours long meeting and after that we went for our lunch. After lunch I started with my PHP team to discuss the current status of the team and to set our next milestone. I am excited to work on my first localization project. As I can’t type Bangla that well, I faced little bit problem to work fast. I spent most of my time staring at my keyboard rather than typing code. In the afternoon I had a great time playing cricket with my colleagues. I just had a great day in “somewhere in…” and I forgot that the office time is far over. I got out of the office around 7:30 PM.

It was an amazing day for me with so much fun and excitement and I hope to continue to enjoy my moments more and more every day. Actually that’s why everyone in “somewhere in…” is focused to do.

We create colorful moments…

Joining Somewherein….

July 11 , 2007 In: Me

I am going to join Somewherein From August 1, 2007 as the PHP Team lead. After spending more than 27 months in ReliSource Technologies  , I have finally made up my mind to switch my job for new challenges and new responsibilities. I am hoping for a great time in Somewherein and to work with the BOBs’ (Best of Bangladesh) and Arild specially.

Wish me best of luck everyone….

About Me


I am Mizanur Rahman from Bangladesh. I am a Software Engineer by profession. I love to work on open source projects and specially web based systems. I am a moderator of the PHPExperts, the largest PHP Users group in Bangladesh.

My Books

MediaWiki Administrators’ Tutorial Guide

My Certifications


My Zend Certification


View Mizanur Rahman's profile on LinkedIn

Categories