« first day (375 days earlier)      last day (4556 days later) » 

12:17 AM
I'll just leave this here...
 
no, really?
I figured you were posting it and then taking it away before I could see!
 
lol
haha
what you doing?
 
watching Futurama
in three or four more episodes, I'll have watched all of it
 
Wow, you've been doing nothing else for the past days, have you?
 
well
I'm supposed to be working very very hard
the problem is that the more I have to do, the more I put it off
 
12:26 AM
lol, I know the feeling
well, I've actually been coding for the last few days, but before I was only browsing reddit for days on end.
@RMartinhoFernandes what you doing these days? Looking for job, or just taking it easy?
 
I'm confused again agh
So the accept function is like a listener, listening for a request yeah?
 
also
I'm out a shit ton of money
 
No that's wrong, an accept accepts requests already in a queue...
 
@TonyTheLion The latter.
 
my old landlord owes me £250, the government £1200, and the university at least £600
 
12:28 AM
@RMartinhoFernandes oh wow
cool
@DeadMG oh wow
so how do you live without money?
@LewsTherin yes, cause listen() will do the listening bit
 
when my granny kicked the bucket a few months ago I got a little liquid capital
 
oh nice :)
 
I've been mostly living off that until the other financial arrangements are, well, arranged
 
right.
 
@TonyTheLion yeah.. I don't understand why accept needs the original socket though.
 
12:31 AM
It needs to know what socket with pending connection requests you want to accept a connection from.
 
sigh
I hate other people with a passion
unreliable, shallow sacks of shit
 
ha ha
 
@DeadMG so you hate us too?
 
eh, I can just ignore you any time I like
 
lol true
 
12:33 AM
@RMartinhoFernandes I don't understand, there is obviously one socket from the server. Does it check to see if the connection belongs to that socket?
 
@TonyTheLion Let's hope he meant "people other than us regulars in the C++ room".
@LewsTherin You can certainly have more than one socket.
 
@RMartinhoFernandes I think, "haters gonna hate" applies here
 
@RMartinhoFernandes yeah that's the socket with the well known port.
 
@LewsTherin But you could just open another one.
 
@DeadMG so what exactly makes you say something that horrendous?
 
12:35 AM
Nothing forbids you from having only one socket listening for connections.
 
because
you can never make them shut up and go away when you want them to
 
@RMartinhoFernandes As I understand it.. the server has a socket bound to a well known port. And whenever it accepts a connection request, it creates a temporary socket leaving the well known port to accept more request. What I don't understand is why accept requires the socket with the well known port.
 
@LewsTherin Your server may have one socket. But you can have a server with two listening sockets, each bound to a different port.
 
@DeadMG oh
 
@RMartinhoFernandes Yes that's true.... but I was hoping we could keep things simple lol
 
12:37 AM
@LewsTherin And you can. But the reason accept needs the socket, is because you can have more than one.
 
and they never understand what you have to say
and they take forever to get back to you with anything meaningful
and they're critically incompetent in just about every respect
 
That's humans for you.
 
@DeadMG and you're not critical?
 
@RMartinhoFernandes oh right. But what does accept do with the socket though? Compare the socket port number with the connection request?
 
@DeadMG and that's not a whole load of epic generalizations?
 
12:39 AM
@LewsTherin Each socket has a queue of pending connections associated. It needs to know what queue to use.
 
never met any exceptions
 
You need to meet more people.
 
woah, you're not gonna get far with people when you have that attitude
 
@RMartinhoFernandes Yeah that makes sense, I think... The handle holds a reference to some sort of queue s->queue blah.. something like that?
 
Yes. Something like that.
 
12:41 AM
eh
people aren't very accessible
the only place to meet them is in places of excessive noise where you can't hear yourself think or them talk
 
Have you considered that maybe you're not very accessible either?
 
nobody else appears to have any knowledge of how the process of "meeting people" actually works
 
perhaps you have the wrong people around you, ever thought of that?
 
yep
 
@RMartinhoFernandes Thanks man maybe I can understand the basics
 
12:42 AM
and tha
t
 
if you ever want to get along with anyone, you're gonna have to change your ways of thinking about others, and probably yourself too
because the problem is most likely not them, but you
 
