« first day (2944 days earlier)      last day (2011 days later) » 

12:00 AM
"By failing to prepare, you are preparing to fail." -Benjamin Franklin (source)
 
12:30 AM
morn
 
morn
 
12:48 AM
Hi guys
what is wrong with my project?
It works on my Laptop, but now that I've cloned it on my desktop, nothing works :(
 
 
1 hour later…
2:13 AM
found it
right-click "src" folder, "Mark directory as" -> "Source"
 
 
5 hours later…
6:45 AM
hi can i ask refactoring question here?
 
@Solar 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
 
6:58 AM
posted on November 14, 2018

 
@JennaSloan charades
 
7:57 AM
Morning
 
Morning.
 
 
3 hours later…
11:04 AM
@Solar you can always ask
@payne what is wrong is that you dont use maven :p
 
11:31 AM
"local variables referenced from an inner class must be final or effectively final" I don't get what could possibly go wrong if it is not final? Is there any example or article about this topic?
 
amen
 
oh oh oh, i know
watch that
 
12:00 PM
Two Excedrin Migraine tablets have 130 mg of caffeine, the same as a Starbucks Light Frappuccino with espresso. (source)
 
caffeine against Migraine?! I'd never come up with the idea to drink coffee against migraine :o
 
12:13 PM
/wiki Excedrin
 
lol wtf
 
Yeah I don't think that caffeine is the thing that works against the headache in that stuff
 
I mean, I just drank two coffees and now I got a slight headache - america explain
 
Would make for a fun experiment tho! Post that fact one facebook and see how many Starbucks Light Frappuccino with espresso are sold more that day.
 
12:16 PM
Let's just open up a new Café with dozens of signs with funfacts like that on them...
@geisterfurz007 Or go to Starbucks and try to sell them your ad-campaign advise
The Rolls-Royce doesn't pay itself, you know
 
"Hey I have this awesome advertisement idea!" shows fun fact
- "Nice thanks bud. Have a nice day!"
 
nonono
"Hey I have this awesome advertisement idea!" - Slaps contract on the table that guarantees me to get 20% of any added revenue for the incoming 2 months.
Buys Lamborghini
Isn't Starbucks technically just a giant drug dealing empire?
Aren't many young people just smoking & taking drugs because they're not allowed to? Let's just drop off a new caffee that is so strong that you declare it illegal for minors (without proper control), so people will sneakily buy it and feel cool.
hold my joint
 
12:40 PM
hmm... a blue screen during windows updates... that cant be good
 
Last time that happened my HDD burnt down :)
good luck, hope you got backups :P
 
pc started up again
so iDunno
 
12:58 PM
Close enough :(
 
1:13 PM
So it's just the two of us in here?
That's so romantic <3
 
1:35 PM
Good mornin
 
1:45 PM
Hello
 
whutup
 
java if and php if are different ina lot of ways
any polygot here who wanna go into details,finer details
polyglot
 
ifs are different?
how so?
 
For instance
Say you have a value from databse that you selected and assigned that to a string
 
no, not for, if
 
1:49 PM
if($q4_field == "UNDONE"){an update statement here will execute}
if(trade_prediction.equals(down) && trade_result.equals(up)) {this will not in java}
 
how so?
 
huh?
 
the only difference I can think of is that PHP is dynamic
which means that every value needs a truthfullness evaluator
while in Java, only booleans are valid
so if (birthdate) is valid in PHP, but not in Java
if the result will be true or false is irrelevant
 
@Wietlol explain
"truthfullness evaluator"
 
posted on November 14, 2018

archive - contact - sexy exciting merchandise - search - about ← previousNovember 14th, 2018nextNovember 14th, 2018: Here's a fun comic for a fun Wednesday, please enjoy!!– Ryan

 
1:59 PM
click the "if()" tab
if ("Hello, World") is not valid Java code
 
Thanks man
 
2:29 PM
@objectiveME take note of en.wikipedia.org/wiki/Evaluation_strategy, PHP uses short-circuit and lazy evaluation
 
@Tiffany Thanks buddy, you followed me here...thanks..may i introduce my friend @Zoe
 
2:47 PM
Oh gosh I just discovered tea, and it's awesome ~
 
is someone working Java in VSCode?
 
Java also uses short circuiting and lazy evaluation
if (false && heavyOperationIsHeavy())
{ }

if (true)
{ }
else if (heavyOperationIsHeavy())
{ }
 
@Wietlol I am unable to draw enough conclusions about the whole short circuiting thing , but java is more of a programming language and php is ... i have no word yet
 
in neither cases will heavyOperationIsHeavy be called
 
2:49 PM
php does not respect some logical contracts you think are obvious
 
php does not respect.
teachers also dont respect logic
 
i am switching from php to spring mvc ..am wiring in the twilio dependecies now
 
meh, mvc
 
@d0n.key o.O
 
what does MEH stand for?
 
2:51 PM
haha yeah
it works and quickly
no unexpected whereaboutery in spring boot
 
@ballBreaker I honestly never drank tea before without being sick - and I wasn't sick enough to require tea in like 5 years. So I just got tea in the office, cause it takes longer than getting coffee - and it's actually delicious. :)
 
