Removing index.php from url of CodeIgnitor project | Using .htaccess file


Step 1 : Edit the configuration file to give the permission to override default settings.
command: sudo nano /etc/apache2/sites-available/default
Change the value of AllowOverride to ‘All’ from ‘none’


    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
        Options FollowSymLinks
        AllowOverride All                                 <- HERE
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All                                 <- HERE
        Order allow,deny
        allow from all

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128

Step 2: Enable module rewrite
command: sudo a2enmod rewrite

Step 3: Restart apache server
command: sudo service apache2 restart

sample .htaccess:

RewriteEngine on
RewriteCond $1 !^(index.php|images|robots.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

N.B: Don’t forget to press Enter once at the end of the htaccess file.Because Newline represents the end of file.


Facebook isn’t loading on MAC? (ম্যাক এ ফেসবুক আসে না?)


টাকা পয়সা জমিয়ে একটা ম্যাক কিনলাম। এরপর বাংলালায়নের নতুন মডেমের সফ্টওয়ার দিয়ে আমার পুরান মডেম দিয়ে নেট কানেক্ট করলাম।নেট কানেক্টেড কিন্তু কোন পেজ আসে না।কয়েকদিন চলল এভাবে।৩-৪ দিন পর থেকে ফেসবুক বাদে বাকি সব লোড হচ্ছিল। “ফেসবুক কেন আসে না” এই প্রশ্ন করতে করতে যখন দিশেহারা তখন সন্ধান পাইলাম কি করলে ঠিক হবে।কিন্তু সেই করাটা কোথায় হবে সেটা খুজে পাচ্ছিলাম না।আরও ৩-৪ দিন পর পেয়ে গেলাম এই মাত্র (৫ই জুলাই,২০১৩ রাত ১০:০৭)।

চলেন সমাধানটি দেখে নেই।
প্রধমেই চলে যান “System Preference” এ। তারপর “Network” এ।
বামদিকের লিস্ট থেকে সিলেক্ট করেন আপনার ইন্টারনেট ব্যাবহার করার মাধ্যমটি।
“Advanced” এ ক্লিক করে “Hardware” এ যান।
এবার নিচের মত করে সবগুলি অপশন সিলেক্ট করে “OK” চাপুন।
Configure : Manually
MTU : 1400

বাকিগুলো অপরিবর্তনীয়।
এখন ধুমাইয়া ফেসবুকিং করছি।

কি মিয়া ভাই, কই যান? MTU কি জিনিস শুনবেন না?
“communication protocol” এর একটি নির্দিস্ট লেয়ারে সর্বোচ্চ যে কয়টি ফ্রেম পাঠানো যায় সে সংখ্যাকে বলা হয় MTU (Maximum Transmission Unit)
বিভিন্ন ISP এর MTU এর মান বিভিন্ন হয়।তাই MTU এর মান ম্যানুয়ালী পরিবর্তন করতে হয়।

নুহিল ভাই এবং জয় দা কে ধইন্যা।

Top X rated products for Virtuemart Joomla 2.5


As one of my client upgraded his site from joomla 1.5 to 2.5 .Everything was ok but top rate product module was for only joomla 1.5/1.7 version. So, He told me to find a suitable module for Display top rated products. I have searched a lot but didn’t get any working module for solving this.So, I have decided to create a module. So ,I learn’t how to create a simple module for joomla 2.5 from here converted the code(top rated module for 1.5) for Joomla 2.5. As database structure in 2.5 is changed from 1.5/1.7 I had to play with SQL queries. Here is the module .You can use this and let me know reviews.


  1. Its easy to use
  2. Can be defined the number of top products to display

Download this module from here .
send email on

Thank you.

Example :

Converting a .JAR Into .EXE for WIndows user


We, the Java developers, develop softwares using Java because of it’s platform independency . Though now-a-days JDK is available to users,we usually provide JAR file of the software to the user.So, users can start it with only a double click. But  still some windows users prefere .exe version of that software. So, now I am going to tell you about a software by which we can convert a .jar file to .exe for windows user.

Before starting this we must read these two posts carefully.

Click here

We will use Jar to exe convert wizard 1.8 to convert  our jar files to exe.


Step 1 : Install the software and run the wizard.

Step 2:  Browse project.jar and press next.

Step 3: Select Console application or Windows gui application

Step 4: Select the Main class from where the software will start and keep “select a picture for splash window” blank.

Step 5: enable Support System tray and disable all others disable. [or, you can change as your requirements.]

Step 6: Add others Jars you have used like mysql-connector.jar . Usually these are on project/dist/lib/ if you are using Netbeans IDE. 

Step 6:  press Next and Finish.

Step 7 : We got the converted exe file of our jar file.


Thanks for reading this post.




Creating AutoBack Up of MySQL Database using JAVA OR PHP ( পিএচপি অথবা জাভা তে কিভাবে মাইএসকিউএল ডাটাবেজ এর অটোমেটিক ব্যাকআপ করতে হয় )


It is usual that we need to backup the database in software development (specially in Enterprise Software,web applications ) Database is very important which contains all the information about the organization. Last night I have coded a auto backup script in both JAVA and PHP. Here I am gonna post them below with comment.

Code Written in JAVA

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
 * @author Ujjal Suttra Dhar

class create_backup{

    String database = "your_database_name",  user = "root", password = "pass";
    Connection m_Connection = null;
    Statement m_Statement = null;
    ResultSet m_ResultSet;
    String m_Driver = "com.mysql.jdbc.Driver";
    String m_Url = "jdbc:mysql://localhost:3306/" + database;

    public create_backup(){

        /*Eshtablishment of Connection of java code with MySQL using JDBC
         You must read my previous post to know further about this. 
        try {
            m_Connection = DriverManager.getConnection(m_Url, user, password);
            //Create Statement object
            m_Statement = m_Connection.createStatement();

        } catch (Exception ex) {

        try {
            //Database will be stored in filename.sql which can be import on MySQl as backup
            BufferedWriter  out = new BufferedWriter(new FileWriter(&quot;kernel_school.sql&quot;));

            //Now here is the informations about the database of which backup will be created
            String dump = &quot;C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqldump &quot; //Path to mysql
                    + "--host=localhost" //Mysql hostname
                    + "--port=3306" //Mysql portnumber
                    + "--user=root" //Mysql username
                    + "--password=pass" //Mysql password
                    + "--add-drop-table" //Add a DROP TABLE statement before each CREATE TABLE statement
                    + "--add-drop-database" //Add a DROP DATABASE statement before each CREATE DATABASE statement
                    + "--complete-insert" //Use complete INSERT statements that include column names.
                    + "--extended-insert" //Use multiple-row INSERT syntax that include several VALUES lists
                    + "kernel_school";                  //Mysql databasename

            //executing the command through process.
            Process run = Runtime.getRuntime().exec(dump);

            /*resultant SQL informations are here on the br which can be read line by line .
            And at the same time it will be written on another sql file.*/
            InputStream in = run.getInputStream();
            InputStreamReader isr = new InputStreamReader(in);
            BufferedReader br = new BufferedReader(isr);
            String line = null;

            while ((line = br.readLine())!=null) {

       out.flush(); // must flush or close the file after completing the task.
        // int exitVal = run.waitFor();//when exitVal is ,then the process is completed

        } catch (Throwable t) {

 } // class

public class autobackup {
    public static void main(String a[]){
            new create_backup();

Code Written in PHP

Changing ownership/Permission of Files/Folders in Linux


A common problem in using Linux is restriction. Some operations are restricted for users by root.But if it is needed to do that operation like editing what to do? Today I have faced same kind of problem. I use /var/www/ as localhost for server based development. I can’t get working jobs (already done) copied from another folder/device because of rescriction by addministrator. If I open that file as administrator ,it works. But It is impossible to open a large number of files by opening as administrator when in server based job like web development. So, I must make /var/www/ accessible for reading and writing for me.

To do this here is the command which must be executed on terminal.

sudo chown -R www-data:ujjal /var/www

// chown    -> change ownership
// www-data (owner name from)-> right click on the file and check permission tab for the owner name.
// ujjal   (owner name to be made)-> your username (check users and groups if you dont know your username)


sudo chmod 777 -R /var/www

Precautions: Linux is case sensitive.mind it.

Thanking you….

Frequently used header files ( string.h , algorithm ) in C/C++


I am starting this briefing assuming that the reader is already known about the basic structure of programming with C. Here you will find a brief collection which are used frequently in programming.

Let’s start from #include
strlen(): int strlen(consts char *array)
A frequently used function and quite familiar to everyone is strlen() which returns the length of a character array passed to the function.


char arr[]=”This is a strlen function test. ”;
Output:  30

strcmp(): int strcmp(const char *a,const char *b)

This one is used for comparing two strings. It can be used on Big number comparison also.

	char  a[]=”ABC”;
	char  b[]=”ABC”;
	char  c[]=”AAA”;
	// now 
	int  x= strcmp(a,b)  ; // x= 0  as a==b
	x= strcmp(a,c);	// x>0  as a>c;  1st  parameter>  2nd parameter
	x= strcmp(c,a)        // x<0  as c<a;   1st  parameter<  2nd parameter

Now what is the basis of comparison of this function and what does this comparison actually mean? This comparison actually means lexicographically comparison.
Each of the character has a ASCII value . and ASCII value thus ‘A’ is less than ‘a’
So if we compare them ‘a’ >’A’

Now let’s have a practice about this type of comparison .
1. strcmp( “abc”,”Abc” ) Output : >0
2. strcmp(“cow”,”woc”) Output: 0
4. strcmp(“cow”,”cowa”) Output: <0
Now have a look closely
A[]= “cow”
B[]= ”cowa”
If we see the memory we would see like this :

A[] :‘c’ ‘o’ ‘w’ 0 0
B[] :‘c’ ‘o’ ‘w’ ‘a’ 0

Now see place 0 : A[0]==B[0] // ‘c’
A[1]==B[1] // ‘o’
A[2]==B[2] // ‘c’
A[3]<B[3] // 0<’a’ by ascii value ( here 0 ,not ‘0’)
So,now strcmp return a value less than 0.
Thus strcmp(A,B)’y’ so it returns >0 value.
It will return 0 if and only if two strings are equal.

strcpy(): char *strcpy(char *destination,const char *source)
This function is used to copy 2nd string to 1st string.

char destination[]=”DEPT”;
char source[]=”CSE”;

destination: “CSE”
source : ”CSE”
One thing is very important and should be remembered that Array size of destination must be greater than array of source, Else program may crash.
Now the question is why?
Look closely at the memory.
char dest=”cse”; // size is 4 considering the NULL
char source=”department”; // size is 11 considering the NULL
Is it possible ?

dest: memory size 4 (considering the NULL)
‘c’ ‘s’ ‘e’ 0

Source : memory size 11 (considering the NULL)
‘d’ ‘e’ ‘p’ ‘a’ ‘r’ ‘t’ ‘m’ ‘e’ ‘n’ ‘t’ 0

Now think is it possible to keep this 11 elements including NULL (0) in 4 sized array of “dest” ? so you have to ensure that the destination will be long enough so that no overflow occurs .

strcat(): char * strcat(char *a,const char *n)
This function is generally used for concatenation. If two strings are str1,str2 then,

char str1[100],str2[100];
gets(str1);  // say input is “cse” 
gets(str2);   // say input is “ rocks.”
puts(str1);    // output : cse rocks.
puts(str2);    // output : rocks

1st string is changed and no change to 2nd one .
But here we also have to be careful about size of 1st parameter . As 2nd parameter is added to 1st one , size should be available otherwise overflow will occur.

memset() : void * memset ( void * ptr, int value, size_t num )
This function is very much helpful.If you want to initialize an array with a desired value then what you will do, just iterate.but memset support this with a single statement.

Lets see

  int a[100];  // or  char a[100]
    for(int i=0;i<50;i++) 
 	a[i]= ‘f’;

this may be done by also this:

memset(a,’f’,50*sizeof(a[0]) );

if any one want to insert whole array a single value than


A complete c code is also provided here for clarification. 


int main ()
  char str[] = "almost every programmer should know memset!";
  memset (str,'-',6);
  puts (str);
  return 0;

strtok: char * strtok ( char * str, const char * delimiters )
strtok is a superb function indeed. According to me this function is more valuable than any other cstring’s functions. Now let’s see ,what is it ?

char str[]=”I am a cse student. Oh! Shit, I forgot to say my high CGPA.”
strtok= string tokenizer (:P)

If you want to tokenize a string by space ,’!’ ,’.’, ‘,’ or any characters then you can do it by strtok. Now what does tokenize means ? sometimes we take input of an array of a paragraph and we need to separate the words form it. In this case words are our token .
You can use strtok in this case.
char * p =strtok(str,” .,!.”);
now we are ready to get tokens :
1. I
2. am
3. a
4. cse
5. student
6. Oh
7. shit
8. I
9. forgot
10. to
11. say
12. my
13. High
14. CGPA
We have 14 tokens as we has given delimiters ” .,!.”
Here a c code is also provided for more clarification.


int main ()
  char str[] ="- This, a sample string.";
  char * pch;
  printf ("Splitting string %s into tokens\n",str);
  pch = strtok (str," ,.-");
  while (pch != NULL)
    printf ("%s\n",pch);
    pch = strtok (NULL, " ,.-");
  return 0;

Splitting string "- This, a sample string." into tokens:

This were frequently used string manupulating functions.

In c++ there is anothet header file algorithm.h which provides us many bullt-in function Which are frequently used by us. Here I am giving an example for describing some of them.

using namespace std;

int main()
    int a=10,b=15;

//a=10 b=15
//a=15 b=10

    cout<< max(a,b)<

There are many of these types of usuful functions in this header file.For further information see books.

There is another thing called STL which means Standard Template Library,another useful library of functions which makes programmer's job easier. This function provides with decrease of line of codes.

Frequently used container classes of STL :
1. vector
2. queue
3. string
4. stack
5. map
6. list
7. set
8. pair

Fore more about STL click here

Thanking for reading this,
Ujjal Suttra Dhar

Programming,Mathematics and Newbies


I am not sure if I am the right person or not to write this. Now I am going to share something with you that I know. Yes, These all are about the “Importance of programming” for the newbies. Here I will inspire you to be a good programmer, not the “Boss” of one of the C/C++/JAVA/PHP or web developments and many others. Being a programmer means being well-developped logically i.e mathematically who can use any language whatever it is,to solve a real life problem efficiently. As I know, and I think everyone will agree with me that mathematics is the one and only way to solve any real-life problems (which are not defined impossible by the experts). As a Bangladeshi , It is a matter of shame that we are far from other countries in the race of mathematics which is an obstacle in the race of technological development. If you say,“God didn’t give me a good brain,what can I do?”, I will not agree with you. As my opinion, It’s all about practice.We,the lazy people,passes our time doing nothing. A Proverb is said to be “Practice makes a man perfect”.
So, What are you thinking now? Wanna start practicing mathematics and programming now? An Eiffel Tower can not be built in one night.So,you have to spend some of your precious times to gain the power to control your PC,the coming world of what to do? Let’s go through some steps.

Step 1:
Find some books on basic mathematics/Number theory.
* Elementary Number Theory with Applications
-Thomas Koshy
*Concrete mathematics
-Donald Knuth

Step 2:
Select an programming language to implement those mathematics you have learnt. Now-a-days, C,C++,JAVA are the most popular and widely used languages. If you are newbie ,I will suggest you to learn C because it is the most efficient and easiest language. Most of important softwares and Some of operating systems are developed in C.
If you are not a student of CSE background,don’t be afraid,because you can learn it easily. You can learn this from this book. Ya, all the newbies who are related to CSE,this book is also for you too.
*Art Of Programming contest
* Programming with C
-Bayron Gottfried
Step 3:
Now you have learnt a little bit of mathematics, at least one of the programming languages, it’s time go now. What to do? You have to solve problems.There are many Online judges,In which there are thousands of problem descriptions with the facility to judge your solution ,is it ok or not,I will mention “Is the solution efficient or not”.
As you are newbie I will suggest you to use UVA at first . For this you have to open an account on this can browse problems of their site. The first job of you to read the problem carefully,find the solution ,then code it.
What is coding? If you have learnt any of the programming languages, don’t ask it again.You have to write a code which will take input and provide with outputs as the problem description. After login you have to submit your solution to the onlinejudge.That machine will judge your solution in RE (runtime error),TE (time limit exceede),WA (wrong answer),PA (presentation error) and AC (accepted).
When submitting,you have take some measures which will be described below.
You can track your progress from here .
After solving some of problems,you should not be limited only in a single judges.

Here are some others OJs.
*Light OJ

Here are some of websites/blogs which can be useful for you too.

Problems solving with C:
A sample code for submitting a problem is given below.
int main()
int testcase,input,I,j,k;
//your solution exists here
If(input ==2)
printf(“Not two”);
return 0;

Now practice problem solving. You must attend free online contests to judge yourself.

For any kind of help or suggestions
I am here

Minimum Spanning Tree in JAVA


বন্ধুরা অনেক আগে থেকে ফ্রিলান্সিং করলেও আমি করি নাই। আমার ইচ্ছা ছিল আগে প্রোফাইল ভাল করব যাতে বিড করলেই কাজ পাই। গত কাল রাতে হটাত ব্রাওজার এর বুকমার্ক দেখতে দেখতে হটাত চোখ পড়লো Ezdia নামক একটি সাইট এ। ঢুকলাম । প্রথমেই যার ওপর চোখ পড়ল তা হল minimum spanning tree এর implementation JAVA দিয়ে করতে হবে। ভাবলাম কোড তো C++ এ করাই আসে।JAVA তে convert করতে র কত সময় লাগবে। Bid করলাম । কাজ টা পেয়েও গেলাম। JAVA অনেকদিন দেখি নাই।তাই ভুলে গেসিলাম কিছু জিনিস। তাই করতে কিছুটা সময় বেসি লাগল। সব মিলিয়ে ২.৫০ ঘণ্টায় কাজ টা delivery দিলাম।

যাই হোক,কাজটা client এর পছন্দও হল। কিন্তু এখন পর্যন্ত উনি আমাকে pay করেন নাই। প্রথম কাজেই ধরা খাইলাম। ব্যাপার না। আরও হবে। আপাতত সেই কাজ তাই আপনাকে দেখাচ্ছি।

updater after 2 days
দেরীতে হলেও ফিডব্যাক পাওয়া গেল।টাকাও।

Here is the input/output format


Input starts with an integer T, denoting the number of test cases.

Each case begins with an integer n denoting the number of nodes. Then there will be n lines, each having n space separated integers, denoting the lengths of two connected nodes. Each length will be between 0 and 100.

If generating a tree is impossible ,then output is -1 else the minimal cost.



27 26
1 52

0 10 10 0
0 0 1 1
0 0 0 2
0 0 0 0

0 1 0 0
1 0 0 0
0 0 0 1
0 0 1 0

Case 1: 105
Case 2: 12
Case 3: -1


import java.util.*;

class edge {

public int dist;
int st, end;

edge(int i, int j, int k) { = i;
this.end = j;
this.dist = k;

class exe {

public edge road[] = new edge[3000];
edge ce;
int arr[][] = new int[52][52];
int rank[] = new int[52];
int par[] = new int[52];
double ans = 0;
int min1 = 0, max1 = 0;
int cost;
int C, R, cnt, E;

int find(int i) {
if (i != par[i]) {
par[i] = find(par[par[i]]);
return par[i];

void link(int x, int y) {
if (rank[x] > rank[y]) {
par[y] = x;
} else {
par[x] = y;
if (rank[x] == rank[y]) {


void kruskal() {
int i = 0, j = 0, u, v, flag = 0;
System.out.println("Tree diagram is ");
for (i = 0; j < C – 1 && i < E; i++) {
u = find(road[i].st);
v = find(road[i].end);
if (u == v) {
link(u, v);
flag = 1;
min1 += road[i].dist;

System.out.println(road[i].st + "->" + road[i].end + " cost is " + road[i].dist);

if (j < C – 1) {
} else {
System.out.println("Minimal Cost is " + min1);

} //krus

public exe() {

int i, j, k, T, cs = 0;

Scanner s = new Scanner(;

T = s.nextInt();

while (true) {
if (T == 0) {

C = s.nextInt();

for (i = 1; i <= C; i++) {
par[i] = i;
rank[i] = 0;

k = 0;
max1 = 0;
for (i = 1; i <= C; i++) {
for (j = 1; j <= C; j++) {
arr[i][j] = s.nextInt();

if (arr[i][j] != 0 && i != j) {
road[k] = new edge(i, j, arr[i][j]);
max1 += arr[i][j];

E = k;
for (i = 0; i < E – 1; i++) {
for (j = i + 1; j < E; j++) {
if (road[i].dist > road[j].dist) {
ce = road[i];
road[i] = road[j];
road[j] = ce;


min1 = 0;

System.out.print("Case " + (++cs) + ": ");

} // while

}//class exe

public class Ezdia1 {

public static void main(String ars[]) {
try {
exe object = new exe();
} catch (Exception p) {



ধন্যবাদ সবাইকে।

Huffman coding


//Originally FOUND in Internet
//by RIT2009061 vikesh iiita

//Author: Ujjal Suttra DHar [CSE’08,RUET]

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>

using namespace std;

struct node {
int weight;
char value;
const node *child0;
const node *child1;

node( int c, int i ) {
value = c;
weight = i;
child0 = 0;
child1 = 0;

node( const node* c0, const node* c1 ) {
value = 0;
weight = c0->weight + c1->weight;
child0 = c0;
child1 = c1;

bool operator<( const node &a ) const {
if(weight ==a.weight)
return value>a.value;
return weight >a.weight;

void traverse(string code="") const{

if ( child0 ) {
child0->traverse( code + ‘0’ );
child1->traverse( code + ‘1’ );
} else {
cout <<" " <<value <<" ";
cout <<weight;
cout <<" " <<code <<endl;


void count_chars( int *counts )
for ( int i = 0 ; i <256 ; i++ )
counts[ i ] = 0;


char c;


int main()


int counts[ 256 ];
char a[1000];


for ( int i = 0 ; i <256 ; i++ )
counts[ i ] = 0;

for(int i=0;i<strlen(a);i++)

priority_queue < node > q;

for (int i = 0 ; i <256 ; i++ )
if ( counts[ i ] )
q.push( node( i, counts[ i ] ) );

//if you wanna show the queue

while ( q.size() >1 ) {
node *child0 = new node( );
node *child1 = new node( );
q.push( node( child0, child1 ) );

return 0;