« first day (1672 days earlier)      last day (3252 days later) » 
03:00 - 14:0014:00 - 00:00

2:00 PM
Lol went to the bathroom and came back to such a confusing conversation
 
Drop table conversation;
 
2:16 PM
hey
can I ask something?
 
You just did, so I guess you can.
 
4
Q: File Excel From Apache POI Cant Open by Ms Excel (corrupt)

ketelagorengI don't know why the file I write using POI cant be opened by Ms Excel 2013, but the file is still readable by POI. (cell value can be changed) this is the error from file here is the code FileInputStream fis = null; try { fis = new FileInputStream(fileUri); //not error at fileUri ...

hehe
I have been stuck at this error
2 days
 
hmm sorry sir, but what is it?
 
ASR
its java basics link for beginers
 
2:25 PM
Why are you linking it?
 
thats the point, why are you linking it
 
@ASR I've seen better guides than this.
 
Looks like shameless spam for self promotion
That's why I'm not clicking it
No clicks from me!
 
Rated 1/5 and on my "will recommend against" list.
 
Chat noob question: how do you thumbnail a link here?
 
2:35 PM
@Dustiny "Thumbnail"?
 
for example a comic or picture, or does it auto do taht
 
It auto does that when you have enough rep
and if you post the link alone
Add any text and it will show as a normal link
[Doing like this](http://stackoverflow.com) will give this result.
Am I helping?
 
Okay cool thanks lol, both helped
My guide to java
 
\0/
ok. Well I'm out, see you in 40min or less~
 
2:40 PM
Ciao!
 
@Gemtastic seeya~
 
3:07 PM
help my question pls :(((
 
@ketelagoreng How? It's not like I use Windows.
 
about apache poi
give corrupt file output :(((
 
I highly doubt it. It's probably Microsoft Excel being stupid.
 
fge
@ketelagoreng I'm afraid you're SOL if you are expecting any help from this channel; most people here use $OS where $OS.startsWith("Windows") == false
 
ssssoooooooooooooooooorrrrrryyyyyyyyyyyyyyyy
haha
 
3:19 PM
I use Windows!!
....to look outside
 
nice coverup, I was going to throw you out of the windows :P
 
fge
"Computers are like air conditioners; they work better when windows is/are closed"
4
 
- fge 2015, all rights reserved
 
fge
No, that quote is not mine
 
:(
 
fge
3:21 PM
<-- should convert into a CS historician
But I like programming wayy to much for that
 
Convert into PDF instead.
 
i need windows, cause I can see outside with it
 
fge
@ketelagoreng with Linux everything is transparent; no need for Windows!
 
(I know the "convert into pdf" joke is old, but I'm not sorry. :p)
 
I need windows because I can see you undressing...right now.. look out in that tree outside your house..
 
3:22 PM
Firstly, I live in an apartment, and secondly, I burned all the trees last month.
 
yeah ppfft oxygen, who needs it!
 
I need solution than oxygen
for my problems
 
fge
"Windows: a 32bit extension to a 16bit shell originally coded over an 8bit operating system developed on a 4bit microprocessor by a 2bit company that can't stand 1bit of competition" <-- old quote back in the days when Win95 was all the craze
 
Golden. :)
 
well played sir,
 
3:28 PM
Back~
 
fge
3:44 PM
Java question, #2: apart from arrays, for any type T, what is required of some object foo so that you can write for (final T t: foo) { /* do something with t */ }?
Bonus question: why isn't there any Stream equivalent for such foo?
@Gemtastic ^^^ do you happen to know the answer to the first part? ;)
 
@fge Iterable<T> or T[].
@fge It's not Iterable.
 
fge
@Unihedron I did say "apart from arrays", right?
 
I know this bit because I golfed this in the past. :P
@fge Oops :(
 
fge
And your answer to the second question was not what I was expecting :p
 
I'm not sure I understand the question
 
3:53 PM
In my defense, I got so excited about seeing a question that I jumped into it without reading the prerequisites. :P You don't see many of Java questions around here.
 
fge
@Gemtastic well, even though Uni answered it, the question was simple: for any type T, apart from arrays, what is required of some object foo so that you can write, in code: for (final T t: foo) { /* do something with t */ }
 
#Enhanced4loop #Java #Fundamentals #UnderTheHood
 
fge
And the answer is that foo must implement Iterable<T>
 
Well, I'm still not sure I understand what you're asking but to use the for loop you need to have some collection that's iterable
 
fge
The bonus question is much more tricky to answer though :p
@Gemtastic that is where you have it wrong
It needs not be a collection
The ONLY requirement is that the object be Iterable<T>
 
3:57 PM
then I wasn't too wrong at all
 
fge
As it happens, Collection<T> implements Iterable<T>
But that doesn't mean that any Iterable<T> has to be a Collection<T>
 
I guess Stream doesn't implement Iterable because Iterable requires .next()
 
fge
Case in point: Files.newDirectoryStream()
 
If I meant Collection<T> I would have written Collection<T>
 
fge
Still, you miss the point
The requirement is only on Iterable
Not Collection
 
3:59 PM
I call a bunch of object "some collection" because I didn't know what else to call it
 
Some objects that behave like collection and implements iterable, you mean
 
so no, I wasn't wrong, just bad at expressing myself
 
fge
@Unihedron that's not even it; look at the javadoc of Iterable
 
@fge should I summon Madara?
 
@Unihedron I could have used "a bunsh" instead of "some collection"
 
fge
4:00 PM
No, he will go on and on about how Java needlessly complicates things etc :p But that is for a good reason
 
I can't spell >_>
 
fge
@Gemtastic have you ever considered that that "bunch" may not even have a defined size?
(that's a hint to answer the second question as well by the way)
 
@fge that was exactly the point
 
fge
@Gemtastic of what exactly? If you really know about this then you should know that the requirement of a foreach loop cannot be that foo be a collection since a collection has a finite size by definition -- even in maths
 
oof
@fge no, she did not mean a collection, just a bunch of T
 
4:03 PM
You understand me about as well as if I had been speaking swedish.
At least Uni gets me ♥
 
> Implementing this interface allows an object to be the target of the "foreach" statement.
... so, that's all in the javadocs?
It's like when you're on an easter egg hunt, and the hint was "under the table", and you find the next hint which says "there are shadows under the table"
 
@Unihedron Short but sweet
 
@Gemtastic but also less than what I'm expecting :)
 
I agree, you have to think out the logic behind it yourself :P
It's a puzzle! :D
the other pieces are hidden in different docs
 
Coming soon on Puzzling.SE: Unihedron asks: Why does Stream not implement Iterable?
 
4:07 PM
I bet you can find that out rather easily, I just never had time to check, so I don't know :P
 
fge
@Unihedron so, why do you think that is? :) And hint: forget about maths, it's about the language
 
@fge I dare not to assume its reason as if doing so invokes the ritual that taints my soul with false knowledge.
 
fge
Or rather, about the implementation of a certain class in the JDK, but at that point I already give the solution
@Unihedron I am adamant that I never spew false knowledge, and if I'm not certain about some point I make the point clear that I don't know :p
 
@fge Huh, is it because the implementation makes it difficult to implement .iterator() as it would 1. be a terminal operation, and 2. require stateful transfer?
 
fge
@Unihedron it's a combination of both; hint: apart from the JDK classes having a dedicated method, what class of the JDK do you usually implement to provide a Stream out of?
 
4:12 PM
Spliterator
 
@Unihedron Huh. Had no idea @Gem was a girl.
 
@Dustiny never mind it
 
fge
Yes. Now, what defines a Spliterator?
 
parallelism
 
fge
That is, how does the Stream API know what it can do with a Spliterator?
 
4:13 PM
When was it mentioned?
 
OH
 
fge
And parallelism is one thing; not the only one
 
It traverses the elements of a source
 
hmm'
 
fge
And how does it determine how to pull the elements?
 
4:15 PM
well, I only qualify as female in the eyes of the law
 
fge
Forget about the intermediary and terminal operations for the moment
 
characteristics vs deterministic methods
 
fge
OK, and "characteristics" are?
 
@Gemtastic yeah, sorry; I usually use gender-agnostic pronouns, not sure what tripped me over there :/
 
@Gemtastic Laws of biology? lol
 
4:16 PM
@fge Ordered, distinct, sorted, sized, nonnull, immutable, concurrent & subsized
 
@Unihedron I forgive you since there are no nasty people online now
;P
 
fge
@Unihedron well there you have it; can an Iterator, for instance, ensure SORTED or DISTINCT? ;)
 
To be fair, if it wasn't mentioned I would have just been stuck in my bubble of ignorance
So you're probably fine lol
 
fge
@Dustiny and why would the fact that @Gemtastic be female make any difference? ;)
 
You can still go back there and keep not thinking about my gender ;P
 
4:17 PM
@fge nope, and that's a pretty good reason :P
@Dustiny on the internet, no one knows or cares if you're a dog :p
 
fge
@Unihedron there is more -- have you noticed ORDERED?
An Iterator is, basically, ORDERED
 
@fge By having Ordered, it makes it pretty clear that the data source can be unordered :p
 
@fge Haha it doesn't. It just tripped me out because I had literally no idea
 
and that trips over any sane iterator implementation for a data source like that
 
fge
4:19 PM
@Unihedron well, I tripped up on that -- you probably recall about my questions wrt Files.lines()
But anyway, here you go
A Spliterator's .characteristics() is why Stream<T> doesn't extend Iterable<T>
 
@Dustiny I take that as a compliment
 
fge
Some characteristics are just not compatible with what an Iterator can, or cannot, provide
 
@fge Yes, and it makes almost no sense to implement Iterable because doing so means the data provider must provide a way to copy its state into an Iterator. And that's insane.
 
Well, streams work across as many cores in the cpu as it can so the information probably can't be sorted since that process works asynchronous, right?
 
fge
@Unihedron that is indeed a good reason as well; however I am unable to come up with a general answer to that
 
4:23 PM
I guess if you really want to use Stream in an Enhanced4Loop, use the terminal op "toArray". :P
 
fge
@Gemtastic just forget about parallelism; do note that a Stream provided to you IS NOT guaranteed to enable parallel computation at all, and in fact, some operations you perform on the stream may very well "downgrade" it to a sequential stream
<-- finding link to a question he asked
 
@Gemtastic Almost; Except that 1. that doesn't always happen, and in fact accidentally downgrades once in a while, and 2. how it works under the hood doesn't affect how an API works :)
 
fge
13
Q: Can a Java 8 `Stream` be parallel without you even asking for it?

fgeAs I see it, the obvious code, when using Java 8 Streams, whether they be "object" streams or primitive streams (that is, IntStream and friends) would be to just use: someStreamableResource.stream().whatever() But then, quite a few "streamable resources" also have .parallelStream(). What isn'...

 
Well, the thing is that there's a CHANCE that streams will multi-thread across the cores, but as you say; it's smart enough to pick the fastest version.
 
A huge part of how Java, as such an old language and heavy tool, still thrives is how it provides a well-thought API vs implementation set.
 
fge
4:25 PM
^^^ see this
 
@Gemtastic modern day computer chips has many caches and sockets and indirections that the storage is heavy to keep track of indeed, but that's beyond the point.
 
fge
@Gemtastic well, the thing is, it may not be as "smart enough" as you think it is
 
@fge No, but if it's not thread safe or guaranteed to be ordered, how can the content it handles be ordered?
I have no clue I'm just guessing here based off of that one thing I do know.
 
fge
@Gemtastic this depends on the intermediary operations; and that's quite a difficult thing to wrap your head around. I've been bitten by it
 
If that's wrong then that's wrong, I thought I'd voice my thoughts since you fish for it :P
 
fge
4:28 PM
Basically, in Java's Streams, there are intermediary operations which can "backstab" to the stream and say, for instance, "ignore the order"
And that means, "ignore the order even if the underlying Spliterator tells you that it's ORDERED"
And I've been beaten by that badly
24
Q: Is this a bug in Files.lines(), or am I misunderstanding something about parallel streams?

fgeEnvironment: Ubuntu x86_64 (14.10), Oracle JDK 1.8u25 I try and use a parallel stream of Files.lines() but I want to .skip() the first line (it's a CSV file with a header). Therefore I try and do this: try ( final Stream<String> stream = Files.lines(thePath, StandardCharsets.UTF_8) ...

^^^ see this
Parallelism is but one characteristic of a Spliterator (it calls is CONCURRENT)
It just so happens that such a characteristic can be retroactively removed from that Spliterator before the stream even produces values
And so can ORDERED if you use .forEach() -- which I learned the hard way before I asked this question
 
forEachOrdered
 
But.. Isn't that what I said? :(
 
fge
Yep, this will preserver ORDERED
 
I'm so bad at expressing myself I should just shut up
 
fge
But I didn't believe at first that .forEach() would f* up Spliterators which, by themselves, were declaring that they were ORDERED in the first place
And it happens, that is does exactly that :/
As of today I still don't understand everything but I do understand quite a few interactions between a Stream (and its underlying Spliterator) and operations on that Stream
That said, I have a few other Java related questions :p
 
4:38 PM
Is it trivia day? :P
 
Well, it's good to spread the knowledge
 
I know! The questions are also brilliant. It just so happens that they don't get passed around here often, so it makes this occasion special.
 
fge
OK, here's the next one then
 
I'd happily see them more often. I'm bad at making them up though because I have formulation problem when expressing myself.
 
fge
You have to read some content from a web service, let's say over HTTP; the content type is declared as text/plain;charset=xxx
We are going to assume that xxx is a known charset to Java
 
4:48 PM
like UTF-8
 
fge
How do you ensure that, indeed, the content sent to you is valid text content according to this charset, that is, how do you make it so that if the content sent to you is not valid, you send an error back to the user?
Recall: from a client upload, all you get is an InputStream
How do you ensure that the bytes from this InputStream indeed are a correct byte sequence for the declared character coding?
 
Read it with Charsets.getByName("xxx")?
 
fge
No
Note that we suppose here that the Charset is known
Hint: there is a process which converts a stream of bytes into a stream of chars
 
hmpf
 
fge
^^^ at some point you did see that, right?
@Unihedron I was unfair; the Java Charset object is a fundamental part of the answer
 
4:55 PM
/javadoc Charset
 
@Unihedron java.nio.charset.Charset: A named mapping between sequences of sixteen-bit Unicode code units and sequences of bytes. This class defines methods for creating decoders and encoders and for retrieving the various names associated with a charset. Instances of this class are immutable. (1/25)
 
fge
But then the Charset object itself has some methods which are involved here
 
Thought: decode() after buffering the bytes in ByteBuffer?
 
fge
Another hint: one of them involves turning a stream of bytes into a stream of chars (nothing to do about java.util.Stream!)
@Unihedron you're getting close
@Gemtastic any idea? :p
 
Guess what?
I gotta sleep, night! :p
 
fge
4:57 PM
@Unihedron I'm not the one to take guesses, I always lose :p
 
@fge Plenty, but they aren't the answer you're looking for :P
 
fge
Well, OK, here's the solution then :)
@Unihedron still there? This will be interesting
 
@fge ohh?
 
fge
OK, so here's the gist
You have a Charset
Which means you can obtain a CharsetDecoder from it
And this particular class has a method called .onMalformedInput()
This takes a CodingErrorAction as an argument
There are three values to that action: REPLACE, IGNORE and REPORT
The default action in the JDK is, yes, to REPLACE
This is why you see that pop up from time to time
But here we want to REPORT
Therefore the solution is to create a CharsetDecoder with this action. Provided the Charset here is named cs we do: cs.newDecoder().onMalformedInput(CodingErrorAction.REPORT)
And we feed that CharsetDecoder into an InputStreamReader which wraps the InputStream matching the data sent to us by the client
Job done!
 
ohhhhh
awesome
and this is why IT is a well-paid job :P
given infinite monkeys and their typewriters, they might code that program you specified.
 
fge
5:05 PM
@Unihedron believe it or not, but in 10+ years of systems engineering experience I didn't understand any of it; it is only when I started to investigate this stuff (largely due to largetext) that I understood the real mechanism behind it all
That is, I understood, and could explain that, only barely south of age 40 :p
Which means that I am, ultimately, an imbecile
 
5:20 PM
@Gemtastic These aren't the droids your looking for..
 
fge
(well, I did have an idea thanks to the iconv command)
 
*you're
 
@Dustiny what about these?
 
hi guys
anyone ever used spring jpa specificaiton to do a "groupby" on results?
i'm trying to get this setup but, not sure how to do it
 
@Gemtastic exactly what you're looking for!
 
5:24 PM
Hi, do you know in this: String.format("Welcome %1$s to %2$d"","Name",2); what is meaning of %1$s and %2$d?
 
did you copy that off of a website?
 
%1 = "Name" and $s =String . Aka tells the formatting to enter the first argument and it will be a string
%2 = 2 and $d =Integer . Aka tells the formatting to enter the second argument and it will be an integer
But my question is, what does "Welcome Name to 2" even mean?
 
5:41 PM
Why does it have to have the 1,2, and $?
Isn't %s and %d enough?
 
5:54 PM
My question is what is role of $?
 
fge
@Gemtastic not if you revert the order of arguments
@M.S. positional matters
 
no i mean what does that signify or what is its use here?
 
fge
%1$s is to be separated in % --> "OK, that a substitution", 1$ --> "OK, the first argument of the Formatter, s --> "OK, this tells how I should format it"
 
ok
 
@fge I see
 
fge
6:00 PM
And by defaut s means caling .toString() on the argument
 
There is confusion here. Why does compiler needs to call .toString() to the argument although argument is a String and if it is not String, it will generate an exception.
 
Because it's bad code to put the string like that, it should be in side an object
 
 
2 hours later…
fge
7:43 PM
@M.S. sample code please
 
2 hours ago, by M.S.
Hi, do you know in this: String.format("Welcome %1$s to %2$d"","Name",2); what is meaning of %1$s and %2$d?
 
fge
@Gemtastic this shouldn't generate an execution error
In fact, writing %s and %d is equivalent here
(instead of %1$s and %2$d)
If it isn't, I'm stumped
Sorry but I just can't resist. And again...
^^^ just listen to all three instuments at the same time on the first tune
Or, at least, try to :p
It's just formidable
 
I was finding it very trippy the cymbal work before the drummer even sat down lol
 
@fge You misunderstand, the person wonders what the symbols for the formatting are
Not why it isn't working but why it is.
 
@fge I can do it for a while, but then my attention keeps diverting to the bass lol, guy is just groovin' ~~(^.^)~~
 
fge
7:57 PM
@Dustiny then listen to it again :p
By the way the bass player is named Jean-Marc Jafet
 
They're all awesome musicians
 
fge
And the first tune is, in fact, the bass player's composition
 
Makes sense, the guitar is a lot louder but the bass shrines through real nice
I'm a drummer, but I don't think I could ever play jazz music lol (for more then a single song)
 
fge
Well, then you certainly acknowledge the talent of that particular drummer ;) Not surprising since he is one of the best jazz drummers in existence :p
 
Oh yeah, he's stellar!
My issue isn't with the genre, I just like to beat the crap out of my kit lol
 
fge
8:07 PM
Well, he is the proof that you don't need to :p
If you actually look at him play, he just caresses his gear all along
But my word how he knows how to do that
My favorite musician still remains the guitar player though
 
Yeah most people don't need to destroy their drums, but I definitely surpassed desire and now need to beat mine, tapping just won't do
Also playing heavy rock in a band, you'll get overpowered if you don't haha
The guitar player is unreal
 
fge
Well, he's basically the best jazz guitar player you can imagine :p
 
I'll have to bookmark this
Here is my favorite song to drum
Bit of jazz guitar in there for yah.
 
 
3 hours later…
11:06 PM
Hey well I decided to learn java in order to start android development but I don't know what resources to use, I don't really like reading a book and would rather have a video tutorial, I didn't like the official java tutorial either. Do you have any good resources?
 
03:00 - 14:0014:00 - 00:00

« first day (1672 days earlier)      last day (3252 days later) »