Tuesday, December 27, 2011

Android Source resource does not exist

While working on Android project with Netbeans I got this error and to resolve it we need to follow these steps:
  1. Open Project Folder
  2. Open build.xml with any text editor
  3. Search for "project.properties" and replace it with "default.properties", means replace
    <loadproperties srcfile="project.properties"></loadproperties>
    to
    <loadproperties srcfile="default.properties"></loadproperties>
Hope this helps :)

Wednesday, November 16, 2011

Remove SVN Folders Ubuntu 11.04

To remove all SVN folders recursively, run below command in your terminal:
  1. Open Terminal
    ShortCut: CTRL+ALT+T
  2. First open your directory (in my case it is "/var/www/mySite")
    cd /var/www/mySite
  3. Run below command
    find . -name ".svn" -exec rm -rf {} \;
Hope this save your time.

Sunday, October 23, 2011

amChart Cache Issue

Add random parameter after the file path i.e. data.xml?<?php echo microtime();?>

Hope this helps to save your time.

Monday, October 17, 2011

Reading initial communication packet system error 34

I checked the configuration of MySQL in /etc/mysql/my.cnf and found that by default MySQL is bind with other ip address that I have.

This situation occurred when I tried to map my system with other ip-address.

If this does not work try below methods

1) Edit file "/etc/hosts.deny" and commented out the default access list rule as shown below.
# ALL:ALL

2) Next I included that statement in "/etc/hosts.allow" as shown below.
ALL:ALL or mysqld: 127.0.0.1 : ALLOW

Wednesday, October 12, 2011

Images not showing in IE

A very difficult problem with very simple solution.

When you run Internet Explorer, the Internet Explorer cache is not used as you expect when you run innerHTML code to insert the same image multiple times.

Here’s the problem: Internet Explorer forgets to look into its own cache when inserting HTML via JavaScript DOM manipulation (read: if you use img tags or any tags with CSS background images, Internet Explorer will always try to redownload these images).

To work around this problem, try following steps:
  1. Preload the image in a DIV element with the display:none attribute:
    <DIV style='display:none'><IMG SRC='image.gif'></DIV>
  2. Create a brief time-delay so that Internet Explorer has enough time to verify whether the image is in the cache, and then call the innerHTML property.
    setTimeout (function(){},2000);
Note: Make sure to add width and height of image otherwise it may display in very very small size like a dot.

Tuesday, August 30, 2011

Internet Explorer with Ubuntu 11.04

First you need to install wine to get it through:
sudo apt-get install wine

Steps to get Internet Explorer are:

1. Open winetricks (Applications->wine->Winetricks)
2. Choose the option, "Select the default wine prefix" (confusing to me since I don't know what a prefix is and it sounds like I'm doing something that will be the default for everything in wine)
3. Click "OK"
4. Choose option, "Install a Windows DLL or component"
5. Click "OK"
6. Now choose IE6, 7, or 8 from the list and check the checkbox
Note: Choose one option at a time as wine need to restart after each install.
7. Click "OK"

After installation it will ask for "restart", this will not restart your system but restart the "wine".

You also get some error messages, just click on OK.

From now on, if you need to run the installed program then go to Applications -> wine -> Browse C: Drive -> Program Files -> Internet Explorer -> Run "iexplore.exe" with "wine"

So, would you ever say that you can not run Internet Explorer on Linux? :)

Friday, August 26, 2011

Downgrade PHP


This post is all about downgrading your PHP 5.3.x to PHP 5.2 because some of your old packages will not work with the PHP 5.3.x.

Essentially, all you have to do is tell the apt system where to find Karmic packages and then tell it that you want it to use Karmic's PHP packages.

So put the "karmic.list" in /etc/apt/sources.list.d and the "php" into /etc/apt/preferences.d.

Then:
sudo apt-get update

sudo apt-get remove php5 libapache2-mod-php5 php5-xsl php5-gd php-pear php5-mysql php5-curl php5-memcache

sudo apt-get install php5 libapache2-mod-php5 php5-xsl php5-gd php-pear php5-mysql php5-curl php5-memcache

If you had not already installed apache, php, and mysql, you can do that with the above files in place and get the right versions without removing anything:

sudo apt-get install apache2 mysql-server php5 libapache2-mod-php5 php5-xsl php5-gd php-pear libapache2-mod-auth-mysql php5-mysql php5-curl php5-memcache

Note: Your php.ini will have been replace, so you have to reset custom settings like memory_limit.

Friday, August 19, 2011

MySql Forgot Password

If you know the password then it is very easy for you to reset the MySql Password but what if you do not remember the password and want to reset it.

To figure it out I spent almost 2 days and now I am sharing so that same thing does not happen with you.

Now, we just need to start MySQL with a flag to tell it to ignore any username/password restrictions which might be in place. Once that is done you can successfully update the stored details.

