Memcached Installation on Windows

Memcached Installation on Windows

Here in this article ‘Memcached Installation on Windows’ we are going to see how to install Memcached on Windows.
As we know Memcached is a Free & open source, high-performance, distributed memory object caching system , generic in nature, but intended for use in speeding up dynamic web applications.

Steps of Memcached installation on windows are given below

Step 1 :

  •  First of all we need to download Memcahced Installation / Service files based on the operation system bits ( Windows 32 bit OR windows 64 bit) .
  •  For Windows 32 Bit operation system, use the win32 binary version. You can download it form the here 
  •  For Windows 64 Bit operation system, use the win64 binary version. You can download it form here OR from here

Step 2 :

  •  Unzip the downloaded zip file to find the file named memcached.exe.
  • Create a folder with name memcached in any drive.Prefer the drive (C Drive) in which the operating system installed.
  •  Copy memcahced.exe file from the unziped folder to the newly created folder ( C:\memcached )

Step 3 :

Install the Memcached service. This can be done in two ways

  1. Right click on memcached.exe file and Run as administrator .
  2. Find the cmd.exe in the system, right hand click on the icon and select Run as administrator

Step 4 :

Open the command line interface and go to the folder where memcached.exe file is available.


Run the below commands to install the Memcached service and start it.

C:\memcached>memcached.exe -d install

C:\memcached>memcached.exe -d start

If you dont get any errors it means it’s worked.

If  you face some problem. It’s may shows some error like “The program can’t install because MSVCR71.dll is missing from your computer .“

To solve this issue you need to download the MSVCR71.dll file. You can download it from here. Download the dll and paste it inside your system 32 folder which is in C:\Windows\system32  and again go to the command prompt and follow the Step 4. Now it should not throw error.


Installation of Memcached on Ubuntu

Read about memcache and cakephp here

set up memcache engine for cakephp

Set up memcache engine for cakephp

Here in this article we are going to see how to set up Memcache Engine for cakephp. Memcached is a Free & open source, high-performance, distributed memory object caching system , generic in nature, but intended for use in speeding up dynamic web applications.

CakePHP comes with several cache engines built-in, and provides an easy system to implement our own caching systems.By default it provides file based caching mechanism which uses local files to store the cached content and is slowest cache engine, and doesn’t provide as many features for atomic operations.

Since the default file engine is very slow there comes the search of alternative cache engines that cackephp provides. one of the most fast search engine that comes in cakephp is Memcache Engine. Below are the steps to set up Memcache Engine for cakephp.

1) Installing the Memcached in operating system.

2) Installing Memcache module/extension for php.

3) Restarting the Apache server.

4) Making Memcache Engine as default engine for cakephp App.

  • Open the bootstrap file which will find in ‘root_folder/app/config/bootstrap.php’
  • Find and replace the code.
Cache::config('default', array('engine' => 'File'));


Cache::config('default', array(
    'engine' => 'Memcache',
    'duration' => 3600, // 
    'probability' => 100,
    'prefix' => Inflector::slug(APP_DIR) . '_',
    'servers' => array(
    'persistent' => true,
    'compress' => false,

5) Set  Memcache engine as the main caching engine for the app

  • Open the core file which will find in ‘root_folder/app/config/core.php’
  • Find and replace the code.
$engine = 'File';


$engine = 'Memcache';

Read more about memcache here

sugarcrm change password validation rules

sugarcrm change password validation rules

In SugarCRM there are some default validation rules that has to be followed while creating or resetting the password. This article  sugarcrm change password validation rules  will explain how to change the default validation rules provided by SugarCRM.

The validation rules are defined in the config file/setting and the  minimum validation rules that are available/required for password are given below.

1) At least one uppercase
2) At least one numeric.

sugarcrm change password validation rules, to change/modify the above mentioned validation rules we have to edit configuration settings. To do so open the config_override.php available in root folder and make the changes as per the requirement.

To change the validation rules, Please edit the below array elements

$sugar_config[‘passwordsetting’][‘oneupper’] = false;   // which removes the validation rule ( one Upper case letter in password )
$sugar_config[‘passwordsetting’][‘onenumber’] = false;  // which removes the validation rule ( one number in password )

To read more about sugarCRM click here


sugarcrm change password validation rules

php group numbers into intervals

php group numbers into intervals

The article php group numbers into intervals will explain how to group the provided numbers in to intervals.


