« first day (3035 days earlier)      last day (2130 days later) » 
00:00 - 21:0021:00 - 22:00

00:00
"Limitations are like mirages created by your own mind. When you realise that limitation do not exist, those around you will also feel it and allow you inside their space. " -Stephen Richards (source)
00:50
Was spinning up my own Promise-like class for very specific use and got stuck saving and calling an anonymous inner class function that takes a parameter. Any takers?
01:08
@AlanKley So it's like the Function class?
I"m actually not familiar with the Function class. I'm basically creating a class that defines a then(ThenInterface) member class that can take an instance of an anymouse class
I store it then call it after making an Asynchronous call
That worked great
Then I added a thenWith(ThenWithInterface) where the implementation of the ThenWithInterface took a parameter. I stored the anonymous class instance passed in (actually a lambda) but didn't know how to call it with the parameter used in the lambda instance
Sounds overly complicated
Maybe. It was actually just a few lines of code. I read CompletelableFuture is what Java 8 provides for what I'm doing but it seemed just as complicated
My class results in be being able to use: new LoginPromise().login().then(()-> continueAfterLogin());
Why are you using a lambda instead of a method reference?
Btw, there's also the CompletableFuture class
01:23
Now I"m just curious to know how to call a saved interface object (lambda) with a parameter that is included in the interface object?
The lambda is just a shortcut for the anonymous class that would take the method reference
But a lambda is slower than a method reference
I"m not sure I'm following. Are you saying lambdas are not a good idea as a replacement for anonymous inner class instances?
Isn't that their reason for existing?
No, I'm saying that if you have a lambda that doesn't have any parameters call a method that also doesn't have any parameters, you might want to consider using method references.
Of course it probably depends on how it's coded too
Ok gotcha.
I also suggest looking at the java.util.function package if you haven't already.
01:34
Thanks. That's new to me. Will definitely check it out!
 
6 hours later…
07:09
ever since C# had delegates, I wanted Java to have something similar
finally they have function, which isn't the same but at least it gets rid of most of the hassle that you'd otherwise have to go through to implement an interface with the proper method signature
there was even a lot of boilerplate in writing all that out
 
