« first day (486 days earlier)      last day (4445 days later) » 

11:00 PM
If the answer is obvious with a vector, then who would sit down and cut their feet off to do it with a linked list?
 
well, this page is stunning: richelbilderbeek.nl/CppCstdalignH.htm
 
and obviously, someone edited my question and took away the "I am a student" part
 
@user1079641 I'm just explaining why people aren't leaping at the opportunity to answer your requests.
@user1079641 It makes no difference, as it doesn't make the question any more interesting.
Just think about it, anyway. You have to fill in the missing terms with zeros.
 
@user1079641 Also, only one answer said "use an array" and had nothing for linked lists
 
So there'll be some sort of loop over the power, starting at zero, and conditionally adding terms if the term is present.
 
11:02 PM
@user1079641 the fact that you're a student is irrelevant. The relevant part is the arbitrary restriction, which I have now put in your answer
 
Missing the "homework" tag is also a drastic faux-pas, as it will make people even less inclined to entertain those seemingly erratic requirements.
 
@KerrekSB fix'd
 
@MooingDuck thanks
@LucDanton Yes, quite. I wouldn't expect there to be fewer features!
 
@KerrekSB Well then I don't understand the question.
 
@LucDanton I wasn't asking any questions. Just a sort-of reason why there's that stdbool header.
 
11:05 PM
Most programming questions don't sound interesting to anyone...Its about you knowing the answer the question and your will to answer it.
 
@user1079641 And the will seems to be absent. Case closed
There is no duty to answer
 
Of course there is no duty
 
answer, will, duty; pick your poison :)
 
I have a question of interest to anyone that deals with generic programming: what exception guarantees would you feel safe to make for the assignment operator for a variant type? IIRC Boost.Variant can provide the strong guarantee.
 
@user1079641 some questions are interesting and/or fun. Unfortunately, yours is not
 
11:07 PM
I respect the efforts of people who answer my questions, but if they don't understand the question, am I not supposed to to tell them?
 
@LucDanton If only Martinho was here. I believe he was working on a variant constructor last week (non-boost) and wondered how to make it nothrow
@user1079641 Not really. Only if it helps. It is ok to come here looking for volunteers. If people tell you why they're not interested, just say, "Ol, thanks anyway"
 
Well if un-fun questions aren't allowed, I guess you people should put up a warning saying do not post questions that aren't fun ?
 
@LucDanton assignment oeprator for a variadic? I don't see why it needs any guarantees except for destructor can't throw
 
@LucDanton I can never remember what those guarantees are. Would it just be the weakest among the types?
 
@user1079641 they're totally allowed, they just might not be answered.
 
11:09 PM
@user1079641 Nobody disallowed it. The question is right there, and I don't see it getting closed
 
@user1079641 it's not illegal to lick pavement, doesn't mean we will do so.
 
@user1079641 Nah, you can post all you like. Just don't always expect an answer.
 
@MooingDuck Mmm. that's a stretch
 
@KerrekSB careful with that, he posted it twice :/
@sehe I'm a stretchy person. And really bad with analogies
 
@MooingDuck variadic? variant
 
