Thursday, December 23, 2010

Email Verifier

Real Email Verifier

If you are having large list of emails and want to check that which email is valid and which are not valid,
just click on below link.

This is not a normal email format checker, it is REAL EMAIL VERIFIER.
Here you can go   Email verifier   .

                                                            
By: Amit Gaur                                        
                                                              
                                                            

Thursday, November 18, 2010

Google map cluster with JSON

Google map cluster with JSON

When will cluster not work!.

I have identified that , if php script or any other server side script output in json and save it in file; and then use that file into google map cluster , then it will not work.

So don't use php or any other server side script which output in json in to system file, instead of json use direct values.

For ex:

// Get data from database and store it in $data variable.
// encode it in json
$json = json_encode($data);
// write it into "demo.json" file.
fwrite($fh, $json);

// use that file in map

$('#map_canvas').gmap().bind('init', function() {
    $.getJSON( 'http://localhost:90/testmapclustermarker/json/demo.json', function(data) {
 //put here marker cluster code, you can see cluster will not show/work.

    } );
    });

// == instead of above code use this below code ==

<div id="map_canvas" class="map" style="height:600px;"></div>
    <script type="text/javascript">
        //first use map api as:
        $('#map_canvas').gmap().bind('init', function(evt, map) {

// start here your server side programming tag:   
// connect to database and iterate it. don't store it in file system and don't convert it in json format.
// while not end database
// end here your server side programming tag:   

var marker_img="http://localhost:90/test/img/test.png";
$('#map_canvas').gmap('addMarker', {
                'position': new google.maps.LatLng(<?php echo (float)$row['lat'];?>,<?php echo (float)$row['log'];?>),
                'icon':new google.maps.MarkerImage(marker_img,new google.maps.Size(32,37)),
                'bounds': true,
                animation: google.maps.Animation.DROP,
            }).click(function() {                                    // marker.content
                $('#map_canvas').gmap('openInfoWindow', { 'content': "test"}, this);
            } );

// end loop database.
// set cluster here
var mcOptions = {gridSize: 50, maxZoom: 9, minimumClusterSize: 15, title: 'test'};
$('#map_canvas').gmap('set', 'MarkerClusterer', new MarkerClusterer(map, $(this).gmap('get', 'markers'), mcOptions));
</script>




Make Profile Photo link in not working in social engine 4

Make Profile Photo link in not working in social engine 4

=====================================================
I was working in Social Engine 4 bug fix. I have found s bug , when user upload event's photo and if want to make it profile photo(by clicking on button) then nothing is happened. It was showing an server side error message.  To fix this problem, make listed below changes in .tpl and .php file  

=====================================================
Open "application/modules/Album/views/scripts/photo/view.tpl" file 
and replace listed below code:


<?php
  $this->headScript()
    ->appendFile($this->baseUrl() . '/externals/moolasso/Lasso.js')
    ->appendFile($this->baseUrl() . '/externals/moolasso/Lasso.Crop.js')
    ->appendFile($this->baseUrl() . '/externals/autocompleter/Observer.js')
    ->appendFile($this->baseUrl() . '/externals/autocompleter/Autocompleter.js')
    ->appendFile($this->baseUrl() . '/externals/autocompleter/Autocompleter.Local.js')
    ->appendFile($this->baseUrl() . '/externals/autocompleter/Autocompleter.Request.js')
    ->appendFile($this->baseUrl() . '/externals/tagger/tagger.js')
    ->appendFile($this->baseUrl() . '/application/modules/Album/externals/scripts/core.js');
  $this->headTranslate(array(
    'Save', 'Cancel', 'delete',
  ));
?>

<script type="text/javascript">
  var taggerInstance;
  en4.core.runonce.add(function() {
    var descEls = $$('.albums_viewmedia_info_caption');
    if( descEls.length > 0 ) {
      descEls[0].enableLinks();
    }

    taggerInstance = new Tagger('media_photo_next', {
      'title' : '<?php echo $this->string()->escapeJavascript($this->translate('ADD TAG'));?>',
      'description' : '<?php echo $this->string()->escapeJavascript($this->translate('Type a tag or select a name from the list.'));?>',
      'createRequestOptions' : {
        'url' : '<?php echo $this->url(array('module' => 'core', 'controller' => 'tag', 'action' => 'add'), 'default', true) ?>',
        'data' : {
          'subject' : '<?php echo $this->subject()->getGuid() ?>'
        }
      },
      'deleteRequestOptions' : {
        'url' : '<?php echo $this->url(array('module' => 'core', 'controller' => 'tag', 'action' => 'remove'), 'default', true) ?>',
        'data' : {
          'subject' : '<?php echo $this->subject()->getGuid() ?>'
        }
      },
      'cropOptions' : {
        'container' : $('media_photo_next')
      },
      'tagListElement' : 'media_tags',
      'existingTags' : <?php echo $this->action('retrieve', 'tag', 'core', array('sendNow' => false)) ?>,
      'suggestProto' : 'request.json',
      'suggestParam' : "<?php echo $this->url(array('module' => 'user', 'controller' => 'friends', 'action' => 'suggest', 'includeSelf' => true), 'default', true) ?>",
      'guid' : <?php echo ( $this->viewer()->getIdentity() ? "'".$this->viewer()->getGuid()."'" : 'false' ) ?>,
      'enableCreate' : <?php echo ( $this->canTag ? 'true' : 'false') ?>,
      'enableDelete' : <?php echo ( $this->canUntagGlobal ? 'true' : 'false') ?>
    });

    // Remove the href attrib while tagging
    var nextHref = $('media_photo_next').get('href');
    taggerInstance.addEvents({
      'onBegin' : function() {
        $('media_photo_next').erase('href');
      },
      'onEnd' : function() {
        $('media_photo_next').set('href', nextHref);
      }
    });

    window.addEvent('keyup', function(e) {
      if( e.target.get('tag') == 'html' ||
          e.target.get('tag') == 'body' ) {
        if( e.key == 'right' ) {
          window.location.href = "<?php echo ( $this->nextPhoto ? $this->nextPhoto->getHref() : 'window.location.href' ) ?>";
        } else if( e.key == 'left' ) {
          window.location.href = "<?php echo ( $this->previousPhoto ? $this->previousPhoto->getHref() : 'window.location.href' ) ?>";
        }
      }
    });
  });
</script>



<h2>
  <?php echo $this->translate('%1$s\'s Album: %2$s', $this->album->getOwner()->__toString(), $this->htmlLink($this->album, $this->album->getTitle())); ?>
</h2>

<?php if (""!=$this->album->getDescription()): ?>
  <p class="photo-description">
    <?php echo $this->album->getDescription() ?>
  </p>
<?php endif ?>

<div class="layout_middle">
<div class='albums_viewmedia'>
  <?php if( !$this->message_view): ?>
  <div class="albums_viewmedia_nav">
    <div>
      <?php echo $this->translate('Photo %1$s of %2$s in %3$s',
          $this->locale()->toNumber($this->photo->getPhotoIndex() + 1),
          $this->locale()->toNumber($this->album->count()),
          (string) $this->album->getTitle()) ?>
    </div>
    <?php if( $this->album->count() > 1 ): ?>
    <div>
      <?php echo $this->htmlLink(( $this->previousPhoto ? $this->previousPhoto->getHref() : null ), $this->translate('Prev')) ?>
      <?php echo $this->htmlLink(( $this->nextPhoto ? $this->nextPhoto->getHref() : null ), $this->translate('Next')) ?>
    </div>
    <?php endif ?>
  </div>
  <?php endif ?>
  <div class='albums_viewmedia_info'>
    <div class='album_viewmedia_container' id='media_photo_div'>
      <a id='media_photo_next'  href='<?php echo $this->nextPhoto ? $this->escape($this->nextPhoto->getHref()) : '#' ?>'>
        <?php echo $this->htmlImage($this->photo->getPhotoUrl(), $this->photo->getTitle(), array(
          'id' => 'media_photo'
        )); ?>
      </a>
    </div>
    <br />
    <a></a>
    <?php if( $this->photo->getTitle() ): ?>
      <div class="albums_viewmedia_info_title">
        <?php echo $this->photo->getTitle(); ?>
      </div>
    <?php endif; ?>
    <?php if( $this->photo->getDescription() ): ?>
      <div class="albums_viewmedia_info_caption">
        <?php echo nl2br($this->photo->getDescription()) ?>
      </div>
    <?php endif; ?>
    <div class="albums_viewmedia_info_tags" id="media_tags" style="display: none;">
      <?php echo $this->translate('Tagged:') ?>
    </div>
    <div class="albums_viewmedia_info_footer">
      <div class="albums_viewmedia_info_date">
        <?php echo $this->translate('Added %1$s', $this->timestamp($this->photo->modified_date)) ?>
        <?php if( $this->canTag ): ?>
          - <?php echo $this->htmlLink('javascript:void(0);', $this->translate('Add Tag'), array('onclick'=>'taggerInstance.begin();')) ?>
        <?php endif; ?>
        <?php if( $this->canEdit ): ?>
          - <?php echo $this->htmlLink(array('reset' => false, 'action' => 'edit'), $this->translate('Edit'), array('class' => 'smoothbox')) ?>
        <?php endif; ?>
        <?php if( $this->canDelete ): ?>
          - <?php echo $this->htmlLink(array('reset' => false, 'action' => 'delete'), $this->translate('Delete'), array('class' => 'smoothbox')) ?>
        <?php endif; ?>
        <?php if( !$this->message_view ):?>
        - <?php echo $this->htmlLink(Array('module'=> 'activity', 'controller' => 'index', 'action' => 'share', 'route' => 'default', 'type' => 'album_photo', 'id' => $this->photo->getIdentity(), 'format' => 'smoothbox'), $this->translate("Share"), array('class' => 'smoothbox')); ?>
        - <?php echo $this->htmlLink(Array('module'=> 'core', 'controller' => 'report', 'action' => 'create', 'route' => 'default', 'subject' => $this->photo->getGuid(), 'format' => 'smoothbox'), $this->translate("Report"), array('class' => 'smoothbox')); ?>
        - <?php echo $this->htmlLink(array('route' => 'user_extended', 'controller' => 'edit', 'action' => 'external-photo', 'photo' => $this->photo->getGuid(), 'format' => 'smoothbox'), $this->translate('Make Profile Photo'), array('class' => 'smoothbox')) ?>
        <?php endif;?>
      </div>
      <?php if( $this->canEdit ): ?>
      <div class="albums_viewmedia_info_actions">
        <a class="buttonlink icon_photos_rotate_ccw" href="javascript:void(0)" onclick="$(this).set('class', 'buttonlink icon_loading');en4.album.rotate(<?php echo $this->photo->getIdentity() ?>, 90).addEvent('complete', function(){ this.set('class', 'buttonlink icon_photos_rotate_ccw') }.bind(this));">&nbsp;</a>
        <a class="buttonlink icon_photos_rotate_cw" href="javascript:void(0)" onclick="$(this).set('class', 'buttonlink icon_loading');en4.album.rotate(<?php echo $this->photo->getIdentity() ?>, 270).addEvent('complete', function(){ this.set('class', 'buttonlink icon_photos_rotate_cw') }.bind(this));">&nbsp;</a>
        <a class="buttonlink icon_photos_flip_horizontal" href="javascript:void(0)" onclick="$(this).set('class', 'buttonlink icon_loading');en4.album.flip(<?php echo $this->photo->getIdentity() ?>, 'horizontal').addEvent('complete', function(){ this.set('class', 'buttonlink icon_photos_flip_horizontal') }.bind(this));">&nbsp;</a>
        <a class="buttonlink icon_photos_flip_vertical" href="javascript:void(0)" onclick="$(this).set('class', 'buttonlink icon_loading');en4.album.flip(<?php echo $this->photo->getIdentity() ?>, 'vertical').addEvent('complete', function(){ this.set('class', 'buttonlink icon_photos_flip_vertical') }.bind(this));">&nbsp;</a>
      </div>
      <?php endif ?>
    </div>
  </div>

  <?php echo $this->action("list", "comment", "core", array("type"=>"album_photo", "id"=>$this->photo->getIdentity())); ?>
</div>
</div>


=====================================================
Open "application/modules/User/controllers/EditController.php" file 
and replace listed below code:

<?php

class User_EditController extends Core_Controller_Action_User
{
  public function init()
  {
    if( !Engine_Api::_()->core()->hasSubject() ) {
      // Can specifiy custom id
      $id = $this->_getParam('id', null);
      $subject = null;
      if( null === $id ) {
        $subject = Engine_Api::_()->user()->getViewer();
        Engine_Api::_()->core()->setSubject($subject);
      } else {
        $subject = Engine_Api::_()->getItem('user', $id);
        Engine_Api::_()->core()->setSubject($subject);
      }
    }
   
    if( !empty($id) ) {
      $params = array('params' => array('id' => $id));
    } else {
      $params = array();
    }
    // Set up navigation
    $this->view->navigation = $navigation = Engine_Api::_()
      ->getApi('menus', 'core')
      ->getNavigation('user_edit', array('params'=>array('id'=>$id)));

    // Set up require's
    $this->_helper->requireUser();
    $this->_helper->requireSubject('user');
    $this->_helper->requireAuth()->setAuthParams(
      null,
      null,
      'edit'
    );
  }
 
  public function profileAction()
  {
    $this->view->user = $user = Engine_Api::_()->core()->getSubject();
    $this->view->viewer = $viewer = Engine_Api::_()->user()->getViewer();

    // remove styles if users are not allowed to style page
    $style_perm = Engine_Api::_()->getDbtable('permissions', 'authorization')->getAllowed('user', $user->level_id, 'style');
    if(!$style_perm) $this->view->navigation->removePage(2);

   
    // General form w/o profile type
    $aliasedFields = $user->fields()->getFieldsObjectsByAlias();
    $this->view->topLevelId = $topLevelId = 0;
    $this->view->topLevelValue = $topLevelValue = null;
    if( isset($aliasedFields['profile_type']) ) {
      $aliasedFieldValue = $aliasedFields['profile_type']->getValue($user);
      $topLevelId = $aliasedFields['profile_type']->field_id;
      $topLevelValue = ( is_object($aliasedFieldValue) ? $aliasedFieldValue->value : null );
      if( !$topLevelId || !$topLevelValue ) {
        $topLevelId = null;
        $topLevelValue = null;
      }
      $this->view->topLevelId = $topLevelId;
      $this->view->topLevelValue = $topLevelValue;
    }
   
    // Get form
    $form = $this->view->form = new Fields_Form_Standard(array(
      'item' => Engine_Api::_()->core()->getSubject(),
      'topLevelId' => $topLevelId,
      'topLevelValue' => $topLevelValue,
    ));
    //$form->generate();
   
    // Not posting
    if( $this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost()) )
    {
      $form->saveValues();

      // Update display name
      $aliasValues = Engine_Api::_()->fields()->getFieldsValuesByAlias($user);
      $user->setDisplayName($aliasValues);
      //$user->modified_date = date('Y-m-d H:i:s');
      $user->save();

      // update networks
      Engine_Api::_()->network()->recalculate($user);
     
      $form->addNotice(Zend_Registry::get('Zend_Translate')->_('Your changes have been saved.'));
    }
  }


  public function photoAction()
  {
    $this->view->user = $user = Engine_Api::_()->core()->getSubject();
    $this->view->viewer = $viewer = Engine_Api::_()->user()->getViewer();

    // remove styles if users are not allowed to style page
    $style_perm = Engine_Api::_()->getDbtable('permissions', 'authorization')->getAllowed('user', $user->level_id, 'style');
    if( !$style_perm ) {
      $this->view->navigation->removePage(2);
    }

    // Get form
    $this->view->form = $form = new User_Form_Edit_Photo();

    if( empty($user->photo_id) ) {
      $form->removeElement('remove');
    }

    if( !$this->getRequest()->isPost() ) {
      return;
    }

    if( !$form->isValid($this->getRequest()->getPost()) ) {
      return;
    }

    // Uploading a new photo
    if( $form->Filedata->getValue() !== null ) {
      $db = $user->getTable()->getAdapter();
      $db->beginTransaction();
     
      try {
        $fileElement = $form->Filedata;

        $user->setPhoto($fileElement);
       
        $iMain = Engine_Api::_()->getItem('storage_file', $user->photo_id);
       
        // Insert activity
        $action = Engine_Api::_()->getDbtable('actions', 'activity')->addActivity($user, $user, 'profile_photo_update',
          '{item:$subject} added a new profile photo.');

        // Hooks to enable albums to work
        if( $action ) {
          $event = Engine_Hooks_Dispatcher::_()
            ->callEvent('onUserProfilePhotoUpload', array(
                'user' => $user,
                'file' => $iMain,
              ));

          $attachment = $event->getResponse();
          if( !$attachment ) $attachment = $iMain;

          // We have to attach the user himself w/o album plugin
          Engine_Api::_()->getDbtable('actions', 'activity')->attachActivity($action, $attachment);
        }
       
        $db->commit();
      }

      // If an exception occurred within the image adapter, it's probably an invalid image
      catch( Engine_Image_Adapter_Exception $e )
      {
        $db->rollBack();
        $form->addError(Zend_Registry::get('Zend_Translate')->_('The uploaded file is not supported or is corrupt.'));
      }

      // Otherwise it's probably a problem with the database or the storage system (just throw it)
      catch( Exception $e )
      {
        $db->rollBack();
        throw $e;
      }
    }

    // Resizing a photo
    else if( $form->getValue('coordinates') !== '' ) {
      $storage = Engine_Api::_()->storage();

      $iProfile = $storage->get($user->photo_id, 'thumb.profile');
      $iSquare = $storage->get($user->photo_id, 'thumb.icon');

      // Read into tmp file
      $pName = $iProfile->getStorageService()->temporary($iProfile);
      $iName = dirname($pName) . '/nis_' . basename($pName);

      list($x, $y, $w, $h) = explode(':', $form->getValue('coordinates'));

      $image = Engine_Image::factory();
      $image->open($pName)
        ->resample($x+.1, $y+.1, $w-.1, $h-.1, 48, 48)
        ->write($iName)
        ->destroy();

      $iSquare->store($iName);

      // Remove temp files
      @unlink($iName);
    }
  }

  public function removePhotoAction()
  {
    // Get form
    $this->view->form = $form = new User_Form_Edit_RemovePhoto();

    if( !$this->getRequest()->isPost() || !$form->isValid($this->getRequest()->getPost()) )
    {
      return;
    }
   

    $user = Engine_Api::_()->core()->getSubject();
    $user->photo_id = 0;
    $user->save();
   
    $this->view->status = true;
    $this->view->message = Zend_Registry::get('Zend_Translate')->_('Your photo has been removed.');

    $this->_forward('success', 'utility', 'core', array(
      'smoothboxClose' => true,
      'parentRefresh' => true,
      'messages' => array(Zend_Registry::get('Zend_Translate')->_('Your photo has been removed.'))
    ));
  }

  public function styleAction()
  {
    $this->view->user = $user = Engine_Api::_()->core()->getSubject();
    $this->view->viewer = $viewer = Engine_Api::_()->user()->getViewer();
    if( !$this->_helper->requireAuth()->setAuthParams('user', null, 'style')->isValid()) return;


    // Get form
    $this->view->form = $form = new User_Form_Edit_Style();

    // Get current row
    $table = Engine_Api::_()->getDbtable('styles', 'core');
    $select = $table->select()
      ->where('type = ?', $user->getType())
      ->where('id = ?', $user->getIdentity())
      ->limit();

    $row = $table->fetchRow($select);

    // Not posting, populate
    if( !$this->getRequest()->isPost() )
    {
      $form->populate(array(
        'style' => ( null === $row ? '' : $row->style )
      ));
      return;
    }

    // Whoops, form was not valid
    if( !$form->isValid($this->getRequest()->getPost()) )
    {
      return;
    }


    // Cool! Process
    $style = $form->getValue('style');

    // Process
    $style = strip_tags($style);

    $forbiddenStuff = array(
      '-moz-binding',
      'expression',
      'javascript:',
      'behaviour:',
      'vbscript:',
      'mocha:',
      'livescript:',
    );

    $style = str_replace($forbiddenStuff, '', $style);

    // Save
    if( null == $row )
    {
      $row = $table->createRow();
      $row->type = $user->getType();
      $row->id = $user->getIdentity();
    }

    $row->style = $style;
    $row->save();

    $form->addNotice(Zend_Registry::get('Zend_Translate')->_('Your changes have been saved.'));
  }

  public function externalPhotoAction()
  {
    if( !$this->_helper->requireSubject()->isValid() ) return;
    $user = Engine_Api::_()->core()->getSubject();
   
    // Get photo
    $photo = Engine_Api::_()->getItemByGuid($this->_getParam('photo'));
    if( !$photo || !($photo instanceof Core_Model_Item_Abstract) || empty($photo->photo_id) ) {
      $this->_forward('requiresubject', 'error', 'core');
      return;
    }

    if( !$photo->authorization()->isAllowed(null, 'view') ) {
      $this->_forward('requireauth', 'error', 'core');
      return;
    }

   
    // Make form
    $this->view->form = $form = new User_Form_Edit_ExternalPhoto();
    $this->view->photo = $photo;

    if( !$this->getRequest()->isPost() ) {
      return;
    }

    if( !$form->isValid($this->getRequest()->getPost()) ) {
      return;
    }

    // Process
    $db = $user->getTable()->getAdapter();
    $db->beginTransaction();
   
    try {
      // Get the owner of the photo
      $photoOwnerId = null;
      if( isset($photo->user_id) ) {
        $photoOwnerId = $photo->user_id;
      } else if( isset($photo->owner_id) && (!isset($photo->owner_type) || $photo->owner_type == 'user') ) {
        $photoOwnerId = $photo->owner_id;
      }

      // if it is from your own profile album do not make copies of the image
      if( $photo instanceof Album_Model_Photo &&
          ($photoParent = $photo->getParent()) instanceof Album_Model_Album &&
          $photoParent->owner_id == $photoOwnerId &&
          $photoParent->type == 'profile' ) {

        // ensure thumb.icon and thumb.profile exist
        $newStorageFile = Engine_Api::_()->getItem('storage_file', $photo->file_id);
        $filesTable = Engine_Api::_()->getDbtable('files', 'storage');
        if( $photo->file_id == $filesTable->lookupFile($photo->file_id, 'thumb.profile') ) {
          try {
            $tmpFile = $newStorageFile->temporary();
            $image = Engine_Image::factory();
            $image->open($tmpFile)
              ->resize(200, 400)
              ->write($tmpFile)
              ->destroy();
            $iProfile = $filesTable->createFile($tmpFile, array(
              'parent_type' => $user->getType(),
              'parent_id' => $user->getIdentity(),
              'user_id' => $user->getIdentity(),
              'name' => basename($tmpFile),
            ));
            $newStorageFile->bridge($iProfile, 'thumb.profile');
            @unlink($tmpFile);
          } catch( Exception $e ) { echo $e; die(); }
        }
        if( $photo->file_id == $filesTable->lookupFile($photo->file_id, 'thumb.icon') ) {
          try {
            $tmpFile = $newStorageFile->temporary();
            $image = Engine_Image::factory();
            $image->open($tmpFile);
            $size = min($image->height, $image->width);
            $x = ($image->width - $size) / 2;
            $y = ($image->height - $size) / 2;
            $image->resample($x, $y, $size, $size, 48, 48)
              ->write($tmpFile)
              ->destroy();
            $iSquare = $filesTable->createFile($tmpFile, array(
              'parent_type' => $user->getType(),
              'parent_id' => $user->getIdentity(),
              'user_id' => $user->getIdentity(),
              'name' => basename($tmpFile),
            ));
            $newStorageFile->bridge($iSquare, 'thumb.icon');
            @unlink($tmpFile);
          } catch( Exception $e ) { echo $e; die(); }
        }

        // Set it
        $user->photo_id = $photo->file_id;
        $user->save();
       
        // Insert activity
        // @todo maybe it should read "changed their profile photo" ?
        $action = Engine_Api::_()->getDbtable('actions', 'activity')
            ->addActivity($user, $user, 'profile_photo_update',
                '{item:$subject} changed their profile photo.');
        if( $action ) {
          // We have to attach the user himself w/o album plugin
          Engine_Api::_()->getDbtable('actions', 'activity')
              ->attachActivity($action, $photo);
        }
      }

      // Otherwise copy to the profile album
      else {
        $user->setPhoto($photo);

        // Insert activity
        $action = Engine_Api::_()->getDbtable('actions', 'activity')
            ->addActivity($user, $user, 'profile_photo_update',
                '{item:$subject} added a new profile photo.');
       
        // Hooks to enable albums to work
        $newStorageFile = Engine_Api::_()->getItem('storage_file', $user->photo_id);
        $event = Engine_Hooks_Dispatcher::_()
          ->callEvent('onUserProfilePhotoUpload', array(
              'user' => $user,
              'file' => $newStorageFile,
            ));

        $attachment = $event->getResponse();
        if( !$attachment ) {
          $attachment = $newStorageFile;
        }
       
        if( $action  ) {
          // We have to attach the user himself w/o album plugin
          Engine_Api::_()->getDbtable('actions', 'activity')
              ->attachActivity($action, $attachment);
        }
      }

      $db->commit();
    }

    // Otherwise it's probably a problem with the database or the storage system (just throw it)
    catch( Exception $e )
    {
      $db->rollBack();
      throw $e;
    }
   
    return $this->_forward('success', 'utility', 'core', array(
      'messages' => array(Zend_Registry::get('Zend_Translate')->_('Set as profile photo')),
      'smoothboxClose' => true,
    ));
  }

  public function clearStatusAction()
  {
    $this->view->status = false;
   
    if( $this->getRequest()->isPost() ) {
      $viewer = Engine_Api::_()->user()->getViewer();
      $viewer->status = '';
      $viewer->status_date = '00-00-0000';
      // twitter-style handling
      // $lastStatus = $viewer->status()->getLastStatus();
      // if( $lastStatus ) {
      //   $viewer->status = $lastStatus->body;
      //   $viewer->status_date = $lastStatus->creation_date;
      // }
      $viewer->save();
     
      $this->view->status = true;
    }
  }
}

Wednesday, November 17, 2010

Multiple and single words count algorithm

<?php
// Multiple and single words suggestion algorithm.


    $words="this is a programming language. the programming language is only for smart humans or aliens in the all universe. There are lot of programming language available. The most popular programming language Java. programming language Java is very poupular due to its robustness. programming language Java programming language Java programming language Java programming language Java testing testing testing testing testing testing testing testing testing testing testing";
   
    echo $words."<br>";
    $words=str_replace(array(".",",",";",":"),"",$words);
    $res=array();
    $wArr=explode(" ",$words);
    $nArr=explode(" ",$words);
   
    $res=getSingleCount($wArr);
    echo "<br>Single words suggestion<br>=========================<br>";
    for($i=0;$i<count($res);$i++)
        echo $res[$i][0]."=".$res[$i][1]."<br>";
   
    echo "<br>Double words suggestion? just use n-1 number, where n is equals to 2<br>=========================<br>";
    $res2=getMultiSuggest($nArr,1,$words);
    for($i=0;$i<count($res2);$i++)
        echo $res2[$i][0]."=".$res2[$i][1]."<br>";
   
   
    echo "<br><br>Triple words suggestion? just use n-1 number, where n is equals to 3<br>=========================<br>";
    $res3=getMultiSuggest($nArr,2,$words);
    for($i=0;$i<count($res3);$i++)
        echo $res3[$i][0]."=".$res3[$i][1]."<br>";
   
   
    echo "<br><br>Four words suggestion? just use n-1 number, where n is equals to 4<br>=========================<br>";
    $res3=getMultiSuggest($nArr,3,$words);
    for($i=0;$i<count($res3);$i++)
        echo $res3[$i][0]."=".$res3[$i][1]."<br>";
   
    function getSingleCount($wArr) {
        for($i=0;$i<count($wArr);$i++) {
            $c=0;
            if($wArr[$i]=="")
                continue;
            for($j=1+$i;$j<count($wArr);$j++) {
                if($wArr[$i]!="" && $wArr[$j]!="") {
                    if(strtolower ($wArr[$i])==strtolower ($wArr[$j])) {
                        $c++;
                        $wArr[$j]="";
                    }
                }
            }
            $res[]= array($wArr[$i] , ++$c);
        }
        return $res;
    }
   
    function getMultiSuggest($nArr,$num,$fullSent) {
        $tt=$fullSent;
        $res=array();
       
        for($i=0;$i<count($nArr)-1;$i++) {
            $sWords="";
            for($j=$i;$j<=$i+$num && $j<count($nArr); $j++) {
                $sWords.=$nArr[$j]. " ";
            }
            $sWords=trim($sWords);
            $m=count(explode(" ",$sWords));
            $w=preg_match_all("/\b".$sWords."\b/i", $tt,$out);
            if($m==$num+1){
                if($w>1) {
                    $found=FALSE;
                    if(count($res)>=0) {
                        for($k=0;$k<count($res);$k++) {
                            if($res[$k][0]==$sWords) {
                                $found=TRUE;
                                break;
                            }
                        }
                    }
                    if($found==FALSE){
                        $res[]= array($sWords , $w);
                    }
                }
            }
               
        }
        return $res;   
    }
?>

Tuesday, November 16, 2010

Restricted access error in Joomla

'Restricted access' error in Joomla

When you work in Joomla, you can get the most common error 'Restricted access' error.
There many possibilities that show this error, but the most common mistake is to write incorrect statement.
you can write:
define('JEXEC') or die ('Restricted access');

but the corrected format is :
defined('JEXEC') or die ('Restricted access');  and run the page.
and Wow!!! you can get the same error message. now this is the time to more correct format is:
defined('_JEXEC') or die('Restricted access');

now run the page , you will not get the error.

 

Thursday, October 21, 2010

Access Controller variable in tpl file in Zend Framework


How to access Controller variable in tpl file in Zend Framework

In controller assign the variable name and it's value as listed below:

Controller file name EditController.php
---------------------------
//$this->view->assign('VARIABLE-NAME', 'VARIABLE-VALUE');
$this->view->assign('listing_id_for_view', $listing_id_for_view);


index.tpl:
---------------
 Access here as listed below:
<?php echo "Your listing id is : ".$this->listing_id_for_view ; ?>




Wednesday, October 13, 2010

Post entire form and return JSON data from PHP


Here is the entire code that will post entire PHP
form to the target page. The target page will receive
the post data and return the result in the format of JSON data.

Here are the two things one is it will send entire form data,
so you not need to mention every control name with parameter in Ajax.
second one is the target page which receive the data, is return output as
JSON Format.

First you need to download the latest jquery from the jquery site and then copy and
paste the below code and run it.

===========================================================
[1] email-form.php
------------------------------------
<script type="text/javascript" src="jquery-1.6.js"></script>
<form id="emailForm">
<p>Name:<br />
<input id="nName" type="text" name="nName"/></p>
<p>E-mail:><br />
<input id="email" type="text" name="email"/></p>
<p><input type="submit" value="Submit" /></p>
<div id="msg"></div>
</form>
<script type="text/javascript">
$(function(){
    $("#emailForm").submit(function(){
        dataString = $("#emailForm").serialize();
        $.ajax({
        type: "POST",
        url: "email-form-process.php",
        data: dataString,
        dataType: "json",
        timeout: 5000,
        error: function (xhr, err) {
                $("#msg").html(xhr.responseText + xhr.readyState + xhr.status);
            },
        success: function(data) {
            $("#msg").html("Hi " + data.nName + ", your email is " + data.email);
        }
    });
    return false;           
});
});
</script>

===========================================================
[2] email-form-process.php
------------------------------------
<?php
$retArr = array();
$retArr["nName"] = $_POST['nName'];
$retArr["email"] = $_POST['email'];
echo json_encode($retArr);
?>

===========================================================

Thursday, September 23, 2010

Apply style in Zend text field

How to apply style in Zend text field

$password = Zend_Registry::get('Zend_Translate')->_('* Password');
// Init password
$this->addElement('Password', 'password', array(
          'label' => $password,
          'required' => true,
          'allowEmpty' => false,
          'tabindex' => 2,
          'filters' => array('StringTrim',),
          'attribs' => array ('style' => 'width: 95%'),
        ));

Wednesday, September 22, 2010

PreparedStatement with Insert in java

PreparedStatement with insert in java
Here listed below code for insert the record using PreparedStatementin java



<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.text.*" %>

java.util.Date now = new java.util.Date(); 
String addMsg="";
String admin_login_add=request.getParameter("admin_login_add");
String admin_pass_add=null;
int admin_type_id_add=0;
if(admin_login_add!=null) {
    admin_login_add=admin_login_add.trim();
    admin_pass_add=request.getParameter("admin_pass_add");
    admin_type_id_add=Integer.parseInt(request.getParameter("admin_type_id_add"));
    try {
        PreparedStatement psAdminAdd= null;
        String sqlAdminAdd="Insert into admin_info (admin_login,admin_pass,admin_type_id) values(?,?,?)";
        psAdminAdd = conn.prepareStatement(sqlAdminAdd);
        psAdminAdd.setString(1,admin_login_add);
        psAdminAdd.setString(2,admin_pass_add);
        psAdminAdd.setInt(3,admin_type_id_add);
        psAdminAdd.executeUpdate();
        psAdminAdd.close();
        psAdminAdd=null;
        addMsg="<font color='green'><b>Admin user added.</b></font>";       
    } catch (java.sql.SQLException e) { 
             if(e.getErrorCode()==1062 && Integer.parseInt(e.getSQLState())==23000) {
                addMsg="<font color='red'><b>This user already exists.</b></font>";   
             }
    }  
}

Thursday, September 16, 2010

Transliteration

Transliteration API.
================================================

Just Test here......


Type English word in Hindi for ex: Amit tum kase ho?

Use listed below code:


<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script>
        if(!window['googleLT_']){window['googleLT_']=(new Date()).getTime();}if (!window['google']) {
            window['google'] = {};
        }
        if (!window['google']['loader']) {
            window['google']['loader'] = {};
            google.loader.ServiceBase = 'https://www.google.com/uds';
            google.loader.GoogleApisBase = 'https://ajax.googleapis.com/ajax';
            google.loader.ApiKey = 'ABQIAAAAcaLlMdnVT3N44H7x504_FRTm3QlNi32Qto_q4ApmWl2h24Y4ZBThIHiDymFNDPXorqAD1uGyzREBow';
            google.loader.KeyVerified = true;
            google.loader.LoadFailure = false;
            google.loader.Secure = true;
            google.loader.GoogleLocale = 'www.google.com';
            google.loader.ClientLocation = null;
            google.loader.AdditionalParams = '';
            (function() {var d=void 0,g=!0,h=null,j=!1,k=encodeURIComponent,l=window,m=document;function n(a,b){return a.load=b}var p="push",q="replace",r="charAt",t="indexOf",u="ServiceBase",v="name",w="getTime",x="length",y="prototype",z="setTimeout",A="loader",B="substring",C="join",D="toLowerCase";function E(a){return a in F?F[a]:F[a]=-1!=navigator.userAgent[D]()[t](a)}var F={};function G(a,b){var c=function(){};c.prototype=b[y];a.S=b[y];a.prototype=new c}
            function H(a,b,c){var e=Array[y].slice.call(arguments,2)||[];return function(){var c=e.concat(Array[y].slice.call(arguments));return a.apply(b,c)}}
            function I(a){a=Error(a);a.toString=function(){return this.message};return a}function J(a,b){for(var c=a.split(/\./),e=l,f=0;f<c[x]-1;f++)e[c[f]]||(e[c[f]]={}),e=e[c[f]];e[c[c[x]-1]]=b}
            function K(a,b,c){a[b]=c}if(!L)var L=J;if(!M)var M=K;google[A].v={};L("google.loader.callbacks",google[A].v);var N={},O={};google[A].eval={};L("google.loader.eval",google[A].eval);
n(google,function(a,b,c){function e(a){var b=a.split(".");if(2<b[x])throw I("Module: '"+a+"' not found!");if("undefined"!=typeof b[1])f=b[0],c.packages=c.packages||[],c.packages[p](b[1])}var f=a,c=c||{};if(a instanceof Array||a&&"object"==typeof a&&"function"==typeof a[C]&&"function"==typeof a.reverse)for(var i=0;i<a[x];i++)e(a[i]);else e(a);if(a=N[":"+f]){c&&!c.language&&c.locale&&(c.language=c.locale);if(c&&"string"==typeof c.callback&&(i=c.callback,i.match(/^[[\]A-Za-z0-9._]+$/)))i=l.eval(i),c.callback=
i;if((i=c&&c.callback!=h)&&!a.s(b))throw I("Module: '"+f+"' must be loaded before DOM onLoad!");i?a.m(b,c)?l[z](c.callback,0):a.load(b,c):a.m(b,c)||a.load(b,c)}else throw I("Module: '"+f+"' not found!");});L("google.load",google.load);
google.R=function(a,b){b?(0==P[x]&&(Q(l,"load",R),!E("msie")&&!E("safari")&&!E("konqueror")&&E("mozilla")||l.opera?l.addEventListener("DOMContentLoaded",R,j):E("msie")?m.write("<script defer onreadystatechange='google.loader.domReady()' src=//:><\/script>"):(E("safari")||E("konqueror"))&&l[z](T,10)),P[p](a)):Q(l,"load",a)};L("google.setOnLoadCallback",google.R);
            function Q(a,b,c){if(a.addEventListener)a.addEventListener(b,c,j);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var e=a["on"+b];a["on"+b]=e!=h?aa([c,e]):c}}function aa(a){return function(){for(var b=0;b<a[x];b++)a[b]()}}var P=[];google[A].N=function(){var a=l.event.srcElement;if("complete"==a.readyState)a.onreadystatechange=h,a.parentNode.removeChild(a),R()};L("google.loader.domReady",google[A].N);var ba={loaded:g,complete:g};
            function T(){ba[m.readyState]?R():0<P[x]&&l[z](T,10)}
            function R(){for(var a=0;a<P[x];a++)P[a]();P.length=0}google[A].d=function(a,b,c){if(c){var e;if("script"==a)e=m.createElement("script"),e.type="text/javascript",e.src=b;else if("css"==a)e=m.createElement("link"),e.type="text/css",e.href=b,e.rel="stylesheet";(a=m.getElementsByTagName("head")[0])||(a=m.body.parentNode.appendChild(m.createElement("head")));a.appendChild(e)}else"script"==a?m.write('<script src="'+b+'" type="text/javascript"><\/script>'):"css"==a&&m.write('<link href="'+b+'" type="text/css" rel="stylesheet"></link>')};
            L("google.loader.writeLoadTag",google[A].d);google[A].O=function(a){O=a};L("google.loader.rfm",google[A].O);google[A].Q=function(a){for(var b in a)"string"==typeof b&&b&&":"==b[r](0)&&!N[b]&&(N[b]=new U(b[B](1),a[b]))};L("google.loader.rpl",google[A].Q);google[A].P=function(a){if((a=a.specs)&&a[x])for(var b=0;b<a[x];++b){var c=a[b];"string"==typeof c?N[":"+c]=new V(c):(c=new W(c[v],c.baseSpec,c.customSpecs),N[":"+c[v]]=c)}};L("google.loader.rm",google[A].P);google[A].loaded=function(a){N[":"+a.module].l(a)};
L("google.loader.loaded",google[A].loaded);google[A].M=function(){return"qid="+((new Date)[w]().toString(16)+Math.floor(1E7*Math.random()).toString(16))};L("google.loader.createGuidArg_",google[A].M);J("google_exportSymbol",J);J("google_exportProperty",K);google[A].b={};L("google.loader.themes",google[A].b);google[A].b.H="//www.google.com/cse/style/look/bubblegum.css";M(google[A].b,"BUBBLEGUM",google[A].b.H);google[A].b.J="//www.google.com/cse/style/look/greensky.css";M(google[A].b,"GREENSKY",google[A].b.J);
google[A].b.I="//www.google.com/cse/style/look/espresso.css";M(google[A].b,"ESPRESSO",google[A].b.I);
google[A].b.L="//www.google.com/cse/style/look/shiny.css";M(google[A].b,"SHINY",google[A].b.L);google[A].b.K="//www.google.com/cse/style/look/minimalist.css";M(google[A].b,"MINIMALIST",google[A].b.K);function V(a){this.a=a;
this.o=[];this.n={};this.e={};this.f={};this.j=g;this.c=-1}
            V[y].g=function(a,b){var c="";b!=d&&(b.language!=d&&(c+="&hl="+k(b.language)),b.nocss!=d&&(c+="&output="+k("nocss="+b.nocss)),b.nooldnames!=d&&(c+="&nooldnames="+k(b.nooldnames)),b.packages!=d&&(c+="&packages="+k(b.packages)),b.callback!=h&&(c+="&async=2"),b.style!=d&&(c+="&style="+k(b.style)),b.noexp!=d&&(c+="&noexp=true"),b.other_params!=d&&(c+="&"+b.other_params));if(!this.j){google[this.a]&&google[this.a].JSHash&&(c+="&sig="+k(google[this.a].JSHash));var e=[],f;for(f in this.n)":"==f[r](0)&&e[p](f[B](1));
            for(f in this.e)":"==f[r](0)&&this.e[f]&&e[p](f[B](1));c+="&have="+k(e[C](","))}return google[A][u]+"/?file="+this.a+"&v="+a+google[A].AdditionalParams+c};V[y].t=function(a){var b=h;a&&(b=a.packages);var c=h;if(b)if("string"==typeof b)c=[a.packages];else if(b[x]){c=[];for(a=0;a<b[x];a++)"string"==typeof b[a]&&c[p](b[a][q](/^\s*|\s*$/,"")[D]())}c||(c=["default"]);b=[];for(a=0;a<c[x];a++)this.n[":"+c[a]]||b[p](c[a]);return b};
            n(V[y],function(a,b){var c=this.t(b),e=b&&b.callback!=h;if(e)var f=new X(b.callback);for(var i=[],o=c[x]-1;0<=o;o--){var s=c[o];e&&f.A(s);if(this.e[":"+s])c.splice(o,1),e&&this.f[":"+s][p](f);else i[p](s)}if(c[x]){b&&b.packages&&(b.packages=c.sort()[C](","));for(o=0;o<i[x];o++)s=i[o],this.f[":"+s]=[],e&&this.f[":"+s][p](f);if(!b&&O[":"+this.a]!=h&&O[":"+this.a].versions[":"+a]!=h&&!google[A].AdditionalParams&&this.j){c=O[":"+this.a];google[this.a]=google[this.a]||{};for(var S in c.properties)S&&":"==
S[r](0)&&(google[this.a][S[B](1)]=c.properties[S]);google[A].d("script",google[A][u]+c.path+c.js,e);c.css&&google[A].d("css",google[A][u]+c.path+c.css,e)}else(!b||!b.autoloaded)&&google[A].d("script",this.g(a,b),e);if(this.j&&(this.j=j,this.c=(new Date)[w](),1!=this.c%100))this.c=-1;for(o=0;o<i[x];o++)s=i[o],this.e[":"+s]=g}});
            V[y].l=function(a){if(-1!=this.c)ca("al_"+this.a,"jl."+((new Date)[w]()-this.c),g),this.c=-1;this.o=this.o.concat(a.components);google[A][this.a]||(google[A][this.a]={});google[A][this.a].packages=this.o.slice(0);for(var b=0;b<a.components[x];b++){this.n[":"+a.components[b]]=g;this.e[":"+a.components[b]]=j;var c=this.f[":"+a.components[b]];if(c){for(var e=0;e<c[x];e++)c[e].B(a.components[b]);delete this.f[":"+a.components[b]]}}};V[y].m=function(a,b){return 0==this.t(b)[x]};V[y].s=function(){return g};
function X(a){this.D=a;this.q={};this.r=0}X[y].A=function(a){this.r++;this.q[":"+a]=g};X[y].B=function(a){this.q[":"+a]&&(this.q[":"+a]=j,this.r--,0==this.r&&l[z](this.D,0))};
            function W(a,b,c){this.name=a;this.C=b;this.p=c;this.u=this.h=j;this.k=[];google[A].v[this[v]]=H(this.l,this)}G(W,V);n(W[y],function(a,b){var c=b&&b.callback!=h;c?(this.k[p](b.callback),b.callback="google.loader.callbacks."+this[v]):this.h=g;(!b||!b.autoloaded)&&google[A].d("script",this.g(a,b),c)});
            W[y].m=function(a,b){return b&&b.callback!=h?this.u:this.h};W[y].l=function(){this.u=g;for(var a=0;a<this.k[x];a++)l[z](this.k[a],0);this.k=[]};
            var Y=function(a,b){return a.string?k(a.string)+"="+k(b):a.regex?b[q](/(^.*$)/,a.regex):""};W[y].g=function(a,b){return this.F(this.w(a),a,b)};
            W[y].F=function(a,b,c){var e="";a.key&&(e+="&"+Y(a.key,google[A].ApiKey));a.version&&(e+="&"+Y(a.version,b));b=google[A].Secure&&a.ssl?a.ssl:a.uri;if(c!=h)for(var f in c)a.params[f]?e+="&"+Y(a.params[f],c[f]):"other_params"==f?e+="&"+c[f]:"base_domain"==f&&(b="http://"+c[f]+a.uri[B](a.uri[t]("/",7)));google[this[v]]={};-1==b[t]("?")&&e&&(e="?"+e[B](1));return b+e};
            W[y].s=function(a){return this.w(a).deferred};
            W[y].w=function(a){if(this.p)for(var b=0;b<this.p[x];++b){var c=this.p[b];if(RegExp(c.pattern).test(a))return c}return this.C};
            function U(a,b){this.a=a;this.i=b;this.h=j}G(U,V);n(U[y],function(a,b){this.h=g;google[A].d("script",this.g(a,b),j)});U[y].m=function(){return this.h};U[y].l=function(){};U[y].g=function(a,b){if(!this.i.versions[":"+a]){if(this.i.aliases){var c=this.i.aliases[":"+a];c&&(a=c)}if(!this.i.versions[":"+a])throw I("Module: '"+this.a+"' with version '"+a+"' not found!");}return google[A].GoogleApisBase+"/libs/"+this.a+"/"+a+"/"+this.i.versions[":"+a][b&&b.uncompressed?"uncompressed":"compressed"]};
            U[y].s=function(){return j};var da=j,Z=[],ea=(new Date)[w](),ca=function(a,b,c){da||(Q(l,"unload",fa),da=g);if(c){if(!google[A].Secure&&(!google[A].Options||google[A].Options.csi===j))a=a[D]()[q](/[^a-z0-9_.]+/g,"_"),b=b[D]()[q](/[^a-z0-9_.]+/g,"_"),l[z](H($,h,"//gg.google.com/csi?s=uds&v=2&action="+k(a)+"&it="+k(b)),1E4)}else Z[p]("r"+Z[x]+"="+k(a+(b?"|"+b:""))),l[z](fa,5<Z[x]?0:15E3)},fa=function(){if(Z[x]){var a=google[A][u];0==a[t]("http:")&&(a=a[q](/^http:/,"https:"));$(a+"/stats?"+Z[C]("&")+"&nc="+(new Date)[w]()+"_"+
((new Date)[w]()-ea));Z.length=0}},$=function(a){var b=new Image,c=$.G++;$.z[c]=b;b.onload=b.onerror=function(){delete $.z[c]};b.src=a;b=h};$.z={};$.G=0;J("google.loader.recordStat",ca);J("google.loader.createImageForLogging",$);
}) ();google.loader.rm({"specs":["feeds","spreadsheets","gdata","visualization",{"name":"sharing","baseSpec":{"uri":"http://www.google.com/s2/sharing/js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":false,"params":{"language":{"string":"hl"}}}},"search","orkut","ads","elements",{"name":"books","baseSpec":{"uri":"http://books.google.com/books/api.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"}}}},{"name":"friendconnect","baseSpec":{"uri":"http://www.google.com/friendconnect/script/friendconnect.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":false,"params":{}}},"identitytoolkit","ima",{"name":"maps","baseSpec":{"uri":"http://maps.google.com/maps?file\u003dgoogleapi","ssl":"https://maps-api-ssl.google.com/maps?file\u003dgoogleapi","key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"regex":"callback\u003d$1\u0026async\u003d2"},"language":{"string":"hl"}}},"customSpecs":[{"uri":"http://maps.googleapis.com/maps/api/js","ssl":"https://maps.googleapis.com/maps/api/js","version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"}},"pattern":"^(3|3..*)$"}]},"payments","wave","annotations_v2","earth","language",{"name":"annotations","baseSpec":{"uri":"http://www.google.com/reviews/scripts/annotations_bootstrap.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"},"country":{"string":"gl"}}}},"picker"]});
google.loader.rfm({":search":{"versions":{":1":"1",":1.0":"1"},"path":"/api/search/1.0/5fb4e9f73de892104904248ce6daa0ed/","js":"default+en.I.js","css":"default+en.css","properties":{":JSHash":"5fb4e9f73de892104904248ce6daa0ed",":NoOldNames":false,":Version":"1.0"}},":language":{"versions":{":1":"1",":1.0":"1"},"path":"/api/language/1.0/57e8a5e8a66c850696b5c616d4a4fdb1/","js":"default+en.I.js","properties":{":JSHash":"57e8a5e8a66c850696b5c616d4a4fdb1",":Version":"1.0"}},":feeds":{"versions":{":1":"1",":1.0":"1"},"path":"/api/feeds/1.0/efe8f95c5756111c3e36c06dab50fd12/","js":"default+en.I.js","css":"default+en.css","properties":{":JSHash":"efe8f95c5756111c3e36c06dab50fd12",":Version":"1.0"}},":spreadsheets":{"versions":{":0":"1",":0.4":"1"},"path":"/api/spreadsheets/0.4/87ff7219e9f8a8164006cbf28d5e911a/","js":"default.I.js","properties":{":JSHash":"87ff7219e9f8a8164006cbf28d5e911a",":Version":"0.4"}},":ima":{"versions":{":1":"1",":1.5":"1"},"path":"/api/ima/1.5/ad9b41a32a3f250f81bb9291743d9e42/","js":"default.I.js","properties":{":JSHash":"ad9b41a32a3f250f81bb9291743d9e42",":Version":"1.5"}},":wave":{"versions":{":1":"1",":1.0":"1"},"path":"/api/wave/1.0/3b6f7573ff78da6602dda5e09c9025bf/","js":"default.I.js","properties":{":JSHash":"3b6f7573ff78da6602dda5e09c9025bf",":Version":"1.0"}},":annotations":{"versions":{":1":"1",":1.0":"1"},"path":"/api/annotations/1.0/ad1565d879cca9982c9467668024f1ac/","js":"default+en.I.js","properties":{":JSHash":"ad1565d879cca9982c9467668024f1ac",":Version":"1.0"}},":earth":{"versions":{":1":"1",":1.0":"1"},"path":"/api/earth/1.0/109c7b2bae7fe6cc34ea875176165d81/","js":"default.I.js","properties":{":JSHash":"109c7b2bae7fe6cc34ea875176165d81",":Version":"1.0"}},":picker":{"versions":{":1":"1",":1.0":"1"},"path":"/api/picker/1.0/b7e9eb7fd8c0e098a7173ce367b2b5c1/","js":"default.I.js","css":"default.css","properties":{":JSHash":"b7e9eb7fd8c0e098a7173ce367b2b5c1",":Version":"1.0"}}});
google.loader.rpl({":scriptaculous":{"versions":{":1.8.3":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"},":1.9.0":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"},":1.8.2":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"},":1.8.1":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"}},"aliases":{":1.8":"1.8.3",":1":"1.9.0",":1.9":"1.9.0"}},":yui":{"versions":{":2.6.0":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":2.9.0":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":2.7.0":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":2.8.0r4":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":2.8.2r1":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":2.8.1":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":3.3.0":{"uncompressed":"build/yui/yui.js","compressed":"build/yui/yui-min.js"}},"aliases":{":3":"3.3.0",":2":"2.9.0",":2.7":"2.7.0",":2.8.2":"2.8.2r1",":2.6":"2.6.0",":2.9":"2.9.0",":2.8":"2.8.2r1",":2.8.0":"2.8.0r4",":3.3":"3.3.0"}},":swfobject":{"versions":{":2.1":{"uncompressed":"swfobject_src.js","compressed":"swfobject.js"},":2.2":{"uncompressed":"swfobject_src.js","compressed":"swfobject.js"}},"aliases":{":2":"2.2"}},":webfont":{"versions":{":1.0.2":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.1":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.0":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.19":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.6":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.18":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.5":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.17":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.4":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.16":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.3":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.9":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.21":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.12":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.22":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.13":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.14":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.15":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.10":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"},":1.0.11":{"uncompressed":"webfont_debug.js","compressed":"webfont.js"}},"aliases":{":1":"1.0.22",":1.0":"1.0.22"}},":ext-core":{"versions":{":3.1.0":{"uncompressed":"ext-core-debug.js","compressed":"ext-core.js"},":3.0.0":{"uncompressed":"ext-core-debug.js","compressed":"ext-core.js"}},"aliases":{":3":"3.1.0",":3.0":"3.0.0",":3.1":"3.1.0"}},":mootools":{"versions":{":1.2.3":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.3.1":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.1.1":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.4":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.3.0":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.1":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.2":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.3.2":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.5":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.4.0":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.1.2":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.4.1":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"}},"aliases":{":1":"1.1.2",":1.11":"1.1.1",":1.4":"1.4.1",":1.3":"1.3.2",":1.2":"1.2.5",":1.1":"1.1.2"}},":jqueryui":{"versions":{":1.6.0":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.0":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.2":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.1":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.9":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.15":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.14":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.7":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.13":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.8":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.12":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.11":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.7.2":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.5":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.7.3":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.10":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.6":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.7.0":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.7.1":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.4":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.5.3":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.5.2":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.16":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"}},"aliases":{":1.8":"1.8.16",":1.7":"1.7.3",":1.6":"1.6.0",":1":"1.8.16",":1.5":"1.5.3",":1.8.3":"1.8.4"}},":chrome-frame":{"versions":{":1.0.2":{"uncompressed":"CFInstall.js","compressed":"CFInstall.min.js"},":1.0.1":{"uncompressed":"CFInstall.js","compressed":"CFInstall.min.js"},":1.0.0":{"uncompressed":"CFInstall.js","compressed":"CFInstall.min.js"}},"aliases":{":1":"1.0.2",":1.0":"1.0.2"}},":dojo":{"versions":{":1.3.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.1.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.3.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.6.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.3.2":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.6.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.2.3":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.4.3":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.5.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.5.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.2.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.4.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.4.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"}},"aliases":{":1":"1.6.1",":1.6":"1.6.1",":1.5":"1.5.1",":1.4":"1.4.3",":1.3":"1.3.2",":1.2":"1.2.3",":1.1":"1.1.1"}},":prototype":{"versions":{":1.7.0.0":{"uncompressed":"prototype.js","compressed":"prototype.js"},":1.6.0.2":{"uncompressed":"prototype.js","compressed":"prototype.js"},":1.6.1.0":{"uncompressed":"prototype.js","compressed":"prototype.js"},":1.6.0.3":{"uncompressed":"prototype.js","compressed":"prototype.js"}},"aliases":{":1.7":"1.7.0.0",":1.6.1":"1.6.1.0",":1":"1.7.0.0",":1.6":"1.6.1.0",":1.7.0":"1.7.0.0",":1.6.0":"1.6.0.3"}},":jquery":{"versions":{":1.6.2":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.1":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.6.1":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.0":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.6.4":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.6.3":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.2":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.6.0":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.2.3":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.7.0":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.2.6":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.4.3":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.4.4":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.5.1":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.5.0":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.4.0":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.5.2":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.4.1":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.4.2":{"uncompressed":"jquery.js","compressed":"jquery.min.js"}},"aliases":{":1.7":"1.7.0",":1.6":"1.6.4",":1":"1.7.0",":1.5":"1.5.2",":1.4":"1.4.4",":1.3":"1.3.2",":1.2":"1.2.6"}}});
}</script>
 <script type="text/javascript">
     google.load("elements", "1", {    packages: "transliteration" });
    function onLoad() {
        var options = {
            sourceLanguage:
                google.elements.transliteration.LanguageCode.ENGLISH,
            destinationLanguage:
                [google.elements.transliteration.LanguageCode.HINDI],
            shortcutKey: 'ctrl+g',
            transliterationEnabled: true
        };

        var control = new google.elements.transliteration.TransliterationControl(options);
        control.makeTransliteratable(['sentences']);
      }
      google.setOnLoadCallback(onLoad);
    </script>
  </head>
  <body>
      If you are using it, Then don't delete listed below three (3) lines <br/>
    Implemented By: Amit Kumar Gaur <br/>
  
    Blog: <a href="http://amitkgaur.blogspot.com">http://amitkgaur.blogspot.com</a><br/>
    <br/>
   
    <br/>Type English word in Hindi for ex: Amit tum kase ho? <br>
    <textarea id="sentences" style="width:300px;height:200px"></textarea>
  </body>
</html>