« first day (292 days earlier)      last day (4640 days later) » 

12:26 AM
Is there a way to detect what system calls a program make while it's running?
 
@Francis you could use hooks (msdn.microsoft.com/en-us/library/ms644959(v=vs.85).aspx) on windows (I think)
 
@Drahakar yea, that's what I'm looking at, atm
That's not quite what I'm looking for
I'd like something similar but to detect low level call like malloc
or a memcpy
 
 
4 hours later…
4:33 AM
TIL my laptop has USB short protection. Mouse cable was flaky so I cut and resoldered the connections, plugged it in and my laptop shut down. Wouldn't power on until I removed the battery. Time for a new mouse...
 
user457812
5:03 AM
Nifty
 
user457812
I did something like that with a mouse, didn't shut down my computer, but that USB port never worked again >_>
 
6:15 AM
Hey can somebody help me with "::" its hard for me.
 
What is confusing you?
 
What exactly does it do, or how does it work.
Sorry if i sound like im a complete noob. I'm about a week deep.
 
That's fine. But, before anything else, I feel compelled to recommend grabbing a good book.
Now, what does :: do. It's just a way to refer to names inside other scopes.
Say, if you have a class inside a namespace, you need to use namespace::class to refer to it (unless you are inside that namespace).
 
Oh, i see. Doesn't c# do this for you? Oh and I have C++ without fear.
 
C# uses . for that.
 
6:25 AM
Thought so. in my book it shows this sort of thing...
void Point::set(int new_x, int new_y)
 
Don't take this badly, but C++ Without Fear is one of the books we around here consider bad :(
@tanner Yes, that's referring to the set function inside the Point class.
 
Thought so, you get lost in its simplicity.
I found myself skipping chapters. It sounds bad, but it was very dry
 
user457812
I've never actually sat down and read a C++ book O_o
 
user457812
I should do that one of these days.
 
What did you d? I just use a book, and do the livefire approach.
Kinda hard tho, no real "Missions" for beginner programmers.
 
6:29 AM
What's the livefire approach?
 
Sitting down with an ide.
or something.
 
user457812
I don't really remember what I did. Probably read some horrible tutorials and then started coding through trial and error.
 
user457812
i.e., wondering what something does and then running it through a debugger
 
Yeah, but its hard to keep the creative mind going all the time.
I really want to get into writing pretty structured code and using uml diagrams lol.
 
6:31 AM
@nil That's how I started programming :) Not C++ though.
 
user457812
Well, I didn't start with C++, so I already had at least the basics to go off of
 
@MartinhoFernandes lol what was your first language.
 
Then I found out that Turbo Pascal had a built-in help system and I started learning much faster.
 
user457812
First language I "learned" was Perl, then some other generic scripting language for a game making tool, then BlitzBasic, a newer BlitzBasic, C, and a bunch of other languages that I don't recall the order of.
 
user457812
Scare quotes because I was never proficient in Perl, and whatever I knew then I don't know now
 
6:33 AM
@nil That's probably a good thing ;)
 
Oh, that's cool.
 
user457812
It is as far as I'm concerned, though I later picked up Ruby, so that's sort of like Perl's slightly less awful cousin I guess
 
@nil I'd say it's a lot less awful.
At least Ruby doesn't have strange concepts no other language has, like typeglobs or whatever those are.
 
I took googles advice and decided to dive in with c++ with no other experiance other than like a year of the ti programming language built into their calculators haha. Horrible i know.
 
user457812
True
 
user457812
6:36 AM
Or barewords, if I'm remembering right
 
@tanner Ah, good days. I still remember wasting all the time in math class writing stupid games.
 
@MartinhoFernandes Lol exactly!! i remember discovering that you can get 2 calculators to talk inside the program.
fun
 
user457812
I didn't even have math class :(
 
Lol how?
 
user457812
Homeschooled.
 
6:38 AM
Oh, i see. Well basically it was like homeschooling. But waaaay less effective.
 
School attendance is not compulsory in the US?
 
Yes. of some sort lol.
 
user457812
Being homeschooled counts as education, so that was the only requirement
 
Homeshooling is regulated.
 
user457812
On the upside, I got to take community college classes instead of going to highschool, so that was fun
 
6:40 AM
That's cool im doing community college now.
trying to keep my brain busy in the summer
So could you clarify a little about the exact meaning of ::
?
 
user457812
It's the scope resolution operator (assuming I still remember names), if that's what you're asking.
 
