Monday, May 2, 2022

Coconut shell charcoal cooker

 In 2022 March ,when our house gas finish,we were unable to buy new gas,due to Sri Lanka economy failure after covid 19 pandamic situation.Then I search for other options.

Then I found this Coconut shell charcoal cooker.

It need 8 kg of cocount shell every week for my home.My home there are 5 members.

It's main row material is coconut shell.

 

We need to create all the curry and once.

Then start the cooker.

It's best option for cooking with out gas.





Friday, December 10, 2021

First Angular Program

 first check whether machine has Angularjs install

 ng --version



ng new hello-world
this will create new project

 

load this web site

ng serve

 

 




Tuesday, September 14, 2021

react js ui and Microsoft Rest api connection

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.app</groupId>
<artifactId>highmaturity</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>highmaturity</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-active-directory-spring-boot-starter</artifactId>
<version>2.1.5</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>

<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>2.2.1</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.15</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-core</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>ui/build/**</include>
<include>static/**</include>
<include>application.properties</include>
<include>logback.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>

<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>

<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<nodeVersion>v14.16.0</nodeVersion>
<npmVersion>6.14.11</npmVersion>
<!--<npmDownloadRoot>http://registry.npmjs.org/npm/-/</npmDownloadRoot>-->
<!--<npmRegistryURL>http://registry.npmjs.org/</npmRegistryURL>-->
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
<configuration>
<workingDirectory>src/main/resources/ui</workingDirectory>

</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>

<executions>
<execution>
<id>Copy my react frontend to the static folder of my spring application</id>
<phase>process-resources</phase>

<configuration>
<target>
<copy todir="target/classes/static">
<fileset dir="src/main/resources/ui/build"/>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>

</execution>
</executions>
</plugin>


</plugins>
</build>

</project>

Thursday, July 15, 2021

Create a SSL Certificate on Nginx for Ubuntu

1.  create ssl folder

sudo mkdir /etc/nginx/ssl

 

 

 2. go to nginx /ssl folder using below command

cd /etc/nginx/ssl
 
3.
The first file that we need to create is the private key. While creating the key, we will be asked for a passphrase. We must make sure to remember the passphrase since we will not be able to access the certificate without it.
 
 sudo openssl genrsa -des3 -out server.key 1024
 

 4.
Once we have the key created, we will use the key on order to create Certificate Signing Request.
 
5.We have to run below command to create certification
sudo openssl req -new -key server.key -out server.csr 
It will ask your old pass pharse value and Company Name,City like wise Questions.
you may refer screenshot.

 
6.If we have a passphrase it has to be typed in manually, so if there is not person available to do it, the website will be offline for a long time. That is why we are going to remove the passphrase from the key file, using the following command 
# sudo cp server.key server.key.org
# sudo openssl rsa -in server.key.org -out server.key
 

 
7.Now we are ready to create and sign our certificate by below command
 sudo openssl x509 -req -days 365 -in server.csr -signkey server.key 

 8.
It will be valid for 1 year (365 days). That is something that can be 
changed if needed. Now we can use the certificate and assign to a 
virtual host. We can copy the Nginx sample configuration file in a new 
file and use that.
 
9.most important part to be change are as follows
server {
  listen 443;
  server_name our-domain.com;

  root /var/www;
  index index.html index.htm;

  ssl on;
  ssl_certificate /etc/nginx/ssl/server.crt;
  ssl_certificate_key /etc/nginx/ssl/server.key;
} 
 

After making the changes and saving the file, we should copy the virtual host configuration file into /etc/nginx/sites-enabled/default file.

Before change it ,please take a backup of it.

and then restart Nginx.

# sudo service nginx restart
  

Install Intellij IDEA IDE on Ubuntu 18.04

 1. go to https://www.jetbrains.com/idea/download/#section=linux 

and Download Linux version Community one.

you may refer screenshot.



2. go to download ideaIC-2019.1.4.tar.gz file and run the below command

sudo tar -zxvf ideaIC-2019.1.4.tar.gz -C /opt/

3. go to install location

cd /opt/idea-IC-191.8026.42/bin/


4. run the below command

./idea.sh


5. you will received below popup window and continue rest of the installation process.


6. Now your installation process completed 



 




Tuesday, July 6, 2021

setup react js on ubuntu 18

 1. run the below command to install nodejs


sudo apt install nodejs
 
2. run the below command to install npm (node package manager)
 
sudo apt install npm

 
3.  Next install Visual Studio code with below commands
 
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add - 
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" 
 sudo apt install code
 
4. After that open Visual STudio Code IDE
Then Add Simple React Snippets  Extension
5. Then Add Prettier
Extension
 

 Now you can run reactjs project on your Ubuntu machine.Good luck

Monday, June 28, 2021

Install tomcat 8 on Ubuntu 18.04

 1. install jdk 8 or open jdk 8

2. create tomcat user account

sudo groupadd tomcat


3. run below command

sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat




4. move to tmp folder

5. run the below command to download tomcat tar file

wget ftp://apache.cs.utah.edu/apache.org/tomcat/tomcat-8/v8.5.68/bin/apache-tomcat-8.5.68.tar.gz
 

 

6. create folder on /opt/tomcat

cd /opt/

sudo mkdir /opt/tomcat
 

 

7. run below command - to extract tar file to /opt/tomcat

cd /tmp/

sudo tar xzvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1
 

 8.tomcat extract to below folder
 

 

9.give the tomcat user control of the entire directory and make all the scripts in the bin location executable

 

sudo chown -R tomcat: /opt/tomcat
sudo sh -c 'chmod +x /opt/tomcat/bin/*.sh'
 

 

 10.run below command

sudo vi /opt/tomcat/conf/tomcat-users.xml

add the below lines

11. add below line to 

sudo vi /etc/systemd/system/tomcat.service

==============================

[Unit]
Description=Tomcat servlet container
After=network.target

[Service]
Type=forking

User=tomcat
Group=tomcat

Environment="JAVA_HOME=/usr/lib/jvm/default-java"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"

Environment="CATALINA_BASE=/opt/tomcat"
Environment="CATALINA_HOME=/opt/tomcat"
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

[Install]
WantedBy=multi-user.target
 
12. After that, run the commands below to reload systemd profiles and enable tomcat service
sudo systemctl daemon-reload 
--- not working below two line ---------- 
sudo systemctl start tomcat.service
sudo systemctl enable tomcat.service
 
13. run the tomcat using the below commands
sudo -s
cd /opt/tomcat/bin/ 
./startup.sh 
  

14. on the web browser run below command

http://localhost:8080