August 28, 2019

How to Convert Array to ArrayList & Enum Example in Java

/**
 *
 */
package com.konzern.transformatore.enums;

/**
 * @author konzernites
 * @version 1.0
 *
 */
public enum CobolDivision {

IDENTIFICATION_DIVISION("IDENTIFICATION DIVISION."),
DATA_DIVISION("DATA DIVISION."),
PROCEDURE_DIVISION("PROCEDURE DIVISION."),
ENVIRONMENT_DIVISION("ENVIRONMENT DIVISION.");

private String division = null;

private CobolDivision(String division) {
this.division= division;
}

public String getDivision() {
return division;
}


}


import java.util.ArrayList;
import java.util.List;

import com.konzern.transformatore.enums.CobolDivision;

/**
 * 8281808029
 */

/**
 * @author Consumerfed
 * 
 *
 */
public class EnumsTestClass {

/**
* @param args
*/
public static void main(String[] args) {

List<String> cobolDivisions = new ArrayList<>();

for (CobolDivision cobolDivison : CobolDivision.values()) {
cobolDivisions.add(cobolDivison.getDivision());
System.out.println(cobolDivison.getDivision());
}
System.out.println(cobolDivisions.size());

}

}


Output

IDENTIFICATION DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
ENVIRONMENT DIVISION.
4


Tik Toc Toe in python, two player game, playing with computer complete source code available soon...



Amazon choice the best affordable mobile smart phone

August 21, 2019

How to handle NumberFormatException: For input string: "0.0"

How to handle NumberFormatException: For input string: "0.0"


Here is the solution for that problem ( Use BigDecimal instead of Long.parseLong())

/**
 * Exception in thread "main" java.lang.NumberFormatException: For input string: "0.0"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Long.parseLong(Unknown Source)
at java.lang.Long.parseLong(Unknown Source)
at com.konzern.solution.StringToNumber.main(StringToNumber.java:18)
 */
package com.konzern.solution;

import java.math.BigDecimal;

/**
 * @author alvin
 *
 */
public class StringToNumber {

/**
* @param cfed
*/
public static void main(String[] cfed) {

/* String valueInString = "0.0";
long valueInLong = Long.parseLong(valueInString);
System.out.println(valueInLong);*/

String valueInString = "0.0";
BigDecimal valueInDecimal = new BigDecimal(valueInString);
long valueInLong = valueInDecimal.longValue();
System.out.println(valueInLong);

}

}


Exception in thread "main" java.lang.NumberFormatException: For input string: "0.0"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Long.parseLong(Unknown Source)
at java.lang.Long.parseLong(Unknown Source)
at com.konzern.solution.StringToNumber.main(StringToNumber.java:18)


I got java.lang.NumberFormatException while using
Long.parseLong(valueInString)
and solved it by using the
BigDecimal valueInDecimal = new BigDecimal(valueInString);


This book helps you to know the concepts of java, Hurry Buy one copy




Tik Toc Toe in python, two player game, playing with computer complete source code available soon...

August 14, 2019

A short introduction to Web services - simple tutorial

What is a web service ?


  1. A web service enables communication among various applications by using open standards such as HTML, XML, JSON, WSDL, and SOAP.
  2. You can build a Java-based web service on Solaris that is accessible from your Visual Basic program that runs on Windows.
  3. You can also use C# to build new web services on Windows that can be invoked from your web application that is based on Java Server Pages (JSP) and runs on Linux.
  4. Here language is not a barrier, you can build web service in any language which can be consumed by any other language.


What is a XML RPC ?


  1. XML RPC is a platform Independent protocol that uses XML messages to perform RPCs.
  2. A Java client can communicate with Perl server through XML-RPC.
  3. XML responses are embedded in the body of the HTTP response.
  4. One of the easiest way to start a web service is using  XML-RPC.


Service Transport Layer


  1. Service Transport Layer in Web Service Protocol is responsible for transporting message between applications.
  2. This layer includes Hyper Text Transport Protocol (HTTP), Simple Mail Transfer Protocol (SMTP), File Transfer Protocol (FTP) and protocols such as Blocks Extensible Exchange Protocol ( BEEP).
  3. XML Messaging is responsible for encoding messages in a common XML format so that messages can be understood at either end ie Client as well as Server.


UDDI ( Universal Description Discovery and Integration)


  1. One of the three foundation standard of web services.
  2. Service Description is responsible for describing public interface to a specific web service.
  3. Service Requester is responsible for opening a connection and sending XML Request.
  4. Service Registry provides a central place where developers can publish new service or find the existing services.


SOAP ( Simple Object Access Protocol)


  1. SOAP is an XML based communication protocol for exchanging information between computers which helps applications to communicate each other.



Thanks to all.

Our suggestions


August 07, 2019

what is an intranet application and how it helps an organisation


Learn about consumerfed kozhikode region intranet


Years ago in 2014, we found missing something that is needed to our regional office, that the way the communication has to be made.

We search a lot, we researched all the software available in the market.

We tried build our own.

An the end result is this....









Thanks to Information Technology Consumerfed

Unwinding a matrix in java on dec 7 th 2019


Facebook comments