Showing posts from November, 2016

Enable ssh tunnel to access phpmyadmin on google cloud

Enable ssh tunnel to access phpmyadmin on google cloud

Here is a hint for those who are trying to connect to you MySQL database server using phpMyAdmin.

It is assumed that you have already setup your Google Cloud server, installed Apache, MySQL and phpMyAdmin.

Opening up phpMyAdmin for access from any machine is not a safe thing to do. Again, adding your IP to the phpMyAdmin.conf everytime is not advisable either.

The best thing to do is to create a tunnel connection to your server, using the following instructions.

When you access phpmyadmin before creating the tunnel, shows you an error message similar to the one on the left.

So, open the Cloud SDK Shell.

Then create a tunnel using the following command.

--zone <ZONE-WHERE-YOUR-INSTANCE-IS-LOCATED> --ssh-flag="-L" --ssh-flag="8888:localhost:80"

eg., gcloud compute ssh myCentos-1
--zone us-central1-b--ssh-flag="-L" --ssh-flag="8888:localhost:80&…

Provide upload rights to a user to a www directory

How to provide upload rights to a user to a www directory?If you have a Google Cloud instance running Centos-7, have setup SFTP on your machine and are now wondering how to provide access to the www folder to your www admin, here are the steps to follow.

Step 1 is to create a unique group, or use an existing group like "apache"

Next, add the group name to the folder you want to share, using 
sudo chgrp -R apache

Step 3 is to add rwx permissions [read, write, execute] to the group, on the shared folder.
You can do that with the command
sudo chmod -R g+rwx

Finally, add the user with whom you want to share the folder to the group, using the command
usermod -a -G apache

After this is done, your user will be a part of the apache group, which will have read, write and execute permissions to the www folder.

You can add additional users to the group apache, which will allow them access to those folders, automatically.

Here is a link on allowing a group read write access to a directory

வாழ்க்கை இரகசியம்

வாழ்க்கை இரகசியம்
சும்மா இரு என்று
முன்னர் கூறிய
குருவை வணங்குகின்றேன்

வாழ்க்கை இரகசியம்
என்னவென் றுணர்த்திய
குருவை வணங்குகின்றேன்

குருவே சரணம்
குருவே சரணம்
குரு திருவடி சரணம்

செய்வன திருந்த
செய்யென கூறிய
குருவை வணங்குகின்றேன்

நம் அனுபவம் செயலின்
பலனென உணர்த்திய
குருவை வணங்குகின்றேன்

குருவே சரணம்
குருவே சரணம்
குரு திருவடி சரணம்

நன்மை செய்து
பழகென கூறிய
குருவை வணங்குகின்றேன்

செயல் போல் வாழ்வென
நிறைவாய் உணர்த்திய
குருவை வணங்குகின்றேன்

குருவே சரணம்
குருவே சரணம்
குரு திருவடி சரணம்

Omens and their Interpretation, Interpreting Omens! - Part 2

Omens and their Interpretation - Part 2It has been a long time since I wrote that first part on Omens.

I am writing this as a continuation to that content, as I wish to share a few more thoughts, based on new learnings acquired over the years.

When it comes to interpreting things that happen to us, we have to take it that Nature or the Cosmos is in constant communication with us, bombarding us with inputs, which we fail to receive; or if we receive, then fail to understand; or if we understand, we fail to take advantage of these signs and omens in everyday life.

There are two types of inputs that an individual receives; one from the inner self or the subconscious; and the other from the unlimited Intelligence that surrounds us, the message from the cosmos.

The inner self reminds you not forget your id card, your purse and so on, when you are in a hurry and going to attend your all important finals. Your bag or shirt getting stuck in the door latch when you exit, or you stumbling on your w…

P V Sindhu is now the 3rd non-chinese that wins the Chinese open women's singles

P. V. Sindhu wins 2016 Chinese Open P. V. Sindhu has won the Chinese Open BWF Super Series final, against Sun Yu of China, with the final score reading 21–11, 17–21, 21–11.
Sindhu was agile, nimble and mostly attacking with quite a few hard smashes to surprise Sun Yu and got to a 11-5 lead in the first 8 minutes of the game.
Sindhu's judgement was precise in the first game which saw only one rally, which Sun Yu won. For the most part, both were in attack mode, with Sindhu prevailing over Sun Yu.
The second set was a tight contest, till the score was reading 17-17, with one interesting long rally for the 12th point with Sun Yu winning it. Both were in their thinking mode with a few intelligent drops and placements by both the players. Sun Yu won the second set with some aggressive body smashes to boot, enabled by Sindhu's somewhat defensive play in the latter part of the 2nd set.
The third game saw Sun Yu hitting beyond the line a few times making unforced errors, while Sindhu was o…

The magic solution for bloating and stomach gas

The wondrous magic of chewing betel leaf with ginger
Yes, it works!

A colleague was suffering from a bloated stomach due to gas. Someone was commenting that eating fibrous foods may result in gas problems.

He was suffering from this problem for over a week.

