« first day (13 days earlier)      last day (4918 days later) » 
00:00 - 18:0018:00 - 00:00

12:13 AM
that quote is wrong, it's members and bases
@thecoshman: "You cannot convince your friends of some things, and it's dangerous to even try." by I forget who, and I probably mangled the quote
unless you're working on a c++ project with him, is it that big of a deal to express the truth to him and not sweat it if he doesn't change his mind?
 
 
2 hours later…
1:54 AM
Oh, so now the lounge is a pointer to member? Whose member is it pointing at?
 
2:12 AM
struct Language { Room chat; }; Room Language::*Lounge;
 
2:56 AM
Wait, I thought classes could have functions and structs couldnt?
 
structs are classes
 
I know that, but a full class, what goes in a header file, is that not what you are refering to?
 
what is a "full class"?
c++ has class types, and the struct, class, and union class-keys are used to declare and define classes
 
Sorry for bein a noob. Obviously I dont use c++ enough lol. Im trying though. So I could declare a struct class in a header file?
 
sure, I do it all the time
 
3:08 AM
Whoa. So what are these union class keys you speak of?
 
unions are a special type of class where the storage of members is overlaid, so they can only store one possible member at a time
googling "c++ discriminated unions" should help
 
Ah. Thank you.
What reference book would you recommend most? I find it annoying to have to flip through my massive textbook just find a small description and example.
 
efnetcpp.org/wiki/…, The C++ Programming Language, and perhaps the standard/draft, depending on what you're looking for
meh, rewriting tinyurls is bad sometimes, I like using tinyurl.com/pppuc :)
 
Once again thank you.
 
 
1 hour later…
4:41 AM
char *passUserChoiceToSyncAgent()
{


printf(">>>>>>>>>>>>>>>>>>>>>>>passUserChoiceToSyncAgent>>>>>>>>>>>>>>>>>>>");

static char pass[10];

strncpy(pass, choice, 10);

printf(pass);

return pass;

}
 
what is the question?
 
 
1 hour later…
6:01 AM
is something wrong with me or SO? I can't see latest questions when clicking on 'Newest'. It shows Sep qustions
 
6:15 AM
I've been getting timeouts and errors on searches
 
 
2 hours later…
8:12 AM
why when I have a typedef of a std::map and some function returns that typedef, can I not assign it to a map with exactly the same types in it?
 
Ionno
what does the compiler say?
 
lol
error C2440: 'type cast' : cannot convert from 'TAGS_Values' to 'std::map<_Kty,_Ty>'
with
[
_Kty=std::string,
_Ty=D_Values
]
 
is TAGS_Values defined as std::map<std::string, D_Values> ?
 
yep
so the call looks as follows:
std::map<std::string, D_Values> mymap = object.getMap(); (returs TAGS_Values)
 
I don't know. But try doing TAGS_Values mymap = object.getMap();
 
8:27 AM
@CiscoIPPhone fixed :)
 
yay. what was the problem?
 
that somehow the D_Values was incompatible with the std::map definition, although they really are the same
 
8:47 AM
That's strange v_v
 
yes it boggles my mind...
 
9:21 AM
Don't be vague, be an ace; learn to write a proper testcase! sscce.org xs4all.nl/~weegen/eelis/iso-c++/testcase.xhtml
@Tony: too little info to say what was going on
 
9:34 AM
@RogerPate ok
 
10:12 AM
that xrobot user (re the latest feed entry) is something else
 
cute name
 
hello @GMan
 
hi
 
10:28 AM
whats new?
anyone know a library to communicate with Oracle databases that is reliable and pref db version independent?
 
meh, lots of work, havent been in chat
 
oh ok
 
10:46 AM
work? oh, yeah; that annoying thing that pays the bills so I can read SO
2
 
