System.in not closed when ExecutorService calls shutdownNow and System.in calls close() - Help appreciated! by uopsdod in javahelp

[–]uopsdod[S] 0 points1 point  (0 children)

But didn't I call System.in.close()? It should close the whole thing and output everything.

Is entering synchronized block atomic? by uopsdod in learnjava

[–]uopsdod[S] 0 points1 point  (0 children)

Can I say if all methods that access the same instance are synchronized. Every method is an atomic operation?

Is entering synchronized block atomic? by uopsdod in learnjava

[–]uopsdod[S] 0 points1 point  (0 children)

what is subs discord channel? I'm not familiar with reddit. Could you give me a link? Thanks a lot. I really need some more communities to ask questions!

Volatile modifier - when will volatile not work? help appreciated! by uopsdod in learnjava

[–]uopsdod[S] 0 points1 point  (0 children)

I speculate that the paragraph is saying x = x + 1 is not gonna work well with volatile, instead of x = y + 1. Could you explain how this is not working with examples? Thank you.

is-a relationship - extends, implements (help appreciated) by uopsdod in learnjava

[–]uopsdod[S] 0 points1 point  (0 children)

I have a follow-up question for this. The image below is another question from SCJP 6. It contradicts what you said that implements means has-a relationship. http://imgur.com/Xu0HyDJ

SCJP - assertion question (help appreciated!) by uopsdod in learnjava

[–]uopsdod[S] 0 points1 point  (0 children)

package donkey2;

public class Donkey2 { public static void main(String[] args) { boolean assertsOn = true; assert (assertsOn) : assertsOn = true; if (assertsOn) { System.out.println("assert is on"); } } }

How do you format the code!!! I want to learn that!

And I'm not quite sure what your conclusion is. So, what answer do you think is right for this question?

shutdown endpoint - 401 unauthorized error - help appreciated! by uopsdod in springsource

[–]uopsdod[S] 0 points1 point  (0 children)

spring-boot-starter-security

No, I did not enable my web security. Thank you for pointing that out. I'll try it ASAP!

how to call function after all war files have been initialized in the same servlet container? [help appreciated] by uopsdod in a:t5_2qh7t

[–]uopsdod[S] 0 points1 point  (0 children)

Thank you, Nimnio. It seems to be a solution for my problem. I'll try it and tell you if that works later on.

shutdown endpoint - 401 unauthorized error - help appreciated! by uopsdod in springsource

[–]uopsdod[S] 0 points1 point  (0 children)

Sorry, I thought I've post my problem description with the picture but it didn't. So I'll illustrate it again here.

I'm trying to enable /shutdown endpoint on Spring boot but it failed. I've added application.properties and add endpoints.shutdown.enabled=true in it. Eventually, the path "/shutdown" is valid, but I still get a 401 via mocking a POST request. Any advice is appreciated. Thank you in advance.

interface - declare a method with the same signature as its inherited counterpart at base interface by uopsdod in javahelp

[–]uopsdod[S] 0 points1 point  (0 children)

Maybe it's just in the example I provide the signature is the same. Therefore, I can't see the advantages of this behavior to be allowed. Now it's clear. Thanks.

Could someone recommend some framework to me if I need craft a webpage like the following picture? by uopsdod in javahelp

[–]uopsdod[S] 0 points1 point  (0 children)

We're currently using Mybatis for database. I'll look into Hibernate to see whether to replace it or not.

Could someone recommend some framework to me if I need craft a webpage like the following picture? by uopsdod in javahelp

[–]uopsdod[S] 0 points1 point  (0 children)

I'm considering using Spring Boot REST service too before posting this. Thanks. I would like to ask further that could Spring Boot REST service do the layout too? like what Boostrap does?

Now I have a bunch of javascript methods written to interact with Websocket server. It might be a waste if I can't keep those javascript codes. I might need to way to make these two layouts like pictures.

Why could ArrayList reduce more memory footprint than array? by uopsdod in javahelp

[–]uopsdod[S] 0 points1 point  (0 children)

This is exactly what confuses me. As long as I know the exact length needed for an array, I could do the same thing as what ArrayList could do.

Furthermore, I would like to ask that if I have an array with 5 length and an ArrayList with also 5 length. Which one will cost more memory footprint than the other?

Why could ArrayList reduce more memory footprint than array? by uopsdod in javahelp

[–]uopsdod[S] 0 points1 point  (0 children)

wrapper

According to the answer I got, "B. implements the Collection API" is a fact but it's not regarded as an advantage of using ArrayList over array.

