« first day (1928 days earlier)      last day (3240 days later) » 

02:48
I have a question about practice. Today, at work, I found some code that had a constructor like so:

public TestClass(String something, long[] somethingElse){
this.something = something;
this.somethingElseA = somethingElse[0];
this.somethingElseB = somethingElse[1];
}

This feels very wrong. But I cannot technically explain why. Is it bad?
03:05
@Cripto yeah.
@Cripto it could lead you for ArrayIndexOutOfBoundsException
wouldn't it be a bad idea to go for var-args ?
public TestClass(String something, long... somethingElse){
 
1 hour later…
04:39
anyone here?
public static enum MenuItemID
  {
    REGISTRATION("Theature.Registration"), ANES_AND_TRECORD_TEMPLATES("Theature.Template"), REG_TEMPLATES("Theature.RegTemplate");

    private final String menuItemID;

    private MenuItemID(final String menuItemID)
    {
      this.menuItemID = menuItemID;
    }

    public String toString()
    {
      return menuItemID;
    }
  }
in another place I guess that's how it used
MenuItemID.REGISTRATION.toString()
I can't understand that above code I shared. Can anyone please explain what it does?
 
2 hours later…
06:35
@CrazyNinja That's rather typical enum usage: the tutorial has a fairly similar case as an example (the example about planets; it just has 2 constructor parameters instead of one).
 
2 hours later…
08:09
int arr = new int[-2];
what will be the output Exception?
just a small warm up question :)
I was going to say ArrayIndexOutOfBounds but I think it might be some array initialization error instead
@Crummy yeah. I was also the same. got it wrong. ArrayIndexOutofBounds will not occur here
because it is not going out of the bound. We are trying to define the bound
therefore, it will throw NegativeArraySizeException
08:40
String str = "LOL";
switch(str){
  case "SIGH": sysout("sigh");
  default : sysout("default");
  case "LOL" : sysout("lol");
}
what will be printed?
I'm guessing "default"
Wait... maybe the compiler will print an error for having case statements after a default?
default is executed only if none of the cases match. it's an oddity of the language that the location of the default label is not specified (so it actually may be in the middle)
(well, it can be executed due to fall through behaviour, but it's not selected otherwise)
Huh, never knew that.
I suppose there could be a situation where you'd want it to be in the middle, when you want to take advantage of the fall through behaviour
iow, in that example, the case "LOL" is selected
@kiheru yup. Even Now only I caught this in one of exam questions
08:51
wouldn't that be rather simple thing to just try, though?
@kiheru I shared it just to let the others to know about this. learning is all about teaching :)
a corner case of the language. you'd not normally encounter such code
Hi. I'm developing a wireframe of a console based game for a presentation. But I have encountered the Problem, that I get this output:
"1890 3000
1470 3000
Round1:
The Attacker Andi Decke was killed! -2979"

Here's my (relevant) code: http://pastebin.com/HLSw2w1v
@TechTreeDev link is not available for me
What was the expected output, and why?
08:55
Expected output would be 3000- 1890 and 3000-1470
h got it, superconstructor was wrong
then you must have specified hp and atk the wrong way around when you create the characters
morning
09:24
Me again: http://pastebin.com/j9zCh5iX

