Self signed SSL Certificate – Apache

In order to create a self signed certificate for a Linux server that runs apache you must first create the required public and private keys. You can easily do that using openssl package.

As a next step you should edit /etc/httpd/conf.d/ssl.conf file and include the new self signed certificate files. Keep in mind that files should be copied in the requested directories.

Lastly you can validate your certificate correctness by following my relevant article https://blog.geralexgr.com/cloud/install-entrust-ssl-chain-certificate-apache-2-red-hat-configuration

Override hardware back button Xamarin.Forms

Some phones support the hardware back button and this may disturb the designed navigation experience that has been implemented in the application. You can override this behavior on Android (iOS does not support a hardware back button) with the following code that has to be placed in the MainActivity.cs of your Android root folder after onCreate method.

The result should look like below. After this action the hardware back button will have no effect and the whole navigation can be performed through the application.

Consume php backend nested array on a C# Application – Json.NET

Lets assume you got a MYSQL database that contains data for your application and you want to consume this information on a C# Application in order to handle it on a client.

For the sake of this example the following table will be parsed

As depicted the following information is returned from the api:

  • the state of the response (succeeded or not)
  • a message that will show the response result
  • the actual result that in this case is a list of trips

Each trip contains id, fromlocation, tolocation, date and time properties that have to be returned to the application.

The php code that was used to create the data from the database is the following:

So in order to parse this json result we will need a plugin like Newtonsoft.Json

The class that will be used to encapsulate the response would be the following:

And then we will consume the json response with the following code in C#. In this example data from the API came from a POST request on a web Form.

Install Entrust ssl chain certificate apache 2 – Red Hat Configuration

In order to install successfully a chain certificate (in my environment it was issued by Entrust) on a Red hat you should edit the following entries in the /etc/httpd/conf.d/ssl.conf apache file.

After the changes you should restart apache so that the changes take place. Keep in mind that if the certificate is password protected, you will be asked for an ssl passphrase that you should provide in order for the restart to be completed.

You can ensure that the certificate is installed successfully by using the following command:

Your response should look like: