Saturday, 15 September 2012

Trim All Posted Variables in PHP

Quick tip to trim all posted variables in PHP.

<?php
            
            array_walk($_POST, 'trim_posted_variables');
           
           /**
            * function to trim all the posted variables.
            *
            * $param : value - as we are using array_walk function, first parameter
            * in the used function should be value.

            * index - second parameter should be key or index.
            */
            
           function trim_posted_variables($value, $index){

                  $_POST[$index] = trim($value);
   
            }


?>


Thanks!!!!!!!!!!!! Enjoy Programming :)

Saturday, 8 September 2012

Migrate existing FB Apps to another account

Recently, one of my friend asked me the question that he wants to migrate all of his FB Apps to another FB account, how he can do it? Solution is simple. May be most of you are already aware of that but I thought of sharing it on my blog.

Following are the steps to migrate one FB App to another account.

1) Go to your developers account and check the page https://developers.facebook.com/apps

2) From left panel select the app you want to migrate to another account.

3) Your selected App details will get populated on right side panel. Under Roles section click on 'Edit Roles' link.



4) A new window will open. Under Administrators tab click on add button and select other account name where you want to migrate this App (So another account holder should be in your friend list by default).

Note : Please make ensure that the other account is verified one.




5) Now the FB app has two administrators and both administrators can do anything. Even one can remove other administrator. Login to your new administrator account and visit the app.

6) Go to the screen as per step 4 and remove your first account name from the App. Now you are no more administrator of the App and App had been migrated successfully.

Thanks!!!!!!! Enjoy Programming :)

Sunday, 2 September 2012

CakePHP code not working on Production Server?

Today when I was preparing myself for tomorrow’s project demo uploaded whole project code on production server. But something strange happened; code was not working as expected. But same code was working fine on my local system. Just noticed that no validation was working and database related functions were also not working fine. Searched over internet and stackoverflow but didn’t answer that could rectify my problem. I thought may be it happened due to Auth component I used. But again if it’s working on local system then it should also work on production server. Keep searching and finally got a blog where I got the proper answer. I did a mistake actually so I was the only culprit. For model names I used different nomenclature. For users table I used User.php as model file name instead of user.php and so on. When I did those changes everything worked fine. So please keep it mind that model file name should be e.g user.php (all small characters) format. 

Thanks!!!!!!!!! Enjoy Programming :)

Odoo 10: Close wizard and open standard form

Hi, Today we are going to learn how to open standard form after saving data in wizard. Let's say I have created an wizard to fill bas...