Sunday, November 27, 2016

Enable ssh VPN tunnel to access phpmyadmin on google cloud


If you are looking to enable ssh VPN tunnel to access phpmyadmin on google cloud, here is a possible solution

This hint is especially good if you are trying to connect to your 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 (global access) is not a safe thing to do. It is insecure and not advised. Of course, you may add your IP address to the phpMyAdmin.conf file. But again, adding your IP to the phpMyAdmin.conf everytime is not advisable either.

Browser screen when accessing phpmyadmin before creating the ssh tunnel
Result when accessing phpmyadmin before creating SSH tunnel

The best thing to do is to create a VPN 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, we open the Cloud SDK Shell.



Then we create the VPN tunnel using the following command.

gcloud compute ssh <NAME-OF-INSTANCE-FOR-THE-TUNNEL
--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"

Note: You will be replacing the words in bold above with your relevant server name and zone name.
phpmyadmin login screen is shown when accessing phpmyadmin after creating the ssh tunnel
phpMyAdmin Login Screen shows after successful creation of ssh tunnel


After doing the above, open phpMyAdmin from your browser by typing the address
http://localhost:8888/phpmyadmin/

Voila, you get the login screen!


Friday, November 25, 2016

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.

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

Here is a detailed explanation on how to add a user to a group
add-a-user-to-a-group-or-second-group-on-linux

Wednesday, November 23, 2016

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


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


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

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

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

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

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

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

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

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

Monday, November 21, 2016

Omens and their Interpretation, Interpreting Omens! - Part 2


Omens and their Interpretation - Part 2

It has been a long time since I wrote that first part on Omens and their interpretation.

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, for example, 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 way out are all simple examples of your sub-conscious communicating with you.

Come back, sit for a minute and you will recall that you forgot such and such a thing during that time. When one does not pay heed to the information the subconscious tells loudly, we find that we remember that we forgot our purse and watch only halfway into the travel.

The second type of communication is about matters that we are not aware of; those which our subconscious cannot warn us of, because it does not have any knowledge about it.

This is the cosmic knowledge which is transmitted to us through external factors. I would like to share an incident with you, which happened many years ago. 


An Omen that prevented an accident


A group of friends were going on a pilgrimage to Pondicherry, with the purpose of visiting various samadhis [final resting place or a memorial] of various spiritual guides. By the way, Pondicherry has a lot of such samadhis to visit.

It was about sundown when a few locals got into an altercation with the group as they parked the car in a place, which the locals objected to. One fellow suddenly leaned inside the driver's side of the car, removed the keys from the ignition and walked away.

Nobody suspected a thing on why this incident happened. An hour or so had passed by the time a compromise was reached and the journey resumed. Later, an hour into the journey, the friends saw a traffic cop regulating traffic around a car which seemed to have been involved in an accident some time ago.

It was then that it occurred to the group that if there had not been that delay due to that incident with the locals, it could have been this car that would have been involved in what was a major accident. The interpretation was that the delay was the divine omen or nature's interception that saved their lives.

Even though this may seem like an isolated incident, it happens to everyone of us, in one way or another. Because, we have been brainwashed into thinking that such thoughts are superstitions, most of us do not give a second thought to it.


A missed flight that saved his life!

In another incident, I remember a friend who missed his flight because he forgot his laptop in his hotel, and check-in was closed by the time he went back to the hotel and came back with the laptop.

The lady at the counter was adamant in not letting him go through. Later on, when they learnt that the flight was involved in a major crash, she came to him and said, "You owe me one".

The way the cosmos works is not immediately clear to us, because we are not party to the entire story; we are players who come to play a single game, go back and come again for another game.

It occurs to me now that nature gives us two guides, one internal and another external. To make use of our personal guides and play a fair game, seems to be the purpose of life. 

How we interpret them, what we call them, Omens or the work of spiritual guides and guardian angels, is immaterial.

Part 1 of this article may be found here

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 on her own aggressive self, winning 21-11 comfortably.

P. V. Sindhu and Saina Nehwal are the only non-chinese who have won the China Open badminton tournament,  since the first tournament in 1986.

Wong Mew Choo, who won the women's singles title in 2007 is Chinese too, even though from Malaysia.
 
So, essentially, only India has won the Chinese open other than the Chinese.

Interesting statistics about the China Open

A total of 26 people have won it in the past 30 years.

The following 5 players have won the China Open twice
Li Xuerui in 2012, 2013
Jiang Yanjiao in 2008, 2009
Zhang Ning in 2005, 2006
Zhou Mi in 1999, 2001
Li Lingwei in 1987, 1988

P. V. Sindhu, Saina Nehwal from India and Wong Mew Choo of Indonesia, are the only non-Chinese who have won the Chinese open till 2016.

Sunday, November 20, 2016

magic solution for bloating and stomach gas

