Saturday, December 31, 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 charm.

1. Import cert anyway

2. Right-click > View

3. Details tab > Copy to File

4. Export PK, assign password, export as .pfx

5. Import new .pfx





It didn't work for me, though. Because, I had created the csr from a Centos 7 linux server.

It is indicated that the certificate may not be installed and doesn't work if the private key is not part of the SSL certificate.

So, I copied the issued certificate to my Centos 7 server and then issued the following command to export it to .pfx format

openssl pkcs12 -export -out sub.domain.com.pfx -inkey sub.domain.key -in sub.domain.com.crt -certfile sub.domain.com-intermediate-cert.crt
Enter pass phrase for sub.domain.key:
Enter Export Password:
Verifying - Enter Export Password:

In the above, enter the pass phrase you keyed in during the creation of the certificate signing request.

The resultant .pfx file created may be used to install the SSL certificate in your IIS server.

After all this effort, if you are trying to install the two certificates on an IIS 7.5 web server or less, you are bound to be unsuccessful, because multiple certs for multiple domains are supported only in IIS 8+ onwards.

That is what we found the hard way. May be we should have researched better.

So, that's what we will be doing. Setting up the Windows 2012, IIS 8+ and install the certificates separately.

Will keep you updated.

Thursday, December 29, 2016

A simple introduction to jQuery

jQuery - A small introduction

What 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 jQuery

jQuery 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 "jQuery says Hello!".


The HTML + jQuery Code


<!DOCTYPE html>
<html>
<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

</head>

<body>
This is a sample HTML file created to demonstrate jQuery. Refresh this page to see again the message alert created through jQuery.
<script>
$(document).ready(function() {
alert("Hello from jQuery!");
});
</script>
</body>
</html>

The Explanation

What you need to notice is the statement $(document).ready();

That will be your default statement for all your html, if you want jQuery in your html. The above code tells the browser to execute the code within the function when the entire document has been loaded.

What we have done:

We have inserted a JavaScript function inside the ready() function and gave an alert() call with a greeting message.

function() {
alert("jQuery says Hello!");
}

The function; it is called an anonymous function, since we have not attributed a name to it, will be called right at the moment when the html document has finished loading.

Congratulations! You have just now completed your first jQuery program.

Wednesday, December 28, 2016

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.

Mathpapa Algebra Calculator

It is a simple algebra calculator, which enabled me to calculate the tax amount from the overall amount.

So, when I filled in the formula in the text box, the site calculated the formula and the value of x for me; which is 1200/1.2875

So, there you are!

Formula to calculate the fixed tax amount from the overall amount

Tax amt payable = Overall amount / 1.(Tax percentage x 100)

Monday, December 26, 2016

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


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

It 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 more clarity to the code and the habit is continued from other programs such as Perl, where a $ is prefixed to define a variable as well.

Tuesday, December 13, 2016

Chennai shuts down for Cyclone Vardah's visit

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

Vardah is closing in

Cyclone vardah nearing Chennai
Cyclone Vardah 173kms/94nm from landfall

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 withstand the powerful winds. Walked the rest of the way to office (the road was wet and water level rising). By this time, power had been shutdown throughout the city. 
Our inverter was switched on and we checked the status of the progress of the cyclone Vardah on the web.

Vardah crossing Chennai



Chennai was too close to the epicenter from the looks of it and we feared that this again would be another bad first in recent times for Chennai.

And what a big bad it turned out to be!!! In just a matter of few hours, between 11am and 2pm, about hundred trees were down in Adyar, courtesy Vardah, on the streets, inside houses and on the main roads.

The services people were quick to attend, but probably short staffed. The trees on the main roads were being  attended to on priority late in the evening.

We decided to go back home, when there was a lull in the storm at about 3pm. By this time, our road was inundated and yet another tree had fallen to Vardah. We waded through knee deep water till the the nearest junction, where the vehicle was parked covered fully in twigs and leaves, truly a green automobile.

The relief of finding the vehicle unharmed transformed into disappointment, when we realised that we were trapped when Vardah sir told us "Hey! I am the boss for today! Why don't you leave the vehicle here tonight at my mercy and walk home".

So, we found a safe place without any trees around, parked the vehicle. Luckily, a friend who stays nearby, lent their Honda Activa and we reached home by about 7pm.
Winds were getting stronger by then, even though it didn't rain (it was drizzling continuously though).


Cyclone Vardah - the aftermath


Today's morning reports tell us more trees have fallen. There is still water on the roads in many areas.

Fallen trees on the main roads have been mostly cleared or in the process. Power has not been restored yet except in some places.

A drive around the town has revealed that four wheelers are better avoided if you need to use the side roads, most of them resembling forest bushes with fallen trees everywhere. Right now, two wheelers are the best for transportation.

There is one thing that all the people of Chennai agree, which is that there has never been as devastating a cyclonic storm in Chennai before Vardah.

A few pictures of Cyclone Vardah that we clicked and others

Vardah, the beginning
Cyclone Vardah in destructive mode



























Vardah the wild

Cyclone Vardah in fury

Cyclone Vardah in action

Saturday, December 10, 2016

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 server

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

It would seem that we have use the command setsebool for the permissions you want the server to allow or deny.

Use either of the following commands to allow http to connect to the database. Use the second command to make the setting permanent. Making it permanent means the setting will be remembered after a restart.

setsebool httpd_can_network_connect_db=1
allows network to connect to the database temporarily


setsebool -P httpd_can_network_connect_db on 
will allow network to connect to the database and enable it permanently

Note:
You may use 
/usr/sbin/getsebool -a|grep httpd|less
to find out the status of the network requests that are allowed [on/off]

Sunday, December 04, 2016

Safe guarding your electronic transactions

Safe guarding your electronic debit card or credit card data

A 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 one

Always, 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

If you use a computer at home, do not install unknown or unnecessary software on your computer; this advise is aimed at people who are not too tech savvy and may be easily misled by the installing software.

For example, if you install a certain software, it also installs a browser toolbar as an add-on, when you install with the default features. So, if you are unsure, get a trained computer technician to do it.

Use only computers that you trust. Do not use computers that are used by people other than you; using a computer in a browsing center is not advised, because there may be suspicious software that might have been intentionally or unintentionally installed on the device; using a publicly available wifi network is also a bad idea.


Cheat them thermal imaging devices

When we key in our debit card pin, our body heat gets transferred to the card authentication device's key pad. This can be easily captured by these thermal imaging devices. Once they have these 4 digits, it is only a matter of time before our pin is identified.

You may be surprised to know that certain devices are smart enough to identify not only the buttons pressed but the order in which they were pressed, using the difference in the heat signature on the keys.

The solution is to rub our fingers all over the keypad, while waiting for the response from the bank, thereby confusing them snooping devices.

Understand phishing attempts

You may receive an authentic looking mail from your bank, asking you to update your card details and change your secret pin. And that your card will be invalidated if you do not update your details. It looks so authentic that we fail to see that the mail is not at all from our bank.

Do not be overawed by such threats. And do not click on any links to visit your bank website. Instead, type in the address of your bank, in your browser's address bar.


Other precautions

Try and use cash wherever possible. Do not share your pin numbers. If you do, change the pin at the earliest possible instance. Do not write down your pin numbers and keep them in your wallet. Use the OTP feature that is provided by most of the banks to authenticate every online transaction.

Thursday, December 01, 2016

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 why
  • Staff 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 cash
  • Please take the Rs.10,000/- and get the rest afterwards [tells him a time]
  • Customer comes later and collects it.

Whatever happens, it seems pathetic customer service in India seems be a norm rather than an exception, leaving a lot to be desired.

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

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