haha. cept mines schoolwork
so i dont even get monies : [
 
even worse
 
ya : (
i mean i bet i could pick up a job someone right now, why do i need to finish waaaaaa
 
wow @GMan, I am most impressed with your C++ knowledge, are you at uni?
 
I go to digipen
 
10:51 AM
donno what that is
 
user behavior is interesting, I think I'd like more formal study of it
6 upvotes and the question has 60 views, but only 4 people clicked through the "belongs elsewhere" link (at least according to the site, which isn't so accurate at times)
 
It's a school that claims to teach computer science/programming, with an emphasis on video games.
 
how do you like it?
 
I've never publically slandered the school, but if you actually want to learn to program well, don't go the school.
 
that's true of all schools
(I dropped out of college after a year)
 
10:53 AM
I think there's one maybe two professors that know what a standard is, let alone follow it.
Granted, they're serious about the games aspect; most of the teachers worked int he games industry for some time, real producers and real tech directors and real programmers.
But that's the problem, the games industry is notorious for being god-awful at programming well.
Every teacher is a C-with-classes programmer, and while they know they're stuff, their stuff is far outdated.
 
yeah, that outlook was required for gamedev 10 years ago
 
Yeah, I agree. Just wish they'd keep up with the times. And there's no computer science, really. One class, learn Big-O.
I'd drop out if I had realized it was a trap sooner than 4 years into it.
 
I have less faith in more overtly for-profit schools, maybe unjustifiably so
 
Yeah; but probably justified. Profit rarely gives a hoot about academia. I was literally told this year to not take the route I was taking with our game engine because "that's more of a research project then practical." Really? Discourage improving the state of the average (student) game engine? Granted I was (and will do) pretty heavy stuff, but it bothers me they'd actually do that.
Almost every game engine is just thrown together copy-paste crap. :/ Most of the students don't know C++, or say "C/C++".
 
I say C/C++ :P
but then, I mean "and" or "or" as / is conventionally used in english
 
10:59 AM
Right. No, to them they know C/C++ (as in the same language, one just has classes.) Not their fault, I don't blame them, but it's a sad reflection on how well the school knows anything outside of just getting by with profit in the field.
Oh well. I'll just tough out this year and the last one and get it over with.
 
oh, by "for-profit" I meant the school itself
yeah, one year to go: might as well slug it out
i.e. state run public schools don't have shareholders to answer to if they don't bring in enough students
my mom's going back to school to be a nurse and taking introductory classes at Ivy Tech
in one case, the school cut-n-pasted math books together to publish their own special version
 
Yeah, indeed. Companies running through there all the time, president "our school is so great yadda yadda, I was one of the best programmers in the field, started to teach it, yadda yadda, our students our great programmers". I always laugh inside. :S I wanna grab him and say "Hey what's wrong with this? template <typename T> struct foo { typename T::value_type type; } and he wouldn't even know.
 
just so they get extra book fees in addition to tuition
in several other cases, they have special compilations so you can't buy the book used or from another store (such as amazon)
and I'm sure they get a kickback from their on-campus bookstore
 
That sucks. That's pretty cool she's doing that. I think I'll go back to get degrees in things I actually like, I really like computer-science and concurrent stuff, it clicks for me. And I''ve always been fond of logic and philosophy. Lately I've been into political science.
 
yeah, hat's off to her; I'm doing what I can to help her
 
11:05 AM
:] yay. So you said you dropped out, did you go somewhere else?
 
I started doing professional photography :)
paid a helluva lot better than being a student
 
Ah. :) That's unrelated lol.
Nice. So is programming a hobby? Or do you program for a job?
 
hobby; now I'd like to do it as a career, but without a degree and no relevant work experience, it's hard to find a job
 
Yeah. Another reason I shouldn't drop out. Everyone wants a degree now. You're crazy knowledgeable for it just being a hobby.
 
@RogerPate wow so how did you get to be so good at C++?
 
11:08 AM
11
A: How do you go from a so so programmer to a great one?

Roger Pate Researchers have shown it takes about ten years to develop expertise in any of a wide variety of areas... The key is deliberative practice: not just doing it again and again, but challenging yourself...   — Peter Norvig [emphasis mine] Experts are made, not born.   &...

I've put a lot of work into it
 
Nice, it shows.
 
@RogerPate :)
 
@GMan: a friend I've known for years told me that, out of the blue, not too long ago; took me by surprise. I just feel average :)
 
Naw, it's nice when you answer because you provide a good perspective.
 
@GMan I agree
 
11:12 AM
communicating with other programmers, especially helping people, is a big way to improve yourself, too
I've been doing that on irc for ~15 years
 
:)
 
Yeah. I've learned more on SO these two years than all my private studying prior. (Granted I was younger and dumb.) 15 years on IRC is awesome. When I was in there a bit, there was tons of knowledgeable people and I was like "ahh, there's more litb's".
 