interesting
somehow, I must have failed to note my own responsibility for their excessive drinking and noise
 
I used to be very bad with meeting others too, and then I realized it wasn't them who were the issue, but my behavior towards them
@DeadMG well, how could you be responsible for their drinking? Could you make them change their drinking behavior?
 
no
 
I don't know, talk to them about it, when they are not drunk
or call the police and complain about the noise
 
12:46 AM
yeah, that totally works
in a not at all kind of way
 
if they don't listen
@DeadMG you haven't ever tried have you?
 
I did a few times
then I stopped
now I just do my best to avoid other people to the maximum extent
 
oh yea, so to handle the problem is to avoid it, good luck with that theory
 
I told you before, that doesn't help when the goal is to meet interesting people.
 
Agh, ok I will never understand this. A socket doesn't store the dest ip/source ip directly right...it uses another data structure.
And a socket doesn't store the data written to it directly, but uses a separate buffer for it.
 
12:48 AM
I'd rather not meet interesting people and avoid it than have to interact with almost everyone that I've met
 
@LewsTherin It stores stuff somewhere. It doesn't really matter.
 
@DeadMG ok, so skip the one's you have met, go to a place you haven't been and meet new people. Not everyone is equal to everyone else
 
@DeadMG Then why are you bitching?
 
@RMartinhoFernandes Ok.. Why didn't it have everything in one socket structure? At least it'd make it easier to know which is which.. i'm thinking too much OOP here
 
that would be a fair suggestion, but the process of "meet new people" is more than a little fuzzy
what do you want me to do, walk into a pub an go "Will u guyz be my friendz?"
 
12:51 AM
@LewsTherin It probably has. But all you get is a handle.
 
there's a computer club at the Union, but I avoided them because the Union guys are pricks
 
That's the way of doing OOP in C.
 
@DeadMG talk to someone, find out what they're all about
 
Not having access to anything other than the handle helps encapsulate the thing.
 
@DeadMG so you've been there and talked to them, or are you assuming they are pricks?
 
12:52 AM
unfortunately, the Union guys came to talk to me
repeatedly
even when I expressed to them how incredibly annoying they were being
 
oh, and what made them pricks in your mind?
define annoying?
 
@RMartinhoFernandes Oh.. I think I see. It's like a file. We store the data into a temporary array/buffer and pass the file pointer and the array into the function..which copies the data into the file.. I guess the socket works the same
 
well, they were holding some idiot election about which I didn't care, and they all came visiting my room endlessly begging for my vote
whilst I was busy not working
 
@LewsTherin Yes, it's a similar idea.
 
and I expressed to them a desire to be not bothered by their endless emails, letters, and interrupting visits
but they completely ignored it
 
12:54 AM
I see
 
also, they organized the mass binge drinking which I spent the whole year complaining about
 
so you spend most of your days alone then?
 
although technically I didn't hang here then so I guess you probably missed it
 
@RMartinhoFernandes yeah I think I understand. Thanks
 
I had an exam at 9am, and they went out and arranged mass binge drinking for all my hallmates, so that they could come in and trash the place at 3am
 
12:55 AM
oh damn, well I don't agree to binge drinking either
 
well, the thing is
I don't give a flying fuck if they want to rape their own wallets and brains
but I care a lot when they make it my problem with the ridiculous noise and mess
 
and the only kind of socializing they had was the kind where you get your head pounded in by excessive noise and booze
all organized by the Union and paid for with my tuition fees, of course
luckily I managed to escape the mandatory payment specifically for the excessive boozing through a typical administrative error
 
have you ever considered that the fact you don't give a fuck about what they do, makes you less in control over it? If you were to actually socialize more and care more about what they do, you could exert more control and probably have more influence over their drinking, and the noise they make as a result.
just a thought...
 
eh, I doubt they'd take kindly to my attitude
not to mention the fact that, well, I'm not an easy guy to get along with, let's face it
 
12:59 AM
well, you are stubborn for one thing
 
I can be pretty rude, but more importantly, I hardly speak the same language as people I meet in person anymore
yeah, and that
 
oh, you're rude?
hadn't noticed :P
 
