Welcome to my Blog

I am Nelson Desai. I complete computer engineering.

This is my personal blog. Here I share some post, which can helpful for me, my friends and you.

Some post may be illegal to share like some crack and keys. but, i think.. which things put online then it's not be secure any more whatever company try.

So, I requested you pls download and use it at your risk. and don't upload it again online.

Thank You for peeping my blog.. Have a Good Day!

Errors while upgrading laravel 5.2.* to 5.3.*

Hello Friends,

Laravel update from 5.2.x to 5.3.x
Sites update from laravel 5.2.X to 5.3.X here is a list of some errors with solutions.

-----------------------------------------------------------------------------------------------------------------------
- laravel/framework v5.3.9 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.

CMD: sudo apt-get install php7.0-mbstring
-----------------------------------------------------------------------------------------------------------------------
- php-http/curl-client v1.6.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.

CMD: sudo apt-get install php-curl
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
- phpunit/phpunit 4.8.9 requires ext-dom * -> the requested PHP extension dom is missing from your system.

CMD: sudo apt-get install php-xml
-----------------------------------------------------------------------------------------------------------------------


For more details mail me on nelson.desai@gmail.com or comments here.
--
Thank You
Nelson Desai

Errors while upgrading joomla 2.5 to 3.xx

Hello Friends,

Joomla update from 2.5.x to 3.x.x
Sites update from joomla 2.5.X to 3.X.X here is list of some errors with solutions.

Errors while upgrading joomla 2.5 to 3.xx

-----------------------------------------------------------------------------------------------------------------------
Strict Standards: Non-static method JSite::getMenu() should not be called statically, assuming $this from incompatible context in serive/templates/yoo_infinite/warp/systems/joomla/layouts/com_content/article/default.php on line 13

Line 54 reads:
$menus = JSite::getMenu();

But it should be:
$menus = $app->getMenu();

If $app is not defined before please define app before calling.
$app = JFactory::getApplication();

-----------------------------------------------------------------------------------------------------------------------
Fatal error: Call to a member function isAdmin() on a non-object in serive/plugins/system/remember/remember.php on line 42

replace serive/plugins/system/remember/remember.php
with old remember.php [old means old versions of your project in 2.5.X before start update]
-----------------------------------------------------------------------------------------------------------------------
Fatal error: Call to a member function getInt() on a non-object in serive/administrator/components/com_postinstall/models/messages.php on line 37

administrator/index.php?option=com_installer&view=manage
see it working admin panel then follow next step.

need to fof folder copy.

replace a serive/libraries/fof folder
with latest version which you install.like Joomla_3.3.0-Stable-Update_Package.zip
-----------------------------------------------------------------------------------------------------------------------

Warning: DOMDocument::loadHTML(): Invalid char in CDATA 0xC in Entity, line: 2 in serive/templates/yoo_infinite/warp/helpers/dom.php on line 44

@$dom->loadHTML($input);
// $dom->loadHTML($input);

-----------------------------------------------------------------------------------------------------------------------
Fatal error: Call to undefined method InvalidArgumentException::get() in serive/templates/yoo_infinite/error.php on line 20
OLD
//$error   = $this->error->get('code');
//$message = $this->error->get('message');
NEW
$error   = $this->error->getCode();
$message = $this->error->getMessage();
-----------------------------------------------------------------------------------------------------------------------
JHtmlBehavior::mootools not found.

Somewhere in your template, you are using:
JHtml::_('behavior.mootools');
or
JHtmlBehavior::mootools();
but this code is no longer supported in Joomla 3.x and it has been removed. It should be replaced with something like:
JHtml::_('behavior.framework');
-----------------------------------------------------------------------------------------------------------------------
Notice: Use of undefined constant DS - assumed 'DS' in serive/modules/mod_jvbingtranslator/tmpl/flag.php on line 13

if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);

-----------------------------------------------------------------------------------------------------------------------

For more details mail me on nelson.desai@gmail.com or comments here.
--
Thank You
Nelson Desai

Beanstream Wordpress Plugin

Use of Beanstream Payment plugin in WordPress.

I create a one simple plugin in wordpress which can make a payment using beanstream payment...
Here you can see some screen of plugin back-end and front-end.

Screen 1: You can see 'Beanstream Payment' Plugin. 





Screen 2: You can see 'Beanstream Payment' now activated and plugin create a custom 'Beanstream' menu in admin back-end.
































Screen 3: Here you can see we write a short code 'beanstream_payment' which we can write in post and page where we want payment form. which replaced by payment form by plugins.





Screen 4: Here you can see a payment from on font-side which shot code replaced by plugin. 




















































































Screen 5: You can see a validation also occur during payment for validations i use validations js.





Screen 6: User also see a validations message, this validation occur on server side[beanstream server].





Screen 7: After successfully transactions this message print for user replace of payment form. 