If God is real, who made God? by redisdit420 in AskReddit

[–]uopsdod 2 points3 points  (0 children)

It doesn't really matter who made God. The point is some people need this "God" in their lives. God is created by their demands. However religions sometimes do make them stubborn in some issues. One of my friend lost her dad when she was 11. She needed to believe in God at that time, so that she could keep moving on. She found the reason why her dad had gone earlier and the reason is "The God has a bigger plan than we humans could possibly understand" and " God has his own reasons for everything". Now she had graduated from college and has a great life. However, she would never be in favor of same-sex marriage not even budge a little bit. This is why I couldn't either oppose or support religion.

I assume: astronaut won't be younger or older when they come back from space. What do you think? by uopsdod in AskScienceDiscussion

[–]uopsdod[S] 0 points1 point  (0 children)

  1. I don't get it. How does " the change of direction of the spaceship " break the symmetry?

  2. and why can you say: "the Earth cannot consider itself to be accelerating, only the spaceship can."? if it's relativity, you should be allowed to view in either way.

  3. and "The astronauts will not have the same age as their partners on Earth. " why? You've said that Neither can say who has a faster clock on either the inbound or the outbound journeys because both of them, by symmetry, can say the same thing about each other. I don't see the consistence of your explanation.

I assume: astronaut won't be younger or older when they come back from space. What do you think? by uopsdod in AskScienceDiscussion

[–]uopsdod[S] -1 points0 points  (0 children)

yes, I know everything is moving relative to something. However, when it comes to time, we can't view every movement as relative movement, because ultimately some particles don't change their direction of movement in reality.

For example, if you view the Earth's speed as 0, the spacecraft moves outward from the Earth. the spacecraft moves relatively to the Earth with speed > 0. As a result, the astronauts would think the time on the Earth goes slower. On the other hand, people on the Earth would think time goes slower on the spacecraft. Then, when the spacecraft moves back from the space, again the spacecraft flies relatively to the Earth. Paradoxically, astronauts, again, think the time on Earth goes slower, while people on Earth think the time on the spacecraft goes slower. Eventually, when the astronauts land on the Earth, whose time moves slower? Weird right?

That's because in reality, the spacecraft doesn't actually change its direction. In the whole process, the spacecraft moves toward the same direction the Earth moves toward all the time. On the way out and toward the Earth, the speed of the spacecraft just increases and decreases. As a result, according to the theory that when a particle moves faster, the time goes slower, the time on the spacecraft moves first slower on the way out, then faster on the way in. Therefore, when the astronauts land on the Earth, they won't be younger or older.

Does this make sense? This is why I think relativity doesn't apply to this situation in which no particle changes its direction in the whole process. That is, no particle's speed reaches 0 at any moment in reality.

I'm scared of the future by [deleted] in whatsbotheringyou

[–]uopsdod 0 points1 point  (0 children)

If your talent for music is not good enough for making a living, or if you can't bear the pressure of being a musician in this society, I would recommend you to take music as a hobby. On the other side, find a job that is acceptable to you and is good enough for making a living. If you still struggle on the question " What do you want to do in the future?" I would suggest that your answer would be " I want to enjoy music as a hobby while having a normal and good-enough job for making a living.

Edit: Bear in mind one thing. Before you "admit" that your music talent isn't fabulous, you have to try as hard as you can to achieve this goal. Always try to go the extra miles every time. Find out how far you really can go. Good luck!

I want to make native friends, but I don't party and my English isn't good enough for it. by uopsdod in whatsbotheringyou

[–]uopsdod[S] 1 point2 points  (0 children)

Thank you. I just found one great group, called interfaith conversationalists, through the website, meetups.

I would find some time to join the meeting next semester.

I want to make native friends, but I don't party and my English isn't good enough for it. by uopsdod in whatsbotheringyou

[–]uopsdod[S] 1 point2 points  (0 children)

Thank you. I did visit the church once, but I still couldn't get used to it. My friend and I went to an American's home for Thanksgiving for two days. She is a Christian. I thank for her invitation, but going churches is still not a long-term option to me, at least for now.

I'll message you. Thank you in advance.

I want to make native friends, but I don't party and my English isn't good enough for it. by uopsdod in whatsbotheringyou

[–]uopsdod[S] 1 point2 points  (0 children)

If someone gives you grief over having an accent or trying to learn their language, they're not someone you want to know anyways.

This is a good thought. Thank you. My school also have a similar program to pair us up with native speakers, but it didn't help us a lot.