Thursday, February 16, 2017

Market Anthropology: Connecting the Dots - 2/16/17

Market Anthropology: Connecting the Dots - 2/16/17: Released yesterday morning, the CPI report for January indicated that prices for goods and services rose by the most in 4 years. On a ye...

Wednesday, November 5, 2014

“Non-resolvable parent POM: Could not transfer artifact” when trying to refer to a parent pom from a child pom with ${parent.groupid}

Looks like you're trying to both inherit the groupId from the parent, and simultaneously specify the parent using an inherited groupId!
In the child pom, use something like this:
4.0.0


  org.felipe
  tutorial_maven
  1.0-SNAPSHOT
  ../pom.xml


tutorial_maven_jar
Using properties like ${project.groupId} won't work there. If you specify the parent in this way, then you can inherit the groupId and version in the child pom. Hence, you only need to specify the artifactId in the child pom.

Sunday, October 26, 2014

DIFFERENCE BETWEEN HIBERNATE FLUSH AND COMMIT

Flushing the Session simply makes the data that is currently in the session synchronized with what is in the database.
However, just because you have flushed, doesn’t mean the data can’t be rolled back.
Commit does flush the session, but it also ends the unit of work.
To summarize commit does two things,
1. Commit internally does flush
2. Ends the unit of work (makes the changes permanent).
FLUSH:
Flushing the Session simply gets the data that is currently in the session synchronized with what is in the database. However, just because you have flushed, doesn’t mean the data can’t be rolled back.
Hibernate will flush changes automatically for you:
before query executions
when a transaction is committed
Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.
COMMIT:
Commit does flush the session, but it also ends the unit of work

Thursday, October 23, 2014

Notepad++ Multi editing

Yes: simply press and hold the Alt key, click and drag to select the lines whose columns you wish to edit, and begin typing.
You can also go to Settings > Preferences..., and in the Editing tab, turn on multi-editing, to enable selection of multiple separate regions or columns of text to edit at once.
It's much more intuitive, as you can see your edits live as you type.

Tuesday, October 21, 2014

Does a method's signature in Java include its return type?

Quoting from Oracle Docs:
Definition: Two of the components of a method declaration comprise the method signature—the method's name and the parameter types.
enter image description here
Since the question was edited to include this example:
public class Foo {
    public int  myMethod(int param) {}
    public char myMethod(int param) {}
}
No, the compiler won't know the difference, as their signature: myMethod(int param) is the same. The second line:
    public char myMethod(int param) {}
will give you can error: method is already defined in class, which further confirms the above statement.

Wednesday, October 15, 2014

Maven does not find JUnit tests to run

By default Maven uses the following naming conventions when looking for tests to run:
  • Test*
  • *Test
  • *TestCase
Your test class doesn't follow these conventions. You should rename it or configure Maven Surefire Plugin to use another pattern for test classes.

Tuesday, October 7, 2014

How to run a JAR file

You need to specify a Main-Class in the jar file manifest.
Sun's tutorial contains a complete demonstration, but here's another one from scratch. You need two files:
Test.java:
public class Test
{
    public static void main(String[] args)
    {
        System.out.println("Hello world");
    }
}
manifest.mf:
Manifest-version: 1.0
Main-Class: Test
Then run:
javac Test.java
jar cfm test.jar manifest.mf Test.class
java -jar test.jar
Output:
Hello world
http://stackoverflow.com/questions/1238145/how-to-run-a-jar-file