« first day (1469 days earlier)      last day (3458 days later) » 
03:00 - 16:0016:00 - 00:00

3:23 AM
yo!
 
 
3 hours later…
5:54 AM
hello I need help
I want to find a plus pattern in a 2d array
{' ', ' ', 'p', ' ', ' ', ' ', ' ', ' ', ' '},
{' ', ' ', 'p', ' ', ' ', ' ', ' ', 'x', ' '},
{'p', 'p', 'p', 'p', 'p', ' ', 'x', 'x', 'x'},
{' ', ' ', 'p', ' ', ' ', 'y', ' ', 'x', ' '},
{' ', ' ', 'p', ' ', 'y', 'y', 'y', ' ', ' '},
{'z', 'z', 'z', 'z', 'z', 'y', 'z', 'z', 'z'},
{' ', ' ', 'x', 'x', ' ', 'y', ' ', ' ', ' '}
here p is in a plus pattern
also y
how can I check this all?
 
 
1 hour later…
7:15 AM
hi, anyone played with java 8 lambdas/method refs?
what is the best way to make a method accept a generic "lambda/method" as a parameter
other than accepting object and inferring from there whatever the method might be...
 
7:29 AM
Hey guys, anyone got a minute?
 
7:42 AM
@AnttiHaapala You there bro?
 
Think you could offer a helping hand? :D
:)
 
fge
8:29 AM
@AnttiHaapala what do you mean by generic?
 
8:44 AM
Java 8 is incredible.
 
@fge not <generic>...
 
fge
@AnttiHaapala so, what do you mean?
@Unihedron yep, there's a lot of good stuff in it
Still no immutable collections though
 
com.google packages ftw
new ImmutableMap.Builder() has to be my favourite
over Collections.immutableMapOf()
 
so basically I want to make a facility that can be used to register unary ... n-ary lambdas... and then I optionally want to be able to infer what arguments they expect...
so this is about "how much hackery we can use to do as little boilerplate as possible"
in the perfect example I could write: registerAdapter((int x, String y) -> y + x);
and the code in registerAdapter could infer that "ok, the lambda we are given really expects int and String and returns String"
 
fge
@AnttiHaapala uh, well, the argument to a method will have to be a functional interface
 
8:50 AM
So, we could limit n to 8 and have unary function, binary, and so on ...
for 8 functional interfaces
but still, the code should be able to know we are talking about Integer and String, not Object.
 
fge
Uhwell...
 
*int and String
as I said this is hackery
 
fge
<T, U, R> void registerAdapter(final BiFunction<T, U, R> f)
 
yes
but registerAdapter cannot know the argument types directly
it just sees "object, object, object"
however they are available somewhere :D
 
fge
Sorry, you lost me completely
 
8:53 AM
^^^^^
 
You must infer types from the bifunction class parameter!
Since you are not passing in generic types.
 
say BiFunction<Integer, Float, Double> f = (x, y) -> (double)(x + y);
asking by reflection what are the methods there,
it says:
public java.lang.Object lambdatest.Test$$Lambda$1/2055281021.apply(java.lang.Object,java.lang.Object)
but I am pretty sure there is a way to know better, someone hinted at SerializedLambda knowing it...
while lots of else is implementation detail, serializedlambda needs to be compatible between different jdks...
In any case I can do:
registerAdapter(Double.class, arguments(Integer.class, Float.class), (x, y) -> (double)(x + y))
 
fge
WHat is serialized is not the lambda itself
It's the recipe
 
it is SerializedLambda
 
fge
8:58 AM
It is up to the VM to link at run time
 
hello every one
 
fge
Are you talking about CallSite?
 
hi
 
8:58 AM
is there any one working on WebSphere
 
I mean yes and no
this is what gets written to objectstream whenever a lambda is serialized
If I could get that information captured the easiest way
 
Hail
 
hi
Is a vararg argument effective or should I avoid it when I don't necessarily need it (e.g. when the implementation contract is that String.. must have either 0, 2 or 4 objects
I just wondered since it pushes an array.
 
fge
@Unihedron well, at runtime it is just an array
 
Issue fix :)
 
9:11 AM
@fge Is it initialized or constructed? If later, I'm probably not a fan.
 
I have interesting problem on windows
 
fge
@Unihedron sorry I don't understand... It is "just" an array, so it is handled like any regular Java array
 
My Java application succesfully working on Win7.
 
@fge ok
But String.format("%s %s", "hi", "bye") passes {"hi", "bye"} into the parameter as varargs, is that through construction or runtime initialization? @fge
 