First of all you will need to ensure that your database is stopped:
root@ravi: /etc/init.d/mysql stop

Now you should start up the database in the background, via the mysqld_safe command:
root@ravi:~# /usr/bin/mysqld_safe --skip-grant-tables &
[1] 6702
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6763]: started
Here you can see the new job (number "1") has started and the server is running with the process ID (PID) of 6702.

Now that the server is running with the --skip-grant-tables flag you can connect to it without a password and complete the job:

root@ravi:~$ mysql --user=root mysql
Enter password:

mysql> update user set Password=PASSWORD('new-password-here') WHERE User='root';

Query OK, 2 rows affected (0.04 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> flush privileges;

Query OK, 0 rows affected (0.02 sec)

mysql> exit

Bye

Hope this save your time :)

Tuesday, July 12, 2011

Ubuntu 11.04 Login with Root User

I know sometimes it is very easy for any user to do this, but I got something else that took my lots of time to get "root" access.

While using Ubuntu 11.04 I got an unexpected error i.e. "sudo: must be setuid root" and for this I need to login with root user but how as when I tried to login it is giving me the same error.

I read somewhere that for the above problem I need to start my system on Recovery Console, but how? As soon as I start my system it is taking me to GUI Login Screen.

Now to get access of "root" user follow the below steps:
1) Restart system by HOLDING SHIFT key.
2) While restarting press ESC key till you get the OS menu telling you for the recovery mode (Do not release the SHIFT key)
3) Now you are on ROOT user and do whatever you want.

Hope this helps :)

Sudo: must be setuid root

Here is a solution to a common error when using sudo

Open terminal (CTRL+ALT+T) and use below commands

loginuser> sudo -l
sudo: must be setuid root
loginuser>

To fix the error above chown and chmod the sudo file as root, in my case the file is in /usr/bin

root>chown root:root /usr/bin/sudo
root>chmod 4755 /usr/bin/sudo
root>chmod 0400 /etc/sudoers
reboot system

That should fix the error and you should be able to sudo without a problem.

Note: You must be login with "root" user.

Friday, July 8, 2011

Install PHPUnit

Install pear on windows
You probably need to do a very simple thing.
C:\>xampp\php\go-pear.bat
if not upgraded then use "pear upgrade-all"

Install pear on Ubuntu
Install: sudo apt-get install php-pear
update its own channel: sudo pear channel-update pear.php.net
upgrade: sudo pear upgrade-all

Now proceed with below steps
  1. pear channel-discover pear.phpunit.de
  2. pear channel-discover pear.symfony-project.com
  3. pear install phpunit/PHPUnit

Wednesday, June 8, 2011

Fatal error: Call to undefined method domdocument

I know you got frustrated with this problem, but after knowing the answer you will cetainly laugh  :)

To remove this error, you need to comment (add ; before) the extension for domxml  in php.ini - or actually BOTH of the php.ini files in XAMPP:

[path to xampp folder]/php/php.ini
and:
[path to xampp folder]/apache/bin/php.ini

;extension=php_domxml.dll

Do not forget to restart your apache, sometimes you need to restart your computer.

Hope this help you to laugh and resolve the error :)

Tuesday, March 22, 2011

Vimeo Video Crawling

  1. API
    http://vimeo.com/api
  2. Advance API
    http://vimeo.com/api/docs/advanced-api
  3. Video Search Function
    http://vimeo.com/api/playground/vimeo.videos.search

Dailymotion Video Crawling

  1. API
    http://www.dailymotion.com/doc/api/index.html
  2. PHP SDK
    http://www.dailymotion.com/doc/api/sdk-php.html#sdk-php
  3. Advance API Reference
    http://www.dailymotion.com/doc/api/advanced-api-reference.html#advanced-api-reference
  4. Need to call "video.list" function and parameter should be "search (string) - A search query"
  5. API Documentation
    www.dailymotion.com/doc/api/DailymotionAPIs.pdf

Wednesday, March 16, 2011

YouTube Video Crawling

Hi Guys,

I got the chance to work on YouTube API so thought that I should share the useful links so that it saves your time.
  1. YouTube API
    http://code.google.com/apis/youtube/getting_started.html#data_api
  2. Get search term feed
    http://gdata.youtube.com/feeds/api/videos?q=internet&v=2 (include the video id also)
  3. PHP Guide
    http://code.google.com/apis/youtube/2.0/developers_guide_php.html
  4. YouTube API with PHP
    http://www.ibm.com/developerworks/xml/library/x-youtubeapi/
  5. API Parameters
    http://code.google.com/apis/youtube/2.0/developers_guide_protocol_api_query_parameters.html#Searching_for_Videos
  6. Guide to display Videos
    http://code.google.com/apis/youtube/2.0/developers_guide_protocol_displaying_list_of_videos.html
  7. Custom YouTube Video Player
    http://tutorialzine.com/2010/07/youtube-api-custom-player-jquery-css/
 Hope this links help you to save your time :)

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/

