« first day (3034 days earlier)      last day (2131 days later) » 

00:00
"Climb the mountains and get their good tidings. Nature's peace will flow into you as sunshine flows into trees. The winds will blow their own freshness into you, and the storms their energy, while cares will drop away from you like the leaves of Autumn." -John Muir (source)
 
5 hours later…
05:17
reads a book
05:48
I feel like I'll never fully understand web.xml files
06:18
That's weird. On checking the java version using 'java -version' command, it returns version 1.8. But when i compile a file and check the major version for the class file using 'javap -verbose' command it returns 50 which is for java 1.6
06:54
:D
@J.Lee Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
Zoe
Zoe
07:20
@TBag are you compiling with Java 8 and java 8 language features?
Compiling it with jdk 8 and no I haven't used any java 8 specific feature
@WilliamLee Yes, that is what I meant
Is that the reason? @Zoe Will it show 52 if i use lambda expressions?
Zoe
Zoe
No, that's not what I mean. Sorry ^^"
Some IDEs (including IntelliJ) lets you specify which version of Java to use (with some backwards compatibility)
07:40
@Zoe Ya but I am not using any IDE here.
@TBag you can force the version to be compatible with a previous version than the jdk being used
so ultimately it depends on which jdk is compiling the code and what parameters were used when it was compiled
Zoe
Zoe
@TBag what build system? Or do you compile every file manually?
@Zoe This is I was just testing out the verbose command using a simple java file.
in the command prompt
Zoe
Zoe
08:40
Weird...
Do you have both runtime and dev kit 8 installed?
09:04
Hey
i have weird use case and it's related to Json anyone, can anyone help me out?
@Clover just ask your question. If someone can answer and wants to, they will :)
@Zoe yes sir!
@Neil Okay, here it goes. I have a class with few fields something this
public class JavaEntity {

int a;
String b;
String c;
public int getA() {
return a;
}
public void setA(int a) {
this.a = a;
}
public String getB() {
return b;
}
public void setB(String b) {
this.b = b;
}
public String getC() {
return c;
}
public void setC(String c) {
this.c = c;
}
and i'm able to convert java to json using this
JavaEntity je = new JavaEntity();
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
String json = ow.writeValueAsString(je);
System.out.println(json);
output:
{
"a" : 0,
"b" : null,
"c" : null
}
ok, but?
Now, i want my json to capture the annotated field. if my fields have @Required int a;
09:11
Hmm, technically an int always has a value
{
"a" : {"required":true}(i don't know the exact format)
}
if you want there to be a problem if a hasn't been assigned yet, you should be using Integer, not int
@Neil i didn't initialize them, as of now i'm using default values.
@Clover you want there to be an exception when you attempt to serialize JavaEntity with unassigned field a, correct?
@Neil umm no, i want field description
09:19
@Clover to my knowledge, that isn't how Required works
@Neil soemthing like this{"a": { "type" : "int", "Required" : "Yes", "format" : "id must not be greater than 99999", "description" : "id of the stock" }
required it's just an required with yes or no
@Clover If you want this data to be serialized, then a is an instance of a java bean class containing all this information
Zoe
Zoe
@TBag I'm not a sir tho. Anyway, what's the output of javac -version?
@Clover use a paste site
the default behavior of serializing an int is to simply do "a": <current value of a>
@Zoe haha its my way of addressing someone who is better than me at something. Any way, it's showing 1.8
09:27
@Neil okay... So, we can't achieve this with default serialization?
@Clover not to my knowledge
You can override how something gets serialized
that's probably what you should do here
@Neil any pointers would be much appreciated
i have no clue how to work with thing
@Zoe yeah sure.
@TBag you can always use Zoe-san
@Clover You can use JsonSerialize annotation on field a and assign it to a custom serializer class for Integer
@Clover why do you want to include metadata inside the json?
09:34
@Wietlol i have sent this json to a third party
ah yes, third party is a bish
@Wietlol Lol. help?
if you can, I would separate the schema and the data
not join them together, that just makes unnecessary large data objects
does this come from soap/xml ?
if you cant really change it, then adding serialization methods provided for the fields is the wae to go
you use jackson as library?
@Wietlol yes
make a method and annotate it as JsonValue
09:42
and no we have no clue how the data gonna come
okay
the result of that method will be included in the json
you can just return a Map<String, Object> containing the stuff you need
you could even make a wrapper class for your fields if their metadata always contains the same stuff
then you should JsonIgnore (iirc) your fields so that they are excluded from the serialization result
JsonValue might also be replaced with JsonProperty
@Clover it würks?
09:58
@Wietlol yeah, yeah, that would work. get the fields and attach the stuff you want and return it map
Thanks for the hint man.
morn-O
dorno
Zoe
Zoe
10:24
@TBag idk then. Might be some kind of compile-time feature that breaks it?
But if you compile it with 8, the bytecode version should be 8 (well, the bytecode version associated with Java 8 anyway)
You could try adding lambda and see if that does anything. It should cause an error if there's something wrong in the compiling process
Does Java have a built-in deep copy array method yet?
10:40
@Wietlol stackoverflow.com/questions/26199716/… Looks like my lead wanted to check on me. Anyway thanks guys!
i find that a horrible use of stuff, tho
at the very least, the data and schema are separated
but you never want to generate the schema rules based on the implementation
same as why you never want to come up with the features based on what your application does
"Our application crashes mac machines."
"Just call it a feature and ship it."
11:20
I'm writing a RESTful webserver using JAX-RS. Where exactly should I connect my database? Where is the software initialization method?
12:00
A shop in Ireland serves a caramelized-brown-bread flavored ice cream. It was invented during hard times when Irish folk were hesitant to waste old bread and found ways to transform it into desserts. (source)
12:15
@JennaSloan My sources say no
Zoe
Zoe
13:04
@JennaSloan what do you mean by "deep copy"?
 
1 hour later…
14:28
@JennaSloan I think there is for multidimensional arrays.
@Michael Welcome back!
Zoe
Zoe
/javadoc System#arrayCopy
Zoe
Zoe
/javadoc System
2
Zoe
Zoe
14:30
oof
You can probably use JNI if you need a native one
14:47
Nevermind. I thought there might be something in the Arrays class.
I think you can use clone() for arrays, provided they only have primitive types.
15:38
@Michael I tried that DNA competition you mentioned. They really need to find a better way for people to submit their solutions. downloading a file string and then uploading it is really not ideal and was not worth the effort. you should let them know.
16:20
Hi guysss
16:57
Hi Guys
@SumanthVarada Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
id suggest trying to reproduce the issue
if you cannot reproduce it, it is going to be really painful to find out what the issue is
also, maybe provide the error you are receiving
Not able to reproduce the issue
How come an encryption algirithm can return the same string as an encrypted string
My input string and encrypted string both are same here
17:36
are you saying you're encrypting single chars?
first thing I'd do is println the key in production, to make sure it's there
Zoe
Zoe
18:08
@SumanthVarada Please use a paste site for long code snippets and stacktraces.
@SumanthVarada Please don't use chat as fastlane for your questions. Instead, wait a few days before asking here to give the people on the main site some time. If we want to answer questions there, we will look for them on our own.
Cleaned uwu
 
1 hour later…
19:11
I'm having a heck of a time with web.xml issues and tomcat if anyone is feeling spicy: stackoverflow.com/questions/54643549/…
I can get the <welcome-file-list> to work fine in jetty, but tomcat hates me basically
 
1 hour later…
20:20
Hello people,

Anyone here?
Zoe
Zoe
usually
Haha I think I talked to you before when I made a Android app @Zoe
Zoe
Zoe
yep
Well I am back xD but not for android. What I am doing now is very unknown to me and likely to most people. I am going to develop a Eclipse plugin the analyzes the code in real time.
Zoe
Zoe
So pretty much what IntelliJ does.
20:29
Haha that's a bit out of my scope;) The idea is to devlop a plugin that other developers can use to analyze their code when they got flaky tests.
Well actually, it is suppose to prevent flaky tests by analyzing the code and detect code that cause non deterministic behaviour.
20:41
Question is though how I should implement the plugin to begin with, secondly how should the plugin access the code that it needs to analyze?
20:53
seems quite broad
Zoe
Zoe
yep
@AndrewPK What are you suggesting is quite broad? I've decided to do this in Eclipse, however I am not aware of any pros/cons considering plugin development in IntelliJ. The whole flaky tests part is not a concern for the moment, just the technical bits. I got datasets of annotated flakiness that been refactored that I will try to implement.
I am simply curious to hear if any of you guys have any advice on how I should go about this from the technical bit.

« first day (3034 days earlier)      last day (2131 days later) »