Thursday, October 31, 2019

Import and Upgrade of Liferay-6.2.0 Theme to Liferay-7.1.0 using NPM, Yeoman and Gulp in Ubuntu

In this post, we are going to discuss how to import and upgrade liferay-6.2.0 portal themes to liferay-7.1.0 themes.

Follow the instructions carefully to have a successful import and upgrade....

Before we Import and Upgrade, there are pre-requisites has to be met, make sure you have following tools available in your local environment.

Prerequisites
Name Version Download Page Direct Link
Node 11.15.0 Node Package Manager Download Page Click to Download Directly

You can use the following links to install Node Package Manager, Yeoman and Gulp.

Installation of Node Package Manager
The node package manager version given in the pre-requisite secition is different than the one that is mentioned in the link, but the installation procedure remains the same
Node Package Manager Installation

Installation of Yeoman and Gulp
Yeoman and Gulp Installation

Import and Upgrade of Liferay 6.2.0 Theme

Import of liferay-theme is a straight forward approach, but the way I want to discuss here is slightly different than the one what has been said in other tutorials or articles. I am not going to refer 6.2.0 theme directly instead I make a copy of it in a separate workspace and then import the same...

To have this done, follow the instructions carefully....

Open a terminal and navigate to one of your favourite locations and create folders to hold the components of the theme...

> mkdir hello-world-theme
> mkdir -p hello-world-theme/docroot
> mkdir -p hello-world-theme/docroot/_diffs
> mkdir -p hello-world-theme/docroot/WEB-INF

Now create the following files as mentioned....

> touch hello-world-theme/build.xml
> touch hello-world-theme/docroot/WEB-INF/liferay-look-and-feel.xml
> touch hello-world-theme/docroot/WEB-INF/liferay-plugin-package.properties

Updating build.xml file
Copy and Paste the content given below in build.xml file.

<?xml version="1.0"?>
<!DOCTYPE project>

<project name="hello-world-theme" basedir="." default="deploy">
<import file="../build-common-theme.xml" />

<property name="theme.parent" value="_styled" />
</project>

Updating liferay-look-and-feel.xml
Copy and Paste the below contents to liferay-look-and-feel.xml file and save it.

<?xml version="1.0"?>
<!DOCTYPE look-and-feel PUBLIC "-//Liferay//DTD Look and Feel 6.2.0//EN" "http://www.liferay.com/dtd/liferay-look-and-feel_6_2_0.dtd">

<look-and-feel>
<compatibility>
<version>6.2.1+</version>
</compatibility>
<theme id="hello-world-theme" name="hello-world-theme">
<template-extension>ftl</template-extension>
<color-scheme id="01" name="Green">
<css-class>theme_green</css-class>
<color-scheme-images-path>${images-path}/color_schemes/green</color-scheme-images-path>
</color-scheme>
<color-scheme id="02" name="Orange">
<css-class>theme_orange</css-class>
<color-scheme-images-path>${images-path}/color_schemes/orange</color-scheme-images-path>
</color-scheme>
</theme>
</look-and-feel>

Updating liferay-plugin-package.properties file
Copy and Paste the following content in liferay-plugin-package.properties file and save it.

name=hello-world-theme
module-group-id=liferay
module-incremental-version=1
tags=
short-description=
long-description=
change-log=
page-url=http://www.liferay.com
author=Liferay, Inc.
licenses=LGPL
liferay-versions=6.2.0+

#required-deployment-contexts=\
#    resources-importer-web

resources-importer-developer-mode-enabled=true

Now Copy and Paste the folders available in _diffs folder of the original 6.2.0 theme folder to the _diffs of hello-world-theme/docroot/_diffs

We are almost at the end of making things right...

Importing 6.2.0 Theme
Now everything is set to import the theme from 6.2.0 to 7.1.0

Run the command below to import the theme..
> yo liferay-theme:import
The above command would ask you to provide the absolute path of the theme folder, provide the one we have just created in previous steps...

You can refer the same in the image given below... in case you need it.


The console looks the one below when you provide the absolute path of the theme's root folder.


Press enter to execute the import.


At the end of the command execution, the console window ask you to provide the absolute path to the local application server, please provide the one which you have installed in your local machine.

In my case, I have given the Tomcat Application Server associated with the liferay portal, the image below would detail it in a comprehensive manner...



Once the theme is imported successfully we will have the directory called hello-world-theme in our workspace.
> cd hello-world-theme
> ls

Use the above command to check it out, you should see something like the one given in the image below..


This concludes the import of liferay 6.2.0 theme.

Theme Upgrade from 6.2.0 to 7.1.0

Now we have successfully imported the theme, the next step is to upgrade it to 7.1.0.

