« first day (250 days earlier)      last day (4703 days later) » 

12:02 AM
@MartinhoFernandes Could you be a little more precise?
 
Simple, you write provideElements to increment a static counter somewhere. Then you write a foreach loop that increments that counter as well.
 
Hm, if I use a timed put on the queue, there's a hard reference to the queue :-/
 
Of course. How stupid.
You'd need to be lucky enough for the GC to kick in in the little time you release that to test :(
 
@MartinhoFernandes Thread A writes to arbitrary variables, Thread A uses concurrent collection, Thread B uses concurrent collection, Thread B reads arbitrary variables. The Java memory model guarantees that all writes from A are visible to B now.
Oh wait, you are talking about race conditions?
 
Yes, race conditions.
 
12:06 AM
Damn, hadn't thought of that :-/
Everything looks so simple on paper, and then you stumble upon problem after problem during implementation :-(
 
Well, you were the one that opened the can of worms labeled "multithreading" :P
 
@MartinhoFernandes I can't release it, the hard reference is there, else I wouldn't have been able to call put :-(
How does C# solve it? When iteration is done (normally or prematurely), some method is guaranteed to be called, right?
 
C#'s foreach loop calls Dispose on the IEnumerator.
 
C# seems really nice.
I just noticed another problem: you can't have multiple iterators on the same collection as it stands :) But I'm working on that, now I have:
ThreadLocal<WeakReference<BlockingQueue<Option<T>>>>
:-)
 
If Java had yield and lambdas, that would be enough to implement LINQ on it. And that would be sweet.
 
12:11 AM
Hm, I could sleep for a little while after the timed put and hope that the GC kicks in then... or manually call System.gc(), although everybody seems to agree this should never be done...
 
Does it force a collection in Java?
Or is it merely a suggestion?
 
the latter :(
 
That makes it kinda useless.
GC.Collect() forces a collection.
 
Yes. System.gc() is like inline in C++ :)
 
sorry, but did I join the wrong chat by mistake?
 
12:23 AM
What, you expected us to discuss C++?
 
@MartinhoFernandes maybe I'm out of my bloody mind. it's only a C++ chat room, after all.
 
private void enqueue(Option<T> optionalElement)
{
    try
    {
        while (!timedOffer(optionalElement))
        {
            procrastinate();
        }
    }
    catch (InterruptedException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

private boolean timedOffer(Option<T> optionalElement) throws InterruptedException
{
    WeakReference<BlockingQueue<Option<T>>> weak = queues.get();
    BlockingQueue<Option<T>> queue = weak.get();
    return queue == null || queue.offer(optionalElement, 1, TimeUnit.MINUTES);
The procrastinate part is probably voodoo, but it's the best I could come up with.
 
Ignore what I said for a while.
 
okay :)
 
Gosh, that's some ugly piece of code.
 
12:31 AM
It sure is :)
 
But seems workable.
 
But according to my standards, it's at least well structured (in the sense that each function does one thing and stuff).
 
Yeah, but the ugliness here comes straight from what it does, no matter how it looks :)
 
12:47 AM
D'oh, I also have a strong reference to the queue due to synchronized (queue) :)
This may be the ugliest toy project I have ever worked on :)
 
lol
It's been an interesting exercise. But I'm going to sleep now. See ya!
 
me too
 
Good night.
 
 
3 hours later…
4:20 AM
Does anyone know how you can get your account suspended on SO for so long? What did this guy do? stackoverflow.com/users/194425/blender
 
Xeo
> This account is temporarily suspended because of low-quality contributions.
What's unclear about that?
 
I'm not sure what that means.
 
Xeo
Click the link then.
 
He got suspended until September... isn't that a little bit too much?
 
Xeo
3 month..
member for: 1 year 9 month
 
4:27 AM
I guess he asked too much questions, too often.
 
Xeo
That shouldn't be it.
You can look through his newest questions, maybe they'll tell you something on the reason.
 
Alright, thanks for the chat. 1:32am, gotta go Zzzz
 
