25 January, 2017

Write your first Groovy Program

Write your first Groovy Program



If you remember we already discussed in my previous post about adding Groovy to your resume. Adding new skills will always help and increase your chance of getting your dream job.

Before everything you should have hands on experience on groovy programming. Lets see how to write a simple groovy program. As a newbie for groovy , you should start a basic hello world program.


Before start your first groovy program , you should make sure you have groovy installed in your machine (Desktop/Laptop). I am using Linux (ubuntu) here to demonstrate this example.

You can check in your terminals and I have already installed Groovy. Below command I have used to check whether groovy is installed and what version of groovy I am using.


root@jdg-HP-ProBook-6450b:~/grovytest$ type groovy
groovy is hashed (/usr/bin/groovy)
root@jdg-HP-ProBook-6450b:~/grovytest$ groovy -version
Groovy Version: 1.8.6 JVM: 1.7.0_121 Vendor: Oracle Corporation OS: Linux


Now, we can write our first groovy program. Usually groovy files are saved with extension xxx.groovy. Groovy program doesn't required semicolon (;) to close like java.This is very simple and reduce the developer effort of coding.


Open vi editor or text pad. Lets start writing your first program. 


Below is a Sample groovy program :-

HelloWorld.groovy



println "Say Hello to Groovy"


Now save this file with extension .groovy. In this example I have given the file name as HelloWorld.groovy.

Now you need to execute this .groovy file using below command  on terminal and check the output. 

root@jdg-HP-ProBook-6450b:~/grovytest$ groovy HelloWorld.groovy
Say Hello to Groovy

Now you can see the output I have highlighted in color. This is a simple groovy program. Find more programs on my subsequent posts.


Hope this will help you!!!





Follow for more details on Google+ and @Facebook!!!

Find More :-



 
 



24 January, 2017

New skill for your resume - Groovy

Adding Groovy to your Resume.


Are you adding groovy to your resume this year ? As a developer with 3-8 year experience you need heterogeneous number of technical skills. To compete a challenging goal and if you are seeking a challenging position , you need many skill sets . Only Java skills will not help you crack the interview.

Now-a-days most of the organizations are expecting a resource with full stack development experience.You can find more about full stack development in another post.


By adding Groovy to your resume will help you to build a positive impression for shortlisting your profile. Interview will always have a positive and negative result. But, shortlisting your profile is most important factor.

Groovy is quite old, but still you need Groovy for certain solution design. Once you added Groovy to your resume , make sure you are ready with all possible questions from interviewer. Sometimes , even you have hands on experience but you can't prompt your answer.

If you see what exactly Groovy is , you can say It's a kind of scripting language. It's a dynamic language with features similar to those of Python, Ruby, Perl, etc. It can be used as a scripting language for the Java Platform, is dynamically compiled to Java Virtual Machine (JVM) bytecode, and interoperates with other Java code and libraries.  

Groovy uses a Java-like curly-bracket syntax and its really very easy to implement.

Finally again, its very clear that adding Groovy in your resume will help to shortlist your profile.This will increase the chance of hiring. Apart from job chance, this will impress the interviewer , if you are prompting with right answer :) :)

Find more posts  related to Groovy Programming Language.


Hope this will help you!!!


Follow for more details on Google+ and @Facebook!!!

Find More :-


23 January, 2017

Vi editor ubuntu terminal is not working properly

Ubuntu terminal is not working properly in vi editor



As we all know vi editor is one of the major editing tool for developers. Sometimes its obvious to handle the issue if its not response properly. There are few scenario where this kind of behavior occurs. 


If you have newly installed the ubuntu , or you have not updated the terminal with latest update. 

Just try to update the terminal by using below command.

sudo apt-get update


Now check your vi editor behavior , if not yet resolved then try the below command to install the vi (vim) editor.

Install Vim Editor using below command :-

sudo apt-get install vim


Now check your vi editor, I hope its fixed. It worked for me and its working awasome :)



Hope this will help you!!!

Follow for more details on Google+ and @Facebook!!!

Find More :-



20 January, 2017

Windows 10 disk usage shows 99%

Windows 10 disk usage shows 99%


Are you facing same issue with Window 10 OS. This is a big messy issue with new 
Windows 10 ,while you are trying to work with your old favorite  laptop/desktop.
You can't work with this slower computer. 

Windows 10 has some certain feature services you need to stop/disable for making
your computer faster. If you check the task manger, you can see the disk usage 
shows 99% , even you are not doing anything in your computer.

Follow the below steps to fix :-


1. Search for Services (Desktop App) or open run command and type services.msc.
2. Find the Superfetch and change the status type disabled.Also stop that service.

     Click on Stop button.
3. Then find the Windows Search and change the status type disabled.Also stop that service.

     Click on Stop button.


Now you can check the task manager, the disk space usage has reduced. I worked for me :)



Hope this will help you!!!




Follow for more details on Google+ and @Facebook!!!

Find More :-

20 November, 2016

How to set java version in Linux

How to set java version in Linux or Unix.


Here I have used Linux Mint, but this setup can work for other Linux distributions. 