haven't you noticed? :P
 
^^
thing is, realistically, my culture is completely different to them
 
1:00 AM
@DeadMG hardly speak the same language? You speak English, afaik
 
sure
but it's not the same thing
 
@DeadMG your culture is C++, afaik
 
these guys watch football and get drunk
exactly
I play games and write C++
 
so you need to find someone with the same interests as you
 
they're hardly going to get my Boxer vs Idra MLG Orlando 2011 second series references
 
1:01 AM
and hang out with these people
@DeadMG I won't get those either, but I'll get most of your C++ talk :P
 
heh
it's not so hard to translate from Game to Code, really
the problem is when you realistically have absolutely nothing in common
 
just so you know, before I had any friends, I had to interest myself in other things then merely my computer. I found some things that others had interest in, and found what I could be interested in, and I made friends that way.
 
I'm sure some of your classmates have common interests with you.
 
Now I have friends with which to share music, technology, car racing, etc
 
well, if there were other interesting things, I've got nothing against that
but the only common interests I've observed amongst other people are the kind where your IQ goes down a point for every minute you spend on it
 
1:04 AM
oh god
so, music for example, no interest?
 
eh
 
playing an instrument?
 
I have music, but playing it doesn't interest me
I don't have the necessary physical dexterity
also, I'm perfectly happy listening to the same music for sometimes many years on end
 
right, well, when I meet someone new, I always ask about music tastes, cause it's an easy point with most people to relate on
 
sure
 
1:06 AM
@DeadMG I do that too, sometimes the same song
 
but because I have no need to discover new music, I have absolutely no current music knowledge
 
wow
you're a funny lad for sure
 
there's "The artists on my computer that I robbed from my friends and family six years ago", and "Who?"
 
lol
well, I should go catch some zzzz's
cause I have social things to be doing tomorrow
 
They're right after the y's, it's hard to miss them.
 
1:08 AM
bb
 
I've been watching Torchwood lately, and I'm not enjoying it.
 
which season?
 
First one.
I don't really like the "monster-of-the-week" kind of shows.
 
eh
it gets better in Season 2
 
1:12 AM
I hope so.
 
try 206, it's a fun one
and there's a couple more fun ones right up after that
 
1:36 AM
It isn't working :(
 
That's the world for you.
 
harsh world
i have no idea what's wrong. I set the server to listen at port 1234 and it works
But I don't know which ip address to use for the server
netstat only says it is listening, but not the ip address
 
What's the machine's IP?
If you're only using one machine for both the server and the client, you can just use 127.0.0.1.
 
I will try that to see if it works...but shouldn't it use one of the 2 that the router has?
 
The router IPs are for access to the router.
There's probably NAT going on as well there, which complicates things a bit.
 
1:43 AM
Still not working...
 
Define "not working".
 
So 127.0.0.1 is actually the network interface card.
"Not working" It doesn't connect :(
oops hold on
It works but it doesn't print data from the server now...
Yay works now
but I have no bloody idea what's happening lol
I'm going to sleep. goodnight
 