Any ideas? (errors in the code as comments, refering to the token)
@TechTreeDev Use a map
@MadaraUchiha Could you explain this?
Do you know what a map is?
!!javadoc map
morn
Yess and no. I know waht it is but not, how to use it
09:27
bot is down
@TechTreeDev A map is a data structure that maps one object to another, in the form of key: value pairs
@MadaraUchiha I know, but how could I use this in this case?
You can map a String weapon to an Integer damage, and take the damage from the map.
Avoiding the switch case.
oh nice pastebin.com is also blocked at $customer
@MadaraUchiha Ah, makes sense now. Thank you, I'll give it a try
sensible (y) You could like paste the source code somewhere. I mean you could still do that on Github or SO or literally anywhere else on the web
09:30
@wonderb0lt welcome to my world
you need $deity permissions
I'd also consider having a Weapon class for holding the related data: weapon name, atk, weight, whatever_attribute_you_need_later...
@MadaraUchiha should have use the polymorphism Lol. our last discussion :D
@kiheru I was just about to say that
@MadaraUchiha Okay, I created the Interface, the Map and implemeted it, how do I access the Integer, where the String == "Sword"?
@TechTreeDev You... don't need to implement a Map...
Java has default implementations which are sufficient 99.999% of the times
09:42
@MadaraUchiha Oh
Although now I'm actually curious about how you implemented it
If you don't mind sharing :D
@TechTreeDev Just use a HashMap<String, Integer> for your usecase.
@MadaraUchiha public class Character implements ItemsI{ :'DD
And then use myMap.get("Sword") to access the integers
@wonderb0lt Thx
10:18
Morning
10:34
Morning!
do you guys know if metaspace is collected in minor GCs or just with majors?
morn guys
@Tavo depends on the implementation, I'd say
@Vogel612 is it implementation dependent?
I assume it would be
I don't think it's explicitly specified anywhere in the contract
not sure about the contract. But yet again, the metaspace is the evolution of the PermGen, so I would assume it would follow the same rules
but I want to be certain
also, I've never seen a contract for minor/major GCs
11:43
Is there any way to implement nested interface on abstract class without creating additional java file?
for example
public abstract class Entity implements Clone {
	protected int x;
	protected int y;

	public interface Clone {
		public void update();
		public void render();
	}
}
Why would you want to do that?
exactly
it looks like you (implement)^2 Clone
really don't know, just being more organized in some way
Either you want that thigns are cloneable, then "Clone" (or more succintly "Cloneable") should be a regular interface
Or you want Entity to be clonable, then you just put those methods as abstract methods into Entity
the second option
11:45
 public abstract class Entity {
      protected int x;
      protected int y;

      public abstract void update();
      public abstract void render();
 }
now concrete implementations of Entity must implement the update and render methods
how that ran out my mind..?
sorry for my foolishness
That's why we're a help channel
:)
we help people
@wonderb0lt actually we are not a help channel
and emphatically so..
A discussion channel then?
we only discuss java here
yea that's probably more correct
11:49
Hm.
you know how blatant halp pl0x no effort vamps get kicked, right?
We're doing a lot of helping then for being a discussion channel
we're doing an awful little discussion for a discussion channel
though there is not that much to discuss when the user base stays compact
the help is much appreciated, more than you know
@wonderb0lt
I still need to do some UI cleaning, back to lurking
11:54
@someFolk I'm happy to help
 
1 hour later…
13:02
Ah I love big Spring projects
The context file loads an XML file
The XML file loads a property file
The property file loads a XML file
The XML file loads a property file
The property file...
the source of all joy
@wonderb0lt what is best in life?
@Tavo XML files?
or crush your enemies, whatever works for you
13:30
oh you weren't being sarcastic
Then I'd say cuddling.
Good morning
What happened to the fish & chips chat?
how did it turn into guppy and chips?
Guppy?
Yeah
This guppy?
all we have is ><>
It used to be ><))))))*>
What is that guppy?
13:36
@DRich ><> is a fish :P
but ><)))))))*> is a bigger fish
This is beautiful fish
That's how I look for this chat, I filter for Java and then look for the fish
@DRich It's a character in a videogame, named after the game maker's super cute cat
The Binding of Isaac was a weird game
13:39
@wonderb0lt I guess that's as valid as hear the lamentations of their women
@Tavo Whose women?
What women are you talking about?
You're talking in riddles, @Tavo
@wonderb0lt your enemy's women
What is best in life? To crush your enemies, to see them driven before you, and to hear the lamentations of their women!
Ah
It's a quote
Haven't seen Conan in the last 581 years
finally!
:P
Back to discussing java
13:45
I'm going to watch that movie this weekend if it's on Netflix
Okay, Java!
Our framework also accepts a system property to tell it where some of the configuration comes from and I could avoid mocking the static access to the configuration! Yay!
@wonderb0lt, Certified Spring Configuration Developer
Java is beautiful too
If I create a new empty ArrayList with ArrayList<dataType> name1 = New ArrayList<DataType>();

