« first day (700 days earlier)      last day (4253 days later) » 

12:01 AM
@Chimera They're both constant time.
 
@R.MartinhoFernandes some answers are saying it's O(n^2) some are saying O(n)
 
They're both in Java
 
I have no idea, I only briefly touched upon it in school.
 
There's always something better to do than argue about big-oh.
 
@Chimera What is even n?
 
12:04 AM
@CatPlusPlus Find the profiler?
 
@R.MartinhoFernandes number of inputs?
 
@Rapptz and English derives heavily from Latin words. Which covers most of the languages known by people in this room.
 
Oh that's Java.. What does this line mean? int[][] world = new world[20][20]; there's no pointer.
 
@Chimera AFAICS, the input size cannot vary.
 
There is always one input. Hohum
@Rapptz Two-dim array, what else.
 
12:05 AM
@Rapptz Create an array of twenty arrays of twenty integers.
 
@R.MartinhoFernandes It is the arbitrary number of inputs which is independent of the number of inputs from a given execution
 
It's also a syntax error.
But who'd care about that.
 
Why can't they just do int world[20][20]
 
Because it's not C nor C++?
 
@Rapptz Because an array is half-assed type.
 
12:06 AM
@CatPlusPlus So you have to explicitly create a new instance of it?
 
@Rapptz Yepo.
 
That seems pretty dumb.
 
@CatPlusPlus It's not. There's a fucking exception for that case.
 
Better question: Why could java just give a damned destructor?!?!
 
@R.MartinhoFernandes Really? Laffo.
@JonathanSeng What?
 
12:07 AM
@JonathanSeng reference counting is slow
 
Because Java is so much simpler with its garbage collection, Java doesn't need a Destructor.
 
@CatPlusPlus Laffo?
 
Its why they've had to do other stupid crap because they lost the ability to do important things.
 
You're approaching infinite levels of ridiculousness here.
what
 
12:08 AM
@CatPlusPlus I think he's debating with himself. and losing.
 
Without ever fixing the real defect: Lack of Destructor.
 
@R.MartinhoFernandes I'm tired and mixing things.
What the fuck are you rambling on about.
 
@JonathanSeng What's a "destructor" in this?
 
@JonathanSeng can't have destructors with nondeterministic lifetimes, can't have a deterministic lifetime without reference counting. reference counting is slow.
 
@R.MartinhoFernandes C++ has a destructor Class::~Class(). Java doesn't.
 
12:09 AM
Java has finalizers, they're just not deterministic. Like in almost every damn language.
 
Java's generics suck!
 
@JonathanSeng Java has finalizers. That's why I asked what it was.
 
@MooingDuck I don't care the reason: Its a blight on Java programming to not have a destructor.
 
Not really on topic, just wanted to say that ;)
 
Reference counting doesn't give you deterministic lifetime.
@JonathanSeng No, it's not.
 
12:10 AM
Giving me the syntax doesn't explain anything.
And these days, Java has AutoCloseables.
 
shared_ptr is not deterministic (have fun trying to pinpoint the end of lifetime in a large project).
 
@R.MartinhoFernandes Sorry, misunderstood the question.
 
@CatPlusPlus if you have shared ownership semantics its required for deterministic lifetime. I suppose you could give up the shared ownership
 
@MooingDuck It's not deterministic.
 
@CatPlusPlus there's a difference between being able to pinpoint the end in a large project and being nondeterministic.
 
12:11 AM
Basically, I was asking what counts as a destructor.
 
@CatPlusPlus Exception Handling without Stack Unwinding is useless.
 
@JonathanSeng No, it's not.
 
@CatPlusPlus I don't see why it's not
 
@MooingDuck Because you don't know when it gets destroyed doh
 
12:12 AM
@CatPlusPlus when the last shared_ptr is
 
Let me rephrase: Exception handling without stack unwinding is precisely a goto with carried value.
 
Saying it's useless is either a troll or an argument from ignorance.
 
And Java objects are freed when GC runs and there's no more references.
So that's as deterministic as shared_ptr.
Computers are fundamentally deterministic machines, so everything is deterministic!
You see how is that not useful.
 
@CatPlusPlus Except for undefined behavior.
 
@CatPlusPlus interesting point. I will rethink mine.
 