It's just a way to access names that are inside other scopes.
namespace foo {
    struct bar {
        struct qux {
            void f();
        };
    };
}
 
Ok void Point::set(int new_x, int new_y) would just do void Point.set(int new_x, int new_y)?
in c#
 
@tanner No, there's no direct equivalent to that in C#.
 
user457812
What he said.
 
6:45 AM
Because in C++ you can define functions outside their class.
And, since you are outside the class, you need to make it clear what class the function belongs to. That's why you use ::.
 
Yeah, thats sooo weird for me. I was learning c# and then people said c++ would be better, so it was like i was learning a hybrid.
 
Well, that was bad.
 
Yeah i agree.
But the scope resolution operator is making more sense.
can you write functions inside the class declaration?
 
Yes, you can.
 
Cool, so its just a personal preferance sort of thing.
 
6:48 AM
Well, not really.
There are some differences.
 
Do go on.
 
Well, since you can define the functions outside the class, it's usual for people to keep the definitions in a .cpp file, and just do the declarations in a .h file.
 
Ooooooh, that would really unclutter things.
would i have to do anything special to call the other files, or does the linker do that automagically?
 
Yes, that's what the linker is for.
You compile each .cpp file, and generate a .o file for each.
Then you link them all together.
This is called partial compilation.
 
Yeah, ok cool. That answers my question.
Could you give me any advice for a beginner. Just in general?
 
6:54 AM
I'm really keen on the good book advice.
24 hours ago, by sbi
Did I ever mention there are many bad C++ books out there? And I'm not referring to "badly written", but to "containing glaringly obvious factual errors" and "promoting very bad coding styles".
The C++ book landscape is a minefield.
2
 
Oh, i can just stick to the book list you gave me earlier.
 
Write code, ask questions.
 
Cool I didn't know if you guys would laugh at my code or something lol.
 
When people show a willingness to learn, that doesn't happen.
Sometimes we do mock other people's code, though. :(
Sometimes it's really, really bad, and the author has a know-it-all attitude or something.
 
user457812
Guys, I just created the matrix.
 
6:59 AM
int x[10][10]?
 
Oh haha i see,
and lol about the matrix thing.
 
user457812
No, no, mine's 4x4.
 
Doing graphics programming?
 
user457812
Among other things.
 
No, he's doing bulk adding.
 
user457812
7:04 AM
The most recent versions of OpenGL, unfortunately, don't let me get away with laziness by using its built-in matrix functions.
 
