Thursday, February 24, 2011

Infinite loop in Facebook Application

Replace this line
$fb_user_id = $facebook->require_login();
to
$fb_user_id = $facebook->require_login($required_permissions = 'publish_stream');

You may change the permissions as per your requirement.

How To Resize iFrame & Remove Scrollbar From Your iFrame Facebook App?

If you are looking for PHP SDK Click Here to download it.

Code I used to remove the scrollbar from facebook application is this:
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
function framesetsize(w,h){
    var obj = new Object;
    obj.width=w;
    obj.height=h;
    FB.Canvas.setSize(obj);
}
</script>
<body onload="framesetsize(500,2100)">
    <div id="fb-root"></div>
    <div style="height: 2000px">
    </div>
</body> 

Make sure you set the facebook application setting to AutoResize, to do so follow this instructions:
  1. Login to your Facebook account
  2. Go to Developer panel
  3. Go to your application
  4. Click on Edit Setting
  5. Click on Facebook Integration Tab
  6. Select IFrame size to Auto-resize
Hope this help you to get rid of scrollbars :)

FB.Event.subscribe is not working in IE

The code that I am using is this:

<script src="http://connect.facebook.net/en_GB/all.js#xfbml=1"></script>
<script>
$(document).ready(function(){
    FB.Event.subscribe('edge.create', function(response) {
        window.location= 'likeApp.php';
    });
});
</script>

The above code works fine in all browsers except IE.

After searching I came to know that we must add the fb-root element just after the body tag (Make sure this tag is right after your body tag):
<div id="fb-root"></div>

Hope this helps :)

Friday, February 11, 2011

How to remove top panel Ubuntu

I have got this problem when I tried to put one more panel on the top panel and set it to auto hide, it went into infinite loop and thus my top panel also stopped working.

This is the bug of Ubuntu and if you have the same problem then do the following steps:
  1. Go to terminal, I know your ALT+F2 is not working, try using CTRL+ALT+F3
  2. Find the toplevel directory where all the panel information stores
    Code: locate toplevels
  3. Go to toplevel directory
    Code: cd /home/username/.gconf/apps/panel/toplevels
  4. Go back one step
    Code: cd ..
  5. Rename the toplevel directory
    Code: mv toplevels toplevels_old
  6. Log Off the panel and login again
    Code: sudo service gdm restart
  7. Now all your panel comes, remove/change the extra panel from top or bottom
  8. Restore the toplevel directory (Go to the directory again)
    Code: mv toplevels_old toplevels
  9. Problem is Solved :) :)
 Hope this wont take much time to resolve the problem. Let me know in case of any confusion :)

Monday, February 7, 2011

Windows Programs is not working in Wine Ubuntu

Dreamweaver or SqlYog is not working after installing through wine in Ubuntu.

If wine is not installed in your computer then use this command to install it:
sudo apt-get install wine

Steps that I followed to resolve this problem are:

1)   Google of course, but you do not need to do, so skip this :)
2)   Go to -> Application -> Wine -> Browse C: Drive
3)   Go to -> Windows -> system32
4)   Download these two files
5)   Paste it in system32 folder
6)   Go to -> Application -> Wine ->Configure Wine
7)   Click on Libraries odbcint.dll and odbc32.dll
8)   Click on drop down of "New override for library"
9)   Write odbc32 and click Add
10) Write odbcint and click Add
11) Click on Apply and close window.
12) Reinstall your application if it is not start working yet

Hope this helps :)

Wednesday, February 2, 2011

Install xdebug for PHP5 in Ubuntu


This method will work for Ubuntu 8.04 and above
sudo apt-get install php5-xdebug

*********************************************************

This is the alternate method to install Xdebug :)

Here is a mini-howto in how to install the xdebug extension with PHP5 in Ubuntu

This will install xdebug 2.0 (or whatever is latest version in PEAR repository when you try this).

It is assumed you have Apache2 + PHP5 working already.

Code: sudo apt-get install php5-dev php-pear

Now install xdebug thru PECL.
Code: sudo pecl install xdebug

After installing above package it will show you the path of "xdebug.so" file, use it in your further steps.

Then edit php.ini:
Code: sudo gedit /etc/php5/apache2/php.ini

Add the following line:
Code: zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"

Then restart apache for changes to take effect
Code: sudo /etc/init.d/apache2 restart

Sometimes you also need to edit your "xdebug.ini"
sudo gedit /etc/php5/conf.d/xdebug.ini
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_log="/var/log/xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_port=9000
(Thanks to Chetan Jain for this settings)

**********************************************************

Check phpinfo() to make sure the extension is loaded correctly. The following line should have been appended to the copyright lines:

with Xdebug v2.0.0, Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, by Derick Rethans

For more information about xdebug configuration and usage, please read the official documentation, found here: http://xdebug.org/docs/