And then I say: name1 = otherArrayList;

I'll have a copy of otherArrayList that I can modify without actually changing otherArrayList itself.

Is that correct?
damn it!
is there a copy method or something I need to leverage?
13:48
All you will have done is have another reference to the first arraylist
so if I want a copy, what should I do?
Cloneable
cloneable, okay, I'll look into that
ArrayList<dataType> name1 = otherArrayList.clone();
read the javadoc for cloneable though
it's a weird design
perfect; thank you!
13:52
@DRich It is example for collections stackoverflow.com/questions/689370/…
@Mikhail thank you!
hm yeah listen to @Mikhail
@DRich Collections.copy()
/javadoc Collections#copy
bot still down :P
shit!
@Michael zzz
13:55
I'd use Arrays.copyOf()
@kiheru Any special reasons?
@ItachiUchiha I don't understand you
@ItachiUchiha Uh, actually I would not. I just somehow read "array", and thought about copying arrays
new ArrayList<>(oldList) would be a rather simple way to make a copy though.
@kiheru THAT looks like what I want
Morning, Java!
14:05
OakBot Online.
Hello @Michael
@OakBot
@someFolk Type /help to see all my commands.
@wonderb0lt @Itachi We're back in business.
And hi @some
14:06
o/
I really need to get to hosting him for you but I don't have the time. When I'm home I much rather watch TV and eat potato chips xP
@Michael what does it means?
Hi @DRich
@Michael How is JavaFX treating you?
@ItachiUchiha Haven't worked on it since we last talked. :/
Still need to read the article you sent me.
@some What does what mean?
14:07
/help
Commands=====================
/8ball     Simulates a magic 8-ball.
/about     Displays information about this bot.
/define    Displays word definitions from the dictionary.
/help      Displays this help message.
/http      Displays information about HTTP status codes and methods.
/javadoc   Displays class documentation from the Javadocs.
/roll      Rolls a variable-sided die or makes a choice.
/shutdown  Terminates the bot (admins only).
/tag       Displays the description of a StackOverflow tag (acts like a Computer Science urban dictionary).
Hi, I've encountered this problem:
Exception in thread "Game_main" java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(Unknown Source)

