Moodle Installation problem in Windows 2000

I’m a MSc. student of IUB(Independent University Bangladesh) with major in computer science and engineering. My thesis topic is “A Classroom and Student Achievement Assessment Framework (CaSA) for E-Learning Technology”. My thesis objective is to implement this framework in Bangladesh at university level. After complete my thesis work a related web based elearning management system need to develop for experiment. So, one month ago I wana install Moodle to achieve this goal.
Moodle is a course management system (CMS) – a free, Open Source software package designed using sound pedagogical principles, to help educators create effective online learning communities. You can download and use it on any computer you have handy (including webhosts), yet it can scale from a single-teacher site to a University with 200,000 students. This site itself is created using Moodle, so check out the Moodle Demonstration Courses or read the latest Moodle Buzz.

I take help for installation Moodle from their site: http://docs.moodle.org/en/Installing_Moodle. I follow their instruction properly and while start installing Moodle within my Windows 2000 OS I faced some environmental settings problem given below:
*cannot find open ssl
* cannot find crul
* cannot find unicode so, u have to change database to utf8_unicode_ci


To solve those problems:
1. give username and password on database setting page
2. go to Apachi/bin folder and open php.ini file.
Find line- “; extension = php_open_ssl.dll” and remove ‘;’ sign from the line.
Find “; extension = php_curl.dll” and remove ; and save the file
3. Restart Apachi server
4.Go previous page and then click ‘next’, ur problem will solved and see now open_ssl and curl are find.

To change database charset problem ‘can’t find unicode’:
you have to set unicode to Moodle database:
1. open browser and type http://localhost/phpMyAdmin/ and press Go.
2. Go to SQL and type “ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;” and press Go button.
3. Select database link to see moodle’s default charset.
4. Restart mysql
5. Click previous button and then click ‘next’ button.

What a pleasent surprise…………. ur all problems are solved and completed installing moodle successfully into Windows 2000.

working with models in CodeIgniter

I develop a dynamic model for our http://www.votebd.org website to work with database with minimum smarter code. It can insert, update, delete, select data from database through only one related function. The code example given below:

votebd_model-

class Votebd_model extends Model
{
function Votebd_model()
{
parent::Model();
}
/**
* Generates an insert sql query from the parameters
*
* @param string $table The name of the table
* @param array $array An associative array with the values similar to column=>value
* @return string The sql query
*/
function getInsertSQL($table, $array) {
$sql = ‘INSERT INTO ‘.$table;
$columns = ”;
$values = ”;

foreach($array as $key => $value) {
$columns .= $key.’, ‘;
if($value != “”) {
$values .= “‘”.addslashes($value).”‘, “;
}
else {
$values .= “‘NULL’, “;
}
}

$columns = substr($columns, 0, -2);
$values = substr($values, 0, -2);

$sql .= “($columns) VALUES ($values)”;

$query = $this->db->query($sql);

return $query;

}
/**
* Generates an update sql query from the parameters
*
* @param string $table The name of the table
* @param array $array An associative array with the values similar to column=>value
* @param string $where What to limit the update to. Cannot be blank.
* @return string The sql query
*/
function getUpdateSQL($table, $array, $where) {
if(trim($where) == “”) {
return;
}

$sql = ‘UPDATE ‘.$table.’ SET ‘;

foreach($array as $key => $value) {
if($value != “”) {
$sql .= $key.”='”.addslashes($value).”‘, “;
}
else {
$sql .= $key.”=’NULL’, “;
}
}

$sql = substr($sql, 0, -2);

$sql .= ” WHERE $where”;

$query = $this->db->query($sql);

return $query;

}
/**
* Generates an delete sql query from the parameters
*
* @param string $table The name of the table
* @param string $where What to limit the delete to. Cannot be blank.
* @return string The sql query
*/
function getDeleteSQL($table, $where) {
if(trim($where) == “”) {
return;
}

$sql = ‘DELETE * FROM ‘.$table;

$sql .= ” WHERE $where”;

$query = $this->db->query($sql);

return $query;

}

/**
* Generates an delete all sql query from the parameters
*
* @param string $table The name of the table. Cannot be blank.
* @return string The sql query
*/
function getDeleteAllSQL($table) {
if(trim($table) == “”) {
return;
}

$query = $this->db->query(‘DELETE * FROM ‘.$table);

return $query;

}
/**
* Generates an select sql query from the parameters
*
* @param string $table The name of the table
* @param string $where What to limit the delete to. Cannot be blank.
* @return string The sql query
*/
function getSelectSQL($table, $where) {
if(trim($where) == “”) {
return;
}

$sql = ‘SELECT * FROM ‘.$table;

$sql .= ” WHERE $where”;

$query = $this->db->query($sql);

return $query;

}

}//end class

implementation in districtList controller class :

#Get POST data
$DISTRICT_NAME = $this->input->post(‘DISTRICT_NAME’);
$DISTRICT_NAME_BNG = $this->input->post(‘DISTRICT_NAME_BNG’);
$DISTRICT_CODE = $this->input->post(‘DISTRICT_CODE’);
$DIVISION_ID = $this->input->post(‘DIVISION_ID’);
$TOTAL_PEOPLE = $this->input->post(‘TOTAL_PEOPLE’);
$TOTAL_VOTER_MALE = $this->input->post(‘TOTAL_VOTER_MALE’);
$TOTAL_VOTER_FEMALE = $this->input->post(‘TOTAL_VOTER_FEMALE’);
$DISTRICT_INFO = $this->input->post(‘DISTRICT_INFO’);