Some of us know how green leafy vegetables are beneficial to the body. Many of us know that ginger, when consumed does incur a few benefits on the body. We are going to see one such solution recipe, where both ginger and a green leaf called betel, when consumed together works magic on the body in a certain way. Here goes.

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 ginger


After 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 they damage the constitution.

He then folded the ginger piece in the leaves and proceeded to put it in his mouth and chew.

Ref: He could feel a difference within a few minutes of consuming this astringent and warm tasting preparation.

Bloating and stomach gas solved



By morning the next day, the stomach felt fresh and no symptoms of gas were found. Thus, he swears that this is a proven remedy for stomach gas.

Hope this solution for bloating and stomach gas works for you.


Saturday, November 19, 2016

Redirect to a related page after an enquiry


Redirect to a new page using jQuery

You 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

jQuery.ajax({
type: "POST",
url: "inquiry.php",
data: data,
success: function (html) 
{
jQuery("#thankyoupage").css("display","block");

}
});

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 ='https://www.myotherdomain.com/?source=ENQPG';
var delay = 10000; //delay in milliseconds
setTimeout(function(){ window.location = ADDRESS; }, delay);

The final code looks like this:

jQuery.ajax({
type: "POST",
url: "inquiry.php",
data: data,
success: function (html) 
{
jQuery("#thankyoupage").css("display","block");
// redirect to another page after 10 seconds
var ADDRESS ='https://www.myotherdomain.com/?source=ENQPG';
var delay = 10000; //delay in milliseconds
setTimeout(function(){ window.location = ADDRESS; }, delay);
}
});

The Benefits

There are two benefits to be accrued from this technique. One, all your serious visitors are introduced to your other portal resulting in more visibility. Your other site also gets increased number of visitors and moves up in search engine rankings.

Thursday, November 17, 2016

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 will result in a cryptic message, "mysqli_query() expects parameter 1 to be mysqli_result"

You need to present the database handle as the parameter for mysqli_affected_rows(), mysqli_num_rows() etc.,

Wednesday, November 16, 2016

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 automatically stopped the instance, when the trial period was over.

But, that is not the problem. Perfectly right on Google to shut the server down. What happened next was unbelievable!

I got wind of it and immediately, we got to revive the account. Within the next few minutes, we made the payment and upgraded the service, only to be greeted by a blank dashboard. All the instances that I created during the trial period were GONE!!!

I also remember seeing a message which communicated something like "you canceled your subscription" or something to that extent.

I do not remember having cancelled the subscription.

But,should not there be a double check, when a user wants to cancel a subscription? Would Google not look at the traffic and activity on that instance over the past 60 days and find that there have been activity in that instance and warn the user against cancelling the subscription?

To get a clarification, we decided to call Google.

If you had encountered the call centre of any service provider in India, which are mostly useless and not at all worth calling in an emergency, you would know what a pain in the neck they are.

Funnily, we could not find a number where I could call and get a clarification. There is no number you can call for any doubts that you may have during the trial period. If there is one, it is not publicised prominently.

So, I tried calling the generic Google number once, but the executive just transferred the call to an extension, without bothering to find out if the extension is being attended to. Guess they had left for the day. So, after a full ring, the call got disconnected. The weekend was a goner, with the next few days being Diwali holidays.

We did not bother to call the Google call center again; not interested in listening to parrots on the other side.

Tolerant as we Indians are, we created another account in Google Cloud and recreated the instances again. Lost a few days' data and a lot of credibility in my organisation.

Didn't expect this googly from Google, though.

Update:
Google has since revived the account. But, I still stand by my words. Customer support is pathetic in India.

Monday, November 07, 2016

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 = 20100412-64
Available: php-common-5.4.16-23.el7_0.3.x86_64 (rhui-rhel-7-server-rhui-rpms)
php-api = 20100412-64
Available: php-common-5.4.16-36.el7_1.x86_64 (rhui-rhel-7-server-rhui-rpms)
php-api = 20100412-64
Available: php-common-5.4.16-36.1.el7_2.1.x86_64 (rhui-rhel-7-server-rhui-rpms)
php-api = 20100412-64
Available: php-common-5.4.16-36.3.el7_2.x86_64 (rhui-rhel-7-server-rhui-rpms)
php-api = 20100412-64

I searched around for a solution. There were many, but none that matched my error.

I then addressed my problem by using the following commands and solved the error that popped up while installing mcrypt in Redhat 7 Enterpise

$ cd /tmp/
$ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ ls *.rpm
$ sudo yum install epel-release-latest-7.noarch.rpm 
$ sudo yum search php-mcrypt
$ sudo yum info php-mcrypt
$ sudo yum install php-mcrypt
$ sudo systemctl restart httpd

Hope it works for you!

Note: The line in italics is optional.

Wednesday, November 02, 2016

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
C:\>\xampp\mysql\bin\mysql

Can't connect to MySQL server
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.

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 ...

Copyrighted.com Registered & Protected DWYE-NHTO-NBNH-7FFM