Screen 8: On admin side you can see all transaction details also you can edit/delete exiting records. 


















For more details mail me on nelson.desai@gmail.com or comments here.
--
Thank You
Nelson Desai

Advanced use of autoloader in zend


For read simple use of autoloader you can see my previous post here on below link:
http://nelsondesai.blogspot.in/2012/09/how-to-use-zend-autoloader.html

Now Advance Use of autoloader for cloud base database service or any.

Que: I have two different class [one amazon cloud and second azure cloud] with same functions name like [insert, update, join etc].

Notes: both class must have same function.

Now i want to choose database[class] dynamic.

So, it's not good to go every controller and we change a class name where we use a class object.

Solution is here,

Let's start..
first file structure..  default I always prefer to use library folder.

library

        |--- Amazon
                   |--- Action.php [with class Amazon_Action] 


        |--- Azure
                   |--- Action.php [with class Azure_Action]


In solution you can also use a custom folder replace of library like [application/cloud/] folder..
for custom folder read my previous post Click Here.

Now in index.php

just define which cloud db we want to use..
define('_APP_BOOT_LIB','Amazon_');
Now in application Bootstrap.php
public function _initAutoloaders()
 {
        $autoloader = Zend_Loader_Autoloader::getInstance();
       
        $autoloader->registerNamespace(_APP_BOOT_LIB);
        if(_APP_BOOT_LIB == "Amazon_")
            $objUser = new Amazon_Action();
        else if(_APP_BOOT_LIB == "Azure_")
            $objUser = new Azure_Action();

     //Here two way to store object 
     
       Zend_Registry::set('objUser', $objUser); 
//for get objUser in controller[$objUser = Zend_Registry::get('objUser');]
     // $this->objUser = $objUser;  
//for get objUser in controller[$objUser = $this->_invokeArgs['bootstrap']->objUser;]
}

Now in controller  IndexController.php
we can get back object to use...
$objUser = Zend_Registry::get('objUser');    
//$objUser = $this->_invokeArgs['bootstrap']->objUser;


 //Notes: both class must have same function.. 
$objUser->query($params);
$objUser->insert($params);

Gud Luck..

For more details mail me on nelson.desai@gmail.com or comments here.
--
Thank You
Nelson Desai


How to use multiple validators in zend form ??


Use of multiple validation in zend form >>

First basic how to add validator to any filed..

$password = new Zend_Form_Element_Password('password'); $passsword->setLabel('Password :') ->setRequired(true) ->addValidator('NotEmpty') ->addValidator('Digits');
So, on this we use two validator one is 'NotEmpty' and second is 'Digits'.

Now problem comes when we submit we got both message together which not good. see in below images.


So, now solution is here..

just use custom modification you can write custom message using setMessage..

$notEmpty = new Zend_Validate_NotEmpty(); $notEmpty->setMessage('The field cannot be empty!');
$digits = new Zend_Validate_Digits(); $digits->setMessage('Please, enter only digits');
$password = new Zend_Form_Element_Password('password'); $passsword->setLabel('Password :') ->setRequired(true) ->addValidator($notEmpty, true) ->addValidator($digits, true)

use of regular expression validator.

->addValidator('regex', true,array('pattern'=>'/^[(0-9)]+$/', 'messages'=>array('regexNotMatch'=>'Please enter only digit.')) )


Here is list of some default validation classes in zend
You can also check in library/Zend/Validate for more details.

For more details mail me on nelson.desai@gmail.com or comments here.

--
Thank You
Nelson Desai

How to use zend autoloader ??

zend autoloader tutorial >>

File Structure:
library

       |--- Amazon


                 |--- Action.php [ with class Amazon_Action ]

In Bootstrap.php
public function _initAutoloaders()
{
    $loader = Zend_Loader_Autoloader::getInstance();
    $loader->registerNamespace('Amazon_');
}

In IndexController or any..
$Amazon_Action = new Amazon_Action();


Now use custom file structure:
In application

   classes
       |--- googles
             |--- nels
                    |--- action.php [with calss name My_Classe_Google_Nel_Action]

             |--- test.php [with class My_Classe_Google_Test] 

       |---demo.php [with class My_Classe_Demo]

In Bootstrap.php
public function _initAutoloaders()
{
 $resourceLoader = new Zend_Loader_Autoloader_Resource(array(
      'basePath' =>  APPLICATION_PATH . '/',
         'namespace' => 'My',
     ));
 
 $resourceLoader->addResourceType('demo','classes/','Classe');

 $resourceLoader->addResourceType('test', 'classes/googles/', 'Classe_Google');

 $resourceLoader->addResourceType('action', 'classes/googles/nels/', 'Classe_Google_Nel');
 
 }

