Posts

Showing posts from 2016

Disappearing SSL certificates from IIS 7.0 Manager

Disappearing SSL certificates from IIS 7.0 Manager
Keep in mind that they are going to cost you much.
If you have two ssl certs for a domain.com and then a sub.domain.com, these two certs cannot be installed in IIS servers upto version 7.5.  IIS8 on Windows 2012 supports it though.
Note: you need to create the csr on the machine where you will be installing the ssl certificate. otherwise, the private key is not present and the ssl certificate is not installed properly.
Solution:
Got this below information from elsewhere...

JBrunelle April 9, 2014 at 8:01 am If anyone is still watching this thread… I came across this with a digicert cert as well. What I did was import it anyway into IIS. After adding it, but before it disappeared I right-clicked and selected view on the cert, went to the Details tab, and selected copy to file. Selected to export the private key, and assigned a password. Then I refreshed (cert was gone) and re-imported the now .pfx cert and entered the password.
Worked like a ch…

A simple introduction to jQuery

jQuery - A small introductionWhat is jQuery?
jQuery is a JavaScript library, one of many available in the market, which can be used to create actions on your web pages, based on user interactions.
All that can be done using jQuery can be done using JavaScript itself. But, it is going to be a big task, in terms of time spent and repetitive code content. By using jQuery, you avoid repetitive code blocks, while making code writing simple and making it easy to make corrections to your code. What can I do with jQuery?
You can make highly interactive user interfaces, which create rich user experience for the end user.
Show me a simple example of jQueryjQuery is used in tandem with HTML and JavaScript and BootStrap, usually. The steps involved are creating the HTML document, with the necessary lines to refer to the JavaScript and the BootStrap libraries.

Next, the HTML text is created, if required.

Finally, the jQuery code is written.

The code, given below, will show a message which informs the user…

How do I calculate the fixed tax amount from the overall amount

How do I calculate the fixed tax amount from the overall amount
This was a task that came to me today. One of our colleagues wanted to calculate the tax payable to the government. 

Most businesses, especially when doing business in known circles are given only a rounded amount for services rendered or products purchased.

So, if the product is 1200 + taxes, the customer will only pay 1200 nett.

The onus is on the seller, to calculate the actual amount of tax payable.

Now, I wanted to find out what will be my tax amount, that is the amount I will have to pay the government as tax, from the 1200 i received from my customer.

The tax percentage is 28.75. I need to find out x, which will be the value I will retain and 1200 -x will be the tax amount payable.

My equation for the solution was this.

1200 =x + (x * 28.75/100)

I wanted a quick answer. My algebra was rusty due to years of disuse. It was then mathpapa.com came to my rescue, with its algebra calculator that gave me the simplified equation.

Ma…

Parse error: syntax error, unexpected '=' in path/to/filename.php on line

Parse error: syntax error, unexpected '=' in path/to/filename.php on line xxxIt is usual to get cryptic error messages when executing php code. It is not intentional but essentially it tells us that the code is not right in just about the indicated area. 

Take a look at the sentence given below.

variable ="select item from my_images where id =$key";

We will have to look a little ahead and a little behind the "=" symbol, in this case.

At first glance, everything seems to be in order. This is true, especially, when one is in an agitated condition.

But, if you analyse the php program statement carefully, you will notice that you have forgotten to place the mandatory $ sign, which indicates that the word is a php variable.

This is a common error in php. 

Place the $ sign before the variable name and all things seem okay.

As to the question of why you need the $ in the first place, it is to declare that this specific word will store some information within.
It provides m…

Chennai shuts down for Cyclone Vardah's visit

Image
Chennai is devastated, would probably be an understatement. Well, it might be an exaggeration, but closer to the truth.

Vardah is closing in
The morning started normally in Chennai; it had started raining the previous night. And, I was keeping track of its progress through windytv, which showed the progress of the cyclone continuously. And, it looked like Chennai is going to be real close to the eye of the storm.

By the way, Chennai has not directly been attacked by a cyclone, at least not from memory. If you ask the experts, they would tell you like "this reminds us of 1972, when something like Cyclone Vardah happened"!

We decided to attend office and started around 10. Traffic was lean and the warnings on TV helped the cause. It was windy with occasional gusts, though it didn't rain much; only a constant drizzle.
Couldn't enter the road where our office is located because a tree had fallen across the road. Found a place under a fairly young tree who looked like he could…

Database connection failed...Error: 2003 Can't connect to MySQL server on '127.0.0.1' (13 "Permission denied")

Database connection failed...Error: 2003 Can't connect to MySQL serverWhen trying to connect through my web application in php, I encountered the above error message.

The solution seems obvious. You just need to assign permissions properly to the user.

But, I have already assigned permissions to the user and it works when I connect through the mysql command line.

When I use the command
/usr/bin/mysql -u alkrie -p mydb
I get prompted for the password and when I key it in, I get the MySQL prompt promptly.

mysql>

So, the MySQL connection is established when connecting through the command line, but generates "Database connection failed...Error: 2003 Can't connect to MySQL server" error, when connecting through the browser.

I looked around for a solution and homed in on a solution. This issue seems specific to a version of Linux. My server is a Centos 7

Find out your Redhat version using the command
cat /etc/redhat-release

Solution to Database connection failed...Error: 2003 Can&…

Safe guarding your electronic transactions

Safe guarding your electronic debit card or credit card dataA little while ago, I was going through an article titled "Six seconds! That's how long hackers need to guess your credit card details"

It elaborates on how ingenious crackers can steal your card information and make purchases in short time.

From my experience, there are a few precautions one may take, to prevent or minimise our credit card or debit card data being stolen or misused.


Keep two Debit Cards but transact on oneAlways, have two debit cards on you. And use only one card regularly for all your transactions. Also ensure that the balance in the card that you use for electronic transactions is as low as you can afford it to be. When it depletes, you can always transfer amount from your other main account.

This shields your main account from hackers and your other card details, even if it is misused, will not bother you too much, since the balance is always kept at a certain minimum.


Beware of software installs…

An incident at a nationalised Bank - Demonetisation

Counter staff refuses to allow withdrawal of more than Rs.10,000/-There was this alleged incident, which happened recently at a nationalised bank in Chennai, where an account holder was refused withdrawal of Rs.30,000/- which he was entitled to withdraw, within the weekly limit of Rs.50,000/- imposed by the central government of India.

The sequence of events is as follows:
The account holder goes in with a self cheque.At the counter, duty staff rudely says he can withdraw only Rs.10,000/-Customer asks whyStaff says, "Go and see the manager".Customer refuses, saying he will not budge until he gets his money.Hearing the commotion, the bank manager comes out.Enquires with the customer; customer refuses to speak to the manager.Tells him to get details from his staff.Manager discusses with employee and then comes back to the customer.Tells him the problem; there is a shortage of cashPlease take the Rs.10,000/- and get the rest afterwards [tells him a time]Customer comes later and c…

Enable ssh tunnel to access phpmyadmin on google cloud

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

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&…

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
al…

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

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

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

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

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

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

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

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

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

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

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

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…

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…