To upgrade the 6.2.0 theme to 7.1.0, use the following command

> gulp upgrade

The execution of the above command is depicted in pictures given below...the images are self explanatory.












This upgrade process converts the components from 6.2.0 to 7.1.0 to its best, but there would be certain errors which has to be fixed manually.

Correcting errors manually is a daunting task but ..... "Patience is a virtue".

This concludes the upgrade of liferay 6.2.0 themes to 7.1.0

Thanks.

Wednesday, October 30, 2019

Creating Liferay 7.1.0 Layout using NPM, Yeoman and Gulp

Hi

This blog post talks about creating liferay 7.1.0 layout using NPM, Yeoman and Gulp. There are many ways liferay offers developing layout for the theme, using the above mentioned tools is yet an other way of developing the same.

Without wasting much of our time lets get it started...

Before you start developing or creating layout, you should have the following prerequisites to proceed..

Prerequisites
Name Version Download Page Direct Link
Node 11.15.0 Node Package Manager Download Page Click to Download Directly

The afore mentioned tool(s) should be installed and to install the same you can refer an other post(s) by visiting the links given below...

Installation of Node Package Manager
The node package manager version given in the pre-requisite secition is different than the one that is mentioned in the link, but the installation procedure remains the same
Node Package Manager Installation

Installation of Yeoman and Gulp
Yeoman and Gulp Installation

Creating Liferay 7.1.0 Layout
To creat a layout, Open a terminal and fire the command below...

> yo liferay-theme:layout

The above command would initiate an interactive session with the user, as a user we have to answer those questions to have the layout to be deployed, the interactive session would appear something like the one given in the picture below...


Provide the name of the layout, in our case let the name be test-one,  The image given below compiles out the questions we answered and let us analyse each one of them



From the image above,

The first two questions takes in test-one as the name and id of the layout, the third question questions the liferay version we are using.

From here on, the questions are much concerned about the divisions of layout into rows and columns...

The fourth question is about adding the first row in the layout.... the point is to be considered is that, each row is split into 12 columns, you can decide how many columns to be there in the first row in our case, we have just one column i.e the entire row is treated as column now.

Once done the subsequent questions would be adding more rows and columns into it, likewise we can add as many rows and columns in a layout.

The following picture depicts the layout structure we have created....



Once we finalise our layout structure, we can hit Finish Layout option to complete the layout creation something like the one given below...



The last question of the interactive session would be the path to the local application server, provide the absolute path to the server's root directory, in our case, I have given the tomcat's directory path which comes as part of the liferay portal.

Now you can witness the layout created at the location where we started the interactive session and the layout can be deployed using the following command

> gulp deploy

With this we have concluded the creation of Layout for Liferay Themes.

Hope you had good time learning

Ciao.

Tuesday, October 29, 2019

Liferay Portal in Developer Mode in Ubuntu

Hi,

In this post, we shall see how to have liferay portal to run in developer mode. This mode of the portal becomes handy when we develop theme for the sites in liferay.

Without talking lets get in to action right away...

Prerequisites
Name Version Download Page Direct Link
Java 1.7 Java Download Page Click to Download Directly
Mysql 14.14 N/A N/A
Liferay Portal 7.1.0 - CE Lifeay Portal Download Page Click to Download Directly

I am going to use liferay-7.1.0 Community Edition as lab rat for our discussion.

For the installation of MySQL you can refer to an other post from the following link below...

MySQL Server Installation in Ubuntu 18.10

The installation details of the software packages mentioned in pre-requisite section is beyond the scope of discussion... you can refer online articles for their installation(s).

Let us assume you have the liferay portal 7.1.0-CE up and running on your local machine, following the instruction below to have the portal running in developer mode...

At the root of the liferay's portal directory, you must see a file called portal-ext.properties, if you do not then create one and append the file with the following property...

include-and-override=portal-developer.properties

The property include-and-override holds the reference of the property file portal-develper.properties, this property file holds all the necessary properties to have the portal run developer mode.

Once done, shut down the portal and restart it again, this will ensure the liferay portal up and running in developer mode.

Well this has concluded the discussion, hope you had great time.

Thanks.

Thursday, October 24, 2019

Developing Liferay-7.1.0 Theme using Node, NPM, Yeoman and Gulp

Hi

In this post I am going to discuss how to develop liferay-7.1.0 theme using Node, NPM, Yeoman and Gulp

Prerequisites
Name Version Download Page Direct Link
Node 11.15.0 Node Package Manager Download Page Click to Download Directly


Installation of Node Package Manager
Download the Node Package Manager archive from the links given in the prerequisite section.... the installation of Node Package Manager has been described in an other blog for you to refer, please refer the link below for the installation.

