Wednesday, August 2, 2023

Enable SSL in Your Angular App to resolve most of native OS issues (IOS/Android)




Today we are talking about an issue which is more painful to developers when we are doing the deployments to outside of localhost(To your local ip address with a port) in Angular.


If you are targeting IOS/Android operating system to launch you angular app, this will probably a good tip.

Enable SSL in your angular app by using a certificate. Create below file and keep inside your folder path and name it as certificate.cnf.

[req]

default_bits = 2048

prompt = no

default_md = sha256

x509_extensions = v3_req

distinguished_name = dn



[dn]

C = BE

ST = digem

L = brussels

O = EY

OU = PAS

emailAddress = lahiru.dhananjaya@randomsoftware.net

CN = <serving address>



[v3_req]

subjectAltName = @alt_names



[alt_names]

DNS.1 = <serving address>


Then you have to run this command to create the certificate in your terminal.

openssl req -new -x509 -newkey rsa:2048 -sha256 -nodes -keyout localhost-remote.key -days 3560 -out localhost-remote.crt -config certificate.cnf


You can try below command in the terminal inside your angular project path


ng serve --host 192.168.x.x  --port 4200 --ssl --ssl-key <key-path> --ssl-cert <cert-path>

or you can add this to .angular-cli.json

{

    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",

    "defaults": {

        "serve": {

            "sslKey": "<relative path from .angular-cli.json>/server.key",

            "sslCert": "<relative path from .angular-cli.json>/server.crt",

            ...

        }, ...

    }, ...

}


After following the steps , you will get the change to smoothly use https over your ip and do debugging easily.This will enable most native features which Chrome/Safari has (Such as settings for the page camera etc)

Wednesday, June 7, 2023

Play with Git SQUASH



Git squash refers to the act of merging multiple commits into a single one. This can be accomplished using Git's "Interactive Rebase" feature, which allows you to perform this action at any given moment. Squashing commits is typically performed when merging branches.

Below are the syntaxes when you perform squash in the git branch

  1. git log --oneline
    • Enter letter 'q' to exit from the current line
  2. git rebase -i HEAD~3
    • Change sub commit from pick to s
    • Then press ESC and type :wq to exit
    • Then again change the commit message and press ESC, type :wq to exit
  3. git push -f

If something went wrong in above steps use git rebase --abort to cancel the process and start again.


Wednesday, April 18, 2018

Dot Net Core Preview Tool 3 Missing Issue with yeoman asp core generator with VS 2017 Sample Project

If you have installed VS 2017 RC previously and upgraded to VS 2017 Community version and when you are working with the sample which provided by yeoman asp core generator,you might see this error occurred,



Previously There was separate .NET Core SDK preview tool installation but now it is missing with their web sites.

To build the VS 2017 project with preview tool 3 you need to visit this url and download

.NET Core 1.0.0 SDK – Preview 3-004056




Saturday, April 14, 2018

Azure IoT Getting Started

Hello after a long time.. Today will have a quick post with Azure IoT.

Internet of Things going in Enterprise level and we have to get ready for the upcoming challenges in large scale. To prepare with it let's begin with Azure IoT.

In this article I am going to do the practice of simulating a IoT device and communicate with Azure IoT Hub (Uses MQTT Protocol).

First of all we need to have a Azure account created and enable a free tier subscription or if you already have a that's better.


1. Goto https://portal.azure.com 

2. Search and create the IoT hub






3.It will take several minutes to complete the Azure IoT Hub creation.Once it compete you can navigate inside to it.You need to get some important names and keys from the overview section and  shared policies section.

Overview 



Then select shared access policies and click on the iothubowner row inorder show the keys and connection strings.

Shared access policies




4.Next step is to integrate with the devices.To do that we have to simulate a device from the code. Here I am using a .net console applications to work as a device. You can download the given sample project from github or just run the command if you have git bash.

git clone https://github.com/Azure-Samples/iot-hub-dotnet-simulated-device-client-app.git


5.Once you get the clone you can open the solution in Visual Studio.There are 3 main console applications
       i.Create Device Identity - Add the simulated device to IoT Hub
       ii.Read Device to Cloud Messages - Read the messages sent from the IoT Hub
       iii.Simulated Device - Sending messages to the IoT Hub



Just add the all related parameters with correct values which are represented in IoT Hub.

6.Set the Create Device Identity project as startup and run it (Add the correct values for properties).



Once you run the application you will see a device key in the console.Note it down and add that key into the Simulated Device project program.cs DeviceId property.



Also check in the Azure portal, it will show up the added device.



Now it's time to get the messages from cloud and send the messages from the device.

Set the required properties as the correct values and run the project Read Device To Cloud Messages.




Sending a message to the device from the IoT Hub


You will receive the messages sent from the IoT hub you can see all the messages in the console.

7. Run Device to Cloud Console application and run a message from the IoT hub using Message to Device option.



8.Finally run the Simulated Device Console application to send the data to IoT hub.


You can see set of messges received from the azure portal IoT hub.



That's all for today with a quick go through .See you next time with an advanced article.