1 hour later…
08:34
morn
morn
Zoe
Zoe
:rainblobwave:
08:42
hi guys
do anyone use svn?
what is it means this icon on eclipse about a file
I try on google but I don't have found nothing
@Doflamingo19 the icon in the bottom right?
No idea, I've never seen that icon before either
but it's customizable you know.
Check what is set in eclipse for that particular icon and you'll know
okiii
yes, I mean the icon in the bottom right
@neil I found the problem
this icon it means that there are some conflict
hmm, weird
for me it's usually a red exclamation mark
I go in the project's path and there are some yellow triangle! So I click on files and I resolve my problem, thanks @Neil
08:59
I didn't do anything,but glad you fixed your problem :)
has anyone bought from this site packtpub.com?
nope
09:23
Hi Everyone I have a question
I am using SQL query on hibernate
sql returns 5k records
but I only need 200 records of column name of 'Roy'
I cannot change my SQL it will get 5k records still
my question is
List<Object[]> object = recData.list().stream().filter(a -> a.getName.equals("Roy")).limit(200).collect(Collectors.toList());
does this do anything to my SQL execution ?
turning it into a stream doesn't mean it isn't loading all 5k records just the same
:(
you should put as much of the filtering as possible into the sql query
though there are ways you can change the hibernate criteria to limit the amount loaded
and though it's database-dependent, if the database supports it, you won't load all 5k
otherwise, hibernate loads all 5k and then only gives you the limited amount you asked for
tsk yeah I think I will do SQL solution for this ...
thanks guys :)
09:28
@Wietlol sometimes that's not an option though
SQL filtering is my last option tho
@Neil if it isnt... then your db library sucks
at least... if you cant do a simple string equality
@Wietlol no, I mean, if say, you need to show customer orders, and no additional filter is added.. you must necessarily load all of them and paginate it
true
if you're lucky, your database supports offsets and result limits
09:31
I just love Spring Data :)
it does everything you want
My problem is user is searching for this all search grid
this grid returns 5k paginated data
only returns 10 data per page
now im asked to make an excel from the search
the excel is supposed to hold the contents of the current page or all 5k?
the good thing is
public interface PeopleRepository extends JpaRepository<Person, Integer>
{
	List<Person> findPeopleByName(String name);
}
5k data is separeted by example color
09:33
so much for all sql
i will only get 200 data of red yellow blue
per excel tab I can show 200 data each color
either you know the results are going to be at most 200 tops and you hold it in memory, otherwise you either load it piece by piece (offsets/limits) or you load it all and use it all immediately
i dont want to SQL for each color tho .... that would be inefficient
or you stream it and use it immediately
yeah thats my options
09:38
@Leroy no, query all of it, and then build the excel as you move through the data
I think with apache poi, you don't have to create the spreadsheets in order
but if that weren't possible, you could always sort by color
though preferably you don't do that if you can avoid it since it would take longer
especially if it weren't indexed by color
you could also just load it in memory
5k objects are nothing imho
I assume this isnt an operation that runs every few seconds
or must take less than 100 milliseconds
5k objects are nothing if the objects are small
plus, and perhaps more importantly, you don't know it'll be 5k or 5 million
that's the key thing
when you don't know potentially how big the results will be, you can't consider loading it in memory
it'll get you into trouble later
doesnt poi keep it in-memory anyway?
yeah of course
but not a lot of choice there
id avoid excel at all cost tho :)
09:48
meh, better than csv
if the client asks for csv, then they intend to import it, and if they intend on importing it, there will be issues
csv is fine
people just incorrectly use it
Zoe
Zoe
csv is overrated
:hide:
in fact, im currently making something that requires csv reports
they set up 3 rules tho
1, values must be separated with ; (semicolon)
2, decimal values must be separated with , (comma)
(only the separation between fractions and... the other part)
and 3, negative numbers must have a leading - (minus symbol)
1 is definitely something you should mention when doing csv stuff
the other 2 are weird imo
but meh
Zoe
Zoe
@Wietlol NO WAY!!!
Here I thought negative numbers were pre-fixed with the text "negative"!!!
wait... even worse
09:53
they forgot about a rule about what happens when your value actually contains a semicolon
> Minus signs should be marked with a - (minus)
By that logic, you could never have a value containing a semicolon
I didnt forget, and my csv library is tested for proper escaping
so, im good wietlol
@Zoe weird.. in my culture, negative numbers are indicated with a troll face
if you can get by like that, all the better. it means you can never go wrong when you see a semicolon
but in my experience, it can and will happen that the client "accidentally" forgets this and adds a semicolon in the value, and then goes, "oh yeah, right.. well could you just make it work in that case?"
but it works in that case
the csv is always correct
it will be like this
value1;"value;with;semicolons";value3
09:56
well that breaches your own rules
even if it is clear how that should be interpreted
which is equivalent to ["value1", "value;with;semicolons", "value3"]
it could conceivably be value1, "value, with, semicolons", value3
that is csv standard rules
there are no standard csv rules
everyone always tends to forget that
In computing, a comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. A CSV file stores tabular data (numbers and text) in plain text. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of the comma as a field separator is the source of the name for this file format. The CSV file format is not fully standardized. The basic idea of separating fields with a comma is clear, but that idea gets complicated when the field data may also contain commas or even embedded line-breaks. CSV implementations...
09:57
it's not a standard format anymore than txt is a standard format
> Any field may be quoted (that is, enclosed within double-quote characters). Some fields must be quoted, as specified in following rules.
@Wietlol that's a convention established by microsoft and tends to stick, but it's not the only one
txt is an... encoding?
csv is a format
otherwise, everytime you import a csv file in excel, microsoft wouldn't be asking you what the delimiter character is
it's not a standard format
csv, json, xml, html, java, cs, cpp, h, php, etc are all txts
> Adjacent fields must be separated by a single comma. However, "CSV" formats vary greatly in this choice of separator character. In particular, in locales where the comma is used as a decimal separator, semicolon, TAB, or other characters are used instead.
its stupid to use a different separator, since there is no reason to
09:59
@Wietlol ok, you continue your career and when somebody somewhere uses commas to separate values in a csv file, you remember this conversation
@Neil why would I?
@Wietlol because it's relevant?
and because you don't have alzheimers?
@Zoe By "deep copy" I mean full copy of every object on every level of a multi-dimensional array, as opposed to a "shallow copy", which only copies the outermost part of the array. ...
if someone would use commas to separate values in csv, then im happy
why would you be happy? your client wouldn't be, and they'd ask you to make it work with commas instead of semicolons
10:01
but it works for commas
csv works for every single value
even if you decide to include every single character in one value
it will still work
so you have multiple delimiters?
no
> Fields with embedded commas or double-quote characters must be quoted.
^ i think this one should change tho
I prefer to use tab-separated values instead.
"Fields with embedded <delimiters> or double-quote characters must be quoted."
I think you're missing the point. Every company has his or her own rules, though the one you provided is usually the typical way of doing it
10:03
the one I provided is the one that every sane person uses
but conceivably tomorrow, you'll get a csv with comma-separated values and decimal points use periods
if said person is insane, said person should be whacked at
@Wietlol so you're assuming every client you'll be dealing with in your career will be sane?
I have my doubts
sane enough to understand standards
sure they understand standards. and they have their own
10:04
there is one third party of which we use stuff that is completely insane
Most standards are not sane.
i could write a book about their stuff
it's not insane. if you replaced quotation marks with apostrophes, it works just as well
Zoe
Zoe
@Neil Well, they're actually supposed to be indicated with a hand-drawn high-detail trollface, but most people can't do that and just write "negative" instead
one is just more popular than the other
Zoe
Zoe
10:05
@JennaSloan oh. Makes sense
@Zoe ah, I see, well that makes sense
@Neil but none of the libraries will support it
@Wietlol lol, again, you're assuming the client is sane
if not, they get whacked
good luck with that assumption
10:06
@Neil In that case, they'd be called "single quotes"
Zoe
Zoe
@Neil Did you just assume wietlol assumed something about the client that assumed wietlol could do that in a sensible way?!
Just saying. I've seen on more than one occasion formats other than the "standard" quotation marks/semicolon delimiter
@Zoe Did you just assume my assumption!?
@JennaSloan of course :)
Zoe
Zoe
@Neil No, I know. :3
I think you assume you know my assumption
are you assuming he knows your assumption?
10:21
assumptions are deadly... i assume
I assume you are correct, sir
you assume I am a "sir"?
you assume I am knighted by ze queen?
/fatcat
Zoe
Zoe
@Wietlol You were tho
10:27
You assume that I assumed such
@Wietlol Would you rather be a "madam"?
I would have great respect for ze queen if she managed to knight a bigcat... wifout peeing her panties
look a pink elephant
hello
I played a game that had a flying talking bipedal pink elephant
Zoe
Zoe
10:31
that got flagged
\o hey folks
@Wietlol Is that a reference to something?
It vaguely reminds me of ugandan knuckles but I'm not sure.
not intentionally
wouldnt that be "da queen"?
10:34
I feel I am missing context
just delete it and be done with it, someone got upset
what got flagged?
Zoe
Zoe
@Wietlol this
well... I cant edit it any more...
10:36
now the elephant is gone
:(
Zoe
Zoe
Out of curiosity, can 10k users see flags against their own messages?
no..AFAIK
@SurajRao yes
@Wietlol you
Zoe
Zoe
@SurajRao yeah, that makes sense. ^^
Hi everyone
10:47
Did I mention that the video game that has a flying talking bipedal pink elephant also has big purple talking platypuses that heals you and can save your game, and the aforementioned elephant is one of the many unique bosses in the game?
so a boss that heals you?
no
the elephant is the boss
the platypus heals you
ah
Yeah, and the platypus likes to sleep
I've been playing a game where man-eating plants try to eat you while you're trying to survive off of mushrooms and flowers, all the while trying to reach a flag pole.
10:50
hmm... sounds familiar
is it pokemon?
Pokémon doesn't have any flagpoles
don't eat too many of those mushrooms though
nope
pokemon does have turtles
yes... yes, that is a bowser-toise
yep, that's the one
10:54
watch someone flagging it
xD
you never know in this chat
The game I was talking about was Deep Labyrinth for the Nintendo DS
Yes.
11:28
hmm... found an annoying part in the kotlin compiler
it doesnt do null checks properly
how's that possible?
it can only be null if you let it be null
this is a very simplified version of the real code
but it essentially wants to go deeper into a tree... or queue... or something
and return the deepest node
kotlin compiler is smart enough to understand that while (x != null) { /* x is never null */ }
but it does not when using a do-while
Try making child a Node instead of Node?
which is fine, because the condition in the while is not enough
but on the first run, child is guaranteed to be not-null
right, so if anything, it should let you assign child to root
11:32
@Neil if I make child a Node, it cannot be assigned to child.child
so, it must be a Node? or I'd have to do the while condition inside the loop
I think the whole "exit on condition" thing only applies to root after the if block
making it a while (true) with a conditional break
it doesn't apply to child
hence the problem
what you mean?
I mean the compiler says, "ok, after this point, root definitely isn't null"
and so it treats it like a Node and not a Node?
but that applies only to root, not to anything you assign root to
11:34
i suppose so
I assume, I mean otherwise I suppose you wouldn't have that issue
though if the compiler were a bit smarter, it would apply the same logic to child as well
it could inherit the guarantees to other values though
nah, that is not the problem
if I do if (child == null) return null before the do-while, it still requires the null assertion
it just doesnt work for do-while loops
oh well that does make sense afterall
it can't know how many times it will loop, so even if that holds true the first loop, it may not hold true for successive loops
well... it makes sense that it has a different condition than a while loop
keep in mind, while (x != null) { ... } does properly guarantee x to not be null
it doesnt matter how many times it will loop, x will never be null at the beginning of the loop
true but you're using a do while, not a while loop
so the first loop probably can't have the same logic applied
11:39
but for a do-while, they had to do an intersection operation on the guarantees of the while condition and the guarantees of the initial state
maybe if you rearranged as a while loop
i could re-arrange it as while loop, but then I have to assign parent to something
and I'd have to assign it to null
in this example, it would actually be fine
but in the actual code, I cant really do that
you don't need parent at all
you could do while (child.child != null)
and child could actually be declared Node
I think
would probably be more elegant
no, child still has to be re-assigned to child.child
and since it is a property, the null check in the loop condition doesnt guarantee anything
yes, but the condition guarantees that child.child isn't null
11:42
except for multithreading
;)
hmm, maybe if Node was declared as a data class
hmm... a data class could make sense...
but it still refuses it
ah well, just an idea
it makes sense tho
since val properties on a data class are guaranteed to never change
(with the exception of reflection, but then you are dealing with serious shit)
well they can't just ignore reflection :P
11:49
they could :)
compiler can't make assumptions if they can be false
I think they even do
class Superior
{
	private val data: String? = "hello"