function group_nums($array) {
  $ret = array();
  $temp = array();
  foreach($array as $val) {
    if(next($array) == ($val + 1))
      $temp[] = $val;
      if(count($temp) > 0) {
        $temp[] = $val;
        $ret[] = $temp[0].’:’.end($temp);
        $temp = array();
        $ret[] = $val;
  return $ret;

$nums = array(1, 2, 3, 4, 14, 21, 23, 28, 29);

    [0] => 1-4
    [1] => 14
    [2] => 21
    [3] => 23
    [4] => 28-29


Get users who flagged a node

Get users who flagged a node

This article will explain how to get users who flagged a node in drupal. Drupal provides a contributed module named Flag module which is used to create unlimited arbitrary flags or bookmarks to flag content.

In one for the Drupal project we had a requirement to get users who flagged a node and display their details when ever that node is viewed in the browser.

To get users who flagged a node, here node can be any thing like blog post, user, content type etc… we need to invoke flog module in our custom module or block that has to display the users list.

Use below code to get all the users who had flagged a particular node.

Step 1 :  To get the node ID from URL

if (arg(0) == 'node') {
  $nid = arg(1);

Step 2 :  Using node ID get users who flagged a node.

$user_ids=array(); //User Array initialization 
$nid = 2; //node ID
  $flags = module_invoke('flag', 'get_content_flags', 'node', $nid);
  if (isset($flags)) {
    foreach ($flag as $uid => $data) {
       $user[] = $uid; //Adds user ids to the user array.

To get User pictures user below code

if (arg(0) == 'node' && is_numeric(arg(1))) {
  $node = node_load(arg(1));
  $nid = $node->nid;
  $accounts = module_invoke('flag', 'get_content_flags', 'node', $nid);
  if (isset($accounts)) {
    foreach ($accounts as $uid => $data) {
      $account = user_load(array('uid' => $uid));
      print theme('user_picture', $account); //Substitute this with whatever you'd like to display from the user.

To read more about Drupal from here

Drupal get comments of node

Drupal get comments of node

In Drupal 7 you can use the below code to get all the comments of a node using node ID

$nid = 2; // node ID
    $comments = db_select('comment')
              ->fields('comment', array('name','subject'))
              ->condition('nid', $nid, '=')
    foreach($comments as $comment) {
        print your comments here

In Drupal 6 you can use the comment_render() ;



Database connection with Nodejs and print data to browser

Install Node.js

Open Command prompt  start server

Run below command in command prompt
npm install mysql

var http = require('http');
var mysql = require('mysql');
var connection = mysql.createConnection({
host: 'hostname',
user: 'username',
database: 'dbname',
port: 3306

console.log('MySQL Connection details  '+connection);

http.createServer(function (request, response)
console.log('Creating the http server');
connection.query('SELECT * FROM user', function(err, rows, fields)
console.log('Connection result error '+err);
console.log('no of records is '+rows.length);
response.writeHead(200, { 'Content-Type': 'application/json'});


Memcache Installation in Ubuntu

Memcache Installation in Ubuntu

This article explains about installation of Memcache in Ubuntu systems.

Memcache installation in Ubuntu is required to use chache mechanism in the applications developed using php. Many frames woks and CMS developed using php can use the advantages of Memcache.

Below are the steps used to follow for Memcahe installation in ubuntu system.

Ensure that we will be downloading the latest packages to our server:

sudo apt-get update

Install memcached:

sudo apt-get install memcached php5-memcache

Install php-pear which is the repository which stores memcache:

sudo apt-get install php-pear

Unless you already have a compiler on your server,  download build-essential:

sudo apt-get install build-essential

Use PECL  to install memcache:

sudo pecl install memcache

Respond “yes” if asked whether you would like to enable memcache session handler support.
Finally, add memcache to php.ini

sudo echo “” > sudo /etc/php5/apache2/php.ini

checkk it terminal by typing command
–>telnet localhost 11211
add extension in php.ini
restart apache
–> sudo /etc/init.d/apache2 start
check in phpinfo.php file memcache enabled

Compare Joomla and Drupal Terminology

Compare Joomla and Drupal Terminology

Joomla and Drupal are the two most popular and most used content management systems (CMS) in web. Both these CMS are open source ( free to use)  and built on PHP + MySQL. Both these CMS vary significantly in terms of features, capability, flexibility and terminology. Below, is the list to compare Joomla and Drupal Terminology.

Joomla : 

Joomla is an award-winning, open-source CMS (content management system) with over 35 million downloads worldwide and still counting. It has thousands of extensions and designs and is backed by a large community of coders, developers and support staff. Joomla is very versatile, user-friendly and mobile-ready, making it a very sought-after CMS for corporate websites.

Drupal : 

Drupal is open source software maintained and developed by a community of 630,000+ users and developers. Drupal is used to build everything from personal blogs to enterprise applications. Thousands of add-on modules and designs let you build online communities, media portal, online store, and more!

 Joomla and Drupal Terminology

  1. Joomla Template is called Theme in Drupal.
  2. Component = Module.
  3. Module = Block.
  4. Mambot/Plugin = Input filter.
  5. Menu-Horizontal = Primary Links
  6. Menu-Vertical = Navigation
  7. Dynamic Content Item = Story
  8. Static Content = Page
  9. Back-end = there is no back-end in Drupal,
  10. SEF = Clean URLs (but some docs refer to SEF, too).
  11. Section = Taxonomy Vocabulary/Term
  12. Section Title = Taxonomy Term (master)
  13. Category = Taxonomy Term (child)
  14. Introtext = Teaser
  15. Maintext = Body (see explanation below)
  16. Pathway = Breadcrumb

Other terms are the same, such as: forum discussion, editor, search, region, comment, subject/title, preview, html tag, view, edit, advertising/banner, log in/log out, profile, avatar, access control, logs, cache, site maintenance, RSS feed, parent-child and snippets.

Read more about Drupal here

Read more about Joomla here

htaccess detect and redirect Mobile users

htaccess detect and redirect Mobile users.

This article explains how to detect  mobile users on website and redirect them to a mobile website using .htaccess.

There are many mobile devices available in the market, So if you want detect particular mobile users on your website and redirect them to a specific page or mobile website we need to alter/add the .htaccess file in your website root.

For example if you want to detect iPhone users and redirect them to specific domain through .htaccess file. Add the below code in the .htaccess file located in the root folder :

For iPhone :

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} iPhone
RewriteRule .* [R]


The below code will work for all the mobiles:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|netfront|opera\ m(ob|in)i|palm(\ os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ (ce|phone)|xda|xiino [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\ wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r\ |s\ )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1\ u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(\ i|ip)|hs\-c|ht(c(\-|\ |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(\ |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(\ |\/)|klon|kpt\ |kwc\-|kyo(c|k)|le(no|xi)|lg(\ g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-|\ |o|v)|zz)|mt(50|p1|v\ )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v\ )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|\ )|webc|whit|wi(g\ |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-) [NC]
RewriteRule ^$ [R,L]

You can read more about .htaccess by clicking here