Java application connect to DB and fetch some data and write them to XLS file. But in win8 application open fetch data and last information of application Jpanel says "examplefile.xls created under C:\examplefile.xls" when i go to C:\ location file is not here. Why Win8 not write to C:\ ?
When i launch application in my laptop file created succesfully.
 
fge
9:20 AM
@Unihedron not sure what you mean, but it is strictly equivalent to String.format("%s %s", new Object[] { "hi", "bye" })
 
I try close UAC in Win8 but no help.
 
@fge Oh, I thought the Java Runtime could just create an array new Object[2] to place "hi" and "bye" into, then reuse where possible. 'Cuz it's Java.
18
Q: Allow Room Owners in chat room to be pinged as a group

FfisegyddIs it possible to add the ability for Room Owners (ROs), as a group, to be "pinged" in the same manner that a normal user can be pinged? At the moment, someone can ping me with @Ffisegydd. I propose that ROs should be ping-able with a similar "group" ping, say @RoomOwners or @ROs. This would all...

 
fge
@Unihedron well, maybe some JVM implementation will optimize it this way... Honestly I have no idea and I don't really care :p
 
@fge Cool, thanks regardless. I'll look at this later. :P
 
fge
I guess you want to javap your class to see what code is generated
But that will only show you the bytecode before JIT
 
9:25 AM
Thanks for the tip, I'll have to do that. ;)
 
fge
@Unihedron just out of curiosity, why do you want to know about that?
 
@fge premature optimization incoming
 
fge
Ah
Danger ahead ;)
OK, back to coding for me
 
Go code!
 
9:51 AM
Hi i have a question maybe anyone want look.
0
Q: Java FileOutputStream to C:\ in Win8

Black WhiteI have Java Desktop Application about statistic data generator. Application connect some DB and fetch data. Fetched datas writing to xls file and created in c:\examplefile.xls Application succesfully working and create desired file in c:\examplefile.xls in my Laptop which running Win7. But some...

 
Hi Black White,
windows does not like files created in c:\ ), because many viruses do writing in root of the disk.
could you change path to c:\somePath\examplefile.xls ? )
sorry for my english )
 
Ok trying
 
is there some limit for argument inferring
ah sorry :P
my mistake
 
fge
10:20 AM
0
Q: How to trigger calls to .serializeWithType() of a class implementing JsonSerializable in Jackson?

fgeThis is Jackson 2.2.x. I have a class implementing JsonSerializable; there are two methods to implement for this interface, serialize() and serializeWithType(). I want to test {de,}serialization of this class, and I can trigger calls to serialize() easily; not, however, serializeWithType(). Th...

 
@ita me want Ita
 
with almost no magic:
	    registerAdapter(
	    	String.class,
	    	arguments(String.class, Integer.class, Double.class, Exception.class),
	    	Test::adapter
	    );
and Test.adapter has proto public static String adapter(String s, Integer i, Double d, Serializable ser)
 
10:40 AM
@miniHessel at your service
:P :P
 
;D
@ita do you have like some time today to provide me some help ? :p
@ita or do you want to take it next week
 
I can advice you, but can't really help you..
 
I meant advice, sorry
 
Okay, say I have one controller: http://pastie.org/9687408

and then in my main controller class I do http://pastie.org/9687409

I know this will make you face palm, but how can I do this with good design?
also, when btnFinish event is triggered and the tab is created, I want that tab selected in the main controller
 
10:49 AM
Greetings
 
greetings
 
@mini I really don't have time to go through code
greetings
 
greetings
 
hi
 
@AnttiHaapala shouldn't you overload with FunctionalInterface to pass in lambdas?
 
fge
10:54 AM
OK, so there are still people who believe that non bocking I/O perform better than the traditional threading model
 
I really like commitstrip. Thanks @uni
 
:)
 
well, de-facto you still fire interrupts everywhere with IO, so TBH it could be worse @fge
 
@ita np :)
 
11:27 AM
BoundAdapter adapter = registerAdapter(
   	String.class,
   	arguments(String.class, Integer.class, Double.class, Exception.class),
    	Test::funnyAdapter
);

String s = (String)adapter.adapt("Foo", 1, 5.2, new Exception());
System.out.println(s);
works with this kind of syntax ;)
 
Good morning.
 
@AnttiHaapala You better include a space between the type and the object to be casted, for good formatting.
 
Frustrated by my German team yet again.
 
Morning!
 
What's going on?
 
11:28 AM
And the morning just got started
 