(References - Azure documentation for IoT Hub with .NET (https://docs.microsoft.com/en-us/azure/iot-hub/))



Wednesday, October 5, 2016

IBM Watson cloud with node Js

Today I'm going to expose you about the IBM Watson Developer cloud using IBM Bluemix cloud platform.

IBM Watson Developer Cloud.
Use language, vision, speech and data insight APIs to add cognitive functionality to your application or service.
(Ibm.com, 2016)

Bluemix is an open standards, cloud platform for building, running, and managing apps and services.
(Console.ng.bluemix.net, 2016)

In this post there will discussions on,
1. Speech to text
2.Text to speech
3.Tone analyser
4.Speech to tone analyser


First go to https://console.ng.bluemix.net/ and sihnup for a free account and follow the instructions to proceed with the application development.Here I will be more discussing about the Speech to tone analyser.




1.Speech to text

There will be a application locally hosted using nodejs. Please follow the following git url and do the practicals as mentioned.

https://github.com/watson-developer-cloud/speech-to-text-nodejs

If you needs to have a look about how it works, please visit

https://speech-to-text-demo.mybluemix.net/

2.Text to speech

Please follow the following git url and do the practicals as mentioned.

https://github.com/watson-developer-cloud/text-to-speech-nodejs

If you needs to have a look about how it works, please visit

https://text-to-speech-demo.mybluemix.net/


3.Tone analyser

Please follow the following git url and do the practicals as mentioned.

https://github.com/watson-developer-cloud/tone-analyzer-nodejs



4. Speech to tone analyser

Please follow the following git url and do the practicals as mentioned.

https://github.com/IBM-Bluemix/real-time-tone-analysis

(When you creating tone anlyser service try standard instead of beta .Because this free plan will not give you access to create that beta service.)


Also make sure to change the manifest.yml file to change the service plan text.In my application I have changed it.So make sure to do the change in your application as well.,



In this phase you have to get the application credentials using the command "cf env <application-name>"

Then change the username and password according to it in vcap-local.json

Check manifest.yml file whether it is having the correct service names of the speech to text and tone analyser services.

So following these steps you can be able to to up and run a locally hosted application using node js.
If you need to deploy directly push it to the web, try "cf push" in the command prompt. 




Hope you got some idea about IBM cloud services.Cheers.














Sunday, September 18, 2016

Oracle installation and Migration to MS SQL Server

This is a short blog post about how you can involve in migrating a Oracle based database to SQL Server.

Firstly make sure you have the both latest versions of SQL Server and Oracle.

Oracle -  http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

SQL Server -  https://www.microsoft.com/en-us/download/details.aspx?id=42299

Sometimes installing oracle may be a bit difficult task for you as beginner. So let see how to do it quickly .

First you run the setup and wait for the installation window


After a while you get the setup.So it is time to follow the steps ,
In the first view you can enter email and continue the setup



Then you have a selection of installations. Better to select the first option.


Then they ask you whether the configurations for the desktop environment or a server.Surely select the desktop class and continue it.


Then it is time to create a new user for the oracle database home user.So i recommend you to create a new windows user by selecting the second option.This enables a separate user to work with the oracle.


Then the configurations with settings the paths and global name.


Next is the installation process starts and after the setup completion you get the software installed.

If all the things are successfully completed , then type dbca in the command prompt to create a new database for oracle.Here you can manage the database instances as usually .


Let's create a new database




Next is the prerequisite checks


Then you get a summary before creating the database instance


Finally you are creating the database and ready for the migration .



After that you can insert data by creating the tables .So I will not going to do that, I will continue with the database migration tool.

If you need to manipulate the databases and tables you can download SQL Developer tool and continue the work.



There is a tool called SQL Server Migration Assistance for Oracle - https://www.microsoft.com/en-us/download/details.aspx?id=43689

After the installation you get a icon like below


Open the software and you can see a interface as below



So next is the connecting both oracle and SQL Server to this migration tool by giving each servers credentials. You can do it by clicking Connect to oracle and connect to MSSQL Server buttons in left top corner.


After establishing the connection ,you can access to both databases at once and then select the database you need to migrate and click the button Migrate data or convert schema .You can select some option to be compatible with the data types and other fields information.

So that is the end of this short post and hope you will understand the instructions. Cheers .

Wednesday, July 30, 2014

WEET (Way of Expressway E Ticketing)

What is WEET? What is is it about ? How was it begun ?

Actually WEET is a mobile Telco application which provides the facility of booking your ticket in ExpressWay .

In TADHACK 2014 Competition it was originally created with the USSD ,SMS ,CAS, and as a web services .

There three parties invovled in this application process

  1. User(Passenger )
  2. Bus Driver
  3. Bus Owner
User (Passenger )can dial the USSD code #771*933# from his Dialog mobile and he access to the E ticketing System .
Then he will get a menu and he can choose his route,time he will pay the ticket amout via this application.
After completing these steps he will get a confirmation SMS with the reference number.

In the same time Bus Driver receive that ticket purchasing details into the tab which is in the bus.So he can get the count total income and other details.

Not only that , also this transaction process can view by the  Bus Owner through a Web Application or a mobile apllication. 

The income directly transfer in to Bus Owner's bank account when the Passenger purchase his ticket.



    • So no need to be a in a huge queue until bus reaches
    • No need to pay using cash
    • Every process is transparent to the bus owner


Watch the WEET Apllication Demo and get a clear idea about how it works