My two cents about software development on the web


Java Date long to C# Datetime Millis

Java Date Long to C# Datetime

static DateTime JavaLongToCSharpLong(long javaLong)
    TimeSpan ss = TimeSpan.FromMilliseconds(javaLong*1000);
    DateTime Jan1st1970 = 
        new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
    DateTime ddd = Jan1st1970.Add(ss);
    DateTime final = ddd.ToUniversalTime();

    return final;

C# Datetime to Java Date Long

static long CSharpMillisToJavaLong(DateTime dateTime)
    DateTime Jan1st1970 = 
        new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
    long diff = 
        (long)(dateTime.ToUniversalTime() - Jan1st1970)
    return diff / 1000;

source: Java Date long to C# Datetime long


Unsupported major.minor version 51.0

During deployment of an EAR file on JBoss 6.0 I received this error (the sample is not really what I read on log file)

<code>java.lang.UnsupportedClassVersionError: test_hello_world : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source)</code>

Looking for a solution I’ve found the answer on StackOverflow.

Note to self:

The version number shown describe which version if Java was used to compile the code.

The reported major numbes are:

<code>J2SE 7 = 51, J2SE 6.0 = 50, J2SE 5.0 = 49, JDK 1.4 = 48, JDK 1.3 = 47, JDK 1.2 = 46, JDK 1.1 = 45 </code>

(source: )


you have to change the version of java in facet of your project


Create a JBoss AS 7 appliance with VirtualBox

In this tutorial we will demonstrate how to create in a matter of minutes a JBoss AS 7.1.1 appliance designed around a Linux distribution. The software we will use for this purpose is Oracle’s Virtual Box.

When you are done you can turn off your VM. Now we will export our Appliance. What does it mean ? simply that you can create your own Linux VM distribution which already contains a set of applications installed on it (in our case JDK and JBoss AS 7) so that we can reuse it how many times we want it.

source: Create a JBoss AS 7 appliance with VirtualBox – jboss configuration – JBoss application server tutorials.


The Degradation of Java Developers

On multiple occasions I was blogging about these legions of enterprise Java developers trained to use certain frameworks without understanding how things work under the hood. This morning I had chance to see it one more time after interviewing three job applicants in a row. [..]

First, about the resumes – each has several pages with detailed description of their work for various employers. Each resume had a list of technologies that the candidate supposedly know. [..]

Looks impressive… for those who haven’t been interviewing Java developers. I don’t want to say that this candidate is lying, but he wasn’t able to maintain a conversation about 80% of these technologies for more than 3 minutes. They’ve heard or even tried working with these technologies or tools, which is all that’s needed for adding them to the resume. What are the remaining 20% they can talk about? The frameworks. Most likely they will explain how to configure Struts or Spring, and even how to make Spring talk to Hibernate. BTW, they all love Hibernate cause it spares them from writing SQL, speaking of which, they know very little about this query language. [..]

When I see all these Struts, Springs, and Hibernates on the resume I start with this, “Imagine, that you’re not allowed to use any frameworks. Explain in details the entire process of bringing the data from DB tables Customers and Orders to the Web page”. For most people it’s a killer proposition let alone writing some SQL queries… [..]

Software development industry is changing. It doesn’t need hackers anymore. It needs craftsmen who can configure and replace blocks of code when something stops working. Ideally, you should have in your team one Java expert who can actually understand the code of your application and can fix it not on the block level, but can drill down to a single line of the Java code. Somehow such people also know how to write a SQL outer joins, how to fix the broken build, and whatever else may come up.

source: The Degradation of Java Developers « Yakov Fain’s Blog


Apache CXF – WSDL to Java

wsdl2java takes a WSDL document and generates fully annotated Java code from which to implement a service. The WSDL document must have a valid portType element, but it does not need to contain a binding element or a service element. Using the optional arguments you can customize the generated code. In addition, wsdl2java can generate an Ant based makefile to build your application.

source: Apache CXF – WSDL to Java