Zoe
@objectiveME I was summoned?
 
I got some bad news for you @Zoe - you just got friendzoned.
 
@d0n.key weird
 
Zoe
@d0n.key whatever
 
2:56 PM
> expressing a lack of interest or enthusiasm.
 
@zoe Indeed, the council of Dol Guldur wants to send their warm regards.
@Wietlol have a look
 
heyheyhey would you not
 
Isn't it pretty
paste your spring boot
equivalent
 
Please post links to snippets, instead of flooding the chat with your trashcode
 
why would I paste "my" spring boot equivalent?
 
Zoe
3:00 PM
@objectiveME ... is that it?
 
@d0n.key My bad, how do i revert
@Zoe Plus we had a discussion on Short-circuit_evaluation, you input is always a treasured
Like the gold at smaug
@Wietlol I was assuming the meh, was from a spring boot aficionado
 
keep in mind mvc is for websites, with views and everything
boot is just a web service
boot is actually pretty good for what it needs to do
I find mvc to be pretty annoying
 
@objectiveME Idk just punch your screen or something.
 
mvc in general
 
@objectiveME lord of the rings is dumb
 
Zoe
3:04 PM
@objectiveME Ok?
 
@Wietlol I find it exciting, it does everything i want
@ballBreaker Withdraw that opinion or else the knights of Mirkwood will set upon up you with Narsil and Glamdring ;)
@ballBreaker Thats your opinion
 
I spit in the faces of the knights of mirkwood
I fart in their general direction
 
@Zoe yes
 
@ballBreaker The strong wind blows both things back to your face
 
@d0n.key tell'em
 
3:09 PM
ofc, when you follow mvc patterns, it does everything you want
but when you need something out of the box, then you always end up with a pain
 
Zoe
@objectiveME I need more details. Otherwise I'll go back to my game
 
@d0n.key I absorb both with sheer force of will and shoot both back with twice as much fury
 
@ballBreaker haha, expect us,yee mere mortal
 
@ballBreaker And the wind blows them back into your face with twice as much strength
 
I pucker up my sphincter and produce such a gust of intestinal wind that the weather pattern changes to direct the wind towards you
 
3:11 PM
@zoe I was doing a little research on how php if statment compares to the java if statement
 
@ballBreaker Can't hit me, I'm to skinny.
 
Zoe
Anything Java does, PHP does worse
 
Or just fails to do
 
I roll my d20, and it lands on 20. It's a critical hit.
 
@Zoe Dont say that loudly...
 
Zoe
3:14 PM
@objectiveME shouts Anything Java does, PHP does worse
2
 
@ballBreaker be afraid as we have offered your digital loot to our god Morgoth Bauglir and summoned beorn to devour your kittens with unrestrained haste...but there still is time for grace,...if you declare me your king and pays homage to thorin
 
