Flipkart

Thursday, April 7, 2011

Eliminate Viruses from Your Pen Drive

Published on February 5, 2009
An easy way for computers get a virus is from the use of pen drives (also known as USB devices or flash drives). Many viruses like the Ravmon virus and Heap41, which is a worm, are not detected by the usual anti-virus software. These viruses spread rapidly through USB devices. Suma Munireddy—our Employee Journalist from Bangalore—sent us a useful tip on how to protect your computer from viruses spread through USB devices.
1. Plug your pen drive or USB device to the computer.
2. After a few moments, a dialog box will pop up. Ignore this dialog box by clicking Cancel.
3. Now go to Start --> Run and type cmd to open the Command Prompt window.
4. In the Command window, type the USB drive letter and then press Enter. For instance, the drive letter for your USB device may be “E:” In this case, type “E:” in the Command window and press Enter.
5. Then, type dir/w/o/a/p and press Enter.
You will now get a list of files. In the list, see if you have any of the following:

 *   Autorun.inf
 *   New Folder.exe
 *   Bha.vbs
 *   Iexplore.vbs
 *   Info.exe
 *   New_Folder.exe
 *   Ravmon.exe
 *   RVHost.exe
 *   Any other files with .exe extension
If you notice any of the files above, type attrib -h -r -s -a *.* and press Enter.
Now delete each of the above files by typing the following command: del "filename" (for instance, del autorun.inf).
That’s all there is to it! Now just scan your USB drive with the anti-virus software you have to ensure that your pen drive is really free of all viruses.

Friday, March 18, 2011

extend CCK-fields with custom formatters

We can create new custom formatter for CCK fields using hook_field_formatter_info(), below is the example


/**
* Implementation of hook_field_formatter_info().
*/
function myModule_field_formatter_info() {
 
$formatters = array();
  if (
module_exists('filefield')) {
     
$formatters['myFormatter'] = array(
       
'label' => t('My Formatter'),
       
'field types' => array('filefield'),
       
'multiple values' => CONTENT_HANDLE_CORE,
      );
  }
  return
$formatters;
}
/**
* Theme function for myFormatter from hook_field_formatter_info.
* @param $element
*   an array of formatter info and the item to theme. look in $element['#item'] for the field item to theme.
*/
function theme_myModule_formatter_myFormatter($element) {
  return
"themed element"
}
/**
* Implementation of hook_theme().
*/
function myModule_theme($existing, $type, $theme, $path) {
  return array(
   
'myModule_formatter_myFormatter' => array(
     
'arguments' => array('element' => NULL),
    ),
  );
}
?>

Wednesday, March 16, 2011

Friday, February 18, 2011

Get number of weeks between 2 dates

function weeks_between($datefrom, $dateto)
{
    $datefrom_arr = explode("-", $datefrom);
    $datefrom = mktime(0,0,0,$datefrom_arr[1], $datefrom_arr[2], $datefrom_arr[0]);
                //echo date('Y-m-d',mktime(0,0,0,$datefrom_arr[1], $datefrom_arr[2]+7, $datefrom_arr[0]));
               
                $dateto_arr = explode("-",$dateto);
                $dateto = mktime(0,0,0,$dateto_arr[1], $dateto_arr[2], $dateto_arr[0]);
               
    $day_of_week = date("w", $datefrom);
    $fromweek_start = $datefrom - ($day_of_week * 86400) - ($datefrom % 86400);
    $diff_days = days_between($datefrom, $dateto);
    $diff_weeks = intval($diff_days / 7);
    $seconds_left = ($diff_days % 7) * 86400;

    if( ($datefrom - $fromweek_start) + $seconds_left > 604800 )
        $diff_weeks ++;

    return $diff_weeks;
}

function days_between($datefrom,$dateto){
    $fromday_start = mktime(0,0,0,date("m",$datefrom),date("d",$datefrom),date("Y",$datefrom));
    $diff = $dateto - $datefrom;
    $days = intval( $diff / 86400 ); // 86400  / day

    if( ($datefrom - $fromday_start) + ($diff % 86400) > 86400 )
        $days++;

    return  $days;
}

Friday, January 28, 2011

Send Text Messages with PHP

PText messaging has become extremely widespread throughout the world — to the point where an increasing number of web applications have integrated SMS to notify users of events, sales or coupons directly through their mobile devices.

For more Information:

http://net.tutsplus.com/tutorials/php/how-to-send-text-messages-with-php/

Introduction to creating desktop applications with PHP and Titanium

We can now create desktop applications without learning a completely new programming language! That is with the help of a free and open source tool called "Titanium". Whats more you will use your existing CSS and Javascript and PHP knowledge.

For more Information Visit:

http://www.sanisoft.com/blog/2011/01/03/introduction-to-creating-desktop-applications-with-php-and-titanium/

Monday, November 15, 2010

drupal_set_message() in user_logout

http://drupal.org/node/754560


   $cookieParams = session_get_cookie_params();
    session_start();
    session_set_cookie_params($
cookieParams);
  // Load the anonymous user
  $user = drupal_anonymous_user(session_id());
  drupal_set_message(t('You have successfully logged out of the system. Enter your Username and Passwords below to login again.'));