11 October, 2017

Write your first Java program.

This is very basic startup for your learning java programming language. Before writing and executing this you should make sure that you have installed the expecting JDK. This JDK is mandatory, apart from this JDK you need some IDE (i.e. Eclipse,Netbean, Jboss developer studio etc). These IDE are not mandatory ,but now-a-days these are very common to make your development easy. 

You can run the below java program on command line also  by using any text editor (i.e. notpad,textpad etc). I have used here Eclipse IDE (Oxygen) for development.

Below is the example :-

package com.javadevelopersguide;
/**
 *
 * @author javadevelopersguide
 *
 */
public class FristJavaProgram {
public static void main(String[] args) {
System.out.println("Welcome To Java");
}
}


OutPut :-
First Java Project



Reverse a String in Java - Java API

Reverse a string using java existing api is really very easy. Below example will show you how to reverse the string using StringBuilder class.


package com.javadevelopersguide.www;
/**
 * This example will help you to reverse a string using StringBuilder.
 *
 * @author manojkumar.bardhan
 *
 */
public class ReverseString {
/**
* @param args
*/
public static void main(String[] args) {
String inputString = "javadevelopersguide";
System.out.println("Before Reverse::" + inputString);
//You can do this using StringBuffer also, based on your requirement. If you really worried about thread saftey
StringBuilder builder = new StringBuilder(inputString).reverse();
// After Reverse using StringBuilder
inputString = builder.toString();
System.out.println("After Reverse:: " + inputString);
}
}


Output :-

Before Reverse::javadevelopersguide
After Reverse:: ediugsrepolevedavaj


Hope it will help you.


17 February, 2017

Recover Missing Or Unallocated Space On A USB Drive

Recover Missing Or Unallocated Space On A USB Drive - using diskpart


Are you worried about your USB Drive? You are thinking you have lost your USB. But, this is quite obvious when you have done something with your USB drive. What happend to your USB Drive ?

Normally when you are playing with file systems , you should bit aware about the pros and cons. However, you no need to worry . You can recover your USB Drive memory space once again.

Every Operating System(OS) has different file systems. When you use your USB Drive cross platform purpose, It mean you are playing with different file systems. What happened to your USB Drive ? Why its not allowing/showing you to the original space/capacity ? 


Let's Assume..... with few below points.

1. May be you have deleted the partition. It means Unallocated space.
2. May be you have burned your space with some different file system , which is not supported by your current OS file system.
3. May be some other reason.


Here, In this post I have lost my memory space . I have burned my USB Drive space, because I was creating bootable Linux Installation drive.I will post in my next article
how to create a bootable USB drive. I have used the below USB Drive for this Post.

USB Drive Details:-

SanDisk , 16 GB Capacity

You need to just check with Windows Disk Management. You will find all information about your computer/desktop drive. Below disk management image shows the disk status.
This will show you the disk allocation , disk space usage, and some other helpful information.
 
java developers guide - disk managment tool
Disk Management - Windows


As I mentioned above, I have lost my pendrive. Its not useful for me until I recover the memory. I am using here Windows 10 OS to recover my lost space.

Windows OS is providing feature to manage your disk partitions using diskpart command.

Open command line or run command and type diskpart.

java developers guide- diskpart
diskpart - open by run command


Now, just simply follow the below commands one-by-one.

1. Check the list of disks in your computer.

          list disk

2. Select your disk that you want to recover. You need to be very careful here , because if you choose the wrong disk you might loose some other data. So, here I am choosing disk 1. Because, its a common sense  my USB Drive capacity is 16 GB.

       select disk 1

3. Now , do clean for your chosen disk.

       clean

4. Now, you have already got successfully cleaning the disk message. Now you need to create a partition for your disk . This is the primary partition, though you are creating only one drive.

     create partition primary

5. If you got succeeded, then you are done. Just exit.

    exit


Below Image will help you to get the commands easily. 



java_developers_guide_diskpart console
diskpart console


Your USB Drive is not yet ready to use. You have just recovered your space, but you need to format the USB Drive. Being I am using Windows 10 , I need to format this USB Drive
to Windows compatiable. Windows OS compatiable file systems are NTFS,FAT/FAT16/FAT32. Below image will show you ....





java developers guide - formatting
Formatting - recovered

Hope you are happy now :) You got your USB Drive back.. and same some Dollars :)


Hope it will help you.
Follow for more details on Google+ and @Facebook!!!

Find More Posts :-

31 January, 2017

Weblogic Error : unable to get file lock, will retry ...



unable to get file lock, will retry ...


This is a common issue for weblogic user/developer. Developers are always facing this issue with file lock.Something went wrong.

Weblogic Console Error Log -


<31/01/2017 2:25:12 PM EST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true>
<31/01/2017 2:25:12 PM EST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Version 17.0-b17 from Sun Microsystems Inc.>

<31/01/2017 2:25:23 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:25:33 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>
<31/01/2017 2:25:43 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:25:53 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:26:03 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:26:13 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:26:23 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:26:33 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:26:43 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:26:53 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:27:03 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:27:13 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:27:23 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:27:33 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:27:43 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:27:53 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:28:03 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:28:13 PM EST> <Info> <Management> <BEA-141281> <unable to get file lock, will retry ...>

<31/01/2017 2:28:18 PM EST> <Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason:

There are 1 nested errors:

weblogic.management.ManagementException: Unable to obtain lock on /usr/java/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/AdminServer.lok. Server may already be running
    at weblogic.management.internal.ServerLocks.getServerLock(ServerLocks.java:206)
    at weblogic.management.internal.ServerLocks.getServerLock(ServerLocks.java:67)
    at weblogic.management.internal.DomainDirectoryService.start(DomainDirectoryService.java:74)
    at weblogic.t3.srvr.ServerServicesManager.startService(ServerServicesManager.java:461)
    at weblogic.t3.srvr.ServerServicesManager.startInStandbyState(ServerServicesManager.java:166)
    at weblogic.t3.srvr.T3Srvr.initializeStandby(T3Srvr.java:881)
    at weblogic.t3.srvr.T3Srvr.startup(T3Srvr.java:568)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:469)
    at weblogic.Server.main(Server.java:71)

>
<31/01/2017 2:28:18 PM EST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED>
<31/01/2017 2:28:18 PM EST> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down>
<31/01/2017 2:28:18 PM EST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>



Solutions :-

You can fix the by simple one step. Just delete the AdminServer.lok file from  your domain.

I have deleted below , check the below commands ..

Go to the /tmp directory inside your weblogic domain.


cd  /usr/java/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp




Checking the existing files inside /tmp directory.


dev@jdg-desktop /usr/java/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp $ ls
AdminServer.lok  WebServiceUtils.ser  _WL_internal  _WL_user


 

Now delete the AdminServer.lok file from this /tmp directory.
 
dev@jdg-desktop /usr/java/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp $ rm -rf AdminServer.lok




Hope it will help you.




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

Find More Issues & Solutions -





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 :-