Monday, January 31, 2011

Install Netbeans and Integrate Subversion with it

Install Netbeans
1) Open Terminal
2) sh dragDropNetBeansFileHere

How to Integrate Subversion with Netbeans
1) Install Subversion first: sudo apt-get install subversion
2) Open Netbeans and follow the path: Netbeans-->tools-->options-->miscellaneous-->versioning>subversion.
3) Set the "Path to the SVN executable File" to "/usr/bin/svn"
4) Restart NetBeans

Must Install in Ubuntu

Install Winrar
sudo apt-get install rar

Installing LAMP Server
sudo tasksel install lamp-server

Install "mcrypt" extension
sudo apt-get install php5-mcrypt

Install "curl" must be loaded
1) sudo apt-get install php5-curl
2) System -> Administration -> Synaptic Package Manager and find the package or software as “php5-curl“ or php curl and install the CURL module for PHP.

Install "GD" must be loaded
sudo apt-get install php5-gd

Install All Extensions
sudo apt-get install php5-mcrypt php5-curl php5-gd

Restart Apache
sudo /etc/init.d/apache2 restart

Install JDK in Ubuntu
1) sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
2) sudo apt-get update
3) sudo apt-get install sun-java6-jdk

Install Netbeans
1) Open Terminal
2) sh dragDropNetBeansFileHere

How to Integrate Subversion with Netbeans
1) Install Subversion first: sudo apt-get install subversion
2) Open Netbeans and follow the path: Netbeans-->tools-->options-->miscellaneous-->versioning>subversion.
3) Set the "Path to the SVN executable File" to "/usr/bin/svn"
4) Restart NetBeans

Run setup though command line for wine
wine /media/storage/Setup.exe

Enable mod_rewrite
1) a2enmod rewrite
2) AllowOverRide All in the following file:
/etc/apache2/sites-available/default
3) Restart Apache

Edit button is not working in Shutter

You can simply install the needed packages with:
sudo apt-get install libgoo-canvas-perl

Hope this helps :)

Tuesday, January 25, 2011

Picasa 3.8 hangs

This is due to new feature in the Picasa 3.8 you just need to follow these step to avoid any crash problem

1. As soon as you open the Picasa, go to Tools -> Options -> Name Tags
2. Uncheck all check boxes and click OK.

Hope this helps :)

Friday, January 21, 2011

Zend Framework Check statusId with username and password

I think you can do that by using the getDbSelect instance of Zend_Auth

// get select object (by reference)
$select = $adapter->getDbSelect();
$select->where('active = "TRUE"');

Monday, January 17, 2011

How to close colorbox

Just use this function to close your colorbox within iFrame.

parent.$.fn.colorbox.close();

Hope this Help :)

Friday, January 7, 2011

Magento Custom Module with Custom Database Table

All that you need is to install the Module Creator.

I found two interesting blog, hope you all like these.
1) Click Here for more information
2) Click Here for more information 

Not able to login into magento admin panel

go to the following file:
app/code/core/Mage/Core/Model/Session/Abstract/Varien.php 

On Line no: 78 

     // session cookie params
        
$cookieParams = array(
            
'lifetime' => $cookie->getLifetime(),
            
'path'     => $cookie->getPath(),
            
'domain'   => $cookie->getConfigDomain(),
            
'secure'   => $cookie->isSecure(),
            
'httponly' => $cookie->getHttponly()
        );

        if (!
$cookieParams['httponly']{
            
unset($cookieParams['httponly']);
            if (!
$cookieParams['secure']{
                
unset($cookieParams['secure']);
                if (!
$cookieParams['domain']{
                    
unset($cookieParams['domain']);
                
}
            }
        }

        
if (isset($cookieParams['domain'])) {
            $cookieParams[
'domain'$cookie->getDomain();
        
}

Replace it to: 
 
    // session cookie params
        $cookieParams = array(
            
'lifetime' => $cookie->getLifetime(),
            
'path'     => $cookie->getPath()/*,
            'domain'   => $cookie->getConfigDomain(),
            'secure'   => $cookie->isSecure(),
            'httponly' => $cookie->getHttponly()*/
        
);

        
/*if (!$cookieParams['httponly']) {
            unset($cookieParams['httponly']);
            if (!$cookieParams['secure']) {
                unset($cookieParams['secure']);
                if (!$cookieParams['domain']) {
                    unset($cookieParams['domain']);
                }
            }
        }

        if (isset($cookieParams['domain'])) {
            $cookieParams['domain'] = $cookie->getDomain();
        }*/