Another friend, who was overhearing the conversation, interjected and said, "Hey, I told you about eating a betel leaf with a piece of ginger last month, didn't I?".

"Oh yes, you did". "Now, I remember". I will definitely try tonight.

Luckily, there were two betel leaves and a piece of ginger at home.
Consuming the betel leaves and gingerAfter having dinner, he shaved off the skin from the piece of ginger. The ginger piece could be a centimetre or half long. Then he removed the petiole (leaf stalk) and the base of the leaf. Next, he flipped the betel leaves and proceeded to scrape the veins of the betel leaves using his long fingernails.

It is said that the veins of the betel leaf should not be consumed as…

Redirect to a related page after an enquiry

Redirect to a new page using jQueryYou have a few related websites that garner quite a few visitors every day. You find that visitors to one website may also be interested in your other related portal.

So, you decide to redirect all those visitors who have posted an enquiry on your portal 1 to portal 2.

This is your original page

type: "POST",
url: "inquiry.php",
data: data,
success: function (html) 


You display a thank you message and after sometime you redirect the user to another page, transparently. The jQuery timeout function is used to achieve the required result.
When you add the following code just below the jQuery() call, the visitor is redirected to your other portal, after the "Thank you" message is displayed for 10 seconds.
// redirect to another page after 10 seconds
var ADDRESS ='';
var delay = 10000; //delay…

mysqli_query() expects parameter 1 to be mysqli_result

mysqli_query() expects parameter 1 to be mysqli_result

See the above message. Then,

Study the script below carefully. There is an error in it. At first glance, it may not be so obvious, especially if you are new to database handling.

$updateQry ="update TABLE set approved=$value where id=$id";
$updQryResult =mysqli_query($conn, $updateQry);
if (!($updQryResult)) {
   $updateResult =0;
else {
   $updateResult =mysqli_affected_rows($updQryResult);

if ($updateResult) {
   echo 'Rejected';
else {
   echo "Update failure";

Okay, the error is in line 7. Yes, easy wasn't it? It is always easy when we know the answer.
How did I miss it?
Let me explain for those who did not see it.
The correct statement in line 7 of the above code should have been $updateResult =mysqli_affected_rows($conn);
Most of us commit this mistake, at some point or other of the learning curve in MySQL and PHP.
By way of habit, we pass the result set handle to the function mysqli_affected_rows(), which w…

The day when Google slipped

Yes, I agree; it is a misleading title.

It should have actually been "The day when Google slipped from its towering pedestal in our minds".

Most of us have high regards for Google, as a company, for its high standards and its blazing growth over the past decades; no doubt.

This piece is not about that. It is about the one area of customer service, which is taken for granted by all or most Indian companies; and Google seems to me as no exception, as the story narrated below will convey.

I signed up for the Google Cloud trial for 60 days. Activated the account, added a card for payment, create an instance and migrated all my domains into the new instance.

All well for 60 days. A few days before expiry, Google started sending me reminders about the expiry, which unfortunately did not come to my notice, since I had used a rarely used account for the subscription.

On the day of expiry, it was around 1030 am, when accessing my domain returned an error. That was because Google automatica…

Error when setting up _ installing MCrypt PHP Extension on Redhat 7 Enterprise x64

Error when setting up/installing MCrypt PHP Extension on Redhat 7 Enterprise x64

I knew that mcrypt was not installed when my call to phpmyadmin threw me a warning regarding the mcrypt extension.

Like so:
Cannot load mcrypt extension. Please check your PHP configuration.

So, I got on to setting up mcrypt on my Redhat server in the Google cloud, using yum install php-mcrypt.

I got an error during the installation of mcrypt on my Redhat server in the Google cloud.

Error returned when installing mcrypt:
--> Finished Dependency Resolution
Error: Package: php-mcrypt-5.3.3-1.el6.rf.x86_64 (rpmforge)
Requires: php-api = 20090626
Installed: php-common-5.4.16-42.el7.x86_64 (@rhui-rhel-7-server-rhui-rpms)
php-api = 20100412-64
Available: php-common-5.4.16-21.el7.x86_64 (rhui-rhel-7-server-rhui-rpms)
php-api = 20100412-64
Available: php-common-5.4.16-23.el7_0.x86_64 (rhui-rhel-7-server-rhui-rpms)
php-api = 20100412-64
Available: php-common-5.4.16-23.el7_0.1.x86_64 (rhui-rhel-7-server-rhui-rpms)
php-api = 2010…

Can't connect to MySQL server on 'localhost'

This morning I opened up my computer to make a copy of my database into another laptop.

When I tried starting up the mysql command line utility, I got an error message which told me that the MySQL server cannot be connected to.

The command I gave was

Here is the message I got.
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
The message does not tell you much, other than the fact that the MySQL server is not available for communication.

At first, I thought that I might have gotten the password wrong or there was a keyboard error and tried as much.

But, then it occurred to me that the MySQL service might not be on. Yes, that was the problem.

I then started up the MySQL service and then... bingo! I was able to connect to the MySQL server.

The error message Can't connect to MySQL server on 'localhost' was gone.