	fun foo(): String
	{
		if (data == null)
			return "null"
		return data
	}
}
(that was completely unintentional)
var data makes it illegal
custom getter or open property also makes it illegal
a custom getter should be fine imho however
anyway, back to being productive
Mexicans drink more Coke than any other country in the world. Mexicans drink about 745 Coke beverages per year. Americans drink about 401 Coke products a year. (source)
12:15
"coke products"
@TheSquirrel 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
alright, will do
@Wietlol "this is fine" automagically turns into that image :)
One of chat's easter eggs.
so if I say "this is fine", that image will spawn?
12:24
that's hilarious
Yes
woah its for real
12:46
@MadaraUchiha I know, I used it before several times
but I just wrote "this is fine" without keeping in mind that it would show the image
13:00
posted on February 13, 2019

archive - contact - sexy exciting merchandise - search - about ← previousFebruary 13th, 2019nextFebruary 13th, 2019: DINOSAUR COMICS BOOK ARE ON SUPERSALE! THIS NEVER HAPPENS– Ryan

Zoe
Zoe
Damn I hate dinosaur comics >.>
 
3 hours later…
15:56
@Zoe So remove it from the list of feeds that get posted in this room
Zoe
Zoe
But @Michael tho
public class OperatingSystem {
    public static final boolean isMacintosh = System.getProperty("os.name").toLowerCase().contains("mac");
}
Is there a less hackish way to do this?
@fredoverflow I don't think so, but there's probably a more reliable hackish way.
@Wietlol if (data == null) return "null" else return data can be shortened to return data ?: "null"
@JennaSloan More reliable by checking for a different substring?
@Zoe Nooo plz don't!! :(
Zoe
Zoe
16:07
I won't, mainly because I didn't add it. Still hate it <.<
@fredoverflow yes, but minifying code is irrelevant for the situation... I guess
Nov 16 '18 at 15:12, by Michael
Well, it's not programming related so if you don't want it, take it down I guess.
@Wietlol Sure, it was just a superficial syntax observation :)
Zoe
Zoe
meh
@JennaSloan Nooo
16:26
ackchually, that superficial syntax observation might be relevant... since your version only accesses data once
im not sure the compiler is allowed to make such a change, but that would make it make good guarantees
16:50
Henlo o/
ohai
Zoe
Zoe
@Wietlol you're missing a couple letters
supplies a couple of letters
Zoe
Zoe
17:05
grass
flour
wait...
flower
flower?
17:40
17:58
@Feeds RIP Opportunity :(
3
18:23
oioioi, anyone know how you install a RCP plugin to eclipse? I exported the .jar file but haven't found anywhere online on how to install it to the Eclipse IDE
@sockevalley I think there's a plugin manager window somewhere
@JennaSloan Under help you can manually install software.
Followed this link, but it did not work.
https://stackoverflow.com/questions/31553376/eclipse-how-to-install-a-plugin-manually
I've created the plugin myself and want to test it basically since you can't test it live in RCP.
I think I fixed it. Need to put it into eclipse/plugins
accordingly to: https://www.eclipse.org/forums/index.php/t/165314/
However, the button that the plugin had did not show up. Apparently this way does not fix that.
18:42
@sockevalley Did you restart eclipse?
@JennaSloan yes, ofc.
Is there a difference on installing plugins on Eclipse IDE for Java Developers vs Eclipse IDE for RCP and RAP Developers? I managed to install the plugin in Eclipse IDE for RCP and RAP Developers, with ease.
/shrug
¯\_(ツ)_/¯
Haha. Damn Java, why you so confusing.
/happy
Since the advent of p2, one should be using the dropins directory instead of plugins.
19:35
@sockevalley I believe the only difference between all the different flavors of Eclipse is the plugins that they are packaged with.
@Michael It appears to be so.
20:30
Super noob question guys but how can I get the name of the project I am in programatically? Lets say the workspace is /Java. And I am working on /Java/Waterbottle.
How can I fetch the name Waterbottle inside Waterbottles main function?
00:00 - 21:0021:00 - 22:00

« first day (3035 days earlier)      last day (2130 days later) »