user406009
12:13 AM
@CatPlusPlus But Java finalizes are not deterministic.
 
user406009
They could never be called.
 
@Cat That was a troll ;-)
 
@MooingDuck Deterministic destruction is useful when you are able to say "I want this to be destroyed here". Otherwise it's as useful as non-deterministic.
 
@JonathanSeng still deterministic, just undefined.
 
@R.MartinhoFernandes Isn't it linear time? Time increases as the number of elements increase in the array? O(n)?
 
12:13 AM
@EthanSteinberg Geez. Pay attention.
 
@Chimera The array size is static.
 
@Chimera as the number of elements in the whole array? yes, linear. As the number of elements in a row? Nonlinear. That's the issue. If the array size is fixed, O(1).
 
Stack unwinding makes little sense in a language with no value semantics.
So, no, exceptions are fine without that.
 
user406009
@CatPlusPlus ? Deterministic is being able to say that once all references are gone, the destructor/finalizer will be called. shared_ptr provides this guarantee. Java does not.
 
@Chimera basically, the difference between the answers is how they're defining n. if it's the row size, O(n^2). if' its the total number of elements, O(n). if it's 20 or 400, then O(1).
 
12:15 AM
(Well, unless you define unwind as just retracing up until encountering the handler; then all languages with exceptions have that)
 
@MooingDuck hmmm
 
@EthanSteinberg What.
Please read that again.
Aloud.
 
When you say #define PI 3.14, you're telling the preprocessor to find all instances of the text "PI" and replace it with the text "3.14".

Can anyone confirm this?
 
The finalizer is not the resource.
 
@MohamedAhmedNabil finds all instances of the token "PI". so "PIE" won't be replaced. Other than that, yes.
 
12:16 AM
Besides, every GC guarantees that finalizers will be called if object dies during the lifetime of the program, there is little reason to implement it any other way.
 
@MooingDuck So all three could be correct? I thought an algorithm had only big O classification?
 
5
Q: What is the complexity of matrix addition?

R. Martinho FernandesI have found some mentions in another question of matrix addition being a quadratic operation. But I think it is linear. If I double the size of a matrix, I need to calculate double the additions, not quadruple. The main diverging point seems to be what is the size of the problem. To me, it's t...

@Chimera Only one? Yes. They're all the same. You're getting confused because the same variable name is being reused.
 
@MooingDuck I never mentioned "PIE"
 
@CatPlusPlus But I can't rely on it happening in a reasonable time, or more specificly at a fixed time, so its useless.
 
WHARRRRRRRGARBL
 
12:17 AM
@CatPlusPlus I don't think that's the case if an exception throws an exception in Java. I think Java can fail to call some destructors if that happens. I heard.
 
I want my file to close when it leaves the stack because some bozo through an exception.
 
@Chimera if you have a clearly defined input, then it does.
 
@MooingDuck Java only fails to call finalizers when shutting down. Until then all finalizers are eligible to be called sometime in the future.
 
@MohamedAhmedNabil that's exactly why I did
 
Right, I'm really not interested in explaining this shit for umpteenth time. So I'll just go to bed. Bye.
 
12:18 AM
@MooingDuck So in this case n is being described in multiple ways.. got it.
 
Now, I see the point that without value semantics all hope is lost, so they totally ruined the language from the beginning.
 
@MohamedAhmedNabil PIE will not be replaced with 3.14E. The preprocessor doesn't replace all text "PI" with that number, only tokens that match "PI"
@Chimera right
 
@JonathanSeng You can have that in Java.
 
With a plonk, really.
 
@R.MartinhoFernandes Please tell how.
 
12:19 AM
@MooingDuck oh thanks
 
Oh oh, did somebody get plonked?
 
Using the deterministic destruction facilities the language provides, which are provided for the situations where deterministic destruction is essential.
If you don't know Java, I don't feel like teaching it just to make a point.
 
user406009
@R.MartinhoFernandes CatPlusPlus was specifically talking about the GC.
 
Also, please don't make me take Java's side on an argument about language features.
 
@MooingDuck but the strange part is it replaces it with the text "3.14" not the value
 
12:21 AM
@MohamedAhmedNabil yes, the preprocessor is just an automatic copy-paster.
 
@R.MartinhoFernandes I know java well enough and am actually sincerely interested in finding a decent mechanism in Java to replace the destructor. I'd take a URL.
 
