Home / v.shakya (page 2)

v.shakya

I am V.Shakya, Software Developer & Consultant I like to share my ideas, views and knowledge to all of you who come across my website. I am young, enthusiastic, highly motivated and self disciplined person. I completed my studies in Master of Computer Application and currently giving my technical expertise to one of the Big IT company. I have more than fifteen years of experience in vast field of Programming , Designing and Development of websites and various software's.

Copy data by rsync from one server to another server in linux

Basic syntax of rsync command $ rsync options source destination $ rsync -avzh /root/rpmpkgs /tmp/backups/ $ rsync -avz rpmpkgs/ root@192.168.0.101:/home/ Copy a File from a Remote Server to a Local Server with SSH $ rsync -avzhe ssh root@192.168.0.100:/root/install.log /tmp/ Copy a File from a Local Server to a Remote Server …

Read More »

Create Different session for admin and frontend using zfcuser in Zend framework 2

If you want use twice ZendAuthenticationAuthenticationService, look in ZendAuthenticationStorageSession, you’ll see in __construct, there’s an namespace parameter, change it for “Zend_Auth_Frontend” (in front) and “Zend_Auth_Backend” for the back. How you can perform above change please follow below steps: For Frontend Changes Please change in two file Step 1: Go to …

Read More »

How to remove “public” from url using routeing in zend framework 2

Create index.php on ZF2 root directory and add the following content: <?php define('REMOVE_PUBLIC_FROM_URL', true); include 'public/index.php'; Create .htaccess on ZF2 root directory and add the following content: SetEnv APPLICATION_ENV development RewriteEngine On RewriteRule .* index.php Finally, add this conditional statement in the top of your layout.phtml file: <?php if (defined('REMOVE_PUBLIC_FROM_URL')) …

Read More »

Validate records in zf2

Inside the controller : public function addAction() { $form = new TestForm(); $form->get('submit')->setAttribute('value', 'Add'); $request = $this->getRequest(); if ($request->isPost()) { $test = new Test(); $form->setInputFilter($test->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $test->exchangeArray($form->getData()); if($this->getTestTable()->validateRecord($test, 'field1', 'test')){ $this->getTestTable()->saveTest($test); $this->flashMessenger()->addMessage('Record added in db'); // Redirect to list of tests return $this->redirect()->toRoute('test'); } else{ $this->flashMessenger()->addMessage('Record Exist …

Read More »

How to get the common sub string in two string?

<?php function retriveCalc($str1,$str2){ $arr1=array(); for($i=0;strlen($str1)>$i;$i++){ $arr1[$i]=$str1[$i]; } $arr2=array(); for($i=0;strlen($str1)>$i;$i++){ $arr2[$i]=$str1[$i]; } $result = array_intersect($arr1,$arr2); return implode('',$result); } $str1='test'; $str2='testingindia'; echo retriveCalc($str1,$str2); echo "<br>"; $str1='1234'; $str2='4254546234231'; echo retriveCalc($str1,$str2); ?>

Read More »

AngularJS and TwitterBootstrap

Create a javascript file and save it in file myUsers.js angular.module('myApp', []).controller('userController', ['$scope','$http', function($scope, $http) { $scope.fname = ''; $scope.lname = ''; $scope.passw1 = ''; $scope.passw2 = ''; $http.get("result.php").success(function (response) { $scope.users =response; }); $scope.edit = true; $scope.error = false; $scope.incomplete = false; $scope.editUser = function(id) { if (id == …

Read More »

addAttributeToSelect – addAttributeToFilter – addFieldToFilter

What’s the difference between addAttributeToSelect(), addAttributeToFilter() and addFieldToFilter() methods? As you know that a product can have many attributes. The addAttributeToSelect() method is used to select the attributes that we want to retrieve. So this method doesn’t filter out the collections, only the attributes. If we use addAttributeToSelect(‘*’), then all …

Read More »

Magento addAttributeToFilter() and addAttributeToSelect()

These two Magento functions looks more like there is no obvious difference between them, but there is. addAttributeToFilter('some_attribute1','attribute_value') filters a Magento entity collection (e.g Products, categories) by only selecting entities that has ‘some_attribute’ equal to ‘attribute_value’ while addAttributeToSelect('some_attribute2') tells Magento to return add ‘some_attributes’ to the set of properties that …

Read More »