Yeah, I heard that now I know close to nothing of OpenGL.
I learned the old API :(
And I can't learn the new one without buying a machine with a newer graphics card.
 
user457812
Yeah, I mostly knew the fixed-function pipeline from using it years ago
 
Hey do you guys have any favorite open source projects that are easy to read?
 
If you need some handy funcs I have a 4x4 homogeneous matrix class as well as a generic matrix class.
 
user457812
So, I've had to rapidly get myself up to speed on shaders and all that stuff, all of which is cool but requires a lot more boilerplate code
 
user457812
7:07 AM
No, I've already gotten all my maths code written up and what not
 
user457812
I also backed it up in about seven different places just so I would never have to write it again
 
Yeah that's what my current project is all about, code I never want to write again in my life.
 
What is the most fun type of code?
 
@tanner lolcode
 
@StackedCrooked Hmm, sounds fun. What is it exactly???
 
7:19 AM
It's a joke language.
LOLCODE is an esoteric programming language inspired by the language expressed in examples of the lolcat Internet meme. The language was created in 2007 by Adam Lindsay, researcher at the Computing Department of Lancaster University. The language is not clearly defined in terms of operator priorities and correct syntax, but several functioning interpreters and compilers already exist. The language has been proven Turing-complete. Language structure and examples LOLCODE's keywords are drawn from the heavily compressed (shortened) patois of the lolcat Internet meme. Here follows a Hell...
 
Haha, as I assumed.
Can i has... gets old tho lol.
So whats the c++ lounge's favorite meme?
 
ARrrgh. Just added :abbreviate teamplte template and a bunch of other template typos to my .vimrc. Damn this word is hard to type.
 
7:37 AM
> sorry, unimplemented: non-static data member initializers
Damn you GCC.
At least she's polite.
 
2
Q: C++ casting a base pointer to an interface pointer

AleksHere is some pseudo code of my setup: class IMyClass { ... }; // pure virtual class class CMyBaseClass { .... }; class CMyClass : public CMyBaseClass, public IMyClass { ... } Then I have collection of CMyBaseClass*. I have custom RTTI that allows me to find out if a class implements given inte...

can anybody explain to me what he means with custom RTTI?
how can you implement that yourself?
 
A very crude way of doing that is to add a member to a base class that gives you the type info.
But there might be some nicer ways of doing it.
 
hmmm ok
and what do you mean, "a member to a base class that gives you the type info"
is that like a member of it's own type?
or a string or what?
 
Well, depends on how much type information you want.
You could just do with an enum or a string.
Or you could have more complex things.
 
oh I see
 
7:50 AM
In the case of the question you linked, seems like it could be a function bool has_interface(std::string name); or bool has_interface(std::type_info type);
This reminds me of COM.
 
oh yea, I guess COM has some RTTI going on eh
 
> If the dream is BIG enough, the facts don't count!
 
Hello
 
hello
 
8:01 AM
(Now I don't know what to say, because I just came here but have no question. I will just stand there waiting for a good occasion of entering the conversation)
 
you could also start a conversation...
 
Well sure ;)
Have you ever had to deal with collegues that don't use const and blame you when you do ?
 
I don't get it. You're the one that gets burned by it.
 
Hi
 
Neither do I
 
8:05 AM
@MartinhoFernandes What do you mean ?
 
That's the point :/ I fail to explain them why const is such a great thing. Even when they get biten by their own lazyness, they still don't get it.
 
@kbok If you don't use const, you can use code with const. If you use const you can't use stupid const-less code.
 
@MartinhoFernandes Ah, ok. I though you were saying "const will burn you", lol.
 
@MartinhoFernandes Well they usually get rid of the problem using C-style casts everywhere. Because, let me quote this : "C++ casts are ugly and take too much time to type"
 
Well, they are ugly.
And they take time to type.
But that's a ridiculous argument.
 
8:08 AM
If you're so in a hurry that you don't even have the time to type c++ casts, there's a problem with your planning.
 
I actually tried to tell them that these casts are indeed ugly and long to type but that it shouldn't be a problem, because less casts indicates a cleaner design.
 
If you need so many casts that they drain your time just by typing them, you're doing it wrong.
Also :abbreviate sc static_cast does miracles. :P
 
I got the following reply : "Who cares about the design as long as it works ? You're not in college : here we write real code that works and is used, no one ever uses all that fancy school stuff"
 
@ereOn I get that all the time
 
@MartinhoFernandes Haha, I got the exact same abbr :p
@kbok: And so ? Have you managed to change things/people that reply that ?
 
8:11 AM
@ereOn I left :p
 
@kbok: In the end, I will do the same I guess ;)
 
But there's people like that even in my current company. The problem is that they are often higher than you in the hierarchy.
 
Shoot them. WARNING the previous link may cause extreme loss of productivity. I take no responsibility for work that was not done.
3
 
Yes, that's often the problem. And as a new comer it is often really difficult if not impossible, to change the way people behave.
 
The only solution I have found so far is to choose very carefully the place where you will work.
 
8:14 AM
@MartinhoFernandes Haha nice link ;)
 
Not everyone can afford to do that though.
 
Yes, sadly.
 
Hmm, anyone here familiar with static_assert?
If I put static_assert(false, "blah"); in a template, and add a specialization without that, the assertion is tested in the specialization (at least with GCC).
Is this conformant?
 
Morning.
 
8:25 AM
Hi.
 
8:43 AM
@MartinhoFernandes I rolled my own static assert but I'm seeing the same behaviour in VS. It has nothing to do with the specialization tho, it triggers when compiling the template because "false" doesn't depend on a template parameter.
 
8:57 AM
try something always false like (!IsSameType<T,T>::Result, "blah"); then the template will compile and only assert on instantiation
 
Yeah, I did that. enum { not_true = false }; is enough.
 
yep same thing in VS, that's enough
 
9:26 AM
meh
 
Meh indeed.
Started reading for the semester this fall a few days ago. Never seen a CS theory book so well written.
 
9:59 AM
@ereOn it depends, if its shoot and forget it might make sense, but anything that you work on for longer than a week ... needs a design, especially if you wish to maintain that software in the furture.
 
why does finding job get so discouraging at times
 
Does anyone know what "Process Monitor" and "StraceNT" in Windows actually monitor?
I'm tracing this game, and there are lots of CreateFile operations. However, the game doesn't itself call the Windows API function CreateFile.
 