In Controller
$opt1 =  new My_Classe_Google_Nel_Action();
$opt2 = new My_Classe_Google_Test();
$opt3 = new  My_Classe_Demo();
For more advance use of autoloader follow thins link..
http://nelsondesai.blogspot.in/2012/09/advanced-use-of-autoloader-in-zend.html
http://framework.zend.com/manual/1.12/en/learning.autoloading.resources.html

For more details mail me on nelson.desai@gmail.com or comments here.


--
Thank You
Nelson Desai

File Upload Using Ajax+Html5+PHP


One day my senior ask me can it possible to upload a file using ajax ??
No, it isn't possible to do this with javascript.
But, yes this is possible with JavaScript now + [AJAX & HTML5].
To Download Code.. Click Here
In all File just find [NELSON DESAI] Where You can get all help in comment.
is also possible to work auto upload and also got customize response.
It's very helpful during profile picture upload. We can also pass a data in post like usre-id in hidden. and in response here we can get the uploaded url which we can add on picture block.
You can also show progress of uploading.
Actually i implemented this code in zend [From one controller to another controller using this demo]
For more details mail me on nelson.desai@gmail.com or comments here.
--
Thank You
Nelson Desai

Get the different date format in JavaScript





Hi,  
This is simple code but, i got it after so much time..


var d = new Date();
// Get today date in this format  Fri Jun 29 2012 10:57:53 GMT+0530 (IST). 


var curr_date = d.getDate();
// Get the only date from today date.


var curr_month = d.getMonth();
// Get the only month from today date.


curr_month++;
// Increase month by 1. becz, u got less one. 


var curr_year = d.getFullYear();
// Get the only year from today date.


// You can get also time, second, minute like this. 
var second =d.getSeconds();
var minutes = d.getMinutes();
var hour = d.getHours();
var milliSeconds = d.getMilliseconds();
// And also join it in date. 


// Now join it in any format. 
var today = curr_year + "-" + curr_month + "-" + curr_date;
// like this return 2012-5-12


var today = curr_year + "." + curr_month + "." + curr_date;
// like this return 2012.5.12


var today =  curr_month + "/" + curr_year + "/" + curr_date;
// like this return 5/2012/12

--
Thank You
Nelson Desai

Calculating the difference between two dates in JavaScript




Hi guys, 
Some day ago i want a difference between two dates to check it's greater or less then..
After searching i got many solutions but best and easy solution it's here...

var dp_b_d = document.getElementById('dp_birth_date').value; 
// Get like 12/04/1990 date format  // Or if u have different format then u should convert it or get it by this link Click Here
var dp_d_d = document.getElementById('dp_death_date').value;
// Get like 15/04/1990 date format

var myDateArray = dp_d_d.split("/");  
var myDateArray2 = dp_b_d.split("/");

// Split it by using "/"  if your date format '15.04.1990' then split with '.'[dot] 

var EndDate = new Date(myDateArray[2],myDateArray[1],myDateArray[0]);
// Always pass this type value in Date(YEAR, MONTH, DATE)  


var Today = new Date(myDateArray2[2],myDateArray2[1],myDateArray2[0]);

var ONE_DAY = 1000 * 60 * 60 * 24;

var date1_ms = EndDate.getTime();
var date2_ms = Today.getTime();
// Convert both dates to milliseconds
 
var difference_ms = date1_ms - date2_ms;

var total_days =  difference_ms/ONE_DAY;
// Get difference in total days.

return total_days; 
// Here it's return 3days in this example.


--
Thank You
Nelson Desai

Download images from url php



First Select link from database or from any...
$url = "SELECT link FROM tablename";

Now second step is check image is available on url or not..
we can check it by so many step i give hint at end of this post....

// check url available using get_header method...
$url_head = get_headers($url)


if($url_head == FALSE) 
{
         echo "URL or HEAD Unavailable.....";
}


else
{
         // now check url image hav not 404 error to download...
         $head_chk = strpos ($url_head[0], '404 Not Found');


 if($head_chk === FALSE) 
 {

       $image_data = file_get_contents($url);   // get content from url..
       $image_name = basename($url);   // for save same name which in url.
       $image__save_location = "/path/images_folder";   // Save location or path..
        
       if(!$image_data)
       {
         // write some another image url like default image save if not available....
         $no_image_data = "some default image url... if some image not available on url"


         // now save image using file_put_contents function with same name which in url.
         file_put_contents($image__save_location."/".$image_name,  $no_image_data);
      }
       else
       {
          file_put_contents($image__save_location."/".$image_name,  $image_data);
       }
}
else
{
      echo "404 and Image Not Available.......";
}
}

-----------------------------------------------------
-----------------------------------------------------
You also check some other condition like image avilabel or not in php
1. getimagesize($url);
2. get_headers($url);
3. file_get_contents($url);

--
Thank You
Nelson Desai







Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by NDR Group | Bloggerized by Er. Nelson Desai | Love U My Friends