Checking the existing java version on your linux machine.
dev@developer-desktop ~ $ java -version
java version "1.6.0_36"
OpenJDK Runtime Environment (IcedTea6 1.13.8) (6b36-1.13.8-0ubuntu1~12.04)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)

 

The above command shows the existing java version installed on this machine. Now I can check the alternative version to set. These alternative versions are available for installation. The below command will prompt with sudo password and selection number. Try with below command :


dev@developer-desktop ~ $ sudo update-alternatives --config java
[sudo] password for dev: ***********
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
  1            /usr/bin/gij-4.6                                 1046      manual mode
  2            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
  3            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode

Press enter to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode.

In the above command, I have opted the Selection 3 , because I want java 1.7 version. You can choose as per your requirements. 


Now you can check whether version 7 is installed or not ? Try the check version command again as below.

dev@developer-desktop ~ $ java -version
java version "1.7.0_79" -----> This is newly installed.
OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.12.04.1)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)




Hope this will help you.








Follow for more details on Google+ and @Facebook!!!

Find More :-


10 November, 2016

How to convert String date to Java Calendar

How to convert String date to Java Calendar.


This can be done by some other way also, but  I have done in the below format. Hope this is will help you.
Example :- 
Input String Date - "20160829T23:59:59Z"

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class StringDateToCalendar {

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {
            String string = "20160829T23:59:59Z";
            String pattern = "yyyyMMdd'T'HH:mm:ss'Z'";
            Date date = new SimpleDateFormat(pattern).parse(string);
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            System.out.println("Calendar is :: "+ calendar.getTime());
    }

}
Output :-
Calendar is :: Mon Aug 29 23:59:59 AEST 2016







Follow for more details on Google+ and @Facebook!!!

Find More :-

How to convert String date to Java Date format

How to convert String date to Java Date format.



This can be done by some other way also, but  I have done in the below format. Hope this is will help you.

Example :- 

Input String Date - "20160829T23:59:59Z"


import java.text.SimpleDateFormat;
import java.util.Date;

public class StringDateToCalender {
    public static void main(String[] args) throws Exception {
        String string = "20160829T23:59:59Z";
        String pattern = "yyyyMMdd'T'HH:mm:ss'Z'";
        Date date = new SimpleDateFormat(pattern).parse(string);
        System.out.println(date);
    }
}

Output :-
Converted Date is :: Mon Aug 29 23:59:59 AEST 2016







09 October, 2016

java.lang.Error: Unresolved compilation problems

java.lang.Error: Unresolved compilation problems:



Facing issue is often hurdle for developer :) :) As you all know, Java Developers Guide always posted the realtime issues. This issue I have faced while writing Junit test cases, but its not so easy to fix your development desktop. The below issue normally happens when the class path is missed the related weblogic jar.

I am using weblogic for jaxrpc client calls, and its failing to find the weblogic jar. Below error logs :
  

java.lang.Error: Unresolved compilation problems:
    The type weblogic.wsee.jaxrpc.ServiceImpl cannot be resolved. It is indirectly referenced from required .class files
    The type weblogic.wsee.jaxrpc.StubImpl cannot be resolved. It is indirectly referenced from required .class files
    The import weblogic.wsee.security cannot be resolved
    The import weblogic.xml cannot be resolved
    The import weblogic.xml cannot be resolved
    The method addCredentialsToSecurityHeader(Stub, HandlerInfo) in the type JdcNotificationHandler is not applicable for the arguments (JdcEnablerService_PortType_Stub, HandlerInfo)
    The method addCredentialsToSecurityHeader(Stub, HandlerInfo) in the type JdcNotificationHandler is not applicable for the arguments (JdcEnablerService_PortType_Stub, HandlerInfo)
    The method addCredentialsToSecurityHeader(Stub, HandlerInfo) in the type JdcNotificationHandler is not applicable for the arguments (JdcEnablerService_PortType_Stub, HandlerInfo)
    CredentialProvider cannot be resolved to a type
    CredentialProvider cannot be resolved to a type
    CredentialProvider cannot be resolved to a type
    ClientUNTCredentialProvider cannot be resolved to a type
    WSSecurityContext cannot be resolved to a variable

    at au.com.mycompany.mcas.sdp.bizservice.user.domain.util.notification.JdcNotificationHandler.<init>(JdcNotificationHandler.java:1)
    at au.com.mycompany.mcas.sdp.bizservice.user.application.facade.spring.handler.JdcNotificationHandlerTest.<init>(JdcNotificationHandlerTest.java:31)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.junit.internal.runners.JUnit4ClassRunner.createTest(JUnit4ClassRunner.java:72)
    at org.mockito.internal.runners.JUnit44RunnerImpl$1.createTest(JUnit44RunnerImpl.java:26)
    at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:79)
    at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
    at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
    at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
    at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
    at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
    at org.mockito.internal.runners.JUnit44RunnerImpl.run(JUnit44RunnerImpl.java:37)
    at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



How to fix  :- This is very simple, just add the weblogic.jar library jar into your class path. Steps as below,


Right Click on Project => Build Path => Libraries and then add the required jar (In my case I have added weblogic.jar).

The screenshot attached for reference. 


java.lang.Error



Hope it will help you.




Follow for more details on Google+ and @Facebook!!!

Find More Issues & Solutions -