Xeo
6:30 am here :P
good night tho'
 
 
2 hours later…
Xeo
6:14 AM
0
Q: Why is it thought of 'T *name' to be the C way and 'T* name' to be the C++ way?

XeoNote: This question is about the position of the asterisk (*). In most C code I see (e.g., in Beej's guide to network programming), all variable declarations / definitions use the T *name format, i.e., bind the * to the variable name. The pointer is thought of belonging to the variable, not the ...

 
7:23 AM
@Default doesn't this miss the point that we usually don't care about the fibonacci numbers, except as a small simple exercise to show we understand recursion?
the algorithm is only bad if you actually intend to compute the damn things to be used
oops
there we go. Replying to the right message now
 
:)
I thought it was a good read at least
 
sur
sure*
but calling it a bad algorithm assumes a lot about the context in which it is used
An algorithm that is more complicated than necessary is also a bad algorithm.
 
true. I guess the writer went for "an algorithm everyone thinks is good but is actually very ineffective when it comes to running it"
myabe that didn't fit in the title
 
:)
 
7:58 AM
@MartinhoFernandes regarding databases
 
8:16 AM
@MartinhoFernandes I think I have the solution: I need a weak reference to another object, distinct from queue, so GC has a chance to get rid of that other object while the queue is locked.
 
8:50 AM
OH HI
 
Oh Hi.
I'm that guy.
Built so fly.
I've got a silk bow tie
 
uh huh
who the hell flagged a feed message? are you on drugs?
 
@karlphillip That's weird. His questions don't look fantastic but, especially considering the rate at which he posts them, they're not so bad.
He must have done something else wrong to be suspended until September.
He has accepted answers and a decent number of badges
Recent comments look reasonable
Odd
 
sbi
9:18 AM
@TomalakGeretkal No he doesn't have to. Tina got locked out for 6 months for asking stupid questions. "They" don't hesitate to be drastic.
I guess this comes with the success of the site. When you have a 7-digit number of users, what's a couple hundred ones to you? Especially, if you feel they don't contribute much.
 
Yellow party people
 
@MartinhoFernandes I can't believe it... I got the damn thing working!
waiting: beautiful
hello
that's it!
waiting: world
[GC 4376K->124K(15872K), 0.0018591 secs]
consumer stopped consuming!
consumer stopped consuming!
By the way, I find it funny how people say that Garbage Collection slows systems down significantly, yet every time I measure GC on real projects, I always get significantly less than 1 percent overhead :)
 
9:47 AM
@Fredoverflow really?
I used an IDE built in java. whenever it decided to to it's garbage collection the system hanged for several seconds
 
Well, IME, GC'd systems use more memory and their performance goes down the drain when you are near the GC memory maximum.
 
@FredOverflow how do you measure the GC?
 
@ÓlafurWaage Start java with -verbose:gc option, let the application run for some time, add all the gc times from the output, and then simply divide.
 
@FredOverflow ty
 
@wilx Good point about the "more memory", that will not be reflected in the GC debug output.
 
9:58 AM
0.16 seconds out of a 1.6 second runtime.
and it's going down as i do more, since 0.09 is startup gc
 
@Default Which IDE?
 
I think it was IDEA
it was a couple of years ago thought. It is possible that it has improved
 
CDT gives pretty good C/C++ editing and compilation through Eclipse.
It's what I use
(Then again I'm a dirty Java developer so thats what i /would/ say)
 
@Graeme you can use asterisks to italice.. text
italice? italicalize.. ita.. hm..
make the text italic
 
pastarize?
pasta/rice?
 
10:07 AM
so !pastarize is potatoes?
 
Funny, I'm cooking potatoes right now.
 
the world makes sense again :)
 
@Default italicise
 
lol
(For some reason i vocalised that "lol" as a french detective... Weird italicising)
 
@TomalakGeretkal thanks
 
10:21 AM
user image
2
 
@Default np
@Graeme mais lol
 
Xeo
@FredOverflow How to identify a nerd: He lols at that picture.
 
