« first day (1586 days earlier)      last day (3350 days later) » 

8:05 PM
@Unihedro what is the pros and the cons of naming a method this way?
public void funcName_(){}
 
You mean with an underscore?
 
yeah
 
why would you do this?
 
@Vogel612 just for knowledge purposes.. though, if it does no harm it could help me reading my code better
does it?
 
what the fuckity fuck fuck fuck
"s" == "a"
clearly doesn't work
but this does
args[1] == "a"
 
8:16 PM
Huh?
 
where args is a string array
 
What's args?
 
wtf what what
 
Given the context it shouldn't even compile.
 
lol
 
8:16 PM
well it did.
and it runs without bugs.
this is in if statements btw
example
	    else if(args.length == 3){
			if(args[1] == "1"){
			    gametype.append("cha");
			}
			else{
			    gametype.append("hca");
			}
	    }
 
8:29 PM
hey..
 
@DonLarynx You know that args[1] is actually the second one, right?
Just making sure.
 
yeah
but the fact is that this code still compiles
 
@DonLarynx Why wouldn't it?
 
@SecondRikudo because you're comparing strings
 
Code point, forgot that Java sucks in that regard.
 
8:40 PM
how can i pass function as a variable?
 
9:12 PM
Hi
 
9:26 PM
@somefolk In Java? No.
 
fge
9:47 PM
Well, you can pass an instance of a @FunctionalInterface
But Java has no function type
 
YOU
9:59 PM
document.getElementById("ioaj").value = (document.converter.operation.value - 32) * 5 / 9
/* Select "ioaj" by Id and set/return output of (operation value) minus 32 multiply 5 Divided by 9 into "ioaj" ID input field*/

Is this correct comment?
 
 
1 hour later…
11:24 PM
Hello guys.
What do you prefer Maven or Gradle ?
 
Gradle: It's not even a subjective choice, it's better, and has better integrations.
 
I am making first step in Gradle. What do you recomend to read about it?
 
the manual
 
@somefolk You can't because Java does not support closures as a functional type as other languages do. You can however pass a representation of a method, such as a lambda form of a method, but that requires an explicit, matching function.
In Javascript:
function foo(bar) {
  // treat bar like a number
  return bar.toString(); // or some string
}
qux = foo // reference to a method
 
11:30 PM
someone say js?
 
In Java (functional representation, for sake of matching the JS example):
 
@Unihedro num.toString() > ""+num
:P
 
thanks
 
.. this, this is why I lurk :P JS is everywhere :)
sorry I intruded, carry on
 
inner foo[(int bar) -> String] {
  return Integer.toString(bar); // or some string
}
@FunctionalInterface interface IntToStrMapper { package-private String arbitraryName(int bar); }

IntToStrMapper qux = this::foo; // representation of a reference to a method
Not an actual function type
@rlemon yes it is, even in the air
 
11:34 PM
earth.components.push(require('atmosphere')());
 
Hmm, the require() is a node component that imports the atmosphere, which treats it as a constructor? It is then pushed into earth.components, as if it were an array?
 
yes
it's js, don't ask it to make sense
 
That's the thing I have a distinct worry from using Javascript... Everything, even the prototype symbolic representations, are public, eventually the way you use a method stops making sense
But in Java, at least even the most bundled code looks like this:
 
Hey guys and gals, just picking up java again, I have a for loop to assign random numbers to array, but for some reason, a random number is being assigned to the last index of the array, all other positions return o
```
for(int x = 0; x < INPUT_SIZE_1; x++)
{
this.input1 = new int[INPUT_SIZE_1];
this.input1[x] = gen.nextInt(UPPER);
}
```
am i missing anything obvious? sorry
 
inOrder(foo).bar(); inOrder(bar(), times(2))
@RobMullins that's github markdown
Also, can you specify the constants and types of your variables used?
Wait, never mind.
@RobMullins yes
You're creating an array every time in the loop and erasing everything that's been done previously in earlier iterations of the loop, effectively voiding your effort of assigning to indices 0 to INPUT_SIZE_1-1.
 
11:42 PM
ahhh
wow
thanks
 
For example, say that stupidly named constant is 3, you're creating three new arrays.
 
yup i get it, thanks man
 
The first indice of the first array is assigned, but it's thrown away.
Et cetera.
You should move the new thing to before the loop, and the loop body should be only of the assignment.
If you're in Java 8, you could probably use streams to make your code compact and neat'er.
 
hmm what do you mean by streams
 
You know what Java 8 is, right?
 
11:45 PM
im assuming im using the lastest version
 
IntStream.range(0, INPUT_SIZE_1).forEach(x -> {
  input1[x] = gen.nextInt(UPPER);
});
 
nice okay, im mainly php so this looks more familiar
 
Ugh, fill doesn't take suppliers.
 
whats the benefit of a stream
or can you point me to a good reading
 
It's streamlined.
(pun unintended.)
 
11:47 PM
lolol im sorry i dont know what something being streamlined means
 
Eh, I suppose that you can chain things.
And prevent writing explicit loops.
It usually makes your code cleaner and neater.
 
okay cool, I'll look into that. thanks for pointing out my error before
 
It also makes use of a lower abstraction layer known as dynamic invocation (invokedynamic) of a metafactory, aka the expression:
x -> { [code] }
isn't compiled into a condensed class, instead is represented by a constant of "int -> void [code]" which the JVM takes care of with a metafactory implementation.
Which, comes with linkage performance, free spin up time, lazy initialization and therefore less memory consumption, all that good stuff.
Don't abuse streams though.
 
yeah I'm not really sure I'm on that level yet anyway. I have to use java for class
 
gotcha
 
11:53 PM
btw, while im here, according to convention, does package import occur before or after docblocks?
 
at least now you know how to fix it
before
wait
 
kk cool
 
I usually do it like this:
// copyright things
package

// citation decisions and justifications, if necessary
/** doc */
type { [body] }
 
alright that's actually how i have it now
 
Is there a way to suggest a feature into the Java API? /* cc @fge */ I want java.util.function types of variables in the Arrays class, like Arrays.fill(<?>[], Supplier<?>) which allows an at least more sane way than assigning constants into every field.
This function is stupid anyway:
/**
 * Assigns the specified int value to each element of the specified array
 * of ints.
 *
 * @param a the array to be filled
 * @param val the value to be stored in all elements of the array
 */
public static void fill(int[] a, int val) {
    for (int i = 0, len = a.length; i < len; i++)
        a[i] = val;
}
 

« first day (1586 days earlier)      last day (3350 days later) »