Good evening!
 
It's morning
 
Zoe
It's afternoon!
 
Or Aftermornevenight
 
Zoe
3:15 PM
I hate timezones!
 
@Zoe {slides to oblivion never to be seen or heard again}
 
Zoe
It's morning on the internet!
Problem solved
@objectiveME K, cya
 
So I got quite an interesting issue going on currently:
I'm trying to provide data to a JavaFX project, from a Java project, via a background thread
 
"It says NullPointerException, even though I check whether it's null by doing: ... object.equals(null); ... "
 
Which, in itself works. However, after each Future<T> call, I want to make sure it is done before trying to get it. If it isn't done however, it's never going to come back to that same future as it is all in a loop
Now I'm looking for a way around that. Should I add everything to a List<Future<T>> to give it more time and execute them all later, or is there a better way around it?
 
3:19 PM
@d0n.key Check if any member of the object is null and being used...
 
@Giovanne 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
 
This is the code we're looking at
 
Zoe
@d0n.key Rip
 
@Zoe not really true, there are things Java does that PHP just doesnt
 
Zoe
doesn't usually => worse
 
3:21 PM
@Xariez have you considered using a callback?
 
I have not considered that, nope
Not that it says anything to me either
 
a future is like a promise or a task
you can check if it has completed, but that is just a bonus
 
Yes
 
the tradditional way to use it is by registring a callback
which gets executed when the future thing is done
 
@objectiveME you're a king of poopoo doo doo heads and I will only bow down so my fart reaches your face more closely
 
3:23 PM
So that would solve my problems without blocking the calling thread?
 
the question is often "where" you want to block
if you just register the callback, you wont block at all
so your call (in the root) will be a fire-and-forget
 
Not finding a lot of great resources on it though i feel like. Most of it is "homemade" solutions
Starting to think if some kind of "Worker" class would be worth it instead? So that the dataservice can block all it want but the end user doesn't notice a difference?
 
future stuff or async programming isnt used that much in Java yet
because the threading in Java is quite simple and effective
 
Perhaps not
 
hence why most people are satisfied with it and dont want to spend much time to convert to Future
 
3:32 PM
But requirements are requirements
And spoiler alert: It is also a school assignment
 
what do you have problems with in particular?
providing a callback?
 
If I DONT check for Future.isDone(), the JavaFX/Application thread blocks
If I DO check for Future.isDone(), the result count is effectively 0
Because, well, they're not done when they need to be
 
try using a CompletableFuture<T>
 
And the only idea that pops into my head is to basically add all the futures into a list and execute them after the initial loop, should give them enough time to finish.
But not sure how effective that is either.
 
f.get() will block until the future is done
 
3:39 PM
Alright, but what part of COmpletableFuture? Theres a lot of stuff in here
 
thenX()
tbh, I also havent used Future<T> a lot in Jaba
 
Jaba
LUL
So I guess I see how CompletableFuture could work
But I need to populate a TreeMap somehow, and the MergeObservationParts() is what handles that
And If I'm using Future.thenRun(), that's not gonna happen, is it?
 
what does the assignment say?
do you have to use Future<T> ?
 
@objectiveME no, I've been in here for a while, lurking mainly. I participate when I have a Velocity issue. Which I'm currently working through one right now, but I'm not yet ready to ask for help. Occasionally digging through chat helps spark ideas.
 
ExecutorService e = Executors.newCachedThreadPool();

e.submit(() ->
{
	Map<String, List<Observation>> result = new TreeMap<>();
	observations.entrySet().forEach(item ->
	{
		var x = new GetObservationPart(start, end, item);

		result = new MergeObservationParts(result, item.getKey(), x);
	});
});
looks like you can do something like this instead
 
3:48 PM
The application thread must never get blocked. There should be separate threads to handle the "filtering" (in my case, make sure it is within the given date) and then separate threads to put those pieces together
 
since you re-assign result, you are in some deep trouble
forEach in your case could be a simple foreach loop instead to avoid issues
 