jesus christ... 596 upvotes in 14 hours
596
A: C++ - local variable's memory can be accessed outside its scope?!

Eric Lippert How can it be? Isn't the memory of a local variable inaccessible outside its function? You rent a hotel room. You put a book in the top drawer of the bedside table and go to sleep. You check out the next morning, but "forget" to give back your key. You steal the key! A week later, you retu...

 
Xeo
@TomalakGeretkal I think it went on reddit or something, as it had ~60 upvotes just some hours ago
 
@Xeo Ah :)
 
Xeo
10:32 AM
Also, it is just a really stupid question. As my comment indicates, I don't think it deserves any upvotes.
And I also believe it's a duplicate of something, but I was too lazy to check
 
Any of you know what "Stack Curruption" is and if it's as cool as it sounds?
 
Ah, Joel tweeted it
 
Xeo
@Graeme It's ~cool.
 
@Graeme It certainly sounds fun!
 
Thought so.
 
Xeo
10:33 AM
@TomalakGeretkal Oh, you meant the answer. I thought you meant the question. That's still at 97 upvotes "only".
 
@TomalakGeretkal I thought saw :)
 
17,731 views and 98 upvotes, and nobody could be bothered to fix the broken tags and title
This question really shows off the inherent bias with SO. It's not a "stellar" question at all; it just so happens that lots of people have seen it, so it's one of the highest-rated questions.
Er, as Xeo said.
 
@TomalakGeretkal I upvoted just to be part of the movement.
 
@FredOverflow I'm sure!
 
Xeo
@TomalakGeretkal Like I said, it's a "stupid" question. Wonder if there's a badge for that...
 
10:35 AM
Stack corruption is when stack accepts money to do stuff it wouldn't do otherwise.
 
Xeo
@CatPlusPlus I finally know that the _mm_* intrinsics are for! The memory mafia!
 
Thanks @CatPlusPlus
 
@TomalakGeretkal It's still a pretty good answer, though.
 
@CatPlusPlus that's Stack Corruption, not Stack Curruption
@FredOverflow Of course it is
@Xeo I'm not aware of "for" as an adjective; can you clarify?
 
@TomalakGeretkal Doesn't explain that you could walk in the room, get bitten by a radio active spider and turn into SpiderMan2 though. Bit shoddy.
 
Xeo
10:38 AM
Damn, typo!
 
Xeo
@FredOverflow I just looked through Erics answers and noticed that he generally seems to give good answers.
 
@Xeo He's a compiler writer, what do you expect? :)
 
@TomalakGeretkal where was that shared? 18k views?
oh. found it. Who's joel?
 
Xeo
@Default Cofounder of SO
 
10:48 AM
@FredOverflow Microsoft compiler writer
*ducks*
I love @ericlippert's answer to this C++ question: http://t.co/I4p5EN9
 
Xeo
Ouch:
489
A: Worst security hole you've seen?

JulietThe least forgivable security hole, and unfortunately a very common and easy to find one at that, is Google hacking. Case in point: http://www.google.com/search?q=inurl%3Aselect+inurl%3A%2520+inurl%3Afrom+inurl%3Awhere It's amazing how many pages on the Internet, government sites in particular,...

 
user784668
11:12 AM
Heh, "you haven't voted on questions in a while; questions need votes too!"
 
@TomalakGeretkal that explains it :)
 
@Default :)
 
oh hai
 
11:29 AM
@CatPlusPlus is your nemesis D(og) ?
 
@Xeo Yeah, found out that one a while ago.. You can also type a "mysql filetype:ini" and find a lot of database login information on different web pages
 
sbi
12:01 PM
Q: Why can I access an out-of-scope C++ var? A: So you rent a hotel room... http://j.mp/lxCqQi
OMG. Not another one.
 
lol
ownt
 
@sbi Perhaps it will be a new record of some sort. "Most reputation gained on StackOverflow in a single day" – Guinnes World Records (2011)
 
i'm inclined to comment "I'm using linux because it's unsafe" xD
 
"Most reputation gained on StackOverflow in a single day" a.k.a. 215.
 
