Posts

Issue with Eclipse and IntelliJ when multiple jdk versions are installed.

When we are using IntelliJ and Eclipse simultaneously and if we want to use multiple/separate JDK versions then we should set environment variable as needed and then IDE should be restarted. In IntelliJ if we want to use Java 11 and in eclipse Java 8 then just add Runtime Environment to IDE setting and even if Jdk 8 is installed it will work as needed. Conclusion: Jdk 8 installed Jdk 11 is unzipped "System Environment variable" JAVA_HOME is set to Jdk 11 Eclipse and IntelliJ Runtime Env setting set to 8 and 11 respectively.  It should work.

Retriving username and password from session in Liferay 6.2

              String userName = null;                try { userName = PortalUtil.getUser(httpRequest).getEmailAddress(); } catch (Exception e) { System.out.println("Exception in retriving user name -> " + e.getMessage()); } String password = null; try { password = (String)httpRequest.getSession().getAttribute(WebKeys.USER_PASSWORD); } catch (Exception e) { System.out.println("Exception in retriving password -> " + e.getMessage()); } Note: Here for getting plain password we need to set below property in portal-ext.properties file. session.store.password=true

How to Fix a Black Screen After Updating Windows 10

Image
Some Windows 10 PCs have been rebooting to a black screen after installing the June 2019 cumulative update from Windows Update. This seems scary at first, but luckily there’s a quick fix that will solve your problem. If your Windows 10 PC reboots to a black screen, just press Ctrl+Alt+Del on your keyboard. Windows 10’s normal Ctrl+Alt+Del screen will appear. Click the power button at the bottom-right corner of your screen and select “Restart” to restart your PC. According to  Microsoft’s support document , this will solve your problem. Your computer will restart normally with no more black screen. It’s unclear what caused this problem—just another issue with a Windows 10 update. But it’s a good reminder that Ctrl+Alt+Del can get your PC out of all sorts of strange states. Ctrl+Alt+Del is good for more than just  opening a Task Manager . If this solution doesn’t help fix a PC with a black screen, here are some other potential solutions: Use the Win+Ctrl+Shift+B hotkey comb

Deploying Java(Spring Boot) Application on AWS for free.

Image
Step - 1 If you have an AWS account then you can login to AWS Console from  AWS - Sign in OR Else you can create a free account at   AWS Console - SignUp SignUp process is very easy and takes very less time: SignUp Form Step - 2 Once login successful, you will be redirected to the  AWS Management Console   Now you first need to go to the Services menu at top and select EC2 AWS Management Console You will be redirected to EC2 Management Console EC2 Management Console Step - 3 Now you will need to Click Instances menu available in left panel.  You will get - Click on Launch Instance and you will be redirected to the New Instance Wizard You can search for Linux or Ubuntu  Amazon Machine Image (AMI) and select Free Tier Only in left panel. After search result appears choose required AMI from listing. I have selected:-  Ubuntu Server 18.04 LTS (HVM) After clicking Next below screen will appear:- Step -

Getting java.util.List from google JSON

import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import java.lang.reflect.Type; import java.util.List; import com.example.model.Employee; String empListJsonString = ""; Gson gson = new Gson(); Type collectionType = new TypeToken<List<Employee>>(){}.getType(); List<Employee> empList = gson.fromJson(empListJsonString, collectionType);

Cannot determine embedded database driver class for database type NONE - SpringBoot

When we create Spring boot starter web project in STS and selected Apache Derby (Any Embeded Database) while creating project and on running project as Run as Java Application   it may give following Error :- *************************** APPLICATION FAILED TO START *************************** Description: Cannot determine embedded database driver class for database type NONE Action: If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). Solution: We have to add following annotation @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) to the class having main() method. Need to import following: import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

Important points that programmers should remember while developing web application

There are a lot points to be considered but some of them I am writing here: 1.   Do  some  R & D about  the  business logic and make a plan  on  how you will implement it before you start writing the  code. 2.   Should write  codes in an  easy, understandable and maintainable way. 3.   Make sure you are developing  an  application  with a  consistent look and feel. 4.   Should  follow  OOP s . 5.   Exercise  best practices that are established in the industry. 6.   Maintain  the  Naming convention . 7.   Transaction should be used properly and where ver  necessary. 8.   Remember  the  concurrency issue while coding. 9.   Validation should be checked properly.  It  should be done at  the  client side  as  far  as  possible. 10.   User or role based permission should be implemented properly so that  the  user  is not able to  do anything if not permitted. 11.   Should  write  comments where ver  necessary. 12.   Should be aware about  the  security of applic