Why's that?
 
you cant loop over all your elements and start 10 futures
because your futures depend on result
and your futures re-assign result
 
Yeah
That's.. the issue from the start
 
so, running them in parallel makes it have a different result
 
compared to running them in order
 
does anyone know of any library that already does the highest frequency function for me already?
or any subprocedure that is similar which can help reduce the length of my code
 
hmm just out of curiosity: does using the Stream API scramble with the order of your List object?
 
@PrashinJeevaganth "highest frequency function" ?
 
@PrashinJeevaganth what is it supposed to do?
@KarelG only if you use .parallel() or .parallelStream()
otherwise, the order is the same as the source
 
3:52 PM
It's supposed to return the characters(in String) that have the highest frequencies. If 2 of them are on par, you return both of them in the list
 
aka, the Iterator<T>
 
yeah like what I have been thinking. Someone blamed the streaming thing but seems that the list got in wrong order when entering the stream
 
so... ["abcf", "adef"] = ["a", "f"] ?
 
Your solution still seems to be returning 0 results i'm afraid @Wietlol
 
@Xariez what do you mean with returning 0 results?
you want to show the results in the UI?
 
3:54 PM
1s
 
@Wietlol Yes, the order doesn't matter here too, if you're particular
 
So this is annoying. If I debug it to show whats happening, it works
 
@PrashinJeevaganth This looks like a "do my homework for me" question
 
If I just run it without the debugger, the table of data is empty however
 
3:56 PM
@ballBreaker it indeed looks like that form because I'm a student, haven't started on a self-sourced project yet so questions are very elementary
Well I just redid one of my past assignments in Python to know more about java syntax, now I'm asking for improvement after an attempt. Is that fair?
 
Yeah, if i add a 10ms sleep at the end of the method, it seems to run fine @Wietlol
 
@PrashinJeevaganth kotlin's stream api is much richer... that one does contain the methods you are looking for...
 
@Wietlol ah ok, but I'm kinda sticking to Java for like a year for academic purposes ...
if Java doesn't have such a feature, I will just take note of it in the future
 
well... you can write the method yourself, but it wont be a chained call
basically, you start of with a flatMap to get a stream of all characters
then, you group them by the element
 
Same goes if i use my previous solution and add a 10ms sleep after the first Future, it runs flawlessly @Wietlol
 
4:02 PM
then you can count the nested elements and sort the results
then you take the upper part
@Xariez are you even doing non-cpu operations?
file-io? http calls? etc?
 
@Wietlol I think I did that in my letterCount alrdy right? (from the part about a flatMap onto the grouping by elements)
 
Nope, just reading and adding to in-memory collections
 
oh yea you did
i see, you are stuck with the last operation
cutting the top thing
try sorting first by the count
 
yes, I don't know if there's an efficient way to just quote the highest frequency among all the keys
How do you sort by the count?
isn't a Map unordered?
 
Depends on the abstract type
 
4:05 PM
a stream is ordered
except if it is a parallel stream
but iirc, the parallelism will be removed after you did a collective call
 
Hmm, so I sort a keyset converted into a stream by its frequency in the actual map... well that would require me to identify what is the maximum and setting the scenario where 2 elements are tied right?
 
Ah well, im gonna go grab something to eat and see if i cant figure this out.
Still, thanks a bunch for the help!
 
seems something like
map1.keySet().stream().sorted(some function)

then I would have to know what's the frequency of the highest one, and I think I only can do that with a terminal
and then I have to start another stream, hence ending me with 2 streams calls again @Wietlol
Oh I recalled the reason why I wrote my code this way ... wanted to dodge writing another custom comparator
 
try that
(untested)
but that should be the equivalent of the top-up limiter
hmm... it will be sorted ascending
you prolly need to reverse the sorter
 
haha :/
seems like there's no way around writing a Predicate or Comparator
 
4:17 PM
hmm... this is interesting
 
was trying to do everything in pure FP
 