lol
hey, my highest rep day is 319, I think
 
12:08 PM
@CatPlusPlus 215? Where did you get that number from?
 
I had 230 few times.
 
Or is it your max rep/day?
 
@Patrick: Reputation cap for all users is 200 per day
 
@Patrick Because rep is capped at 200, and the only way to get above that is accepted answers and AFAIK bounties.
 
you can go above it with accepted answer, which is +15, and a couple other things which aren't upvotes
 
12:09 PM
You can go to his rep graph and see for yourself, 215.
 
@DeadMG I knew that, but you can still get upvotes.. That was what I really meant
 
so basically, he got like 700 upvotes but will only see rep from 20 of them
but that has absolutely no relation to what you said
 
okay okay, I was wrong ;)
upvotes*
 
Besides, the mighty regex answer got upvotes faster AFAIR.
 
the most reputation I ever earned was on dec30/2008. earned 305 that day
the least one was on jul04/2010 where I earned -191 !
lol
 
12:12 PM
owned nubbin :)
lol wtf? you earned -191 rep?
 
@JohannesSchaublitb Impressive
 
because I payed a bounty worth -250
 
Did you downvote a lot?
aha
 
12:12 PM
lol
yeah
I just checked and my lowest is -33, paid a 50 rep bounty
 
sbi
Anyway, there's no way this question could have deserved 132 upvotes. I support @Johannes' idea of closing it as a dupe and merging the answer into the other question. If we could only find a dupe...
 
that'S nothing compared to Jon. apparently he earned 755 one day
 
although honestly right now, I've got so much rep and ask so few questions, I could give away enough bounty to encourage a hundred answers
 
sbi
There must be questions about returning references to local objects. Does anyone have the time to find a suitable one?
I like being a party-pooper. :)
 
lol
 
sbi
12:16 PM
How about this one?
 
no
 
sbi
Oh, look, this one even observed that "it still works"!
 
that's not even undefined, he returned by value
 
@sbi That's very close
 
@sbi I agree that's exactly a dupe
reference vs pointer makes it differ 0.00000001 percent. outside my precision
 
12:18 PM
it would only be a dupe if he took a reference, instead of taking a value, imo
 
sbi
Voted to close.
Anyone else?
 
the ultimate question this time was about the memory of a local variable. and a reference still refers to the memory of the other variable
 
sbi
@DeadMG Feel free to find a better one.
 
perhaps I feel that it's not an exact duplicate?
 
sbi
@DeadMG Make your pick: stackoverflow.com/…
 
12:20 PM
@DeadMG he returned by reference and then read from it when the variable was dead
but he omitted the write. that makes it a bit less of a dupe :(
 
sbi
You can then close it as a dupe of this one: stackoverflow.com/q/2612598/140719
 
still it is "accessing" the memory of the local
 
> Why does this Object wonk out & get deleted ?
 
oh wait, he took the address of the local in main.
 
Wait, what?
 
12:22 PM
fail :) but still the read was of the dead variable.
 
I'm going to do a dictionary. It will be full of objects wonking out and memory invasions.
 
sbi
This question now has four suggested dupes.
That ought to be enough for anybody.
Ha! One more vote.
 
I take it you all saw this? stackoverflow.com/questions/6441218/…
 
sbi
Now we need one to have this merged to. Any suggestions which one is best?
 
@sbi Party pooper ;P
 
12:26 PM
the question starblue found is a very close one
 
ahh - looks like that's what you've been discussion. As you were
 
sbi
@PhilNash Thanks.
@JohannesSchaublitb Indeed. But so is this one.
 
man
Google sucks
you do a search and all you get is links to results pages of other search engines
 
sbi
This one is also good, IMO.
 
12:29 PM
you already linked it
 
will joel's tweet link still refer to the merged question then?
 
sbi
@DeadMG Yes, I did. I'm now asking for where to merge Eric's answer to.
 
@sbi i think that's a bad question because the &i refers to the local var of main
so it's confusing
 