unihedron: like "never!!!"
 
It's always morning on the internet until someone has to go to sleep.
 
This team has been working with 90's technology forever. The Perl team. They've used Perforce for source control and I recently convinced them to begin using git.
 
@spoulson now what?
ahh
 
I took a look recently at the commit log and it's full of commits with decent comments (good), but none of them are prefixed with the JIRA issue ID.
So there's no context what the change was for.
 
11:30 AM
i see
 
:(
 
I gently remind the team to do this and why it's helpful.
Let me paste the first response
"I don’t yet understand how this could be used. You’re apparently looking at a view of the git commits that I personally don’t use. It does sound like unnecessary typing (which means more possibility of mistakes), since the information “TDCCLOUD-83” is already contained in the branch name. I also don’t like having to type something repeatedly in capitals."
 
hehe
 
Then proceeds to recommend a git post commit hook to decorate commits with the branch name somehow.
I already explained that once you merge branches, you lose the branch name it came from.
 
The awkward moment when you try to have a conversation about your life with a techno-illiterate.
 
11:32 AM
I started a reply, then decided they didn't deserve one.
 
That awkward moment when someone interrupts an interesting talk about developers with an awkward message.
 
The other teammate already made a git post commit hook to do it.
 
@Unihedron Well, I had nothing to contribute with but I still wanna chat :(
 
xD
No worries :P
 
Then you branch off and your own thing ;P
 
11:34 AM
This helped me decide that I need to talk to the boss.
 
pls take ma colleagues 2 course kthxbai
 
I'd prefer to be on another team, really.
This crap is so backwards here, and it's deemed ok.
 
Plz to gief good team nao
 
I wouldn't mind coding PHP if it meant wokring on a team that isn't full of whiney devs working with a broken process.
 
Just so you know @spoulson; this site exists:
 
11:38 AM
oh wow, I didn't know!
 
I dunno if that was sarcastic or not, but it feels more OnT than the Java chat :P
 
Yesterday I was working on a secret Java project.
Trying to see if I can write the gist of some of what this Perl project does in Java.
Still a work in progress.
 
Secret for work or secret from work?
 
Both, I guess. SAP has its own Javascript client framework, but this team would rather make 1995-looking sites.
And the most work the web app does is wade through thousands of YAML files to generate reports.
 
@spoulson It has stricter quality guidelines than Stack Overflow though, so poke around their meta first
 
11:43 AM
Some functionality exists to invoke commands, like deploy server. But there's an API be built for that now, that I could tie into.
@Unihedron Seems decent for general advice. It's not geared towards a dev workplace, specifically.
 
:(
Well, this site works best for you: http://chat.stackoverflow.com/rooms/139/java
^_^
 
Speaking of YAML, has anyone worked with YAML in Java?
 
me
SnakeYAML is a great library
 
I was using Snakeyaml, but it has a limitation with handling tags.
 
Ah.
 
11:45 AM
e.g. !!perl/hash:Some::Class
 
Anchors
 
I want it to disregard the tag, but there's no easy way. A couple feature requests asked for this and the author managed to talk them both out of it.
Says you should be in control of the YAML being produced. I do not.
And the doc is pretty slim on this use case.
 
fge
Argh, YAML
 
:/
 
fge
I really fail to understand why it was born at all
There's JSON, for cryin'out loud
 
11:50 AM
Well, JSON is missing a couple basic things.
Comments, for one.
 
fge
Frankly, this has never been a problem for me
 
You could use meta attribution.
 
Is Glassfish dead?
 
Alas, it was a great project.
 
:(
So, is it dead?
Is it good to keep using glassfish?
I really love it.
 
11:56 AM
Glassfish?
 
yup
 
Nani sore
 
It is a webserver
How will content based authentication be implemented in java ee
using tom-ee
 
:O
 
holy cow!
 
12:08 PM
Since when do cows go to church?
 
:D
from ancient time .
 
12:33 PM
Hi everybody. Anyone can give me an answer for this stackoverflow.com/questions/26674737/add-tag-to-xml-exception
 
12:53 PM
If I want to keep a map between two variables, is there any alternatives to hash map? My hash map fails, because I always do Variable variable = new Variable(); then map.put(variable1,variable)
never mind, rebuild and it worked..
 
good
@Goldbones what are you doing?
 
^ I was just wondering as well
 
hehu
 
Holy shit, it's halloween, everyone!
I totally had something planned, but I think I'll just code, as usual...
 
@kinkajou I just want to add a exception tag
 
1:01 PM
hmm
 
@Goldbones Don't you have an XML parser?
 
Why I need that? My code is working, but I don ´t know How can I add exception tag in begin and end of my response
 
'Cuz you just gotta extract the element, then add the tags, concatenate and you got it.
 
Ok, i will give a try
 
fge
0
Q: Jackson 2.2.x: recursive deserialization fails, why?

fgeTo be precise, this is Jackson 2.2.3. The deserialization process is quite complicated, since depending on the type of the JSON value I deserialize, the class changes: the base, abstract class is JsonMergePatch; when the JSON value is anything else than a JSON object, I deserialize to NonObjec...

I'm stuck here :/
 
1:09 PM
@fge Review completed.
 
fge
@Unihedron what review?
 
... never mind
 
:D
 
Oh hi @kinkajou :)
 
@Unihedron hi ! So, what do you think about glassfish ?
 
1:15 PM
I like glassfish, a great server. Plus, it's open-source!
 
1:27 PM
@Unihedron so should we continue using it?
 
If it ain't broke, don't fix it. ;)
 
@ita believe I found another bug :P
 
hmmm
:D
 
fge
Meh, I found a solution but it's an outright hack
 
fge
2:02 PM
Argh, I hate half-assed code, but I have no choice currently :/
 
:/
// TEMP
 
:)
 
//Temp
Nice!
 
fge
Well, maybe someone will come up with a better way
I posted to jackson-dev also...
fge@alustriel:~/src/perso$ grep -wlr FIXME .|wc -l
64
Not bad
(given that I have 200+k lines of code in there
 
2:22 PM
If you do
Map<Tab,TableView> map = new HashMap();

void createTab(){
Tab tab = new Tab();
TableView tableView = new tableView();
map.put(tab,tableview);
}

Shouldn't it work?
 
@miniHessel You're doing it wrong
new HashMap<>();
 
Didn't help :P
the problem is after the second time I call the algorithm, it returns null when I use map.get()
@uni they are unique, so why it shouldn't return I don't get
 
Ugh... I think something's wrong with my new mouse :( It keeps scrolling up a little every now and then when I croll down
 
@gem :(
 
Scrolling up seems to work fine
ugh
 
2:39 PM
argh
 
Hi, can anyone help me on this plz stackoverflow.com/questions/26662542/…
 
3:12 PM
Hmm... the ice-cream truck is not only out in october, it's out on halloween O.o
 
o_O
Anyone else seen the github halloween theme?
 
>_>
<_<
 
3:31 PM
I can't wait until I'm an intern :') thecodinglove.com/post/100732706005/intern-taking-notes
 
fge
Dear dear
20 stars on json-patch in 2 days
What the...
 
@Gemtastic LOL
 
First day of programming school:
This is the reaction I got at my meter joke :O
 
^ It's also how I feel as you post all those pictures.
 
I'm bored ok!
I came to see the mObscene
 
3:39 PM
:P
 
Hi I have simple java question
 
Shoot
 
I am trying to set up enums and have enum equal to an int/number
but i am getting an error
it says unexpected token
 
Oh no... Not another "I'm casting enum" question
Post your code here in the chat in fixed font.
 
XD
public enum Fruits {

APPLE = 0,
BANANA = 1,
ORANGE = 2

};
Something like that
 
3:41 PM
Sorry, it doesn't work that way.
 
I'm trying to associate an enum with a value
How does it work?
 
No, you're trying to define constants, but enums are immutable instances of the enum object, you cannot overwrite their values.
You can either:
public enum Fruits {

APPLE(0),
BANANA(1),
ORANGE(2);
private final int id;
Fruits(int id) { this.id = id; }
public int getId() { return id; }

};
 
The whole point with enums is that you can't change them
 
Which is already equal to .ordinal(), so that's stupid.
From what you're trying to do, it seems that you want to define constants, so:
 
yeah
kind of
 
3:43 PM
public class Fruits {

public static final int APPLE = 0,
BANANA = 1,
ORANGE = 2;

}
 
Basically, all I want is to have constants that I can use in my application
with associated values
so that I can check the database
 
Now we're talking code, I don't have to post gifs any more :D
 
Well, I showed you the two approaches
If your enums are going to hold more than one values, the first is preferable
 
and instead of string compare for the fruits, I think comparing values is better
Well the thing is
 
public enum Fruits {

APPLE(0, "bitter"),
BANANA(1, "meh"),
ORANGE(2, "sour");
private final int id;
private final String flavour;
Fruits(int id, String par2str) { this.id = id; flavour = par2str; }
public int getId() { return id; }
public int getFlavour() { return flavour; }

}
 
3:45 PM
I want my enum to hold a value, an int and an image associated with it
 
Then in the class you can even use utility methods:
 
´@Uni can you cast an image char to an enum?
 
public Fruits getFruit(String flavour) {
  for (Fruits each : values())
    if (each.flavour.equals(flavour))
      return each;
  return null;
}
@Gemtastic No, you cannot cast anything into enums except the enum object, cuz all enum objects are final
 
Wait, so how would I associate both a constant int and an image to an enum?
Is this possible?
 
It depends. Do you have the cached image or the path?
 
3:48 PM
yeah I have the image path
 
Then you can either cache the path or use a transient cached field.
in the enum
 
Like
public enum suit{
    HEART(♥), CLUBS(♣), DIAMOND(♦), SPADE(♠)
}
^That's what I meant with my question
 
@Gemtastic It doesn't work that way, however you can associate to chars using '♣'. Syntax.
Then you can use a constructor which takes a char.
 
@Gemtastic, but what if I wanted Heat(0) { imagePath} ;
Does that work?
*Heart(0)
 
What?!
 
3:50 PM
'So
public enum suit{
    HEART('♥'), CLUBS('♣'), DIAMOND('♦'), SPADE('♠')
}
?
 
You'll also need a constructor for the enum objects, and accessors to the char.
 
I mean Unihedron, what if I wanted Apple = 0 associated with apple image
 
public enum suit{
    HEART('♥'), CLUBS('♣'), DIAMOND('♦'), SPADE('♠');

    private final char shar;
    public Suit(char o) { shar = o; }
    // getter for shar here
}
 
Do you know a tutorial that teaches this, or could you just code me an example? (I think I'll understand just by reading the code)
 
@KalaJ Then you can modify my last code which each enum object is mapped to an id and a string, to cover the file path.
 
3:52 PM
hmm
 
Assuming the path is String, since you never gave specifications.
 
@Gemtastic uni gace moar then enough examples..
 
Enums, however, can implement interfaces:
1
A: Bukkit - Aquiring explanition for why enums is not working

UnihedronAll enums are constants. You cannot specify parameters for new instances of an enum. Instead, use a class to construct new objects based on the given parameters. Example of an enum in usage: enum WeekDay { MONDAY(1), TUESDAY(2), WEDNESDAY(3), THURSDAY(4), FRIDAY(5), SATURDAY(6), SUNDAY(0); publ...

 
the thing is: everything until the first semicolon will be interpreted as calls to the enum constructor
 
What if the path is an int?
 
3:53 PM
@Vogel612 Yea?
 
then you use an int called path...
 
@KalaJ Then switch out the string to an int
 
@Gemtastic that's it..
 
8 mins ago, by Unihedron
public enum Fruits {

APPLE(0, "bitter"),
BANANA(1, "meh"),
ORANGE(2, "sour");
private final int id;
private final String flavour;
Fruits(int id, String par2str) { this.id = id; flavour = par2str; }
public int getId() { return id; }
public int getFlavour() { return flavour; }

}
 
okay cool, thanks
 
3:54 PM
@Vogel612 I don't get what you're getting at
 
everything else works just like a class..
or rather like a class with final instances...
compare::
 
Hold on, so it works like this:
public interface IntValues {
  public int value();
}
^ That's how a signature is defined. Like an enum, the methods declared in an interface is present in its overriding class, and the methods declared by an enum is implemented by the enum.
 
public enum Suits {
    HEARTS('♥'), DIAMONDS('♦'), /*spades and clubs */;
    public Suit (Character char) {
         this.char = char;
    }
    private final Character char;
}
vs:
 
public interface IntValues {
  public int value();
  public static final IntValues ONE = new IntValues() {
    @Override
    public int value() {
      return 1;
    }
  }
}
^ So here you have, an immutable object that returns 1 when it gets called value().
 
public class Suits {
      public static final Suit HEARTS = new Suit('♥');
      public static final Suit DIAMONDS = new Suit('♦');
      private final Character char;
      public Suit(Character char) {
            this.char = char;
      }
    }
 
3:58 PM
Imagine adding methods to IntValues interface, that's like what happens as you add methods to an enum, except the implementation cannot be changed.
 
do you see the similarity??
 
Enums are also simply immutable. So a programmer could even do this:
 
03:00 - 16:0016:00 - 00:00

« first day (1469 days earlier)      last day (3458 days later) »