« first day (1749 days earlier)      last day (3193 days later) » 

5:54 AM
Hey, does anyone know if theres a reason why there's no [java8] tag? There isn't one for any other java minor version either
 
If there isn't one it's because noone's made one
Annnd morning all
 
6:31 AM
@Jojodmo
Always search with stackoverflow.com/tags if you're looking for a tag.
 
MrT
6:45 AM
hi again - the stupid "i want to measure excle loading time" - guy is back :)
still searching for a solution: if someone have some new ideas for this problem: stackoverflow.com/questions/31652387/…
i will mary him :)
 
@MrT This room is about Java, not JAVA. No one here can help you.
 
@Unihedron I tottally knew that already... I swear...
 
o/
@Michael I hope you have learned from your mistakes :P
 
@ItachiUchiha I accidentally ran sudobrm -rf / before... I forgot to cd to the directory...
 
Some systems come with mandatory --no-preserve-root though
 
6:55 AM
sudo rm -rf /
 
well, always be careful with what you sudo
 
@Unihedron Yep, I also learned that backups are my friend
 
backup everything
backup everyday
backup like no tomorrow
 
Exactaraly
 
@Unihedron Where do you backup everything everyday?
 
7:05 AM
everywhere
 
as in?
 
whereever
 
pfft
 
7:34 AM
Morning
 
morn
 
 
2 hours later…
10:01 AM
Ahh it's so nice to "generate" SQL from available data with simple regex match-replaec
1.5 hours for all countries with their german names and 2-Letter ISO-codes as well as marking eu members
 
 
2 hours later…
12:01 PM
peace
 
12:51 PM
Yo
 
Lii
1:07 PM
@Unihedron LOL
 
Ohayo/
 
ohaiyo/
 
1:37 PM
Announcement: The troll's account has been deleted once again. I suspect they might attempt to rejoin again. We're now at level three, destruction mode for two weeks. Kick suspects on sight: "ShaU Returns".
5
 
/nick schaub0lt
 
hey Guys,
How can I get a notification from system when uptime is 9 hour through a java program
on Linux environment
 
By... sending a notification
 
There is a command uptime in Linux which tell us uptime.
The other way I can think is to run a timer but that I don't want
by sending notification I didn't get it
 
Start program, read uptime once, parse uptime, calculate 9h-currentUptime, wait that long?
 
1:52 PM
Send a signal to the kernal.
 
I don't think Linux comes with a notification system for something like that
 
I want it like when system start program will start and after 9 hour my program got notified.
If I take example of Android there is broadcast receiver to serve this purpose
we can configure system for shut down system after few hour .... I think system mustn't be using separate timer for this purpose
 
@ashutiwari4 There are things like system bus and notification systems in some linux distributions, so you could check if this is a possibility in the distro you're using.
 
I'll check BTW I am using Ubuntu
 
I still don't understand what's so bad about int currentUptime = getUptime(); Thread.sleep(NINE_HOURS-currentUptime);
 
2:03 PM
for that I need to run my application
that can be done
That will serve my purpose
But I want to know if System notify itself as well form Learning point of view
 
@wonderb0lt the sleeping, especially without timeunit
 
@Vogel612 This was just something to show the concept
 
java is not a tool made for that job.
use something the OS gives you.
 
@Vogel612 What would that be?
 
think cron or sth.
 
2:05 PM
like Shell Sript
 
schedule a cron for 9 from start when starting
don't try to abuse a programming language for that..
 
TIL "shell sript"
 
god dang object declarations
in a world where myObject newObj(a, b, c); isn't possible
 
@Vogel612 watch -n 1 "uptime | grep '09:00:00'"? :P
 
2:14 PM
@wonderb0lt sounds cool
 
@DonLarynx Nice. I've been googling programming related stuff for years and never got this
@Vogel612 Yeah polling every second is FAAAAR better than letting a thread sleep 9h :P
 
Anyone solved for create script dos with open cmd and launch jar??
There is a solution without open cmd (window)
 
@DonLarynx Google sucks.
@MirkoCianfarani Can you try again but in proper English? I don't understand you
 
and?
 
2:21 PM
I need a batch-file with open window of cmd
and ask if anyone solved this bug
 
@DonLarynx How did your google search appeared that way
 