hehe
like everything from the 80s, irc is confusing and bewildering to newcomers today
like usenet for that matter
 
i agree!
 
hey, I'm from the 80's!
 
11:19 AM
I bet little kids today don't understand you ;)
 
sbi
@CiscoIPPhone I'm from the 60's. Late 60's. (Hi)
 
Hi.
My app was rejected by apple today
 
ouch
 
It had a control that was too similar to the slide to unlock control which is patented/trademarked by apple
 
sbi
So I went and tried to check out clang today. Got stuck. I've always hated CMake. Anyone here tried that?
Anyone knowing anything about CMake?
Hello?! <considers_hall>
Am I alone in here?
 
11:35 AM
Shhh, I'm trying to listen to the silence. :)
 
/me drops a pin
never liked cmake either
@CiscoIPPhone see, that's the type of thing that turns me off from apple's platforms
 
I'm cursing on Cmake as well. Trying to compile SOCI but it keeps disappointing me...
 
@HostileFork: like the blog, you should post more often
made enough of an impression that I actually recognized your name :) (think I first found it through SO, too)
 
11:54 AM
0
Q: Line x and y n-intercept point / C++

user491232Can someone please help me. I understand the equation of a line and how to solve for the zero intercept on paper, but I have trouble converting it to code. More specifically, I need to calculate the point at which a line intercepts any given X or Y coordinate with two different functions... doub...

 
whomever changed it: don't you think the c++ feed is too noisy to put as chat messages?
 
Let's try it out and see. :) Obviously the test will be a busy day mid-day, not now, but I don't think so.
I didn't change, btw.
 
/whisper Feeds hey how u doin
 
0
Q: Using Apple Events

Stephen FurlaniHey, I'm not even sure where to begin with this question... I want to be able to send mouse-click events to another machine, as if the user had clicked on that machine. I can do it on the same machine via: CGEventSourceRef source = CGEventSourceCreate(NULL); CGEventType eventType = kCGEventLe...

 
put the data in a packet, send it to the other computer. Jeez feeds you're asking simple questions.
 
12:02 PM
no no, answer on SO! :P
 
sbi
@RogerPate: Oops. I thought I'm just changing that for me! How did I get the power to change something room-related??
Um, shall I change it back?
 
we can try it, as gman said
you're a room owner, so you can modify the room :)
 
sbi
@Roger: I just changed it back. <sigh>
WHAT?
Did you say I'm a room owner??
 
yes
 
you have enough c++ experience, enough experience on SO to know how things work, and I thought you'd use it responsibly; so I made you an owner
 
sbi
Thanks.
I'm flattered.
Um, well, it might be a good idea to tell users when you promote them. Or they go and break something because they think it's just their private setting.
 
the whole thing with switching rooms was because the owner was mia, so hopefully we will avoid that with enough owners that someone is around 2-3 times a week in case something should be done, etc.
yeah, good point
 
sbi
I'm still trying to find my way around here in chat, finding something new everyday. Having found a feature I didn't have access to before didn't seem conspicuous to me
 
press up to edit your last message
most useful chat tip I've found this week :)
 
sbi
12:09 PM
@RogerPate Wow, that's a great one! (two, three...just playing with it :))
Ah, and Escape will cancel the edit. Good.
 
hmm, esc doesn't do that here, might be related to my vimium extension
 
sbi
Does for me in FF3.6.11 on Win7/64
 
chrome 8, ubuntu 10.04
 
Test
works for me
 
@AlexReece: we can't see what you're saying, you might have to change some setting
 
12:14 PM
I can see it.
 
I was testing the ability to use escape to cancel modifygin
it works for me, I'm running ubuntu 10.05
*04
let me get myc chrome version number
 
@GMan: dammit man, he was supposed to say "you can't see this?" so I can say "nope"
 
:S
 
sbi
@Roger: While I cannot see what he said, I certainly see what he wrote.
 
@AlexReece: vimium interacts a bit with textboxes, so I think it's that
 
12:16 PM
I appear to be running Chromium 6.0
 
@sbi: you remember microsoft chat? it actually had text bubbles so you could say what people said
 
sbi
@Roger: No, I dont. I've never been in a chat before.
I guess I'm too old for that. :P
 
u dnt txt w/ ur kidz?
 
