Monday, October 31, 2016

Speed limit in NH 48

There is some news for those using the national highway NH 48, especially the Chennai Bengaluru section.
There has been an introduction of speed limits for vehicles of different categories in the NH 48. There are different speed limits for cars, SUVs, autos, trucks, vans and heavy vehicles plying along the NH48.

We just happened to pass through one of these toll gates on the Chennai Bangalore section of NH 48, last Saturday, 29 October, 2016.

We noticed that there was a board indicating 3 different categories and speeds for each of these.
According to the notice board, the speed limit for autorickshaws is 60kmph, whereas trucks, vans and heavy vehicles can travel up to a speed of 80kmph, while cars, SUVs and other private vehicles can go up to a maximum speed of 100kmph.

The fine for exceeding the limit would be Rs.400/-, for first time offenders and Rs.1000/- for a repeat offence.

Our belief is that there are hidden speed guns installed along the route, which will be monitoring the speed of the vehicles passing through. These gadgets could be communicating with the next toll booth about vehicles violating the speed limit.

But, the question is, how will they know the number of the vehicle? So, it is possible that there could be cameras installed to capture the number plate also, when the vehicles approach a clickable distance.

So, folks. Be warned. Drive safe, when you are taking the NH 48 or Chennai Bengaluru section of the National Highway!

Tuesday, October 25, 2016

How do I recover MySQL root password?

Recover MySQL root password in 5 Steps

In the rush of things, we sometimes fail to remember some important information such as wife's birthday or your MySQL password. 

Here are the steps that you may use to reset you MySQL password. For the problem of remembering wife's birthday, you will have to find your own solution. There's a solution to improve your memory, but that post will come later.

This assumes that you already have access to the computer but have misplaced your MySQL admin password.

These are the steps I followed to to reset the MySQL database server password.
Login as superuser, as root.

1. Stop the MySQL server process.
# /etc/init.d/mysql stop

Stopping MySQL database server: mysqld.

2. Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for a password.

Start the MySQL server w/o password:
# mysqld_safe --skip-grant-tables &

[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started

3. Connect to the MySQL server as the root user, using the MySQL client.

# mysql -u root

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


4. Set a new root password.

mysql> use mysql;
mysql> update user set password=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Note: It is important that you give password("Your new root password") and not just the "NEW-PASSWORD", which is a common mistake that happens.

5. Exit and restart the MySQL server.

Stop the MySQL server:
# /etc/init.d/mysql stop

Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/
mysqld_safe[6186]: ended

[1]+  Done                    mysqld_safe --skip-grant-tables

Start the MySQL server and test it:
# /etc/init.d/mysql start
# mysql -u root -p

Friday, October 21, 2016

Calendar template for a bird's eye view of events

A bird's eye view of events in a calendar template

I wanted a calendar template that would show me a list of events that we have scheduled for the month, for our internal use.

I am okay with jQuery, Javascript and all, but why take the effort to re-create a wheel when it is available readily.

So, I jumped into the Google ocean and looked around for this Calendar shrimp. There were many available, but this particular module from seemed appropriate.

It is based on php, jQuery and Javascript, which is my development environment as well. It has all the requisite code in a single, simple, easy to understand piece of php file.

You would need to provide the database credentials in the file dbConfig.php. 
There is a function getCalender() in the php file functions.php, where you can make changes in the section [id="calender_section_bot"], to change cell colours and to show additional information as you find appropriate.

I made some changes to the table structure and the script to customize it to suit my requirement.

Note that you have to link to the bootstrap css, jquery js files and the custom style sheet to make it display properly.

If you do not link to bootstrap css, the alignment of the calendar will misfire.

Here is the link to the calendar template.

Build event calendar using jquery ajax php

Monday, October 17, 2016

PHP - Error 500 - Centos 7

Error 500 Internal Server Error in PHP

I have a Google Instance running Centos 7.

I had this strange Error 500 message whenever I upload a piece of php code.

When accessing through the browser, it comes up with the error message, which was loading without issues in my local machine.


Internal Server Error

The error was something like this.
HTTP request sent, awaiting response... 500 Internal Server Error
2016-10-18 11:28:33 ERROR 500: Internal Server Error.
I searched around and found a solution probable solution.

Somebody suggested that I execute the following command to make it right.

sudo chcon unconfined_u:object_r:httpd_config_t:s0 myfile.php

It did work though I do not know why. My guess is that it could be something to do with the newline and return values.

Notepad plus, which is the editor that I used for this purpose, has the options, Windows, Unix and Old Mac under "Edit", "EOL Conversion". My guess is that choosing "Unix/OSX format" when saving you code in Notepad plus might be another method to solve the problem.

Here is another instance where the 500 Internal server error may occur. Let us suppose you have a symbolic link to a folder that is present elsewhere in the disk. You are referring to a specific file, it may be a config file which you want to include in your php code. This error is thrown because Centos has a problem accessing the file due to non availability of rights. As you know, every object in Unix is accessible based on rights only.

How to find the exact problem for Internal server error

Our system was Unix/Centos

We can find the exact problem by looking at the httpd server logs that are created in the Apache server or Nginx or any server that you may be running.

So, what is the Centos error log file location?

In Centos, the Centos error log file path would be  /var/log/httpd/-error_log

So, if your domain is and you are running your webserver in a Centos machine, then the path to your error log file would probably be  /var/log/httpd/

An example error_log file would look something like this.

[Tue Oct 18 11:35:28.950158 2016] [:error] [pid 15013] [client 172.xx.xx.49:33929] PHP Warning:  include(/home/ghost/rider/tajmahal.php): failed to open stream: Permission denied in /home/ghost/rider/opendata.php on line 3
[Tue Oct 18 11:35:28.950188 2016] [:error] [pid 15013] [client] PHP Warning:  include(): Failed opening 'tajmahal.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home/ghost/rider/opendata.php on line 3

If you look in the above log, it becomes obvious where the error lies. 

Hope it helped. 

Locking Unlocking Aadhar Biometrics, Lock Unlock

Recently, there was a news item, which claimed that we can lock and unlock our Aadhar biometric details from being requested for biometric ... Registered & Protected DWYE-NHTO-NBNH-7FFM