11:09 PM
@KerrekSB Weak means that the object which member has thrown something is 'toxic' (no guaranteed state, invariants won't hold, etc.), strong means that the object is in a known state and invariants still hold, no-throw means, well, just what it says on the tin.
 
@MooingDuck elastic fantastic
 
I don't expect someone to spend hours answering my question, but I hope someone will help me
 
@sehe erm, yes. That's what I meant
 
@MooingDuck Hehe... but honestly, I don't really mind. It's not like serial-interview guy last year
 
@user1079641 four+ people did already
 
11:10 PM
@LucDanton Ah, right, it's about the atomicity of validity somehow, right?
So, if the active type only has a weakly-safe assignment, then I doubt the entire variant could do better
 
@KerrekSB Validity yes, atomicity I'm not so sure.
 
They did and I told them that their answer didn't completely answer my question, and then you came and said its my fault
 
Until the next assignment, that is.
@LucDanton "Transactionality"?
 
@MooingDuck 4 people have helped you. You are just not satisfied. I'm not saying you should, but just take the disappointment and learn it yourself then. I'm sure there are tutors and peers students. I might even think there are study guides and books
 
:2640308 Part of the invariant is that an object is never 'empty' in this case. (Boost.Variant has the same.)
 
11:11 PM
@user1079641 And because you don't like that answer, does that mean we're wrong?
 
@sehe you mean user1079641, but yes
 
as i said i respect other people
 
@LucDanton Hah, I have the same policy on my whisky shelf.
 
s answers
 
@user1079641 It happens that people don't answer your exact question. Sometimes, when they get hooked, they will spend the next three weeks tuning the answer. Sometimes, they leave it at that.
 
11:12 PM
@user1079641 also, if you don't understand our answers, you should talk to your teacher. He's paid to know how to explain stuff to you
 
Anyways, you're on ignore from now for me
 
@LucDanton oh, alright
 
@user1079641 You can also add a bounty to encourage an answer.
 
you can't do anything when your teacher doesn't help you much
 
@KerrekSB That's a good point. That was created specifically for this kind of purpose
 
11:13 PM
@KerrekSB Well, really it's just a common vocabulary to express guarantees in terms of other guarantees. E.g. std::vector<T>::assign has the same guarantees as that of the assignment operator of T (well I don't know if this example actually makes sense or is true).
 
@user1079641 Try complaining to him, instead of us
 
I am not complaining to anyone
 
@user1079641 Think about the problem more; try something; if you still fail, post a specific, concrete problem, as narrow as possible.
 
I didn't get the answer to the question so I asked again
 
@user1079641 You are not?
 
11:13 PM
Rinse and repeat.
 
Yes, I am not complaining...All I did was ask and when I didn't receive the answer I needed, I was asked by other people in this room why I keep asking despite getting an answer
 
@LucDanton Oh, I just meant that all exception guarantees are about ascertaining a certain level of transaction-safety in the event of exceptions, to my understanding, but I'm not sure.
 
@MooingDuck This does mean that behind the covers the object can actually become empty when construction fails. But when construction fails, there's no object to prod from the outside world so it still counts as the strong guarantee!
 
@user1079641 until better answers appear, how about just code a simple version, that only works if both have all four numbers, and then post that code. I think it might help a lot. Do you understand how to do that part by yourself?
 
@KerrekSB Ah yes, I see what you mean. Yes, there's a parallel with transactions.
 
11:15 PM
Does anyone have the same problem: I once refreshed the chat when halfway into a message. Now, anytime I open my browser, or reload the page, I get that message as a pending edit.
The irony is that message is now over week old. I might clean my cookies, I suppose
 
@sehe ctrl+f5?
 
you guys are very mean..."Do you understand how to do that part by yourself?" i thought a community of developers will be able to help me as I had heard from my friends who referred me here...To answer your question, yes i can
 
@user1079641 I'm sorry, I actually rewrote that three times to try to avoid being offensive. It was very much not my intent to offend :(
 
@MooingDuck Firstly, I'm on opera; secondly that won't help because ctrl-F5 only means 'ignore cache expirations' - so it influences server resources only. This is clearly client data. It must be a cookie. I'll delete my cookies first
@user1079641 For the record, I accept this explanation.
 
Its ok, I just need to finish this quickly and I guess I wasn't clear enough for anyone to be able to help me, I will write more code and try to find a smaller problem so someone can help.
 
11:19 PM
@user1079641 Right now, I think it would be good advice to leave it at this. It certainly comes across as 'complaining' by now, and all points have been sufficiently made. The 'bounty' suggestion seems a good bet, as is the idea of posting/editing into much more concrete version of the question
@user1079641 Cheers, that's the spirit. I'm sure we will recognize it as such and will certainly show our appreciation of the effort. See e.g. this now-famous question:
47
Q: Why does the use of `new` cause memory leaks in C++?