So let's say we have a setter function. Normally, you'd just do:
void set(const std::string& x)
{
    member = x; // copy into member (set)
}
 
sbi
@Roger My oldest is just now is reaching the age where she might be interested in chatting.
 
12:18 PM
microsoft chat came out with window 95? I think. it was an extension to the irc protocol focused on graphics and ease of use, but ended up just being comical
 
sbi
@GMan: Yes, and?
 
But in C++0x, we'd like to take advantage of move. Does this imply an overload?
void set(std::string&& x)
{
    member = std::move(x); // move into member (set)
}
Will we write two setters per set now?
Oh wait.
Got it
 
I don't think so
 
void set(std::string x)
{
    member = std::move(x); // move into member (set)
}
duh
 
sbi
@GMan: That's good. Unfortunately, it's used for a setter, and setters are dull.
 
12:26 PM
lol
well, its actually for something else, but setter covered it :P
 
sbi
ok, had fun here, but I will need to do a few things now
see you later
 
later
 
 
1 hour later…
1:37 PM
when creating a copy constructor, do you have to do copies of only the pointers or also of the non pointer objects?
 
errrr
1st: you don't have to do anything unless you want to :p
2nd: When you say copies of pointers, do you mean copying the pointers or the data the pointers point to?
 
@CiscoIPPhone I mean the data
else I could just leave it up to the default copy ctor
 