Though the versions are different, the installation procedure is same as that of the one given in the link.

Node Package Manager Installation

The following sections or the portions of the blog assumes the Node Package Manager is installed and working as expected...

Installation of Yeoman and Gulp
For the Installation of Yeoman and Gulp, you can refer the next blog post from the link given below...

Yeoman and Gulp Installation

Installation of Liferay Theme Generator
After installing the required packages for creating themes in Liferay-7.1.0, now is the time to install the Theme Generator... to do this

Open up a terminal and execute the command given below
> npm install -g generator-liferay-theme@^8.x.x
The execution of the above command would result something like the one given in the image below...


With that we have concluded the installation of Liferay Theme Generator

The following sections details the actual theme creation for Liferay-7.1.0

Creating Themes...
Open a terminal window and move to any directory of your choice to create themes

Fire the command below to have your theme created
> yo liferay-theme
the above command would ask you a set of questions provide answers to those for the successful creation of one, the sampled one is given below for you to refer...




This concludes the successful creation of the theme...

Now the next part is important, i.e deploying the theme.. please follow the section below to deploy the theme created.

Deploying the Theme
Move to the root directory of the theme which we did create and fire the command below...

Make sure your liferay portal is up and running.

> gulp deploy

if the command execution is successful, then you would have something as depicted in the images given below...




On the server console, the deployment of the new theme can be verified as depicted below...



With that we have concluded the theme development of liferay-7.1.0 using NPM, Yeoman and Gulp.

Hope you find this article useful.

Thanks.

Wednesday, October 23, 2019

Installing Yeoman and Gulp using NPM in Ubuntu

Hi,

In this post I am going to talk about installing Yeoman and Gulp in Ubuntu, the version of Ubuntu I was using was 16.04, the procedure followed here for the installation of Yeoman and Gulp should be pretty much the same for the feature versions and to some extent recent past versions of Ubuntu

Since Yeoman and Gulp is depending on NodeJs Package Manager for their installation, first let us have NodeJs Package Manager(NPM) installed.

To Install NodeJs Package Manager or NPM, please refer to an other post of mine whose link is given below...

Installation of Node Package Manager or NPM

The following sections assumes you have NodeJs and NPM in place to proceed...

Installation of Yeoman

Open up a terminal and execute the following command at the prompt
> npm install -g yo

When everything goes fine, you should see something as shown in the image below...



This concludes the installation of Yeoman.

Installation of Gulp

Installation of gulp is very straight forward, just execute the commands given below and wait till it completes... you can verify the result of the command with the image given at the tail of each one of them.

> npm install --global gulp-cli


> gulp --version



With this we have concluded the installation of Yoeman and Gulp.

Hope you had wonderful time.

Thanks.

Installation of Node Package Manager in Ubuntu

Hi,

In this blog article I would like to discuss the installation procedures for installing Node Package Manager shortly called as NPM in ubuntu.

Prerequisites
Name Version Download Page Direct Link
Node 12.13.0 LTS Node Package Manage Download Page Click to Download Directly

This post mainly focuses on installation of Node-12.13.0 LTS and its working, the procedures followed for the installation of this version and the forth coming version of Node would remain the same.

Using the links given above in the prerequisite section download the package in one of your preferred locations and extract it.

Open up a terminal and execute the following commands one after the other...

Moving the prompt to the user's home directory
> cd

Editing the .bashrc file using gedit
> gedit .bashrc

In case if you do not have gedit text editor, you can use any text editor of your choice

Append the file with the following lines
NODE_HOME=<INSTALLATION-PATH-OF-NODE>
PATH=$PATH:$NODE_HOME/bin

* installation path is the location where you have extracted the node tar package

With that we have concluded the installation of Node

Use the following command to verify that the installation has happened correctly....

> which node
the above command would return the path of the executable as something shown in the picture given below...


> node --version
the above command would return the version of Node installed as given in the image below....


> which npm
the above command would return the path of the executable as something shown in the picture given below...


> npm --version
the above command would return the version of NPM installed as given in the image below....


With this we have concluded the installation of Node and NPM in Ubuntu.

Hope you had great time reading...

Ciao

Tuesday, October 22, 2019

How to completely remove NodeJs and NPM in Ubuntu

Hi,

In this post I am going to write about how to completely remove NodeJs and NPM from ubuntu.... I was having Ubuntu-16.04 as my operating system during installation of NodeJs and NPM, this procedure should be fine for future versions and to some extent recent past versions of ubuntu

With that said, lets get into action

Assuming you have installed NodeJs and NPM using apt-get, the following is the procedure to completely remove NodeJs and NPM from your presonal computer....