$table = “district_list”;
$array = array(
‘DISTRICT_CODE’ => $DISTRICT_CODE,
‘DIVISION_ID’ => $DIVISION_ID,
‘DISTRICT_NAME’ => $DISTRICT_NAME,
‘TOTAL_PEOPLE’ => $TOTAL_PEOPLE,
‘TOTAL_VOTER_MALE’ => $TOTAL_VOTER_MALE,
‘TOTAL_VOTER_FEMALE’ => $TOTAL_VOTER_FEMALE,
‘DISTRICT_NAME_BNG’ => $DISTRICT_NAME_BNG,
‘DISTRICT_INFO’ => $DISTRICT_INFO,
);

#work with our database
$this->load->model(‘Votebd_model’,”, TRUE);
$data[‘query_division’] = $this->Votebd_model->getSelectAllSQL(“division_list”);
$this->Votebd_model->getInsertSQL($table, $array);
$this->load->view(‘admin/adddistrictlist_view’, $data);

Same way u can update, delete data from table

Apache failed to run after install skype

After install and run skype I failed to run apache server in my pc. Display port 80 is busy. The reason is Skype keep busy port 80 when it is running. To solve the problem:

1. right click on skype icon on taskbar and click on Quit

2. click on Quit button

3. now restart Apache server

now it works fine. It is good practice if ppl remove Skype from startup

Face problem to access css file and enable mod_write

i’m start working with codeigniter. keep images and css folder into system folder and my page layout works fine. Suddenly I download ci_sample file and find .htaccess file within it. Just for curisity I copy it and paste within my system folder. Then wana browse my existing completed pages to see the effect-but it gives server error like below:
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
127.0.0.1
04/17/08 20:58:48
Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.3
———————————
To solve the problem
To solve css file find problem:
open httpd.conf file from conf folder
and enable this line #LoadModule rewrite_module modules/mod_rewrite.so to

LoadModule rewrite_module modules/mod_rewrite.so
and restart apache.

Then give error message “unable to redirect page”.
So I have to open the .htaccess file and replace the existing code with new code:
existing code-

RewriteEngine on
RewriteRule ^$ /index.php [L]
RewriteCond $1 !^(index\.php|img|css|js|video_files|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]

replace new code:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1″


now mod_write enable and apache works fine

CodeIgniter (A framework with Model View Controller)

CodeIgniter is a PHP framework that helps structure your code and make redundant tasks less tedious. There are countless similar PHP frameworks, the most popular ones being CakePHP and symfony. After looking at several frameworks, the reason I chose to work with CodeIgniter first is that it is a more loosely formed framework, serving as a middle ground between convention and convenience. A trend of framework these days, such as Rails and CakePHP, is to favor convention, forcing strict rules. I won’t argue the benefits/negatives here but I find both claims reasonable. CodeIgniter doesn’t impose those rules and gives you more freedom to write your code and use the framework whenever you want to. Therefore, it’s a good transition between no framework and a full-fledged framework. Also, it is possibly one of the best documented frameworks with tutorials and great documentation of the classes.

A theme to all frameworks nowadays is the Model-View-Controller (MVC) architecture. So let’s hammer this down to the ground before starting. A common philosophy to programming is separating the logic and the presentation. This is the heart of the MVC architecture. Let’s examine the easiest part to understand first.

  • View
    • This is the presentation to the user. A way to think of this is let’s say you’re given a Word document with all the information that your client wants for a website. You don’t have to do any server end scripting. Basically, you just have to design around the given information and then plug it in. This process is what the View does: takes the finalized information and sticks it into a pretty design to display. What should come to mind are client side presentation technologies such as HTML, CSS, and JavaScript. There can be PHP code but theoretically there should be as little logic as possible. You’ll want to use some logic for looping through arrays and making minor decisions. You hear View -> Think template, HTML, pretty.

Now for the two that I find slightly harder to distinguish: Model and Controller.

Both are part of the logic portion of the model and do the “thinking” of the process. This includes retrieving information from databases, processing headers, sorting data, authentication, security, and so on. The “brains” behind the website.

  • Model
    • Models can be thought of as data structures, kind of like classes in object-oriented programming. They interact closely with the database and XML data. You want to get the last ten posts from the database? Ask a model to do that for you. They do the brute work: working with the database (getting, updating, inserting, deleting information).
  • Controller
    • Last but definitely not least, the controller. The controller will interact with the user and process all the requests. The GET and POST headers will go through a controller. The controller is the center of the application and serves as a channel that can request information from a model and throw it out to the view or take some header data and ask a model to update the database. It serves as the information desk and the mediator for the Models and Views. The central brain of the system.

These properties lend to a common flow through these structures. The front user sends a request which is taken by a controller which decides what to do. The controller will do whatever calculations it needs and will ask for information from the models and/or send information to the models. After all the logic is done, the controller has the final dynamic information that will be presented to the user. This information is sent to the view where it is plugged into the template and presented to the user. The end.

This style of coding is in almost all frameworks but let’s examine this in terms of CodeIgniter now.

Some frameworks implement MVC by imposing rules, such as what database tables need to be called, something being the plural of another and so on. CodeIgniter is pretty slack on this and lets you name your classes whatever you want. There are a couple restrictions that apply and the ones worth mentioning are:

  • controller and model class names must be capitalized
  • controller and model file names have to be the same as the respective file names but lower case

When a user accesses a CodeIgniter application, the URL call is like the following: index.php/controller/action

This will access the controller with the same class name and then execute the specified action (or index if not given). Then your controller will call models and do business logic as needed.

While others enforce frameworks enforce the use of all three components and naming conventions, CodeIgniter does not enforce the use of models and in fact, the name of all three components can be completely unrelated.

I hope this clarifies some confusion on the MVC approach. Check out how to easily implement this in the great CodeIgniter documentation.