Here's my code: http://pastebin.com/iyifmjth
the file is located at /Project_name/game/src/sprite_sheet.png
/about
OakBot by Michael | source code | JAR built on: About 3 months ago. | started up: 3 minutes ago | responded to 1119 commands since May 1, 2015
/wiki
14:09
@someFolk Please specify the term you'd like to display.
Please go to Sandbox if you want to play with OakBot. :P
@TechTreeDev try: SpriteSheet.class.getClassLoader().getResourceAsStream(path))
I'm interested in what functionality it has and what it's purpose
Gooooooooood morning
@TechTreeDev "/res/sprite_sheet.png"
14:10
@someFolk mostly just 8ball questions and urban dictionary lookups
@Michael tried this, too
@someFolk Well, OakBot is in the Sandbox chat room too.
@TechTreeDev -_-
/8ball is @someFolk gay for me?
@ballBreaker Are you kidding? No!
@TechTreeDev Where is the file located?
14:11
Well played
/8ball Will I go insane from loading XML files which load property files which load XML files which load property files?
@wonderb0lt Ask again later
He'll already be insane by then!!
When I loaded some XML files?
@Michael C:\Users\Name\OneDrive\Game\res
14:12
@TechTreeDev getResourceAsStream only works if the file is in the classpath. In other words, the file has to be in the project's "src" folder.
@TechTreeDev if the image is inside src or classpath, then you should try : getClass().getResourceAsStream("/sprite_sheet.png")
Windows relative path
https://en.wikipedia.org/wiki/Path_(computing)#MS-DOS.2FMicrosoft_Windows_style
backslash
@ItachiUchiha And if it's outside? :D
@TechTreeDev then you cannot load it using the class loader and you will have to use File API to load it.
@ItachiUchiha Okay
14:15
@Mikhail You can use forward slashes in Windows too.
Okay, it works now. Thx
new java.io.FileInputStream(<image path>)
// TODO Guava OH NOES!!! REMOVE Pl0x
I like to be sassy in my code sometimes
@Mikhail Please use nio :D
After I was scolded for talking about Guava yesterday :D
"We use Apache Commons!"
14:18
@wonderb0lt Gross
I use Apache Royalties
@wonderb0lt Guava is one of the best libraries out there. How can they say that? :P
To me, Guava = "The library with Multimaps". xD
That's about all I've used it for.
@ItachiUchiha NIO is difficult for beginners
well, yes and no!
@ItachiUchiha "yo"?
"nes"?
14:22
@Mikhail Programming is difficult for beginners.
Promises are difficult for beginners, functional reactive programming is difficult for beginners.
2
Doesn't make them any less awesome :)
@MadaraUchiha those are difficult for beginners and non-beginners both
@Tavo Promises aren't that difficult for non-beginners.
FRP is though.
14:24
not "that" difficult, I agree
but the concept itself can be confusing
@Tavo What concept?
promise
Of an asynchronous action, or of an object that models the result?
Live is difficult for beginners
the fact that you launch a thread that at some point in the future is going to give you something back
14:25
s/live/life
I picture it myself as a boomerang
/urban frb
launch it, do stuff, get it back
FRB (http://frb.urbanup.com/6655774):
Fat
Rat
Bastard
@MadaraUchiha wtf is FRB?
14:26
dafuq oak?
@ItachiUchiha Functional Reactive Programming
@ItachiUchiha FRP, Functional Reactive Programming
^ that
Ahh, my fault :P
I read it as FRB
14:27
dat urban entry though.....
@Tavo Because threads are implementation details
that's beyond NSFW
@ItachiUchiha Functional Reactive Brogramming :P
at least we learned something today folks
14:27
A Promise isn't necessarily the result of an action done in a thread.
@Tavo that sounds GAY :P
A promise is a proxy over a value
Promise<Integer> is only an object that wraps around a (potential) integer
You don't care where it's from, or what kind of action generated it.
@MadaraUchiha true. I'm too used to using promises in multithreading
A Promise can technically also be sync (but that would be kind of pointless)
@MadaraUchiha well, that's almost an Optional
14:32
But Promise on itself isn't very interesting. A reactive stream is a much more useful model for multithreaded operations.
For example, imagine a GUI application in which event handlers are not classes, but reactive streams you can subscribe to and transform to fit your needs.
I'd give a talk about it, but I'm not fluent enough on the subject as a concept to teach it comfortably.
@ItachiUchiha "We've been using Apache Commons for longer, and we don't want people to need to know both"
@MadaraUchiha that's what I've been doing with Clojure lately (sorry, work required me)
@Tavo I really should try Clojure.
14:40
it's pretty awesome, but it's a huge change in the programming paradigm
I just got so confused hearing you guys talk about promises and having no idea wtf you were talking about
I like it better than Scala
I thought you guys were being philosophical
6 mins ago, by ItachiUchiha
user image
hahaha. I promise you we are not
14:41
haha ;)
@ItachiUchiha I love that GIF. xD
The Tim and Eric show is hilarious. xD
I can stare at that gif for way too long
Kinda like this one too
lmao realized probably not a good idea to post it actually
damn it
other way around
haha I always forget
I hate it that atlassian has different syntax
i.e. [text|url]
14:48
@ballBreaker s/possibly/definitely
@wonderb0lt Same here. They suck, they have different syntax for adding comments on JIRA and Bitbucket.
what!!
That's just dumb
@Michael :D what do you mean? It's just numbers, symbols, and letters..
To be fair, I don't think a combination of those three things has ever looked better to my eyes
Now I'm intrigued but it's definitely NSFW and I'm at W so
hmpfh
@wonderb0lt ehh worth it
It's not really that bad
14:50
haha
@ballBreaker Yeah. And a picture is just tiny colors of light on a flat surface.
@Michael See! You're catching on!
If you zoom anything far enough in it just becomes meaningless dots
Oh, and that stripper next to me? That's just a collection of carbon atoms.
you win
damn sexy carbon atoms
14:52
/internet
Those pornographic sounds are also just sound waves with different frequencies and amplitudes! Nothing wrong there
@wonderb0lt remind sometime to tell you about this friend bachelor party
not all carbon atoms are sexy
14:55
The dudes "singing" voice is ludacris man
Also, neon is sexy
@wonderb0lt You ever listen to Tool?
@ballBreaker eh
Is that a 'meh' equivalent
or a grunt of recognition
Anyways, this song has been helpin' me out a lot. It's an amazing song
One I've listened to for years but never stopped to really listen until semi-recently
The music video is strange AF so don't mind it lol
15:15
Given two approaches of having many small objects or fewer large ones, which of the two is preferred when designing?
@someFolk Closed as: Too broad
@ballBreaker Damn it now I've been listening to Tool for 20 minutes without even realizing
@wonderb0lt i was wondering
@someFolk It's best to avoid creating objects that do too many things.
@someFolk It's best to avoid to create unnecessarily small objects that have no meaning or purpose by itself
you see what I mean?
@wonderb0lt hahaha
They are easy to listen to without realizing.. really good band in my opinion
15:27
@someFolk in the olden days, object creation was expensive so there are outdated advices out there, that advocate fewer large objectes over many small ones for performance resons. Today object creation is a non-issue (more or less).
the same goes for gc (and the same outdated argument)
Just FYI: I'm talking about capabilities and responsibilities of a class, not performance overhead
@ballBreaker It's a good band to llisten to at work, then
@wonderb0lt Yeah exactly, nice because of the progressive aspects, the vocals aren't too overpowering so they don't overly distract you then you get some heavy, hard-hitting parts in it to keep you motivated.. pretty nice
I'm really, really surprised this song only has 1.1 million views. Wtf, man.
Boo tool isn't on google music
Wait, what? damn..
I guess they're too cool for school, or such sentiments
They've also been blue-balling fans for the past 8 years with releasing a new album
They aren't on any streaming service it seems like, unfortunately.
15:38
Lol check this song out if you want a nice 15 minute epicness. It gets intense... as hell .. but it's an amazing song
I heard it's something to do with them placing importance on their album artwork, might be just a rumour though.
@Crummy Hmm, I could actually see that being part of it
i want to give this channel something from the deepest end of my heart, it's not that valuable, yet the most honorable
Also they seem to be a band that gives a big middle finger to the whole music industry
They released a vinyl of one of their most popular albums.. and it's only in special edition.. which is around $55 CA
It's super cool though.. like super super cool
"Failed to rollback transaction" Is it correct in English? :)
15:42
@Mikhail Yep
@ballBreaker Thanks
15:57
Off to lunch, bye Java!
NSFW stuff isn't really tolerable for the SE network.
lol....
there are some exceptions but none of them apply here
My ideas of what is not safe for work are usually pretty skewed
An ascii gif of a booty being slapped is I don't know, is that nsfw?
I guess it must be
16:13
it's close enough to the borders that I want to be sure...
sooo...
Yeah that's fair enough
I mean it was pretty detailed..
Shockwave and everything
You're probably a better judge than me on these things, so I'll trust your opinion
 
2 hours later…
18:00
@Vogel612 lol
18:37
http://www.commitstrip.com/en/2016/02/02/no-coder-does-this/
CommitStrip
No coder does this
CommitStrip
1454438040
 
1 hour later…
19:57
Hi y'all. Can someone help me by answering this question? stackoverflow.com/questions/35157247/…

« first day (1928 days earlier)      last day (3240 days later) »