2:48 AM
I'm so sick
:(
 
 
1 hour later…
3:48 AM
Hey if you have a "language" which can only take 123, or 1, or 2, or 3, or 12, or it can be 123123...(1, 2, 3, 12) etc. How would yo udefine the regular exppression? (1 union 2 union 3)* ???
@RMartinhoFernandes
 
Is "321" valid?
Because your expression allows it.
 
no 321 is not valid. Damn. how would i express it then?
Because i'm at a complete loss.
I can make an FA easily, but not an expression
 
123+ union 1 union 2 union 3 union 12?
 
but wouldn't that possibly give us 3123
@RMartinhoFernandes
 
4:00 AM
how not? I thought union could bring the 3 in front?
 
A union B means it allows either A or B, not both.
So you either get sequences of "123", or "3" (or any of the other choices).
 
Okay. Thanks, that helps. @RMartinhoFernandes
 
Hi, been a while.
Need some help with homework.
Weirdness with ifstream.
 
I'm here :)
 
@RMartinhoFernandes Cool.
I'm supposed to read three groades for a student - er, five students - from a file and do some stuff with it, but - I'm supposed to use a separate function to read the grades from a file.
So, I'ce got an ifstream and a three calls to it in the function, which is the way the instructor wanted it done, but it always restarts from the beginning. Globals are not allowed in this assignment.
 
4:07 AM
I think you should open the ifstream outside of the function and pass it as an argument.
I.e. the function is responsible for reading, not opening/closing.
 
@LucDanton - I've tried that, but not sure how to do that. I got a weird error trying to make an if stream an argument type.
//Reads in three grades and "returns" them as reference parameters
void readNextGrades(float &grade1, float &grade2, float &grade3){


    ifstream fin;
    if(!fin.is_open()){
        fin.open("grades.txt");
    }
    if (fin.fail()) {
        cout << "The method readNextGrades() failed to open file input stream. Returning.\n";
        return;
    }

    fin >> grade1;
    fin >> grade2;
    fin >> grade3;

    fin.close();
}
Which is why I popped open this chatroom.
Can I really pass in an ifstream?
 
You need to pass a reference to it.
 
Yes.
 
Ok, let me see...
Marvelous! Thanks guys.
 
Martinho
wtf are you still doing awake?
at least I'm nasty sick
 
4:19 AM
I woke up at around midnight.
 
by the way
laugh at my ludicrous compression algorithm that I invented three years ago when I sucked tremendously
I decided that you could reduce data to an index into an irrational number
 
Oh my god, I didn't know you had ever sucked!
 
hmmm
there was once a time
technically
I was but a young grasshopper who yet miracled at the idea of variable scope
 
Does anyone here understand pumping lemma?
I'm at a complete loss, tried watching youtube/reading, not helping <,<
 
No idea what that is.
 
4:25 AM
:( It makes no sense, that's what it is ahha
 
 
1 hour later…
5:31 AM
guys
 
no?
run it's Johannes!
 
avoid his clever questions
 
eh
they're usually useless trivia- the kind of thing you notice, and then forget due to it's extreme irrelevance
 
yup - should have added a smiley there.
but still, it can be fun
 
@LewsTherin: Have you read "The Design and Evolution of C++", or does that go against your ideology as well?
 
5:44 AM
i should fill my local subways with these videos.
 
The restaurant or the transportation?
 
haha - the transportation is what i had in mind, but the restaurant could also be interesting.
 
6:09 AM
@FredOverflow Would you recommend it?
 
6:41 AM
> Of all the things the problem that wasn't his was, being not his problem wasn't one of them.
Amazing.
 
7:38 AM
"Hey guys, I wonder if someone know how I can do magic in C++."
0
Q: fastest way to convert a std::vector to another std::vector

inf.ig.shWhat is the fastest way (if there is any other) to convert a std::vector from one datatype to another (with the idea to save space)? For example: std::vector<unsigned short> ----> std::vector<bool> we obviously assume that the first vector only contains 0s and 1s. Copying eleme...

 
I think I'll post a question about uppercasing a std::string without uppercasing each individual character.
 
@AlfPSteinbach What do you mean? Not having to write the loop? The operation of uppercasing is defined as converting is character to uppercase, I don't see how that could be avoided
 
@DavidRodríguezdribeas it was just in response to the question about copying a vector without copying.
 
of course, if the collection type was unspecified then it could suffice to set an internal flag.
 
7:44 AM
This is from late last night, so I guess I will try to bump it here, if no answers are found, I'll try again in a few hours...
3
Q: When must a type used as template argument be complete if it is used internally in a context that requires a complete type?

David Rodríguez - dribeasI have a question that has been puzzling me for a couple of hours. Initially I thought that the type would have to be complete at the point of instantiation, but all compilers I have tried accept the type to still be incomplete at that point, as long as it is defined anywhere in the translation ...

 
my immediate reaction is that the code is Wrong, but it compiles with comeau and msvc, and even yields correct answer with the latter
 
@DavidRodríguezdribeas From my limited understanding of templates and bearing in mind how std::unique_ptr works, types must be complete at the site of instantiation.
So I, too, would say your example shouldn't work.
 
8:00 AM
@LucDanton That is not really so... from the (now) current standard, §20.9.11.2/2 Specializations of shared_ptr shall be [...] The template parameter T of shared_ptr may be an incomplete type.
 
My feeling is the template it not compiled until the end. Its only expanded into source before test is complete
 
@DavidRodríguezdribeas uh, that's unrelated
 
Err right, should be complete at those sites that do require a complete type in the first place.
template<typename T> struct foo { void bar() {} }; being fine with incomplete types for all members.
 
And going up a little bit §20.9.10/5 Each object of a type U instantiated form the unique_ptr [...] The template parameter T of unique_ptr may be an incomplete type.
 
@DavidRodríguezdribeas Must be complete at sites that uses the destructor. Try it; you'll get a diagnostic.
 
8:03 AM
@MartyTPS Yes, that is my feeling of what is going on, but I still believe that it should be complete at the point of instantiation, which is consistent with Must be complete at sites that uses the destructor
@AlfPSteinbach That's completely related to Luc's last comment, the claim was that types used in templates must be complete, and I provided 2 counter examples to that claim
@LucDanton Funny enough, that is where all started, I will add a new question when I get to the office relating to that diagnostic :)
 
@DavidRodríguezdribeas oh, sorry, i didn't expect any such claim to pop up here. didn't see it was a reply
if you let function return T, then it's a different game
so i guess it has something to do with wording about instantiation and dependency
 
Marking the template constexpr yields an error.
 
as a practical matter, for the sizeof expression the compiler can just backpatch, and maybe such practical considerations have influenced the wording (that we seek)
 
@DavidRodríguezdribeas I see. I can compile similar code with std::unique_ptr.
 
I have two members in my class that I need to initialize in the constructor of the class that has them, how do I do it?
Class::Class() : var1(value), var2(value) {..}
Is that correct?
 
8:10 AM
@BPDeveloper yes
 
So you just comma separate them?
 
@AlfPSteinbach I would be just as easy to patch the result of sizeof(test) used outside of a template, and it is disallowed
 
@BPDeveloper yes. and preferably keep these initializers in the same order as declarations. because they will be executed in the order of declarations
 
Ah, so I need to put this line in the header too?
 
@DavidRodríguezdribeas yes, i'm just bouncing ideas here. and obviously (to me) when it does compile, the compiler is backpatching
@BPDeveloper no
 
8:13 AM
I kind of believe what @MartyTPS said before, the compiler fully processes the TU, and then performs the instantiation, rather than doing it at the point of instantiation
 
@DavidRodríguezdribeas well no. then it should work to let function return T. that doesn't work.
so it seems to have to do with kind and "strength" of dependency
 
That is, if the instantiations all happen after processing all non-templated code, then by the time it gets to process the template the type is complete.
 
but then it should work to let the function return T, shouldn't it?
 
@AlfPSteinbach Not really, in a function call (not standard, but all compilers do) it is usually the caller the one that reserves the space for the return type, and that is a non-templated piece of code, so it needs the result of sizeof
 
Compiler side effect if the way templates are expanded in passes internally.
 
8:17 AM
not really, because it compiles fine to let function print sizeof t, or return that and let main print it, and then it needs the result of sizeof
 
If that call is moved into a template, then it does compile:
template <typename T> T foo() { return T(); }
template <typename T> int size() { T x = foo(); return sizeof x; }
class test;
int main() { size<test>(); }
class test {};
 
by the same mechanism that lets it print the sizeof result, it can use that result in allocating proper amount of memory
ok so we need like a new concept "at template time" ... :-)
 