@ashutiwari4 i googled "arraylist java" and then my browser was deforming
HINT don't use arraylist
(Use ArrayList)
 
Don't use google, duh.
Worst search engine of history.
 
what do you recommend then
 
2:23 PM
benefit over google ?
 
@Unihedron How old are you?
 
@ashutiwari4 doesn't suck
 
Google doesn't suck
 
here we go..
 
what the heck, i have to use toArray to convert the ArrayList to an array?
highly inefficient
 
2:25 PM
@durron597 how is that relevant? it's an obvious hyperbole
 
Doesn't look inefficient to me.
@Vogel612 See the link I posted
(but that's openjdk)
 
@Vogel612 Just saying, I remember the days when altavista was an improvement over excite and lycos and yahoo search was just "search our own links that people have registered with us directly"
 
if the javadoc says it's not a refernce
 
@wonderb0lt the docs for arraycopy() just give me a declaration so i cant tell
 
/javadoc System.arraycopy
 
2:27 PM
@DonLarynx Well it's pretty obvious what that does
 
@Vogel612 Sorry, I never heard of that class. :(
 
/javadoc System#arraycopy(*)
 
Did you mean this one? (type the number)
1. java.lang.System#arraycopy(Object, int, Object, int, int)
 
1
 
@Vogel612 void arraycopy(Object src, int srcPos, Object dest, int destPos, int length): Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array ...
referenced by dest. The number of components copied is equal to the length argument. The components at positions srcPos through srcPos+length-1 in the source array are copied into positions destPos through destPos+length-1, respectively, of the destination array. (1/7)
 
2:27 PM
boils down to good old memcopy.
you ain't getting faster than that
 
System.arraycopy: the only way to copy an array.
 
Right, the time is O(n)
whatever i'm just using an iterator
 
yea .toArray was really "highly inefficient"
why not just something unuseful like a foreach?
 
@DonLarynx It's not O(n), it's n. It has no overhead at all.
1 min ago, by Vogel612
you ain't getting faster than that
 
i said that out of context, my professor for data structures doesn't like O(n) time so it's been imprinted on me t(-_-t)
 
2:30 PM
listen
your professor is wrong and rants to hide his insecurity in the lack of knowledge
so take everything he says with a grain of salt
most professors are like that.
 
How could copying an array possibly be less than O(n)?
 
@Unihedron done and done
 
Something like "search for a key" could be less than O(n) with the right data structure
But even search is O(n) in an array.
 
HashMaps, for example, are O(1)
because the location in the bucket is known
 
2:32 PM
so does myArrayList.iterator() return an iterator at the beginning of the list?
docs say "Returns an iterator over the elements in this list in proper sequence." but idk what that means
 
It means what it says.
Objects in the Java API are implemented by really smart people. They will be more efficient than the code you write as long as you're not using them in wrong ways.
 
@DonLarynx That means proper sequence. Starting at the start and ending at the end
 
how do i dereference said iterator at the current position? i can't use next() because that returns the next element
 
@DonLarynx It starts BEFORE the first element
 
2:44 PM
thanks
 
while (iterator.hasNext())
  // do something to iterator.next();
 
just use while(iterator.hasNext()) { Element element = iterator.next(); /* your code */ }
 
ninja'd
 
That's what i'm doing :o
but if i'm at 1 before the end, like the last item in my arraylist, doesn't hasNext() return false?
then the item goes unchecked
 
@DonLarynx There are two ways to do the logic. The way you describe, and the one that doesn't miss the last element
Which way do you think is more likely that they implemented it?
Which one would be harder to write loops for?
 
2:50 PM
if the iterator points to a valid position or the next element is valid, it returns true?
 
@DonLarynx n o
has next() returns whether there are more elements to return on next() call
 
right
 
in english, if hasNext() then next() won't throw error
 
so if the iterator points to the last element in the list. hasnext returns false
 
no
the iterator does not point to an element, it iterates through them
if there is more, hasNext()
if there is none, !hasNext() and next() throws exception
 
2:53 PM
ohhhhh
 
note that for unordered collections iterator() does not warrant ordering
 
got it
 
but ArrayList is a List, which is ordered
so it's safe to use
 
the iterator's "pointer" is between elements, not on top of them.
 
That's a better way to think about it, yeah
 
2:56 PM
Looks like this is going to go into the grace period
31
Q: Does autoboxing call valueOf()?

shmoselI'm trying to determine whether the following statements are guaranteed to be true: ((Boolean)true) == Boolean.TRUE ((Boolean)true) == Boolean.valueOf(true) ((Integer)1) == Integer.valueOf(1) I've always assumed that autoboxing was equivalent to calling valueOf() on the corresponding type. Eve...

The JLS doesn't say that it "must" call valueOf, but all the major compilers do
 
yes, it's an implementation detail like the answer says
it's not like anyone would create a Proxy for Integer.valueOf() anyway, so the concern is moot
 
@durron597 I was thinking C++
then i remembered
theres no pointers in java
 
@DonLarynx It's not a C++ pointer, that's why I put it in quotes
 
It's like an assistant
it's behind you, the item
 
encapsulation
anyway, it works, so don't worry about the sky falling
 
3:12 PM
vOv how is that a dude shrugging his shoulders, it looks like he's cheering
 
\o/ << this is cheering
wtf is wrong with your eyes, man
 
lool
 
self blog spam I've flagged as vlq
hm there are actually two VLQ answers there
 
yea, but the other one's not blatant spam / offensive
sure it's dumb, wrong and should be deleted, but just downvoting it into oblivion should be enough
 
@Vogel612 There's also a third answer which just copies an answer from 6 months prior
 
3:16 PM
that again could use a "other" flag
 
@Vogel612 If I had 20k I would vote to delete it.
 
I got 500s to investigate though
 
@LeeJeong next time your on ping me, and we'll make a private room, Brainless Chat has officially died today. We got a new thing going, but it's on WhatsApp
(everyone else, sorry, just ignore that)
 
whatsapp sucks
 
Yah it's not favourable
 
3:29 PM
@Unihedron it will be faster if you just name the things you think that don't suck
 
Oh man hahahaha
 
then we can all assume the rest sucks for you
 
@Tavo weather, unihedron, personal reality, colors, programming
that's about it
 
@Unihedron cool. We should add that to the room's topic
I wonder about the colours thing though
 
I wouldn't object to that but I don't want the room to become about me, though
 
3:32 PM
I'm sure some colours suck
@Unihedron it's just an idea for you to type a lot less
 
lol
 
shrugs
 
I don't fancy puke yellow very much. Not an amazing colour
 
I love how @DumbKnee can turn any topic into an inappropriate chat message
 
The first rendition was much worse, I really had to restrain myself here
 
3:46 PM
Brainless starts bleeding into Java<> :P
 
I think they missed us
 
@DumbKnee where the heck did that association come from??
 
16 mins ago, by Tavo
I'm sure some colours suck
Also I was thinking about a puke yellow colour the other day
Eh stupid one boxing lol. It's not actually puke just saying
If it makes any more sense, my brain is a fuster cluck of happenings
 
@Unihedron It's curious Uni isn't #1 in that list
 
8
Q: Handling type erasure in constructors with generics

Captain ManI am trying to make a class that can hold only one of two objects and I want to do this with generics. Here is the idea: public class Union<A, B> { private final A a; private final B b; public Union(A a) { this.a = a; b = null; } public Union(B b) { ...

@wonderb0lt Especially since certain types of weather do suck. like tornadoes. They're basically a giant vacuum in the sky
 
3:55 PM
 
4:07 PM
@wonderb0lt Did I do it again?
 
wat
 
4:19 PM
hi
how to get input data from user in java?
 
use I/O
 
write code
 
Use a scanner class
  Scanner input = new Scanner(System.in);

  // now we can use the object to read data from the keyboard.
  // Some sample calls:
  int x = input.nextInt();
  double y = input.nextDouble();
  String s = input.next();
 
spoonfeeding festival huh?
 
You helped me so I must pass it on
 
4:28 PM
@Unihedron That sounds oddly intriguing
Is that another phrase for retirement home?
 
lol
 
 
1 hour later…
5:59 PM
http://www.commitstrip.com/en/2015/08/07/are-we-coding-or-what/
CommitStrip - Blog relating the daily life of web agencies developers
Are we coding or what?
CommitStrip
1438969811
 

« first day (1749 days earlier)      last day (3193 days later) »