user1131997I learned C# first, and now I'm starting with C++. As I understand, operator new in C++ is not similar to the one in C#. Can you explain the reason of the memory leak in this sample code? class A { ... }; struct B { ... }; A *object1 = new A(); B object2 = *(new B());

@user1079641 It started out with a onfocused question by a newbie user of the site. He was initially complaining about people not willing to answer his 'diffuse' question, because, it was basic and overly broad at the same time. We (I) urged him to repost a single question from that post as a separate, and see what that brought him (^^)
 
+168? wow, pictures go a long way!
 
@user1079641 StackOverflow rewards questions that work well; it is not about whether it is an interesting question at all (this question really reather excruciatingly dull and basic). Make it short, make it specific: make it answerable. In the worst cas, you get linked to the FAQ or marked a duplicate of another question :)
 
@sehe to be fair, you asked him to leave it at this, and then posted four additional messages about it :D
 
@MooingDuck Because sehe is getting hooked now :-)
 
@MooingDuck I meant to advise him to do so. Then I provided a rationale for that.
 
11:25 PM
@sehe sehe has 44k rep, and the default avatar?
 
@KerrekSB I certainly was. Not on the content of the question, unfortunately. Never had a thing for polynomials.
@MooingDuck And I grow a beard. I'm just that lazy. I don't care for 'externals'
 
@sehe Try formal power series.
 
@KerrekSB ? Sounds mighty sexy for a valentine's day
 
@sehe None of this finite crap, and multiplication is well-defined, too.
 
@sehe hmm, wonder what confusion it would cause if I changed my name and avatar to yours. Or DeadMGs! And then was nice to people! :D
 
11:27 PM
@sehe Haha, quite. I don't often go to infinity.
 
@MooingDuck No one would notice, if you were nice and pretended to be me?
I mean, I **am** me and I pretend to be nice.
No one noticed that yet
 
@sehe Speaking of, I need to go. I wish you all lots of rep during the night hours.
 
@KerrekSB Don't need no rep today. Cheers
 
@sehe they wouldn't notice as fast I wouldn't think, until you started writing lots of code that didn't compile
 
@MooingDuck And they would notice the amount of very bad puns decreasing on average. I'm sure the robot would detect an anomaly, but he isn't here.
@MooingDuck Anyways, I'm so glad I convinced you to keep your screen name before, I'm sure I can convince you again :)
 
11:30 PM
@sehe but if DeadMG was nice for a day.... :D
 
@MooingDuck We would get moderators visiting because of suspected sock-puppetry or account hijacking
 
@sehe I actually changed my pic the other day to a giraffe saying "Moo, I'm a goat!", but changed it back
 
Nah. I recently declared my respect for DeadMG. He's got a nack for nocks but he isn't bad.
 
you did? I wasn't watching
 
@MooingDuck I doubt it would work on a thumbnail size
@DeadMG Let me google that for you, 20secs...
 
11:32 PM
@sehe actually it was mostly the colors that bothered me, but I could read it fine
 
Feb 7 at 23:13, by sehe
But I won't get into a mess over that. I respect you even though you are arrogant.
Feb 7 at 23:13, by sehe
You know why?
 
@sehe DeadMG gets angry with me a lot, because I challenge assumptions and voice those before I think everything through. He's convinced me every time though.
 
and the rationale follows, as usual.
 
So I do have a more specific question but i don't think I need to post this as a question
Can I ask it here? It would only take like 2 minutes to answer
 
@user1079641 As they say on the interwebs "Don't ask to ask"
 
11:37 PM
ok ill ask
 
@user1079641 sigh :) We might need to add "No need to precipitate the Q" to the meme
 
I have a bunch of lines of polynomials of different sizes (as you know by now), I am using string tokenizer to take coefficient and exponent of each part of the polynomial. How would I go about running a while loop that takes each line and using string tokenizer, creates and connects as many linked lists as needed in accordance with the length of the polynomials?
 
@user1079641 isn't there only two lines? Or has this been generalized? Nevermind, stupid question
 