@AlfPSteinbach main can print the value that is obtained at runtime after calling the function when only printing the size, but needs the size to reserve space in the case of a function returning a T
 
well the function that returns the size needs the size in the same way
but if it's a function template then it gets "filled in" later
 
Yes, it does, but if the compiler is pushing the generation of the specialization to after processing the whole TU, then the type is complete at the time. Note that if the definition of the test type is not present at all you get the expected error, which is why I believe this is what the compiler does
 
8:22 AM
If I have a member of type Dog in class Owner, how long does the dog object live?
 
As long as the Owner.
 
@MartyTPS: I agree with your answer in that this is what is going on, but the question is rather on why is it allowed or forbidden. If there are no other answers I will consider accepting it as the best partial answer
 
Strange...I moved two things from inside a function to members and I get Buffer overrun issues
 
It is an assignment
 
8:28 AM
I certainly hope that the behaviour is not mandated. Templates are already hard enough to explain without taking into consideration why int make() { return sizeof(test); } and template<int I> int make() { return sizeof(test); } don't work, but why template<typename T> int make() { return sizeof(T); } would for make<test>.
 
@DavidRodríguezdribeas it may be that it can be argued that "phases of translation" (2.2 in C++11, in particular 2.2/8) supports your conclusion. but i think more wording, about dependencies, has to be considered also
 
