Drupal

Let’s talk about drupal.

Drupal is a free and open-source content management framework written in PHP and distributed under the GNU General Public License. It is used as a back-end framework for at least 2.1% of all websites worldwide.ranging from personal blogs to corporate, political, and government sites including whitehouse.govand data.gov.uk. It is also used for knowledge management and business collaboration.

The standard release of Drupal, known as Drupal core, contains basic features common to content management systems. These include user account registration and maintenance, menu management, RSS feeds, page layout customization, and system administration. The Drupal core installation can be used as a simple website, a single- or multi-user blog, an Internet forum, or a community website providing for user-generated content. To work with drupal, you should start from the Wikipedia page [1], there are a lot of basic concepts given about drupal.

Current drupal version is 7.23, it has about 23945 registered modules and 1847 themes [2]. Drupal has a healthy documentation available in [3].

If you are interested, download and start reading this (https://drupal.org/documentation/install)

 

Reference:

[1]http://en.wikipedia.org/wiki/Drupal

[2] https://drupal.org/

[3] https://drupal.org/documentation

 

 

Advertisements

PHP5 chaining methods example


// This Person class encapsulates a couple of properties which
// a person might have: their name and age.
// We also give the Person the opportunity to introduce themselves.
class Person
{
private $m_szName;
private $m_iAge;

public function setName($szName)
{
$this->m_szName = $szName;
return $this; // We now return $this (the Person)
}

public function setAge($iAge)
{
$this->m_iAge = $iAge;
return $this; // Again, return our Person
}

public function introduce()
{
printf(
'Hello my name is %s and I am %d years old.',
$this->m_szName,
$this->m_iAge);
}
}

// We'll be creating me, digitally.
$peter = new Person();

// Let's set some attributes and let me introduce myself,
// all in one line of code.
$peter->setName('Peter')->setAge(23)->introduce();

// another one example

$peter->setAge(23)
->setName('Peter')
->setName('Winifred')
->setAge(72)
->introduce();

Read more: http://www.talkphp.com/advanced-php-programming/1163-php5-method-chaining.html

http://stackoverflow.com/questions/7549423/how-do-i-chain-methods-in-php

array_unique in php

array_unique — Removes duplicate values from an array (available from PHP4)

here is the definition,


array array_unique ( array $array[, int $sort_flags = SORT_STRING ] )


It takes an input array and returns a new array without duplicate values.

Note that keys are preserved. array_unique() sorts the values treated as string at first, then will keep the first key encountered for every value, and ignore all following keys. It does not mean that the key of the first related value from the unsorted array will be kept.

Short flags:

  • SORT_REGULAR – compare items normally (don’t change types)
  • SORT_NUMERIC – compare items numerically
  • SORT_STRING – compare items as strings
  • SORT_LOCALE_STRING – compare items as strings, based on the current locale.

example:


<?php
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
?>

read more: http://php.net/manual/en/function.array-unique.php

Objective C tutorial

A good Object C tutorial for beginners can be found here : http://rypress.com/tutorials/objective-c/index.html

Pear Upgrade: Security Error Fix

This was an issue I had for just about a week. I am kinda new to the idea of doing regression tests on all of a project’s codebase, but the tools I was going to be using were easily installable via PEAR. Setting up the development environment was quite a task and because of this, I found myself installing and re-installing software multiple times so that the settings would be correct. I’m not sure if this was the reason for this issue none the less, after a few re-installs of PEAR, I started getting the following error when I attempted to upgrade:

Error getting channel info from pear.phpunit.de: SECURITY ERROR: Will not write to C:\Users\DTHOMP~1\AppData\Local\Temp\pear\cache\4ab1bc7c
67cfd409719746ffb3d29a21rest.cacheid as it is symlinked to C:\Users\dthompson\AppData\Local\Temp\pear\cache\4ab1bc7c67cfd409719746ffb3d29a2
1rest.cacheid – Possible symlink attack

 

Very simply put, the solution was to locate the pear cache folder and delete all of it’s contents. Once I did that, I was able to run pear upgrade without any issues.

A few things to consider:

1. PHP Unit was the package that I installed before getting the upgrade errors.

2. This was running on a Windows 7 box

 

Taken From: http://www.mrdonovanthompson.com/teck-talk/pear-upgrade-security-error-fix

 

Continuous Integration and PHP by Arno Schneider on Feb 22, 2008

Short overview of the main principles of Continuous Integration (CI), describing benefits of CI and showing a smooth path of integrating CI into your development cycle, finishing with a short introduction into Xinc – PHP CI Server and how to utilize it for your projects.

Using sami with composer

For the work of DNA fragment assembly in php, I used sami as the default documentor generator. The packagist page of sami is in [2] and the github page is in [3] .

In order to install sami, I added the following line in composer.json

“sami/sami”: “dev-master”

I installed the sami package using composer by writing composer install in command prompt where I placed composer.json file (means my project, see note 1 and 2 for more) then I created a file doc.php at root of my project and then I wrote the following code,

<?php

require (“vendor/autoload.php”);

return new Sami\Sami(‘src’);

?>

I placed my codes in src folder. Next I wrote the following line in command prompt while I am at root of the project,

Vendor\bin\sami.php.bat update doc.php

After execution, the project documentation is placed in build folder of the project.

 

Notes:

  1. If you have used composer install once, you need to use composer update for updating your package.
  2. I installed the windows binary of composer.

Reference:

[1] Composer introduction page http://getcomposer.org/doc/00-intro.md

[2] sami packagist page https://packagist.org/packages/sami/sami

[3] sami github page https://github.com/fabpot/sami

Migrating vb6 application to vb.net, the first thing I learned!

Image representing Microsoft as depicted in Cr...
Image via CrunchBase

One of the milestones of my project which I am working on BUET is the migration of the whole system from visual basic 6.0 to any .net version. While researching on the internet, I found that Microsoft has discontinued their vb migration tool from vb2010. They are proposing some third party tools for that! (why Microsoft, people likes this migration tool).

 

At first I installed visual basic express 2010 (better be a good person. Even I have a pirated CD version of visual studio team edition 2010), but didn’t found the migration tool. Then I learned that Microsoft discontinued that and for this reason, I am downloading vb 2008.

 

Hope downloading vb2008 works !