@user1079641 Erm... You would run a while loop that takes each line and using string tokenizer, creates and connects as many linked lists as needed in accordance with the polynomials.
 
there are 10 lines and i only need it to run for two lines at a time
@sehe funny but I am kind of serious right now
 
11:41 PM
I'd give each list an element at(index) member, that gets the element at that index of the linked list, or adds it if needed. That makes everything else much easier
 
you'd offer random access to a linked list?
ballsy since every call is O(n)
 
@DeadMG it's a one time use learning assignment, I'm going to focus on easy for the moment
 
fair play
 
@DeadMG and his samples are never more than 9 elements
 
here are two sample lines
10x^5 -3x^3 +4x^2 -234x^1 -12x^0
-5x^5 -2x^3 +10x^0
 
11:44 PM
@user1079641 I really want to help you, and I can think of some C++ for it, but I don't know about string parsing in java :(
@user1079641 but read in a line, read an "element/power" pair of numbers, stick that element at the power-index of the list, and repeat until the newline
once for each line.
 
well i know a little about string parsing and if you tell me what you are talking about, i can write it in java
 
Ooooh, I can use the strong guarantee if the types have a no-throw move constructor, basic guarantee otherwise.
 
@LucDanton It's my understanding that the Standard authors couldn't do better for the Standard library
 
Then start at the beginning of each list, and choose whichever has the bigger "power", and print that node. If they're equal, add the element/values, and then print that. Then move to the next element of the bigger or both lists as appropriate.
 
so here is part of what I have right now
StringTokenizer myTokens;
String line,polyTerm;
Node first=new Node();
Node second=new Node();
while (inFile.hasNextLine())
{
line=inFile.nextLine();
myTokens=new StringTokenizer(line);
polyTerm=myTokens.nextToken();
first.value=polyTerm.substring(0,polyTerm.indexOf("x"));
first.value2=polyTerm.substring(polyTerm.indexOf("^")+1);
}
 
11:48 PM
Double dispatch makes it look like it's complicated but once you're inside the visitor it's really about a wrapper.
 
polyTerm=myTokens.nextToken(); sets polyTerm equal to 2x^4
firstL.value = 2 and firstL.value2 = 4
the problem comes here where I don't know how many times should i do first.value or first.next so that i get the whole line in as i don't know how long the polynomial actually is
 
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/StringTokenizer.html
StringTokenizer st = new StringTokenizer("this is a test");
while (st.hasMoreTokens()) {
System.out.println(st.nextToken());
}
 
this
is
a
test
 
So you'll need to have a while (st.hasMoreTokens()) { inside your existing loop
 
so it captures each word
 
11:54 PM
@user1079641 they delimit on spaces, you delimited on "x" and "^" in yours. Well, kinda
 
yes because that seems to be the best way
i could have done something else
 
while (st.hasMoreTokens()) {
    first.value = st.nextToken("x");
    first.value2 = st.nextToken(" "); //each begins with a ^,
    //stuff
}
 
i followed your advice and it seems i got it
while (inFile.hasNextLine())
{
line=inFile.nextLine();
myTokens=new StringTokenizer(line);
while (myTokens.hasMoreTokens())
{
polyTerm=myTokens.nextToken();
first.value=polyTerm.substring(0,polyTerm.indexOf("x"));
first.value2=polyTerm.substring(polyTerm.indexOf("^")+1);
System.out.print(first.value + " " + first.value2);
}
System.out.println();
}
2 4-5 3+9 2-10 0
3 4-6 3+10 2-11 0
-2 1+4 0
2 1-4 0
 
@user1079641 yeah, better, we're making progress
 
thats what is prints out
 
11:59 PM
wait no, that's the wrong direction, sorry. I misread part of your code
 
did that but that prints the whole word out like this:
2 2x^4-5 -5x^3+9 +9x^2-10 -10x^0
3 3x^4-6 -6x^3+10 +10x^2-11 -11x^0
-2 -2x^1+4 +4x^0
ok
 

« first day (486 days earlier)      last day (4445 days later) »