@JonathanSeng Depends on your definition of decent: docs.oracle.com/javase/tutorial/essential/exceptions/…. I won't claim it's perfect and all that. But I do believe it ruins all claims of uselessness.
You had try-finally before, but that was incredibly clunky and boilerplate-y.
 
@R.MartinhoFernandes Agreed about the try-finally. Skimming through.... Yeah, its not general purpose, but it might work for "important" cases. Thank you.
<humor>Okay, Java only mostly sucks.</humor>
 
To be honest, I think it can get slightly decent with the next iteration, once it gets lambdas.
 
@R.MartinhoFernandes And you didn't make a point. You introduced a very useful thing. Thanks.
 
12:27 AM
But there's something about the whole Java ecosystem that seems to foster crappy APIs.
 
Getting called down from the office. Later guys.
 
Have fun.
Oh wait, office.
:P
 
god damn it.
They ran out of Wii U preorders in 24 hours.. What is this shit..
 
Supreme laziness: ordering pizza from a Web site.
 
@EtiennedeMartel Some websites offer coupons for ordering online.. like Domino's.
 
12:31 AM
@EtiennedeMartel Oh yeah, that's awesome.
 
@Rapptz The proof that humanity still has problems to fix.
 
@EtiennedeMartel you could order pizza hut from inside Everquest2 with /pizza
 
@MooingDuck Well, that's quite the product placement.
 
@EtiennedeMartel en.wikipedia.org/wiki/EverQuest_II "In February 2005, EverQuest II began allowing players to place an order for pizza delivery from within the game, with a simple and easy command typed into the chat bar, "/pizza".[2] This promotion has since ended, but generated significant press for the game."
 
That's awesome. Even if it's a product placement, it's awesome.
 
12:43 AM
?
 
@MooingDuck epic :D
 
@JuanAntonioOrozco Hi. Who are you?
 
hi im juan an student from mexico
 
Hello Juan. Welcome to the Lounge.
 
12:48 AM
thanks
 
"This is the way professional programmers are: They want to see
symbols more than numbers." Why am I having a hard time believing this
 
Without context, it's hard to understand what that means.
 
@MohamedAhmedNabil Depends on what "symbols" and "numbers" mean in this context.
 
heeeeeeey
 
@EtiennedeMartel predefined constants
 
12:53 AM
Howdy.
 
Why are you up so late?
 
It's only 02:00.
 
The robot never sleeps.
 
12:53 AM
cough
 
That's not only
 
@MohamedAhmedNabil Yes, magic numbers are BAD BAD BAD
 
@MohamedAhmedNabil Still don't get it.
 
@R.MartinhoFernandes Where do you work now? Do you want to work in compilers at Oracle?
 
@Rapptz Professional programmers dont like seeing numbers in the code, they like predefined constants
 
12:54 AM
Are you a recruiter now?
 
No :) But they are looking for people, and you're really good
 
@MohamedAhmedNabil Like Chimera said, magic numbers are bad.
 
@MohamedAhmedNabil That's right, because when you see 14 in the code instead of MAX_NUM_THREADS you don't know what you are looking at. Not to mention it's easier to maintain a constant.
 
@Chimera I thought programming was all about numbers xD I was so wrong
 
What is more readable?
14
or
MAX_NUM_THREADS
 
12:57 AM
@Chimera the predefined constant, I get it now
 
@MohamedAhmedNabil great
 
@ManofOneWay I don't have a "real job" right now. We'll see if it gets real very soon (in fact, I'm working late right now, because we need to get some things right for a presentation we'll have to do soon). But I like to keep my options open, because we're not entirely sure we can make this thingy work out.
 
@R.MartinhoFernandes If you want to, I can talk to some people
@R.MartinhoFernandes If so, let me know
 
Ok, thanks.
 
Are you actually working at the moment?
 
1:00 AM
@Chimera Or ZERO and 0.
 
@EtiennedeMartel Erm, no, that's silly.
 
@EtiennedeMartel for(int i = ZERO; i < TEN; i++)
 
What about NULL and 0?
 
That's... unfortunate.
 
@Chimera I pretty much shouldnt use numbers except in loop counters or something like that?
 
1:03 AM
You could comment your code to explain.
 
I don't agree with comments instead of named constants (or comments instead of functions).
Comments are not maintained.
 
