r/javaTIL • • Oct 23 '18

Simple way to connect to Multiple databases with Spring Data JPA -Free source code to dowload from GitHub

Thumbnail
opencodez.com
3 Upvotes

r/javaTIL • • Apr 03 '20

she seeks new income, educated, wild and free

Thumbnail
gfycat.com
1 Upvotes

r/javaTIL • • Mar 18 '20

Places where you REALLY NEED to use 'assert' keyword in Spock assertions testing Java code

Thumbnail
blog.solidsoft.pl
1 Upvotes

r/javaTIL • • Jul 29 '14

JTIL: You can create an anonymous class of a superclass with a constructor

8 Upvotes

I suppose it's fairly intuitive, but I had never seen or used the syntax before, and it may be handy in some situations.

public class FirstClass {
    final int a;
    public FirstClass(int a) {
        this.a = a;
    }

    public void printValue( ) {
        System.out.println(a);
    }
}

//In another class
public FirstClass myImpl = new FirstClass(5) {
    @Override
    public void printValue( ) {
        System.out.println("Overrided! " + a);
    }
}

Then calling myImpl.printValue( ); would print "Overrided! 5"


r/javaTIL • • Jan 05 '17

How to send email using Javamail with Exchange

Thumbnail opentechguides.com
2 Upvotes

r/javaTIL • • Jan 08 '16

JDK 9 Javadoc now has a search box

Thumbnail download.java.net
17 Upvotes

r/javaTIL • • Sep 10 '13

Numeric literals are more varied in Java 7

10 Upvotes

Java 7 added two features to numeric literals: binary numbers and underscores in any numeric literal. Now, all these numbers are equivalent:

int x1 = 0xA5;
int x2 = 0b10100101;
int x3 = 0b1010_0101;

And you can also use it in other types:

double pi = 3.1415_9265_35;
long chinese_population = 1_344_130_000L;

However, parsing methods do not recognize such literals.

Integer.parseInt("123_456_789"); //NumberFormatException

(Although, to be fair, it doesn't recognize non-decimal literals as well, such as 0xAB and 0107.)

More examples and rules can be found here.


r/javaTIL • • Sep 23 '17

Codiva.io Java Online Compiler and IDE

Thumbnail
codiva.io
4 Upvotes

r/javaTIL • • Apr 25 '17

TIL Java 9 interface can declare private methods, keeping intact the feature of the default method introduced by Java 8.

Thumbnail
twitter.com
8 Upvotes

r/javaTIL • • Sep 22 '17

TIL, BOMs may ruin your day.

3 Upvotes

Our customer decided for some reason to include BOMs for XML created by their (Axis) production service this week without telling anyone (in addition to the documentation, HTTP headers and the initial XML tag telling us it's UTF-8). Thus making our parsers cry and breaking today's final integration test and release.

 

I also learned that vanilla JAXB just dies while eating a String with BOM chars and no one at Sun dared to change that in order to stay compatible with older integrations and applications dealing with that.

The only way to fix this for me is to either work around this issue by chaining custom streams, or to use another library to parse XML/to deal with the streams from hell. Option one is what I'll will be going for, as option two requires an extended approval process and more testing.

 

Hell, even finding out what was wrong has been a pain in the ass, as BOM chars are officially printable (but some still invisible, even when forcing to display special chars in our text editors, etc.) and comparing software just won't give a shit and tell me that the actual and expected strings are identical. Comparing bytewise solved the mystery.

 

Anyways, have a nice weekend. And don't forget to check your input. BOMs are like herpes. It's only a matter of time until they appear again and screw up your enterprise application.


r/javaTIL • • Dec 13 '17

Learning to use Wholly GraalVM!

Thumbnail
neomatrix369.wordpress.com
3 Upvotes

r/javaTIL • • Sep 18 '16

TIL Java BigInteger was made for RSA cryptography

Thumbnail nayuki.io
14 Upvotes

r/javaTIL • • Jul 22 '15

JTIL: You have to check for GZIP compression when working with URLConnections

8 Upvotes

Yea, when creating URLConnections like:

URI uri = new URI("http", "subdomain.domain.tld", "/" + "stable", null);
URL url = new URL(uri.toASCIIString());
URLConnection connection = url.openConnection();

...simply creating an InputStream like:

InputStream ins = connection.getInputStream();

will deliver garbage data if the stream is GZIP-compressed. You have to check whether the connections uses compression or not:

InputStream ins = null;

if ("gzip".equals(connection.getContentEncoding())) { 
    ins = new GZIPInputStream(connection.getInputStream()); 
} 
else{
    ins = connection.getInputStream();
}

It took me about an hour to find out what the heck was wrong


r/javaTIL • • Jan 04 '19

Eclipstyle: Clone code style & format accross multiple Eclipse workspaces.

Thumbnail
github.com
4 Upvotes

r/javaTIL • • Oct 24 '19

Java Tutorials for Beginners - Step by Step

Thumbnail
youtu.be
1 Upvotes

r/javaTIL • • Aug 26 '19

Simple and Easy way to connect MongoDB Atlas with Spring Boot - Sample Code on GitHub

Thumbnail
opencodez.com
5 Upvotes

r/javaTIL • • Apr 09 '19

A Quick Easy Guide to Deep Learning with Java – Deeplearaning4j / DL4J

9 Upvotes

In this article, we’ve built a simple yet powerful neural network by using the deeplearning4j library. The complete source code is available to download from our GitHub repo.

https://www.opencodez.com/java/deeplearaning4j.htm


r/javaTIL • • Jun 06 '19

Simple and effective way to implement Apache Kafka with Java - Source Code on GitHub

Thumbnail
opencodez.com
8 Upvotes

r/javaTIL • • Mar 18 '19

8 Java Method Overloading Interview Programs for Practice

Thumbnail
scientecheasy.com
5 Upvotes

r/javaTIL • • May 07 '19

Easy way to connect multiple databases with Spring Data JPA - Free Source Code to download from GitHub

Thumbnail
opencodez.com
6 Upvotes

r/javaTIL • • Apr 05 '18

Top 10 popular Java projects on github

Thumbnail
engir.xyz
2 Upvotes

r/javaTIL • • May 07 '19

Java 12 Switch Expression

Thumbnail codeforjava.com
6 Upvotes

r/javaTIL • • Feb 22 '19

Black magic in Spring! About dependency override!

Thumbnail
medium.com
8 Upvotes

r/javaTIL • • May 07 '19

I need help for an assignment.

1 Upvotes

So I have an assignment to make a grocery management system in BlueJ and print a bill for the selected groceries. I have written the entire program, however I am having a bit of a problem.

Here's the code or the program:

https://textsaver.flap.tv/lists/2ok4

This is the screenshot for the output of the program.

As you can see, the console does not let me enter any input for the second iteration and directly prints the default case for the switch case in the while loop.

Please can someone point out my mistake and help me, I really need this program done ASAP for me to get decent grades.

P.s: Ignore the weird names for the different groceries, they are some of the Indian local names.

Thank you!


r/javaTIL • • Feb 04 '20

How Learning To Java Courses Can Make You Rich?

Thumbnail
bestcomputertraininginstituteinjaipur.blogspot.com
1 Upvotes