[HowTo] Stop phpmyadmin from asking username, password in localhost

Yesterday, I showed you how you can keep local installation of phpmyadmin from logging you out every few minutes. I took one more step and edited configuration to not ask me username, password at all. Now phpmyadmin never asks me for mysql username and password.

Keep in mind if you follow this tutorial anyone would be able to access your database using phpmyadmin unless you deny access via apache configuration. Don’t do this on production servers.

Steps to follow:

  • Run: gksudo gedit /etc/phpmyadmin/config.inc.php
  • Find:
    $cfg['Servers'][$i]['auth_type'] = 'cookie';

    And change it to:

    $cfg['Servers'][$i]['auth_type'] = 'config';
  • Just below this line, add:
    $cfg['Servers'][$i]['user'] = '';
    $cfg['Servers'][$i]['password'] = '';

    Replace and with mysql username and password.

  • Save the file.
  • Changes will be applied immediately, no need to restart apache.

Now, you’ll never have to enter username and password in phpmyadmin.

Cheers!

[HowTo] Optimize Mozilla Firefox for better performance

Firefox is getting very popular lately, mainly due to its customizability. I use firefox as my main browser and use all sorts of addons which help me in web-development. These addons make my firefox hungry but I can’t do without them. So, instead I tweaked around some settings in firefox which made it much responsive and faster than before.

To tweak those settings, follow the following steps:

1. Type about:config in your address bar and hit enter.

2. In the filter type browser.session
3. Modify browser.sessionhistory.max_entries by double clicking it. This setting sets the number of steps you can go forward or backward on a page. Default is 50 which is just too much. 20 will be more than sufficient for most people.

4. Modify browser.sessionstore.interval by double clicking it. This setting specifies the rate of saving current session. The default is 10000 milliseconds which means that every ten seconds your sessions are stored. So, when your browser crashes you will, at most, lose only tabs since last nine seconds prior to crash. Change it to 30000 or 20000, whatever suits you. 10000 is definitely not required by most of the people.

5. Modify browser.sessionstore.max_tabs_undo. This setting stores the number of tabs you can undo-close by pressing ctrl-shift-t. Default has been set to 10. I set it to 5 which is more than sufficient for me.

6. Modify browser.sessionhistory.max_total_viewers. This setting can vastly improve the performance. It specifies the number of pages to store in memory. When you press back/forward in a browser, pages are instantly displayed. This is because those pages have been stored in the memory and this setting specifies how many pages should be stored. By default, its -1 which means it depends upon the amount of ram. I have 2 GB and I set this setting to 4.

7. Modify network.prefetch-next. This setting specifies if the prefetching should be enabled or not. Prefetching is when a site tells the browser to download a link (which is most likely to be visited) beforehand only. It is useless and only takes up extra bandwidth and memory. Set the value to false.

Lastly, you can try to change some settings yourself and see the results. You can check the mozillazine knowledgebase to know what a particular setting does. For example, for network.prefetch-next you can check out the setting details at http://kb.mozillazine.org/Network.prefetch-next. Similarly, for other settings.

Some more tricks to free up memory usage of firefox:

1. The awesome bar (address/location bar), as you must be knowing is really amazing feature but it may lead to slowdowns if history is too large. Go to Preferences->Privacy, and in ‘Remember my browsing history for atleast’, put minimum history that you ever require. Mine is 30, since I don’t need more than that and putting a less value always speeds up things. In the same dialog box, In ‘When using the location bar, suggest:’ , try an use only one option if you don’t require both. This will further reduce the address bar lag.

2. Remove useless plugins/extensions: Periodically check the list of your extensions and disable those which you haven’t used since a long time. Extensions are the main cause of Firefox’s slowdown.

3. Use a blank pages as your home page. This makes firefox startup a bit faster.

4. Try and use default theme as themes eat up way too much memory. It delays the startup very significantly.

5. Flash is one of the reasons why Firefox eats so much amount of memory. It has been known that memory taken by a flash animation isn’t freed even after closing that tab. They said they improved this memory leak from Firefox v3 onwards but I don’t see much of a difference. The solution is you can replace all your flash animations with a play button using flashblock extensionsand just click the play button to play the required flash animations.
This way you control which flash files are being played, thereby reducing the amount of memory taken.

These settings will definitely make your Firefox blazing fast. Try and implement all of them and see the difference.

Cheers!

