Sunday, 27 May 2012

DirectoryIndex and AddType - Apache

The DirectoryIndex directive sets the list of resources to look for, when the client requests an index of the directory by specifying a / at the end of the a directory name.

DirectoryIndex index.html index.php /cgi-bin/index.pl
would cause the CGI script /cgi-bin/index.pl to be executed if neither index.html or index.php existed in a directory.
You can write PHP code in a file with extension other than .php but still the server recognises and execute it. This is possible if you add the below line in apache conf file  

AddType application/x-httpd-php .bop .foo .133t
AddType application/x-httpd-php .asp .py .pl
AddType application/x-httpd-php .htm .html

Reference: http://php.net/manual/en/security.hiding.php
 

Wednesday, 21 March 2012

Excerpts from Robin Sharma's books

  1. A bit of fragrance clings to the hand that gives flowers.
  2. As Gandhi stepped aboard a train one day, one of his shoes slipped off and landed on the track. He was unable to retrieve it as the train was moving. To the amazement of his companions, Gandhi calmly took off his other shoe and threw it back along the track to land close to the first.
    Asked by a fellow passenger why he did so, Gandhi smiled. "The poor man who finds the shoes lying on the track," he replied, "will now have a pair he can use."
  3. People asked Thomas Alva Edison why he didn't invent a machine to help him hear. And he always replied that "a man who has to shout can never tell a lie".
  4. Kaizen - continuous improvement.
  5. One night a father was relaxing with his newspaper after a long day at the office. His son, who wanted to play, kept on pestering him. Finally, fed up, the father ripped out a picture of the globe that was in the paper and tore it into a hundred tiny pieces. 'Here son, go ahead and try to put this back together.' he said, hoping that this would keep the little boy busy long enough for him to finish reading his paper. To his amazement, his son returned after only one minute with the globe perfectly back together. When the startled father asked how he achieved this feat, the son smiled gently and replied 'Dad, on the other side of the globe there was a picture of a person, and once I got the person together, the world was okay.'"
  6. king Midas loved gold so much he prayed that everything he touched would turn to gold. When his wish was granted he rejoiced. That was until he realized that he couldn't eat because his food had turned to gold and so on, so forth."

Tuesday, 20 March 2012

Edit button missing google blogger

rRecently Google started routing users to country-specific URL. i.e For example if you are in India and trying to use example.blogspot.com , it will be redirected to example.blogspot.in. This affects the normal functioning of the site like the edit option for post is missing. To prevent this we can use a flag NCR(No country redirect) in the URL like this http://example.blogspot.com/ncr.
Reference: http://support.google.com/blogger/bin/answer.py?hl=en&answer=2402711

Lightbox for ajax loaded content Drupal

Normal way of implementing lightbox does not work out for the onclick event of ajax loaded content. For that we should do the below thing
$(document).ajaxComplete(function() {
   Lightbox.initList();
});
Reference: http://drupal.org/node/282089

Friday, 16 December 2011

Cannot start session without errors phpmyadmin

Sometimes when you hit the phpmyadmin page, you will receive error saying cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.
This can be eliminated in two ways.
1. Try clearing the cookies and then hit the phpmyadmin page.
2. If step1 is not working, then you need to set the tmp folder path in PHP directory to the session.save_path variable in php.ini file.
Reference: http://www.webteches.com/cannot-start-session-without-errors-please-check-errors-given-in-your-php-andor-webserver-log-file-and-configure-your-php-installation-properly/

Theming Views Drupal

Thursday, 15 December 2011

URL encoded query string from key value pair

To generate a URL encoded query string from an associative array in PHP, use the function http_build_query.
Reference: http://php.net/manual/en/function.http-build-query.php


screenshot of a whole web page

Have trouble in taking a screenshot of the whole content of  a web page when there is scrollbars , then you should check these addons.
ieSnapshotter - http://www.filedudes.com/ieSnapshotter-download-45699.html
screengrab - https://addons.mozilla.org/en-US/firefox/addon/screengrab/ - After installing , go to the site and right click and select screengrab then save as complete page.

database name as numeric mysql

Have you ever wondered why the numbers or number-text combination  with spaces is not allowed in naming a database in mysql, then you check the below links. The solution is to give them inside a backtick operator.

http://stackoverflow.com/questions/5986497/can-a-database-name-start-with-a-number
http://stackoverflow.com/questions/2121596/mysql-numeric-database-limitation