I don't either, but it's an option.
 
Nice with weekend or what do you say guys?
 
I remember someone showed curiosity about my ideas about designing the bestest language, but I don't remember who it was. Whoever it was, I wrote this gist.io/3707974.
 
getline has delimeter (newline) how can i get rid of it?
 
1:07 AM
@R.MartinhoFernandes Support for anything other than x86 and ARM

If it forces me to make the language any more complex than I want, I don't care about your platform.
 
Mwahaha new avatar xD
 
What's this got to do with the language?
 
@ManofOneWay C++ has lots of UB that exists only to support all kinds of exotic platforms.
 
@MohamedAhmedNabil getline(in,str,delim)
 
@Rapptz yea, but i dont want any sort of delim
 
1:14 AM
@MohamedAhmedNabil why
 
@R.MartinhoFernandes I'm really tired, it's 03:18 here
 
Tbh, I don't see how it makes sense to have a getline function without a delimiter. There cannot be a concept of multiple lines without delimiters.
 
@MohamedAhmedNabil Do you mean getting rid of the delimiter in the resulting string?
If so, there's nothing to do, since the delimiter is not included.
 
1:30 AM
Hey guys , I am trying to create a solution with 2 projects (one of which is being built as a static library)
But whenever I try to build it , it says "unable to run program engine.lib" (I have set up the dependencies and everything ! any obvious reason for this ?
 
The library project cannot be the startup project
its trying to execute a .lib
 
@Borgleader it isnt , I have set the other one as the startup project and I have told it that the engine is a lib
 
Well to me the message seems to indicate that it's trying to run the .lib
 
@Borgleader nevermind, it seems I needed to restart Visual studio and reset the project as startup for all the changes to reflect
you'd think that we'd be past the point for needing to restart a program !!
 
@angryInsomniac Remember that the next time you're writing a program of yours.
 
1:36 AM
@R.MartinhoFernandes I do :) almost anything I write lets you do on the fly changes if they make sense ! ( I must concede that I have never written anything approaching the complexity of Visual studio though :P )
 
@angryInsomniac I would suspect the problem with VS stems less from its overall complexity than simply its age. It's been partially rewritten a few times, but is probably overdue for a ground-up overhaul. Unfortunately, given the quality of work they've put into it recently, if they actually did that, the result would almost certainly be (quite a bit) worse than what we have now.
 
@JerryCoffin Quite possibly ! I however shouldn't really be bitching since they gave me the pro versions for free :P
 
@angryInsomniac That would be pretty hard to complain about. If they threw in VA-X for free too, I'd be a really happy camper.
 
@JerryCoffin I hate free stuff ! ... said no one .. ever :D
@JerryCoffin wuts that ?
 
@angryInsomniac Visual Assist X. The secret sauce that makes Visual Studio tasty and wonderful.
 
1:46 AM
I haven't tried VAX, but I tried R# and I can't use VS without it (I only use VS for .NET stuffs, not for C++).
 
hi guys, how i must insert a line break in a std::wstring, i tried whit \n but it dont work
 
@JerryCoffin Interesting :D will try to harass my univ to get it
 
Got two upvotes on my CodeReview post :)
 
I remember who you are.
It just came to me, you're that guy who used me as an example why your code was better.
That was rude and irritating. Especially since the difference would have been absolutely minimal.
 
Lol, how did that happen.
 
1:54 AM
lolwut
 
I was just thinking I saw the name Borgleader before.
Then I remembered, I don't really care now though
How is my suggestion different than Kerrek's? Plus its definitely better than adding an outside variable for the counter like Rapptz did (performance wise anyway) — Borgleader 2 days ago
but yeah I don't really care. lol was just surprised I remember.
 
Reminds me of that story in the bible.
 
The one where the dude feeds everyone?
 
Thats you o.o
 
?
 
1:58 AM
I was just trying to understand why I got downvoted and I didn't see a fundamental difference in our approaches.
 
I don't know.
 
I got downvoted for telling someone how to fix their problem which involved including precompiled headers and got into an argument about them. SO is a weird place.
 
> God, I thank you that I am not like other people—robbers, evildoers, adulterers—or even like this tax collector
> How is my suggestion different than Kerrek's? Plus its definitely better than adding an outside variable for the counter like Rapptz did (performance wise anyway)
Perhaps I have too much imagination.
 
