Thursday, October 12, 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. notepad,text pad etc). I have used here Eclipse IDE (Oxygen) for development.

Below is the example :-

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


OutPut :-
First Java Project

Reverse a String in Java Using 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.techbyteslearn.www;

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 are concerned about thread safety, use StringBuffer.
        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

Saturday, February 18, 2017

Recover Missing or Unallocated Space on a USB Drive Using DiskPart

Recover Missing Or Un-allocated Space On A USB Drive - using disk-part


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 happened 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 Un-allocated 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:-

San Disk , 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 compatible. Windows OS compatible file systems are NFTS,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 :)

Tuesday, January 24, 2017

Adding Groovy to Your Resume: Why Learn 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) byte code, 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!!!

Monday, January 23, 2017

Ubuntu Terminal Is Not Working Properly in Vi Editor

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

Friday, November 11, 2016

How to Convert a 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

How to Convert a String Date to Java Date

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