sbi
@JohannesSchaublitb Ok.
 
it sounds as if the questioner thinks that i in main is actually a reference
 
sbi
12:30 PM
How about the other one then?
 
those a all nice I think
 
sbi
@JohannesSchaublitb It would refer to the closed one, which refers to the one it is merged into.
I think.
 
sbi
So I will flag it and suggest stackoverflow.com/questions/2862494/… and stackoverflow.com/questions/2612598/c-returning-a-reference as questions to merge this one to? It might be better to suggest only one. Votes?
The second one deals with references which, according to @Dead, is a better fit. :)
Last chance to object before I suggest the second one...
three...
two...
 
no, @Dead wasn't particularly impressed with any of the suggestions
 
sbi
12:35 PM
@DeadMG Yeah, but he didn't make any better ones either.
 
but I think it's much more effort than it's worth to go hunting for an absolutely hundred percent perfect duplicate
so I'll go with whatever you suggest
 
sbi
FWIW: I'm sure this will be closed. It's too obvious a dupe. But I also think Eric's answer is worth to be salvaged from the wrecking. So I'd like to suggest merging.
 
I don't
 
@sbi I favour the first of the two proposed dupes
it's simpler
 
I think that's just treating it specially because it got a bunch of upvotes and ooooh it's Eric Lippert
I think if anyone else had written such an answer, we would ruthlessly close it
 
12:37 PM
I don't think the write in the current question is a particularly defining part of it
 
sbi
@PhilNash Now both have 50% of the given votes. Ugh.
 
as it should be
 
@sbi glad I could help ;-)
 
sbi
@DeadMG No, it's definitely a good answer, I think.
 
of course it is
but dupe questions get good answers all the time
 
12:38 PM
@DeadMG I think it would do well whoever wrote it - esp. after Joel tweeted it
 
I just don't think that it should be treated specially and should go the same road as every other good answer to every other dupe question
 
but @DeadMG it's not "special" because of who wrote it, it's "special" because it's taken on a life and character that transcends the original question.
Occasionally allowing and pandering to that is in the spirit of SO
 
sbi
@DeadMG Every other answer to every other dupe which is as good as this answer should be salvaged, too.
 
as Jeff would often say in the podcasts
 
@PhilNash: Jeff says a lot of things in the podcasts
then he starts permanently deleting any thread that disagrees with him on Meta
 
sbi
12:41 PM
Meanwhile, could someone please provide the finishing stroke to the question? No need to draw out the agony...
 
Saying a lot of things is definition of a podcast.
 
sbi
@CatPlusPlus Yep, but @Dead does have a point there.
 
@sbi done
 
I get that Jeff owns the site, Jeff put the money into the site, Jeff is the ultimate authority, yadda yadda
but ultimately- when was the last time Jeff answered one of my questions, or any other question I've seen for that matter, or popped into the chatroom?
 
@DeadMG I happen to agree with him on this one. Allowing this sort of thing occasionally is fun and doesn't get in the way
 
12:44 PM
my experience on this site is pretty much exclusively dictated by the other users.. not Jeff
 
sbi
@PhilNash You're a star! :)
@DeadMG It should be. However, then Jeff comes along and plays dictator, and our experience is dictated by him again.
 
well
 
@DeadMG Jeff is not God - but he has played the role of, largely hands-off, benevolent dictator fairly well. Not perfectly, but well enough that I think his vision of how things should be run at least deserves consideration - but certainly not blind following
 
your experience seems to be on occassion, I personally have never had a problem
not that I'm going to make a point of that, just bringing it up
 
sbi
@DeadMG You talking to me? I did have several occasions.
 
12:47 PM
well, after Jeff shared some of Tina with us, I suddenly feel glad that I don't have any personal data here
 
@DeadMG also I can't say too much against him or I won't be invited to speak at the SO conferences again ;-)
 
lol
I'd probably be better off if I stopped wasting so much time here ;p
 
when has being "better off" ever been the goal? :-)
 
lol
 

« first day (250 days earlier)      last day (4703 days later) »