@BPDeveloper Still not enough information.
 
I understand
Ah! I think I know why!
 
@AlfPSteinbach Pretty good, I think that's it!
 
First-chance exception at 0x013942b2 intest.exe: 0xC0000094: Integer division by zero.
A buffer overrun has occurred in test.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.
 
8:33 AM
press break
simple choice, that
:-)
 
At least it's not the horrendous "Abort-Retry-Ignore" dialog where you need to press "Retry" to debug.
 
@RMartinhoFernandes i think it used that because it was (at one time) guaranteed to work even in low memory conditions
 
And what should I understand from that? #if defined (_CRTBLD) && !defined (_SYSCRT)
DebuggerWasPresent = IsDebuggerPresent();
_CRT_DEBUGGER_HOOK(_CRT_DEBUGGER_GSFAILURE);
#endif /* defined (_CRTBLD) && !defined (_SYSCRT) */
 
Well, that thing is still horrendous. For some time my instinctive reaction had always been to just "Abort" and try again with serious debugging from the start.
Then one day I actually read it.
 
@AlfPSteinbach If you post that as an answer, I will accept it. If you don't I will post it when I get to the office.
 
8:38 AM
Look at the call stack.
 
@AlfPSteinbach: Rather answer to this other question: stackoverflow.com/questions/7210286/…, and vote to close mine as duplicate :)
 
hi
This networking crap is confusing the bejesus out of me.
I thought when we send data to a server, the socket needs to have the client/server ip addresses and port numbers? But in the code..it doesn't
 
The client needs the endpoint of the server.
(I assume this is TCP you're dealing with.)
 
@RMartinhoFernandes Yeah that's fine, I understand that. And we supply the ip address and host to the structure. But does the structure not need the ip address/port of the client? Or how'd the server know how to reply back
Yep tcp
 
The accept command provides the client's endpoint.
You're using the POSIX API?
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
The second parameter is an output parameter that gives you the client's endpoint.
 
8:50 AM
@RMartinhoFernandes No I am using Berkeley Sockets...or I don't know what POSIX mean.. yep that's the function.. But how does it know where the endpoint is?
Oh, so the accept fills in the address and port number of the client connection. My question is though at what point does the data have the client address? Because we never fill it in
 
After the connection is accepted, i.e., when accept returns.
 
Em, I am the client and I send a request saying hey server can I please connect with you. The server listening to connections puts my request on a queue. Eventually accept processes my request, in that request does it contain my address?
 
@RMartinhoFernandes How come? I never filled it in. I only filled the Servers address in the structure...
 
@LewsTherin accept fills it in.
 
8:55 AM
Ah this shit doesn't work
 
@RMartinhoFernandes Oh yeah, but what I mean is...how does the accept know which address to fill in
 
The IP packet headers include both the source and destination addresses and ports.
 
@RMartinhoFernandes Oh right, so while we provide the dest addresses/port the ip stamps the client address and port on to the data
 
Yes.
I think the ports are part of the TCP headers, not IP headers, but that's irrelevant. What matters is that the information is included in the packets as part of the protocol.
 
@RMartinhoFernandes I understand that then. Yeah I believe I do. Em, one of many question however, the server program requires INADDR_ANY. I assume because the server listens to all packets with different ip address it is hosted on. How does 127.0.0.1 work?
 
8:59 AM
@LewsTherin When you open the socket in the client side, the socket is created with an ip and port
 
@LewsTherin 127.0.0.1 is the address of the local machine.
 
@DavidRodríguezdribeas implicitly?
 

« first day (375 days earlier)      last day (4556 days later) »