« first day (1666 days earlier)      last day (3274 days later) » 
00:00 - 20:0020:00 - 21:00

12:51 AM
hey guys
has anyone worked with git before?
 
fge
Of course
What developer worth the name hasn't?
 
lol I was in the impression may be people have used SVN more than git
 
fge
That was true maybe 5 years ago
But nowadays git is the SCM of choice
You have more people with working knowledge of git than svn
 
I am having weird issue, I have cloned one of the open source project and imported as a maven project in eclipse but all the structure is messed up
I do have a question here opened
0
Q: importing maven project is messed up in eclipse

user1950349I cloned one of the open source git repositories and was trying to import it as maven project in eclipse. After I imported everything as a maven project, whole package is getting messed up. See the below error: How can I fix this issue so that I can build it on my local box? I am trying to bui...

This is the open source project I am talking about - github.com/yahoo/Pistachio
I have never seen this issue before in any of the maven projects I have worked in the past
 
fge
Uhm, how is this related to git at all?
 
rao
1:05 AM
hey awesome folks can someone help me understanding big o for a few for loops
for(i=1,i<=n; i=i+2){//end}
 
its not related to git, I was going to ask somebody to see whether they are seeing same issue
after importing the project from git
 
rao
I believe the program should be a logn am I right?
 
so that's why I asked if anyone has worked with git before so that they can check out to see whether it fails for them as well
 
fge
No idea, I don't use maven anymore; but the results would have been the same had you imported your project from any other SCM which is not git
 
or its me only.
All other projects worked fine, this is the only project which is having issues for me
 
fge
1:08 AM
@rao this all depends on the contents of the code block in the for loop
 
rao
@fge its just for(i=1,i<=n; i=i+2){
//one fundamental operations
}
 
fge
Define "fundamental operations"
 
rao
say cout <<
is a fundamental
 
fge
They may not be as fundamental as you may thing
 
rao
basically no ++ within the for loop
 
fge
1:11 AM
s,g$,k,
cout has side effects, so it is not really a candidate for a big O calculation
I can provide you with a cout that blocks, how do you estimate your big O?
 
rao
ok how about a basic adding 2 numbers
I am new to this big 0 concept
Is i = i +2 and i=i*2 one and the same when it come to big O
since both are incrementing by 2's
 
fge
Erm no
The second is a multiplication
But if you want to do such a calculation you should not reason like this
 
rao
well if i say for ( i = 1;i<=n;i=i+2) { } does it not come out to be the same as for ( i = 1;i<=n;i=i*2) { }
first gives 1,3,5,7,9 for n = 10
 
fge
That has nothing to do with big O
 
rao
second gives 2,4,6,8 for n = 10
I am trying to understand what big o would be for the above cases
 
1:16 AM
second gives you 2,4,8
 
fge
The same; as I said, what matter is what is within the {}
 
rao
I am sure I am not doing a good job explaing
 
fge
The only thing that the for loop does is define a set on which you are working on
That the set has size 1, 5, 10, 10^4, 10^19 is irrelevant
 
rao
if say I have pure int k = 0; int x = 1; int z = x+ y inside the for loop
 
fge
You operate on a set of n elements; you want to compute a result out of this set; how much time does it take to compute that result, where n is the size of the input?
That is what big O is about
O(n) means that the time is proportional to the size of the input
 
rao
1:18 AM
so in both the cases where i = i + 2 and i = 2*i i am saying big o should be log n am i right on it
 
fge
O(1) means that the time is constant and does not depend on the size of the input
 
rao
since they reduce by half exactly
 
fge
NO
You didn't listen to what I say
 
rao
:(
 
fge
The only thing that for() does for you is define your initial inputs, a set of size n
The ONLY thing that matters is what is inside the {} since this is where you operate on the elements of your set
 
rao
1:20 AM
in my case the only comment inside the for loop is //perform 1 fundamental operations // endfor
 
fge
Although using a for loop guarantees that you'll have at least an O(n) time
For instance, you want to calculate the sum of all natural numbers from 1 to n
You can do it in O(n): for (int i = 1; i <= n; i++) ret += i; return ret;
But you can also do it in O(1): return n * (n + 1) / 2;
Your input here is a set of size n [1 .. n]
The first algorithm runs in linear time: O(n)
The second algorithm is independent of the size of the input: O(1)
 
rao
hmm
makes sense
 
fge
More generally speaking there are algorithms which run in polynomial time: for an input size of length n, there exists a finite number p so that an algorithm exists that is guaranteed to complete in at most n^p time units
Those are algorithms which are called P in CS jargon
There also exist algorithms which run in non polynomial time, for instance in O(n!), O(2^n) etc
Those are called NP
And the most fundamental and famous problem in CS is: are P and NP the same?
If this is true then this means that any NP algorithm is reducible to a P algorithm
But the general consensus is that P is not NP
Still not proven, though
The one who is able to prove that, one way or another, will be filthy rich and unhealthily famous
Note that O(1) and O(n) are in polynomial time
It's just that for those estimations, p is 0 and 1 respectively
 
rao
woah all above my head now
got to sit down and read the basics of big 0
fun weekend :)
 
fge
That's the basics of algorithmics you want
Big O is but a consequence of those, and a permanent field of study in computer science
Another permanent field of study is the halting problem :p
This latter problem is just as fascinating as P = NP
 
1:38 AM
@fge what the use of URL in xml? like for this instance xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
and basically this URL never exist
 
fge
No idea, I don't do XML; but basically this just defines a namespace; the URI is kind of irrelevant here
 
 
2 hours later…
4:00 AM
Weird question - Can we make self-driving cars with Java technology incorporated to control the GPS positioning, camera data process management, self-regulatory safety procedures?
 
 
2 hours later…
fge
6:18 AM
@MissionCoding probably so; now the question is "why"
 
 
2 hours later…
fge
8:33 AM
Heh, nice
With assertj-core-java8 you can do assertThatThrownBy(some::throwingCallable)
 
Morning
 
Morning
 
fge
Moo too
 
Moo three
 
fge
8:54 AM
Refreshing to code for the fun of it :p
 
I'm implementing WrapperIntStream implements CollectibleIntStream.
 
Ok, now to run a regex and create a CollectibleLongStream file with all Int -> Long :p
 
9:09 AM
Long story Short?
 
fge
@Unihedron use what IDEA has to offer instead of using a regex here
You can delegate methods
Just create the class, pass it a LongStream as an argument, and tell IDEA to generate delegation methods
 
wait, really?
 
fge
Yes, really
 
:O
 
Apart from the pom, and the places I've linked in my intelliJ question, are there any other places to set the language? Could it be that a dependency sets it awry?
 
fge
9:15 AM
@Unihedron ^^^
 
Ok, I can't find an option to delegate methods, + I have no idea how to, so I'm looking up the manpages now :p
Is that the alt+shift+a godbox?
 
fge
Hmwell, I use Alt+Enter myself
 
erm
it hanged when I use alt + enter in class scope
 
fge
Huh
Here it doesn't...
Oh, sorry
It's Alt+**Insert**
:/
 
Oh no wonder I couldn't find it :p
welp terminating
Eh, my desktop crashed
but my secondary desktop still works, that's weird
dammit unity engine
 
9:22 AM
gud aft
 
fge
Eaaasy
Hmm, next for arrays
And after that, Stream
 
10:03 AM
@fge wanna review my answer? stackoverflow.com/a/30274257/3763850
@Uni can too if he wants to ;P
 
Thanks~
 
fge
10:20 AM
@Gemtastic upvoted
And now I wonder whether I'm the only one out there to use IDEA's default theme and not the dark one...
 
You think it was a good answer? That's good. Let's hope it helps the asker ^^
@fge funny enough I still use the white NetBeans one
NeatBeans, not many who share that opinion XD
 
fge
Hmm, NetBeans
I need to download and install it to test daimor's COS plugin
 
@Gemtastic @Unihedron @fge hello guys, i am having some silly issue in parsing a complex ksoap2 response ,i am able to parse only upto one level after which parser is not identifying parameter ,can anyone please help me out with this?
pastie.org/10191778 ksoap2 response
 
fge
@jenil don't arbitrarily "ping" people on chat, this is considered rude
 
oh sorry
 
fge
10:27 AM
Also, I can't help but quote Postfix's SMTP reply: "550 5.0.0 Polite people say EHLO first"
And I don't do soap nor ksoap, so I really can't help, sorry
 
there was a hello..
 
@jenil cool cool
 
fge
@Vogel612 Yeah indeed, my bad
 
String imageString = (String) req.getParameter("imagedata");
BufferedImage image = null;
byte[] imageByte;

BASE64Decoder decoder = new BASE64Decoder();
imageByte = decoder.decodeBuffer(imageString);
ByteArrayInputStream bis = new ByteArrayInputStream(imageByte);
javax.imageio.IIOException: Error reading PNG image data
 
fge
Hehe
multiterator is really fun to do
 
10:56 AM
I don't know anythign about ksoap either
 
@fge What is it about?
It sounds nice
 
fge
Right now I'm factorizing code
 
11:13 AM
... windowed multiterator sounds like a weird idea
It's basically round robin grouping, isn't it?
 
Hi all :D
We got an extension for the TSP :D Because everyone is messing up
 
oh boy, that sounds bad
 
fge
@Unihedron no, there's no round robin
 
erm
I can't think correctly atm
brb coffee break
default <T, V> V collect(IntCollector<T, V> intCollector) {
    return intCollector.finisher().apply(
        collect(
            intCollector.supplier(),
            intCollector.accumulator(),
            intCollector.combiner()::apply)
    );
}
something about it tells me it's bad
Maybe I should use this.<T>collect
Hmm, just saw this: List<Person> persons =...
when you see it...
 
fge
11:38 AM
@Unihedron what makes you think that?
Well, if I were you I'd rename T to A and V to R, to be consistent with Collector
But apart from that I don't see a problem
 
hellow all
 
@fge My T is equivalent to Collector's T in T, A, R
 
fge
Err
No
It's equivalent to A
 
Maybe I should extract the collect() call and then use the result in apply(), but as of yet the nesting is bad
@fge Oh yeah it is
 
fge
T is the type parameter of the elements of the stream in a collector
And here those are ints
 
11:42 AM
ok I changed it
 
Any idea how to implement the held-karp algorithm?
 
fge
@Unihedron so, what do you think is wrong with your approach?
 
the nesting
I changed it to using T result = collect() and then return ...apply(result)
 
fge
Hmmthen what about this? Create a base implementation of IntCollector and override the existing collect() method so that it calls this implementation with Function.identity() as the finisher
And then implement .collect() on your own
 
I can't because I didn't write the IntStream interface.
 
fge
11:52 AM
That doesn't prevent you from overriding methods, now, does it?
 
Eh, then how would a user get a class with the implementation of my-IntStream while still able to use the base implementation?
 
fge
I don't see where you see a problem?
The only thing is that if a user implements your IntStream she will have to override your .collect(), not IntStream's
 
Yeah but a user who has a JDK IntStream, namely from Arrays.stream(new int[]{1, 2, 3}), wouldn't be able to use methods from my IntStream
 
fge
Obviously so; she will have to use one of the methods you provide
 
    default <R> R collect(Supplier<R> supplier,
        ObjIntConsumer<R> accumulator,
        BiConsumer<R, R> combiner) {
        return collect(new IntCollector<R, R>() {
            @Override
            public Supplier<R> supplier() {
                return supplier;
            }

            @Override
            public ObjIntConsumer<R> accumulator() {
                return accumulator;
            }

            @Override
            public BinaryOperator<R> combiner() {
                return (r1, r2) -> {
like this?
 
fge
12:04 PM
Erm, return null in the combiner?
 
eh, the return value of IntCollector is unused anyway
that's why JDK IntStream has this:
<R> R collect(Supplier<R> supplier,
              ObjIntConsumer<R> accumulator,
              BiConsumer<R, R> combiner); // <- BiConsumer instead of BinaryOperator
 
fge
Then just throw new UnsupportedOperationException
That's better imho
Ah, OK, I see what you mean
My bad
 
no worries
though frankly the collect() method is confusing, because the primitive types exploits how R (the accumulator) has to be mutable
wait hold on
if Stream.collect combiners takes care of merging partial elements, why doesn't IntStream.collect finisher do that as well?
 
fge
Because the finisher operates on the "finished product"
That is, it will only be called when the A is fully generated in <T, A, R>
 
ahh
 
fge
12:12 PM
But anyway that's a good question... Why are primitive Streams combiners BinaryConsumers and not BInaryOperators
That's fishy
 
wait I found something
<R> R collect(Supplier<R> supplier,
              BiConsumer<R, ? super T> accumulator,
              BiConsumer<R, R> combiner);
this is the Stream.collect method
its Javadocs say this:
 List<String> asList = stringStream.collect(ArrayList::new, ArrayList::add,
                                            ArrayList::addAll);
Why would ArrayList::addAll match BiConsumer<ArrayList> ?
 
fge
Well, it does
In the same vein that Path::toAbsolutePath matches a UnaryOperator<Path>
 
ah
ok now I have a new problem
How am I going to implement .collect(IntCollector) now since I can't access the implementation of the underlying Spliterator from StreamSupport?
ugh I can't access IntPipeline<E_IN> container, it's package-private
 
fge
Implement the Spliterator yourself? ;)
 
so I'm going to implement my own Spliterator, my own Stream pipeline, my own AbstractPipeline, and my own Characteristic flags?
oh and PipelineHelper<E_OUT>
also, Node.Builder<T> and Sink<T>
Even Sink is private too, that means I can't implement that
oh I only have to implement Spliterator
 
fge
12:25 PM
Yes, "only"
Well, it's not hugely hard
s,hugely,,
 
ummm
If I implemented my Spliterator for int, then I can't turn that into a CollectibleIntStream
...
why??!
 
fge
Wait, you implement Spliterator.OfInt, right?
 
yes
but to turn Spliterator.OfInt into Stream, I'd have to throw it through StreamSupport.intStream(spliteratorOfInt) and that gives an IntStream, a JDK one
the underlying Spliterator of IntStream.range is in AbstractPipeline.sourceSpliterator, for instance
 
fge
1:01 PM
sigh It appears that many people find flaws with Stream; throwing-lambdas is far from being the other "supplemental Stream package" out there
JooL, javaslang... And there are probably more
 
@fge I managed to make my adjacency list
 
fge
Good
 
-10
Q: Naming conventions Google?

S.D.Ran into : fyiWillBeAdvancedByHostKThx() What would be a sensible alternative name for this method ?

a 15.2k rep ask like this, how come!
 
1:42 PM
High rep users suck.
Just kidding.
 
fge
Spliterators are easy, in fact :p
 
@deadlydragon00 Well, that was asked in 2013, so they weren't 15.2k rep when they asked it, for sure
@fge yes but making it work with custom stream interfaces aren't
 
fge
Yeah, the JDK doesn't make it easy to implement your own Streams
In fact you have to rewrite pretty much everything :p
 
don't remind me
i'll just... call toArray() first, then operate on that
 
1:56 PM
Morning, Java!
Ugh. I hate it when I kill the chat. :/
 
2:11 PM
OMG
ARRRRRRGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
while(1)chat('H')
implementing this collector thingy is going to suck for primitive streams
 
 
1 hour later…
fge
3:34 PM
    return IntStream.range(offset, offset + windowSize)
        .mapToObj(index -> values[index])
        .mapToInt(Objects::hashCode)
        .reduce(1, (x, y) -> 31 * x + y);
Eaaasy
 
3:48 PM
Is there a clean way of iterating over each character in a String?
Other than using a for loop and charAt().
 
Yes
@Michael: for (char each : str.toCharArray())
 
@Unihedron That's horribly inefficient. Calling the toCharArray() method creates a copy of the String.
 
@Michael look at the implementation
in JDK
 
@Michael no why?
 
it's an O(0) method
 
3:52 PM
IIRC it returns a reference to the underlying storage array.
 
I guess it is indeed horribly inefficient for some definitions of inefficient
 
Can anyone answer please :)
 
@Sabir no
 
@Vogel612 But that would make the String mutable.
 
Okay @Unihedron
 
3:53 PM
@Michael no
 
fge
@Michael string.chars()
It creates an IntStream
 
@Unihedron Please explain.
 
fge
And string.codePoints() iterates over code points instead
There's another solution
 
@Michael What are you looking to explain? Your assumption is wrong, that's all. :P
 
@fge Thanks. Code points are for Unicode, correct?
 
fge
3:54 PM
Wrap your String in a CharBuffer and call .get()
Yes they are
/javadoc CharSequence#chars()
/javadoc CharSequence#codePoints()
 
/about
 
@Unihedron How so? If String.charArray() were to return a reference to the underlying character array, you could modify the array and, thus, modify the string.
 
@Michael toCharArray.
 
fge
@Unihedron your assumption is wrong; .toCharArray() does create a copy of the array
 
@fge For VM implementations, not JDK
 
3:56 PM
"Converts this string to a new character array."
 
fge
Sorry but you are wrong; the javadoc says so
 
OakBot Online.
 
fge
/javadoc CharSequence#char()
 
@fge Sorry, I can't find that method. :(
 
fge
Argh
/javadoc CharSequence#chars()
 
3:57 PM
@fge IntStream chars(): Returns a stream of int zero-extending the char values from this sequence. Any char which maps to a surrogate code point is passed through uninterpreted. (1/2)
 
fge
/javadoc CharSequence#codePoints()
 
@fge IntStream codePoints(): Returns a stream of code point values from this sequence. Any surrogate pairs encountered in the sequence are combined as if by Character.toCodePoint and the result is passed to the stream. Any other code units, including ordinary BMP characters, unpaired surrogates, and undefined code units, are zero-extended to int values which are then passed to the stream. (1/2)
 
Wait, this is only since Java 8, right?
 
fge
@Unihedron the behaviour of .toCharArray()? Certainly not
 
those two streams are since 8, but toCharArray() has always done a copy
 
fge
3:59 PM
That would be a HUGE change in the API if that were the case
You are probably mixing with .substring()
 
(and has to, since there's no way to make array contents immutable)
 
fge
Indeed, its behaviour has changed in Java 8
 
/**
 * Converts this string to a new character array.
 *
 * @return  a newly allocated character array whose length is the length
 *          of this string and whose contents are initialized to contain
 *          the character sequence represented by this string.
 */
public char[] toCharArray() {
    // Cannot use Arrays.copyOf because of class initialization order issues
    char result[] = new char[value.length];
    System.arraycopy(value, 0, result, 0, value.length);
    return result;
}
 
quite obvious copying there
 
yes
pfft
 
fge
4:21 PM
^^^ Comments welcome
 
cool beans no clue when I need it
 
fge
Me neither :p
I just did it for the kicks :p
(like pretty much all of my projects, really)
 
You have great ideas though :p and even if they aren't, they are cheap to implement
well except for http/2
 
fge
In fact you can use this pretty easily to build a matrix out of a linear list
Multiterator.ofSize(lineSize).windowed().over(theArray).stream().map(values -> values.stream().toArray(T[]::new)).toArray(T[][]::new)
 
that's not exactly my definition of easy
 
4:34 PM
That don't look easy to me. xD
 
fge
Done :p
 
Won't T[]::new throw an error for generic array creation?
 
fge
Yes, that was an example; substitute that with your actual type
Well, that's refreshing after three weeks non stop working on parsing that darn language :p
 
:p
 
fge
Now on to the primitive versions...
 
5:04 PM
Hey everyone.. I hope you can help me with this one : stackoverflow.com/questions/30276953/delay-time-on-slideshow
any help would be appreciated
 
@fge Your mom's a primitive version.
 
@Mdermez That is JS
 
oops wrong room :/ sorry :/
 
Off to lunch. Later @all!
 
fge
5:35 PM
Hmm, speaking of multisomething, a multistream would be really nice to have too
Although I believe there is an implementation already...
 
 
1 hour later…
6:48 PM
@ItachiUchiha Hey man, how I shrink/grow text as the user resizes the screen in javafx FXML?
 
use em values for font-size..
well that's standard css though..
 
What does this mean in Java
<<
The double arrow?
 
So I should use a window listener that changes the em values of the text font as the windows resizes?
 
NVM got it
 
@LuisAverhoff no, that should happen automatically...
if I understood em correctly..
 
6:53 PM
ok thanks
 
fge
7:24 PM
sigh it has always escaped me why you can define in Java an interface/class (abstract or not) with a circular reference to a generic type, such as Foo<X extends Foo<X>>
I use that a lot but I'm darn unable to explain why it's legal :/
 
7:43 PM
Can anyone explain to me that piece of code? pastebin.com/ART83m6Y
 
fge
@Sabir first of all this piece of code is poorly written imho
 
I'm not understanding how it finds the cost based on the adjacency matrix
Is there a way to rewrite this without bitwise shift?
 
fge
Bitwise shift is very efficient; however this is not your main cost here
But you can use a BitSet
Anyway, this code suffers a fundamental flaw which is very often seen
 
Can i use normal thing like [i<1] ?
Because I have my adjacencyMatrix and this short code gets the cost
It's so short and works. But I want another way not using bitwise or bitshift
@fge do you mind explaining to me that piece of bitwise code.
 
00:00 - 20:0020:00 - 21:00

« first day (1666 days earlier)      last day (3274 days later) »