lol
0
Q: Calculating it wrong in a C++ coin change program

user15169So, I am trying to build this program, where I am suppose to take an input from a user which is a total amount and an amount which is the paid amount. Now, the balance should be broken down into $10, $5, $1, quarters, dimes and nickles. But the below program/code, tells me the total number of qua...

 
2:00 AM
Too localized.
 
I wanted to flag too.. but I don't know.
 
flag?
 
Button next to retag.
 
I'm having a brain fart. What's the term for the difference in how bits are represented?
 
No I mean flag as what?
 
2:02 AM
Too localized
 
@chris What do you mean?
 
I downvoted the answer now I have a neat number of rep (850)
xD
 
Never mind, it's endianness.
 
Oh.
 
2:04 AM
wth?
the same person posted a different answer?
 
lmao
Just saw that
 
I noticed because I got 1 rep back xD
 
@chris Where?
 
-1
A: Calculating it wrong in a C++ coin change program

CaesarThe easiest fix is to get the number as a float then multiplying it by 100 then saving it as int. #include <iostream> using namespace std; int main ( ) { float userNUmber; int change, quarters, dimes, nickels, pennies; // declare variables cout <<"Enter the amount of mo...

accepted..
Reminds me of that meta thread for a badge for an accepted answer with a score of -5 or lower..
 
lol what was the proposed name for the badge?
 
2:08 AM
@chris Also, I've noticed you've taken a liking to my rule of zero post :)
 
@Borgleader Purple Heart
38
A: Badge suggestion: Unsung Hero (5 accepted answers with no votes)

TheTXII actually like this idea. It also made me think of another badge idea. Purple Heart - Accepted Answer with a negative score.

 
Ah, TheTXI.
The guy responsible for the unicorn craze.
 
He also posts a lot of memes on meta.
 
Wow.
-24
A: Break statements In the real world

S.LottIn the real-world, I look at every break statement critically as a potential bug. Not an actual bug, but a potential bug. I challenge the programmers I work with on every break statement to justify its use. Is it more clear? Does it have the expected results? Every statement (especially ever...

+77, -101, +500 bounty.
 
Everything in that question is upvoted and downvoted to zero.
Well on the second page, most of them are
I didn't know there were criticisms for using break.
Does bitbucket use markdown like github
 
2:19 AM
For READMEs?
Yes.
 
nice
I just looked it up on the documentation, instead of ```` for code syntax it uses :::
 
2:31 AM
@Rapptz wait there's a tag ? lol
 
implicit tag.
 
@Rapptz: what the fuck man, the tag even has a follower
WHAAAAAAAAAAAAAT?!
--faith_in_humanity
 
the homework tag has 1.4k followers
 
@Rapptz Not really. I suppose coin-change problems can show up in some POS development. I'm not sure if that would generate decent questions, but well...
 
piece of shit development?
 
2:36 AM
Point of sale. (likely to be both)
 
@R.MartinhoFernandes: heh
if some guy doing POS dev is asking about coin change questions, I...
I... don't... I... (sigh)
 
@R.MartinhoFernandes, Sorry, I was gone. I have taken a liking to that.
 
wtf?
0
A: Why is processing a sorted array faster than an unsorted array?

LukaszWhen data are sorted, the framework can and will (most probably) use binary search algorthitm (or its variations): http://en.wikipedia.org/wiki/Binary_search_algorithm Its power is very brightly illustrated by 2 analogies from real life (from Wiki): 1. Number guessing game: This rather simple...

I fail to see how that's in anyway relevant to the question.
 
"When data are sorted, the framework ... " what?
 
2:48 AM
That guy Vulcan's solution is fast eh
 
@Rapptz I wouldn't consider it a solution since it takes advantage of the benchmark loop.
hence the downvote and that long comment
 
@R.MartinhoFernandes He's so full of shit. And I know quite a lot about shit.
 
@Mysticial WTF. That's cheating.
 
Adisak's comment makes that pretty clear.
 
I'm still amazed at how fast the vote counts for the question and your answer rose that day.
 
2:53 AM
Of all the other answers, I liked WiSaGaN's answer. That's a type of optimization that I occasionally do as well.
@chris Yeah, it was pretty ridiculous. AFAIK, only Eric Lippert's book in hotel room answer was ever faster.
 
railroad picture = instant upvote
I mean, if you go and fetch a picture of a railroad to support your answer's analogy, it's probably a good one
that said, it was indeed a very good answer, probably the best explanation of branch prediction I've seen
 
That was new to me. I learned a lot.
 
I added that picture and analogy hoping to get a few hundred votes out of it. I couldn't have imagined that people would like it that much.
 
a few hundred upvotes
meanwhile none of my answers have 10.
 
@Rapptz: railroad pictures man
 
3:06 AM
All I remember was that it had about 80 votes when I submitted that final edit with the picture and analogy.
 
@Rapptz: try and plug in a railroad analogy, add a picture, and link to @Mysticial answer's
 
I was hoping it would help it to a few hundred - and if I'm lucky, maybe it would beat my denormal float answer.
 
Inspired by Alexander Lee
 
What I didn't expect was for it shoot to the top of reddit/r/programming in under 2 hours. (and stay there for a solid 24 hours)
 
@Mysticial: there are probably a few hundreds out there that didn't even have any fucking clue of what branch prediction was
most likely PHP devs
and then they come the next day at the office and plug that stuff in the conversation
 
3:09 AM
@netcoder I would imagine that most people have never even heard of it.
 
please, if i mentioned branch prediction at school, they'd think i'm crazy
 
what are you in? high school?
high school kids probably think you're crazy if you mentionned that, yeah
 
yup. last year
 
or you know "whoa man... that's messed up dude yo, you can predict the future"
@chris nevermind ;-)
 