Open up a terminal, and fire the command below...
> sudo apt-get update
The above command will make the local repository in sync with the remote repository for the other commands to have a smooth process.

Once the update is done, fire the following commands one by one at the terminal

Removing NodeJs

> sudo apt-get purge --auto-remove nodejs
> sudo apt-get purge nodejs
> sudo apt-get autoremove

The above commands ensures the removal of NodeJs but it will not ensure the removal of files installed during installation, after the removal of NodeJs there would be some files left orphan in the system, to remove those file(s) proceed with the following commands...

> sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules

To remove node or node_modules from /usr/local/lib
> sudo rm -rf /usr/local/lib/node*

To remove node or node_modules directories from /usr/local/include
> sudo rm -rf /usr/local/include/node*

To remove any node file or dir from /usr/local/bin
> sudo rm -rf /usr/local/bin/node*

Removing Node Package Manager
To remove NPM, fire the following commands at the prompt...

> sudo apt-get purge --auto-remove npm
> sudo apt-get purge npm
> sudo apt-get autoremove

Well with this I conclude this post, if you find any discrepancies please comment it in the comment section below....

As always, hope you had good time reading...

Ciao.

Thursday, October 10, 2019

RazorPay Web Integration Demo Application

Hi,

In this blog I am going to demonstrate how to integrate RazorPay payment gateway in your web application(s).

The below section details the pre-requisites required to run the web application.

Prerequisites
Name Version Download Page Direct Link
Java 1.7.0_79 N/A N/A
Apache Maven 3.6.0 N/A N/A
GIT 2.7.4 N/A N/A

From the prerequisite section please download the softwares and have it installed in your system, I am not going to discuss the installation procedures of the same because we have plenty of online resources to have it done.

1. Creating your RazorPay Account
Before you have the web application up and running you should have valid RazorPay account to access the payment gatewary service.... if you have one already you can use it or you can sign up in RazorPay website to have one

The image below gives the signup/login page of RazorPay site


Use the link below to get to it...

After successful registration you can access your account by signing into the site and you got to look for two important informations

1. Merchant ID
2. RazorPay API Key

The image below would help you to fetch the merchant id from MyAccount page of your account.



This image below would help you to fetch the RazorPay API key from the setting page of the account



2. How to work with the application?

Below is the location of the project, use git utility to clone
> git clone https://github.com/ravaneswaran/razorpay-web-integration-demo.git

To download the same as ZIP package, use the following link

You have to update the property file of the application with the details of your RazorPay account, the following properties are residing in the property file named razorpay-dev.properties


Open the property file in your favourite text editor and update the following keys accordingly from the RazorPay account

1. merchant.id
2. razorpay.key.id
3. razorpay.key.secret

Move to the root directory where you have cloned or unzipped the downloaded package to test the application using the following commands.

> mvn clean compile package
> mvn jetty:run

If this is your first install of Maven, then it would take some time to have the application up and running, b'coz maven has to download all the required libraries from maven central repository, once the required libraries are installed in your machine/computer you would have some thing as depicted in the image below


Initially when the system is up, you would have one user account already registered in the system by default who is nothing but the admin user.... you can use the admin user credentials to login and browse the application

Admin User Credentials
Usernameadmin@demo.com
Passwordadmin

Open any browser of your choice and hit the location given location in  address bar...

The login page would appear similar to the image given below, key in the credentials to sign in.


In case if you do not like to use the admin user account, you can have one for you through the registration process, well it will not have any complication as we do have in production ready site.... as soon as you are registered in the system the system will take you back to the login page to browse the application.


The page given below is the product listing page you can select any of the products you like...


In order to select the product, you can click on the item itself as like one shown in the image down below


There is another way to select the product, when you mouse over on a product you would have a slider  which would help you to have the product specifications along with adding the particular product to the cart.


The order(s) yet to be made would be listed in order listing page, either you can select the option to pay the order or to delete the order, the image given below would detail the details of order listing page of the system.


The image below gives the picture of details of an order along with the payment option and also with the amount to be paid...



In order to make the payment, click on the button "Pay with RazorPay" button which you could see on the right panel, once you click the payment gateway interface would appear as that of the one shown below image. you must key in the phone number to enable the options in the interface.


Option to pay with Credit Card


Option to pay with NetBanking


Option to pay with UPI



Well I have tried my best to demonstrate the payment gateway integration with RazorPay in a web app and I hope this demo app would be a good starting point for those who wants to have RazorPay Payment Gateway Integration in their web application

Write in you comments about this blog in the comment section to make this demo application even better.

Well that is it, hope you had great time reading.

How to change the root password in linux when it is forgotten/to change

This blog is all about changing the root password of the Linux system when it is forgotten or to reset the password...   Let's get it ...