ok yes, you will also have to do copies of the non pointer objects
(they won't be copied by default)
 
oh ok
 
When you make a copy constructor, you have to copy everything; it's your responsibility now.
Why you're doing more than managing a single resource, who knows. ;)
 
1:43 PM
@GMan, you mean it is wrong to have more then one object pointer as a class member...
 
You either use resources, or manage a single one.
If you're copying what a pointer points at on copies, why not just make the member a non-pointer?
 
:(
 
:]
 
cannot instantiate abstract class
that is why
 
just quickly, you only need to define a copy constructor when you have a class that has pointers to data, and you want the new copy to not just point to the same data (as is default) but rather has its OWN copy of the data that is being pointed to, so it can change it with out affecting the data of the original
 
1:48 PM
@Tony ah
 
if I use a pointer, the compiler does not complain, else it does
 
Right. Maybe you want to make a clone_ptr class.
 
and in the documentation of this library they always seem to use pointers
template?
 
ya
 
guys, anyone familiar with mfc?
 
1:50 PM
and just create a new T in the template...
 
one sec tony
 
we use mfc in a few of our projects, but I haven't touched it much. I made a minor project that was mfc.
 
it doesnt concern its architecture. i just want to know is there a good directory selection component(similar to CFileDialog, but for directories only)
 
@Anton You can use the WinAPI SHBrowseForFolder
That will give you the standard Windows browse for folder dialog.
 
1:57 PM
@Tony all these classes on codeguru are ugly(I'm checking them right now)
@James thanks! i hope it wont be painful to make this func work
 
@Tony: Aw, I just wrote one real quick. :)
    #include <algorithm>
    #include <functional>

    template <typename T>
    class clone_ptr
    {
    public:
        // types
        typedef T element_type;

        typedef element_type value_type;
        typedef const element_type const_value_type;
        typedef value_type* pointer;
        typedef const_value_type* const_pointer;
        typedef value_type& reference;
        typedef const_value_type& const_reference;

        // creation
        clone_ptr() :
        mPtr(0)
        {}
But there's no standard one.
 
@Anton You may find it easiest to write a class that encapsulates the SHBrowseForFolder functionality.
While you can use MFC for a lot of tasks, it doesn't do everything, and you can always call the WinAPI directly.
 
@Anton I was just providing an example, I never guaranteed anything about the code quality
@Gman, wow, you can just do that off the bat, that's pretty impressive!!!
 
@Tony and im not judging you, just my opinion about the code, nothing personel:)
 
@Tony: Well I've done it before, but thanks.
 
2:06 PM
@Tony Nah, he stays up all night writing code snippets in the hope that they will be useful answering questions on Stack Overflow someday...
 
@James: Haha.
 
@Anton, ye I didn't take it personal, just saying :)
 
@James sadly mfc interface is not my task itself, and writing a class will take some time i need to work on my main functionality. i hoped there's a ready industrial class :)
 
@Gman, cool
@JamesMcNellis haha
 
2:09 PM
One more question, guys, have you ever used libraries written in c++ with some .NET languages, like C#? I have several classes implemented in C++ but now im not sure i want to implement interface with mfc, winforms would be much more easier.
 
@Anton It's likely you'll spend more time looking for an "industrial" class than you would just using the WinAPI function.
 
I used C++/CLI before. It worked
 
@CiscoIPPhone I found that rather confusing...
@Gman, so I just use that clone_ptr template in my copy ctr?
 
You don't need to write one.
Whatever class you had, replace the member pointer T* with clone_ptr<T>
 
@Anton Windows Forms has been superseded by WPF; if you do want to interop C++ with .NET, you'll want either to use P/Invoke to marshal calls between the two or use C++/CLI.
 
2:11 PM
hehe
 
When it needs to copy, it calls the clone() function. (Your base class should have a virtual clone() function, and derived classes define that is return new Derived(*this);
 
@James oh damn im so out of this whole windows programming thing. i've been a web developer, after that i worked with c/c++ in linux now im programming for windows with UIs and feel so stupid ><
 
@Anton Nobody can keep up with everything.
 
@Gman this class has no derivatives
 
Huh?
I thought you said it was abstract
 
2:15 PM
oh, I mean that was the class member object pointer
the one I was trying to copy in my copy ctr
 
you were pointing to abstract, right?
 
yes that object pointer (member in my class) is abstract
 
@James right.. but the department that gave me this task want me to keep up with everything :D So what actually do people use(nowadays) when they need to write a windows application with UI using C++ without .NET?
 
private:
	bool InitializeXML();
	clone_ptr<DOMImplementation> impl;	//Abstract
	DOMDocument* document; //Abstract
	DOMElement* rootelement; //Abstract
 
ok, that's okay
 
2:18 PM
cool
 
so, how did you intend on copying it?
 
create a new and copy the data
in the copy ctor
 
You can't copy an abstract class
Or rather, you can't make a new one
 
true, but this library has some init functions to init the abstract pointer
impl = DOMImplementationRegistry::getDOMImplementation(X("Core"));
lol /me is confused
~:
 
so i think you want something like this
struct default_clone
{
    template <typename T>
    T* operator()(T* pPtr) const
    {
        return pPtr->clone();
    }
};
That goes above clone_ptr.
Then you do:
    template <typename T, typename Cloner = default_clone>
    class clone_ptr
    {
    public:
        // types
        typedef T element_type;
        typedef Cloner cloner_type;
 
2:25 PM
and I use the clone_ptr...
like i did before
 
Then
        clone_ptr(const clone_ptr& pOther) :
        mPtr(pOther.get() ? mCloner(pOther.get()) : 0),
        {}
Then:
    private:
        pointer mPtr;
        cloner_type mCloner;
    };
And lasty:
struct DOMImplementation_cloner
{
    template <typename T>
    T* operator()(T* pPtr) const
    {
        /* your clone code*.
    }
};
Then clone_ptr<DOMImplementation, DOMImplementation_cloner> impl;
So it uses your custom cloner.
 
It might need some custom cleanup code too. :P
 
yea.
 
sbi
@GMan do you ever sleep?
 
sometimes
didnt this night
I love sleep. But sleep and I are damned to never get together. :(
 
sbi
2:40 PM
Ah, the joy of skipping nights. Did that in my 20's and early 30's, too.
 
Yeah. Doesn't break work flow.
Except at the end of this day, when all work flow goes "$#%#TASD"
 
sbi
Brakes you, though. :)
 
lol
 
sbi
Break! I meant breaks! dammit!
 
Edit!
 
sbi
2:42 PM
editing is for wimps. :)
 
heh
 
@sbi lol
 
sbi
(btw, @Roger told me the up key edits your last message)
 
@sbi just confirmed that is right
 
Test. Awesome.
 
sbi
2:44 PM
ok, was just dripping in to see whether you're all still here, need to leave the house now... might see you tonight (CEST)
@Tony: Did you think I'd lie to you?
 
k, see ya
im off for now too
 
@Gman thx for all the help :)
 
 
1 hour later…
3:49 PM
yawn.
 
4:17 PM
@CiscoIPPhone: that's contagious
 
strange thing here... I want to make an array of objects, but at compile time I don't know what this object will actually look like... but there is a finite number of objects that I might want to make array of
 
see what I mean?
@thecoshman: what do you mean?
 
at run time, I want to make an array of structs, but its not untill run time, I know what data I want my struct to hold I think this is the same thing, just reading it now stackoverflow.com/questions/777689/…
for example, I might want my array to be of struct {flaot a,b,c} or of struct j{unsignd long d}
but I do know that this 'struct' I want an array of will be made of certain components, and in a certain order
hmm... what about multiple inheritance... can I declare at run time to inherit a b and c, and ensure that the data in this composite type will be in a fixed order?
 
I still don't follow the usecase, sounds like tinyurl.com/meta-xy
 
4:26 PM
lol, probably right
 
sounds like he wants a javascript type array where you can stick anything in it
 
making a Model Class, it needs to store an array of its vertex data, but its vertex data may not always be in the same formate. Some times I want to just have x y and z, others I might want to add in a rgb colour as well. But the order these elements are in, is fixed, they may not all be in there though. I also need to be able to extract an array that is the one contiguis block of memory, so values I am not using being null will not work
 
Last time I just hardcoded the different structs I'd need for the vertex data formats I wanted, I didn't support an infinite amount of combinations
 
There are a finite number of combinations, but loads of them
 
pfeh I don't differentiate between really big and infinite :p
I'd talke more but gotta catch train, be back later
 
4:37 PM
he he he, thought o a way to not have this problem :D
 
Is there any way to benchmark a program in vs2008? i have to learn which one of my functions is the slowest.
 
I'd like to know as well.
One trick is to press the pause button in your debugger and look at the call stack. Nine times out of ten the code will have stopped in your slowest function.
But I'd be interested in a real profiler as well.
 
@Anton 2010 lets you see how much time is spent in a function, and break that down, so you can see how much each function call is taking etc
 
@Anton: they removed the profiler from the "lesser" editions of msvc a long time ago; I don't know if the "higher" editions still have it or what other options exist for msvc
 
Hmm.. can there be any problem with porting small project from one version to another?:) And will there be a profiler in express ed?
 
4:44 PM
you can check the feature list before installing it :)
 
@RogerPate right, thats what im gonna do right now :)
 
The last version that had the profiler built into the Pro edition was VS 6. Now, only the very top versions ($10,000 and up) include a profiler (for native code). I don't think the Express Edition has ever included a profiler.
 
Bad. May be some utility not from microsoft? im sure msvc includes debug information into exe file, so some program can extract it, set breakpoints... or am i too naive? :D
 
profiling is more involved that just setting breakpoints
 
I now, i now.
 
4:54 PM
typically (and the only method I'm aware of for deterministic profiling) special code is injected to (quickly) manipulate the profile info
and that needs to be done by the compiler
now this is fun: ~150 answers and I've been carefully watching for duplicates (because some people don't see the handy link in the question text to search), then see comments
4
A: What's your favorite programming joke?

Roger Pate(Doesn't involve a programmer, but was first given to me in the context of writing bug reports, where the point certainly stands.) An astronomer, a physicist, and a mathematician were traveling to Scotland. Glancing from a train window, they observed a black sheep in the middle of a field. "Ho...

ack, I'm confusing questions; his duplicate was on the quotes question
 
5:17 PM
Best bet is probably to buy a different product that has profiling, if the only VS editions with profiling are the absurdly expensive ones.
The Intel profiler is expensive, but not outrageously so.
 
I've heard of people using gcc just for the free gprof
 
@RogerPate
lol, I've even heard of people porting an app to OS X to use Shark.
not sure if that actually got them any meaningful information, though.
 
5:34 PM
Are you still around thecoshman? What was your solution to the vertex struct problem?
 
@CiscoIPPh: last thing he said was "thought of a way to not have the problem"
so I guess it went away somehow or other.
 
5:50 PM
hello again
 
hi tony
 
hi
how long have you been coding in C++?
 
uhhh umm 10 years or so
 
oh wow
have coded in other langauges too?
 
yes a decent amount of other languages, c++ is still my main language, and the one I use at work the most
 
5:58 PM
:)
love C++, its so versatile...
 
do you know asm?
 
00:00 - 18:0018:00 - 00:00

« first day (13 days earlier)      last day (4918 days later) »