nah, out of all of the people in the school, only my friend is about as crazy for coding as I am
 
3:13 AM
85k views right now...
 
o.O
 
That isn't actually much compared to most of the other things with 1k+ votes.
 
@Mysticial You have 2 reddit accounts for posting questions from SO?
 
@Rapptz Yeah. Apparently, my first one got banned.
 
Well I never posted anything on reddit so I find that impressive
 
3:16 AM
@Borgleader: what's impressive? posting on reddit?
 
getting 85k views
 
ah ok
if you want to free reddit karma, just reposts Mysticial's answer
it's what reddit is all about
 
All the old questions have at least 10k views..
 
@netcoder no, they hate dupes that happen too close together.
That loop question that I answered with 500+ votes has over 100k views.
But it's much more difficult to understand. So the it got a low fewer votes.
 
Then those questions that are easy to google.. have like 100k+ views.
As an example
388
Q: Splitting a string in C++

AshwinWhat's the most elegant way to split a string in C++? The string can be assumed to be composed of words separated by whitespace. (Note that I'm not interested in C string functions or that kind of character manipulation/access. Also, please give precedence to elegance over efficiency in your ans...

> viewed 367951 times
 
3:20 AM
Choosing a good title for something like that is important.
 
I answered a non trivial question on strings...for once... yayyy
 
Most of the highly-searchable questions have been taken up back in the early days of SO.
If you go through all the +1000 posts on the site. The vast majority of them are very old.
 
Oh wow. That string split question has more views than the book question.
 
All the recent ones got that high because they viral for a few days.
 
@Mysticial, Yes, all of the more fundamental questions and joke questions are pretty old.
Oh, I thought up a bonus for the first year C++ class.
 
3:23 AM
My favorite question on SO is the what is your favorite comment in code question
 
@Borgleader: that's very off-topic though, and subjective, etc.
 
I'm giving them the whole year to explain a 2-line code sample with 2 lambdas in main covered up with a few digraphs.
 
@netcoder: doesn't matter had laugh
The one about Richard is particularly hilarious
 
Anyways, I'm actually gonna head to bed early today. I'm sleep deprived from last night and I got some stuff to do tomorrow.
 
Mysticial sleeping early? Inconceivable!
Good night though.
 
3:27 AM
@Rapptz Yeah. I have something to finish by 1pm tomorrow. I'm supposed to be doing it now. But I'm too tired to concentrate. So yeah, I'm gonna sleep - at 10:30pm...
I was up till 5am last night and got up at 9am.
 
@Mysticial Story of my life.
 
3:46 AM
@Mysticial Have fun.
 
3:59 AM
@Rapptz Damn. That's good.
 

« first day (700 days earlier)      last day (4253 days later) »