Monday, October 31, 2016

Speed limit in NH 48

There has been an introduction of speed limits for vehicles of different categories in the NH 48.

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

There was a board indicating 3 different categories and speeds for each of these.
Thus, the speed limit for autorickshaws is 60kmph, trucks, vans and heavy vehicles 80kmph and for cars, SUVs and such private vehicles it is 100kmph.

The fine for exceeding the limit would be Rs.400/-, for the first time and Rs.1000/- for a repeating incident.

I guess there are hidden speed guns installed along the route, which will be monitoring the speed of the vehicles. But, the question is, how will they know the number of the vehicle? My guess is that they have cameras installed to capture the number plate also.

So, folks. Be warned. Drive safe!

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

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.

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.

How to not print columns on display while printing on paper

Many of you may or may not be aware of a javascript code that is capable of printing page content. We had created a report which looked s... Registered & Protected DWYE-NHTO-NBNH-7FFM