[SOLVED] Error “undefined reference to `libiconv_open’” while compiling

I was trying to compile sphinx server from source but I go the following errors on executing make

undefined reference to `libiconv_open’
undefined reference to `libiconv’
undefined reference to `libiconv_close’

To fix the error, you can compile without iconv (multiple encoding support) support. Use the following commands to compile. You can add more parameters as per your requirements.

./configure --without-iconv
make CFLAGS=-liconv
make install

I hope that helps

Undo recent facebook style changes

Recently facebook made its font smaller. It worried lots of people with weaker eye sight. The font looks ugly as well. They reduced it all the way to 11px from 13px. And changed its color to #000 from #333. I made a quick greasemonkey script as it works cross-browser to fix the issue until facebook does something about it.

You can install the script from the following link:
http://userscripts.org/scripts/show/89552

Google Chrome: Chrome doesn’t need any extension for this to work. It’ll install the script right away.
Firefox: You need to install greasemonkey extension from https://addons.mozilla.org/en-US/firefox/addon/748/

Opera: It has its own Userjs API. This script might work on Opera. However, it has not yet been tested.

I don’t recommend using any version of IE, hence no instructions for that.

[HOWTO] Send emails(using mail function) from localhost in PHP through msmtp (using gmail account) on Linux

There’ve been lots of times when I wanted to use the mail() function on my local server. I am sure lots of you would’ve been wanting it too but most of you would’ve settled for PHPMailer or just used a web host to test the code instead. I myself had been doing the same until recently when I finally decided to do some research and get it to work.

Here are the steps in short for the geeks who like to do things on their own:
All I did was used smtp client called msmtp, configured it to work with my gmail account and configured PHP to use msmtp to send emails.

This tutorial is only applicable for linux users. I’ll write another article for windows users soon when I get my hands on a windows box.
All the commands used in the instructions are for Ubuntu, however you may use corresponding commands for your distro (for eg; you can use yum install instead of apt-get install on fedora, redhat, centos.

Step by step instructions:

  1. First of all, follow this tutorial:
    Install msmtp on your linux box and configure it to work with Gmail.Msmtp is highly configurable and you can easily configure it to work with any smtp server. If you wish to use any other service with msmtp, you may read its manual and configure it.
    Proceed to next step only if you have successfully configured and are able to send a test message.
  2. Open php.ini in your text editor.
    sudo gedit /etc/php5/apache2/php.ini

    Search for ‘sendmail_path’ and change it to look like

    sendmail_path = '/usr/bin/msmtp -t'

    Save the file and exit the text editor.
    Please note that your msmtp path may vary if you are not using Ubuntu. You may find the path to executable by:

    which msmtp
  3. Restart apache:
    sudo /etc/init.d/apache2 restart

    OR

    sudo /opt/lampp/lampp restart
  4. Everything’s done. Lets test if the mail() function is working now:
    if ( mail ( '[email protected]', 'Test mail from localhost', 'Working Fine.' ) );
    echo 'Mail sent';
    else
    echo 'Error. Please check error log.';

    Replace the [email protected] with your own username, save it into a php file along with php delimeters in your virtual host root folder and execute it through the browser. You should receive a mail.

Give yourself a pat on the back.

Some points to note:

  • If you weren’t able to send yourself a test mail in Step 1 ie. setting up msmtp, you should look at the debug information and search for solutions accordingly on the internet. Here’s the manpage of msmtp to help you with configuration
  • If you didn’t receive a mail in your inbox on the last step, check in your Spam folder. If its not there your should check the php error log for hint about what went wrong and act accordingly.
  • For any other questions, suggestions or appreciation feel free to use the comment box.

Cheers!

[HOWTO] Install Opera 10.6 via PPA in Ubuntu

Opera 10.6 which was released yesterday is currently one of the fastest browsers. It has beaten Chrome in javascript speed test. It also features better support for HTML5, WebM video support.

You can now install it on Ubuntu via PPA.

Add the PPA in your repository:


sudo sh -c 'echo "deb http://deb.opera.com/opera/ stable non-free" >> /etc/apt/sources.list.d/opera.list'

Add the key:


sudo sh -c 'wget -O - http://deb.opera.com/archive.key | apt-key add -'

Update your package list:

sudo apt-get update

Finally install opera:

sudo apt-get install opera

Enjoy the all new opera!
Cheers!