Those could be indirect calls.
 
my thoughts too
 
10:14 AM
hey guys
do you say: courses I have been particularly good at or courses I have been particularly good in ?
 
the first
 
@MartinhoFernandes Yeah, for sure ... is there a way to find the address of the function that ultimately opens the file?
Some sort of memory debugger acrobatics?
 
Yeah, something like that.
 
@TonyTheTiger okey, thanks!
 
Can't you use a regular debugger?
 
10:17 AM
@MartinhoFernandes I only have the binary. It's a commercial game.
 
I basically want to find the last in-game function before the CreateFile call.
 
uh, if you don't own the game, why would you try to do this?
and how could you know that it doesn't contain any CreateFile calls directly?
 
But I've already detoured the Windows CreateFile() function, and that never gets called, so must the file opening be happening at an even lower level?
I want to build a crash protection by disabling the write buffer
 
Hacking your way around a bug so you can play it?
 
10:19 AM
there is no lower level than CreateFile
 
@DeadMG Well, I've detoured CreateFile() and made it print a log message. And the message doesn't get printed for all but one or two files.
 
if you've detoured the function and it never gets called, then it must be being called through a dependency DLL or something
 
@MartinhoFernandes No, I want to make sure that in the event of an opponent-triggered crash the replay file is as complete as possible.
@DeadMG Oh, does that mean I cannot detour the call?
@MartinhoFernandes At the moment, after a crash the replay file size is a multiple of 4096. So worst case I lose up to 4kB of data.
 
not necessarily, it just means you need to crack open the PE import table and start looking at the DLLs it depends on
 
@DeadMG Can I do that with the Dependency Walker?
 
10:21 AM
how should I know? ask it's documentation
 
@DeadMG OK, sure. Dependency Walker is part of the Sysinternals tools and can be called directly from Process Monitor... good idea, I'll try that out!
Isn't there an Windows kernel file opening operation that might get called directly?
No, wait, that's unlikely. I think all the calls do get made via the API (kernel32.dll).
 
CreateFile is the kernel operation for that.
 
@MartinhoFernandes Could that itself be detoured, as the ultimate, uninterruptable detour?
 
I have no idea. :(
 
OK, no worries. I'll just try figuring out the calling function, shouldn't be terribly hard. Thanks for the input!
 
10:42 AM
Is there a macro or something that I can use to detect the system endianness?
 
it would probably be easier to just look up the CPU you're targetting?
 
And how do you do that?
 
well, surely you know what CPU you're building for?
 
What if I'm targetting different CPUs?
 
Boost has macros for it, I think
 
10:53 AM
I found something in a detail folder.
I guess I could replicate that.
 
> From what time in C++ you can include cpp files?
 
A comment on a suggestion of including .cpp file.
 
11:26 AM
@MartinhoFernandes I solved it -- it was actually very easy, the game does call the API function... it simply calls CreateFileW, while I was looking for CreateFileA :-)
 
Ah, stupid aliasing shenanigans.
 
rofk
rofl
 
11:49 AM
shenanigangs eh
lol
 
sbi
God, afternoon!
 
Thank you. Good afternoon to you too.
 
Afternoon :)
 
Pity they didn't let Randall test the horse theory.
 
12:05 PM
Hello Gentlemen
 
@sbi Hey, thanks for the tip about Detours! I made it work!
(Also entirely without any 2.5GB SDK :-) )
 
18 hours ago, by Cat Plus Plus
@KerrekSB Look into Detours.
 
sbi
@KerrekSB ??
I believe you're confusing me with someone else.
 
Ohh -- whoops!
I did! Let me edit my question! :-S
 
@MartinhoFernandes Freak!
 
12:07 PM
Sorry!!
 
@hexa What?
 
@MartinhoFernandes Dude, you knew he asked Cat instead of sbi AND you manage to get the 18hrs old line before sbi even said wtf
 
Er, I have a good memory.
 
Oh, yeah, that was good retrieval skill!
 
sbi
@hexa I didn't say "What the fuck."
 
12:09 PM
one ? is like "im cluess" two ?? is "wtf" three ? is my mom using facebook
 
I'm very psyched about detouring CreateFile. There are two flags pertaining to buffering "write_through" and "no_buffering", I will try all combinations.
So... @CatPlusPlus, if you post that as an answer, I will accept it!
 
Free rep!
> This is somewhat hypothetical as I'm not too worried about performance - just wondering which option is actually the fastest/most efficient in general, or if there is no difference whatsoever.
 
