Thursday, July 22, 2010

Discrimination kills - Maternal mortality and human rights

Though this is not on a programme subject, it is something very important - the importance of which cannot be expressed even if all lines of code written in the world so far or will be written is raised to the power of nth degree where n is all lines of code written in the world so far and be written...
Please share this documentary as widely as you can in your blogs, on Facebook, through emails etc...




Discrimination kills - Maternal mortality and human rights

Discrimination against women leads to preventable deaths and injuries during pregnancy and child birth. Each year hundred of thousands of women and girls die and millions more become disabled as a result of complications during pregnancy and child birth.

A study by United Nations Human Rights office (OHCHR) finds a clear relationship between maternal mortality and morbidity and violations of human rights.

------
http://www.youtube.com/unohchr

The study by the UN Human Rights office is produced under the request of the Human Rights Council.

The short documentary is the story of a widower whose wife died during childbirth. He speaks of how his wife's death could have been prevented. The UN human rights office says discrimination against women is causing unnecessary deaths and injuries during pregnancy and childbirth.

For more details on this and other works of OHCHR, visit their global website: www.ohchr.org or the website of its Nepal office: nepal.ohchr.org

Sunday, July 18, 2010

PHP/MySQL based Content Management System (CMS)

I have just finished the development of a PHP/MySQL based Content Management System (CMS). Below is a low-resolution screen-shot of the system.

Details about this system can be viewed on my website at http://www.vibhumishra.com/index.php?projects&cms_1

There are two versions of this system, one with an ordering component which will let one do business online and the other without this component, some of the other features (common to both versions) include:
  • Display web-based advertisements such as Google AdSense ads.
  • Ability to publish pages straight away, save drafts and archive pages.
  • Flash and other multimedia integrated.
  • Tracking individual page hits, user browsing trends and other information.
  • Full-featured password-protected administrator side, including with Secured HTTP (https://) support (server feature).
  • 3-customizable colour themes (customizable by site visitors).
  • Multiple font support (not restricted to standard web fonts).
A screen shot of the CMS, (populated with dummy data):

Friday, July 16, 2010

Enabling PHP on stock Mac OS X 10.6 Snow Leopard

A quick way of enabling the stock installation of PHP on Mac OS X 10.6 "Snow Leopard". You may use either the Terminal or the user interface of the Finder.

1. Go to "/etc/apache2"

2. Use either of the options:

2.a. If using Finder: Give yourself access privileges (read-write access) to file "httpd.conf" and open the file using your favourite text editor

2.b. If using Terminal: Using your favourite text editor (vi, pico etc), using sudo open the "httpd.conf" file.

3. Uncomment (remove the #) in front of line:
LoadModule php5_module libexec/apache2/libphp5.so
4. Add the following lines (preferably at the end of the document so that it is easier to debug later if required):
#IfModule php5_module$
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
</IfModule>
In the above, replace # with an "<" and the $ with an ">"

5. Try by running a test php page.

<?php phpinfo(); ?>

In the above, replace # with an "<" and the $ with an ">"

Tuesday, February 23, 2010

Object Oriented Programming and Polymorphism in PHP

Introduction:

One of the greatest strengths of any programming language is its Object Orientation and from this comes Polymorphism, way back when I was in college, I studied this section of programming with immense interest and while at first, avenues for its implementation were very limited this is growing day by day.

Following are some examples and implementation of these concepts.

Example:

All Object Oriented Programming languages (OOP languages) offer some form of polymorphism. Following is an example of implementation of polymorphism using PHP:


interface vehicle{
function getType();
function getCapacity();
}

abstract class baseVehicle implements vehicle{
protected type = $type;
}

function getType(){
return ($this->type);
}
}

class motorbike extends baseVehicle{
function getCapacity(){
return ("2 people");
}
}

class car extends baseVehicle{
function getCapacity(){
return ("5 people and 400 litres of boot space");
}
}

class truck extends baseVehicle{
function getCapacity(){
return ("3 people and 10 tonnes of cargo space");
}
}

$vehicleArray = array(
new motorbike("Enfiled Bullet Motorcycle"),
new car("Tata Indigo Station-wagon"),
new truck("Leyland Flatbed Truck")
);

foreach ($vehicleArray as $vehicleData) {
echo $vehicleData->getType() . " - " . $vehicleData->getCapacity() . "\n";
}

Output:

Enfiled Bullet Motorcycle - 2 people
Tata Indigo Station-wagon - 5 people and 400 litres of boot space
Leyland Flatbed Truck - 3 people and 10 tonnes of cargo space

If there are any questions or feedback regarding this, please post in the comments box!