.sorted(comparingInt(Entry::getValue)) this is fine
.sorted(comparingInt(Entry::getValue).reversed()) this is not
.sorted(Comparator.<Entry<Character, Integer>>comparingInt(Entry::getValue).reversed()) inferring doesnt work any more so the generics need to be explicitly specified
 
@Wietlol just to confirm how does the method references work? I usually use them when they are static methods but not sure how they work for methods invoked by instances
 
ah, .sorted(comparingInt(Entry<Character, Integer>::getValue).reversed()) also works
which is much clearer
instance methods work the same
Type::method
can mean
e.method()
or
Type.method(e)
 
@Wietlol thanks for the info
lol was quite surprised that I have only been using the comparator for the compare method
 
4:29 PM
you arent really using a comparator really
you are just comparing elements to each other
the thing in FP that will make it much nicer is the window operation
you can then group elements together
 
@Wietlol what do you mean by window?
 
so you can do a takeWhile for each element, while also knowing the next element
so you can compare them
that would then process without the cache and be pure
which is often what you want with these things
 
XD, the moment I see the command takeWhile ... RIP InfiniteLists
 
the kotlin function is pretty lacking in its behavior really, but whatever
takeWhile is fine
sorted is the RIP
takeWhile is lazy
sorted requires all elements to be processed
but you cant get a result out of an infinite list
 
@Wietlol I usually don't use takeWhile either unless it's an InfiniteStream. It's like I won't ever find a scenario I will use both a takeWhile and a sorted together
 
4:37 PM
the takeWhile here only makes sense because of the sorter
the sorter says, put the elements with higher frequency in front
so you get [ ('a', 100), ('c', 10), ('b', 3) ]
then takeWhile takes all elements until there is a change in the value
 
@Wietlol actually about your solution provided, how would you produce a Map<Character,Integer> in the first place? To use grouping by, we will be forced to use the counting() method in Collectors right?
 
try .mapToObj(c -> (char) c)
then you get a Map<Character, Long>
you can use the longs instead
then just change comparingLong, Entry<Character, Long> and Long::equals
 
@Wietlol I actually don't really like using Long, was trying to find a way to use Integer instead XD
but was forced to according to the API
 
longs are fine
I just mindlessly default to Int though
but there isnt really a reason to not use them
 
4:53 PM
well sometimes passing longs to functions that take in ints get pretty irritating ... if it's between a double and int there's that lossy conversion error
Well it's more of a convenience issue, why would we use long just to have the compiler yell at us haha
 
because streams are based on longs
 
5:30 PM
 
5:56 PM
Hi,
 
@user3212324 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
 
can someone pls help in this wuestion
I am seriously stuck here and cant proceed further for more than couple of days
Badly need some solution to procesd further
@OakBot Thanks...
 
@user3212324 Type /help to see all my commands.
 
@OakBot /help
Anyone available ?
Btw is it the correct chatroom to enquire about spring boot with jpa
/help
 
6:23 PM
> My commands are also listed here: github.com/JavaChat/OakBot/wiki/Commands
 
6:49 PM
1 message moved to friendly bin
 
7:07 PM
@user3212324 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.
1 message moved to friendly bin
@user3212324 In a few days it would be though ;)
 
7:27 PM
within Velocity, is it possible to convert a variable of type org.jdom.Element into java.util.Date? More specifically, I have the contents of an XML node, which is an ISO 8601 formatted date, and I'd like to convert it into a Date object so that I can format the text into something readable by end-users
I haven't googled much about the converting part, but if it's not even possible to do, I don't see much point in trying to find something that would do it
I mean, I can find ways to do it through Java, but Velocity is a bit more limited in what it can do with Java...
I guess I can do some type juggling rubber-ducking
 
Zoe
8:20 PM
lmao, that for some reason reminded me Emacs has a built-in rubber duck debugger called the "emacs psychotherapist"
 
Zoe
@Feeds lmao, the alt text xD
 
 
3 hours later…
morn
 
morn
 

« first day (2944 days earlier)      last day (2011 days later) »