Rep Whore
 
I'm confused.
 
bout what?
 
12:12 PM
That quote I posted (from here: stackoverflow.com/q/6940856/46642).
 
hmmm he's not worried about perf, but does want the fastest most efficient way to do it
 
You guys that have a wordpress blog... how do I sucessfuly post code? I tried last night only to get very angry
 
meh
that is confusing
 
hmm. I've never seen a good reason to use dynamic_cast... I mean, how could you know which derived class you want but your program doesn't?
 
12:14 PM
yes, that is the plugin im using
 
what does this do?
#define IMPLEMENT_VISITOR_WITH_SUPERCLASS(superclass)  \
    typedef superclass visitor_super_t;     \
    virtual void visit(Visitor& v) { v.visit(*this); }
 
It converts everything to html entities and when it doesnt it does stupid things like </iostream>
 
ugh wordpress :(
 
@TonyTheTiger It's a macro that declares a typedef and defines a function.
 
12:16 PM
hmmm
for some reason, macro's always confuse me
 
Those \ at the end are line continuations.
Damn, I'm fighting again to get a single backslash Markdowned as code.
Arrrgh.
 
so I guess superclass is the arg and I'm not sure what purpose the typedef has here?
 
It's used in the Visitor.
In a cast.
 
hmmm
but not in the function below it
so is that function part of the macro?
 
It is.
And that function calls Visitor::visit which is where the typedef is used.
 
12:21 PM
and what does this refer to then
this is isn't being called in a class instance
 
Yes, it is. Look at the last snippet of code.
The macro is used inside a class declaration. That makes the visit function in the macro a member function.
(which it must be, because it's virtual.)
 
oh I see
 
It was the damn wordpress' "visual editor" destroying my code
 
Ah, typical.
 
12:38 PM
I switched back to the original WYSIWYG editor and I seem to be able to edit fine now, gah.
I am writing this post on how to install cygwin + eclipse + boost from scratch on windows
including the compiling of boost
 
oh, sounds interesting
not that I would ever use eclipse, but boost compilation I might need some day
 
in portuguese tho :P
there is plenty of material in english tbh
 
Eclipse is nice actually
It's not just for Java
 
For me, it lacks something essential: an editor I feel at home in (i.e. vi-like).
 
12:49 PM
@MartinhoFernandes so you don't like VS for example?
 
@MartinhoFernandes oh well, you will never be satisfied then ;)
 
I like eclipse's editor, it has everything I need
 
@TonyTheTiger There are addins for that for VS.
 
@MartinhoFernandes VI like addins... link?
 
@MartinhoFernandes You like VI?
ouch.
 
12:50 PM
@hexa VI likes him
 
@TonyTheTiger There's VsVim by our fellow StackOverflower JaredPar.
2
@hexa Well, vim.
 
@hexa I never use the wysiwyg editor, and then I installed a markdown plugin. So I just type my code the way I would on SO
 
I find vi so painful. View mode, edit mode, weird ass : commands
 
There's also ViEmu, but it's a bit expensive.
You kids and your just-type-stuff-with-colors editors.
 
@hexa just a matter of habit, I guess
 
12:53 PM
but don't you miss like intelli-sense?
 
I'm fairly comfortable with Vi for everyday stuff, but don't use it enough to figure out how to really exploit it
 
In VS, I get both IntelliSense and a vim-like editor.
 
When I type object. I want to see what my options are...
@MartinhoFernandes best of both worlds
 
@TonyTheTiger Intellisense? In C++? Why would you miss something that slows your machine to a crawl, fails to suggest anything 50% of the time, and is wrong 30% of the time, and crashes the remaining 20%?
 
I hate doing html by hand so the wysiwyg is nice. The default one doesn't seem to break the code when I edit it.
 
12:54 PM
It's handy enough in the semi-rare cases where it works though
but nowhere near reliable enough for me to really build my workflow around it
 
When coding C#, it's awesome.
 
@MartinhoFernandes yep
 
I don't miss it for C++.
I'm fine with vim Ctrl+P (completes from words in the same file) most of the time.
 
@jalf oh lol, cause it still makes me feel like I'm doing something right... hahah
anybody got any advice for getting an job interview? maybe some tips for a good CV?
 
do you have the careers cv?
 
12:59 PM
@ÓlafurWaage yes
 
@TonyTheTiger make it look good and be well structured?
 

« first day (292 days earlier)      last day (4640 days later) »