« first day (777 days earlier)      last day (1624 days later) » 

00:03
@fr33: This is chromium, I haven't touched it.
Stack trace is at bpaste.net/show/55306 and have reported it, appears a bug where WebCore talking with v8 is going wrong.
 
2 hours later…
02:21
Thanks for the notice
03:16
and thus beings my all nighter...
@TomWijsman you around? I know it's super late for you...
03:44
Hello knonos
I was expecting you
04:18
"Sorry for not being too cool to be spoken to :L"
05:05
@fr33 I was having issues
Ok, my bad ;L
I hope your issues were resolved
@Bob do you know anything about overloading the == operator in c++?
They were
Bob
Bob
@KronoS something, yes. much? no :P
cool
// Overloads==
bool operator== (const Vertex &n1, const string &n2)
{
	return n1.getName() == n2;
}
is it possible to do something like this?
actually we should migrate over to fake programmers
05:07
so did you got fixed the problem you had with the list not being a template type or something like that yesterday?
@fr33 yes... @TomWijsman was very helpful
// Overloads==
bool operator== (const Vertex &n1, const string &n2)
{
	return n1.getName() == n2;
}
so is this possible?
let me see....
Bob
Bob
overloading == is definitely possible
but there's only one parameter/argument
yes it is, but in that particular case
Bob
Bob
you use this to refer to the LHS
05:09
I've got a list of Vertex's but want to compare it's name (a string) to a known string value
Bob
Bob
You would do something more like
// Overloads==
bool operator== (const string &other)
{
	return this->getName() == other;
}
@Bob that doesn't work
Bob
Bob
o.O
use a pointer instead of unary resolution operator?
Error:operator has too few arguments
05:11
5 messages moved from Root Access
why wont the object call wont work as suppose using the unary resolution operator (.)?
seems that it should
had you tested?
Bob
Bob
ok, now I'm confused... the few times I've done that, I've used a single argument. some sources say that. some other sources say use two arguments
well you just comparing the operator variable with two different others at the time... although I think would be better if you separate the condition in two
@Sathya thank you
Bob
Bob
@fr33 not so much the comparing, more the function prototype. Is it bool operator==(const Type &LHS, const Type &RHS) or bool operator==(const Type &other)?
05:14
ok, my bad I thought it was comparison, but is not is initialization
@KronoS welcome.
Bob
Bob
ah, I see
but still you want to know if LHS type and RHS match or so to make the call using the object
Bob
Bob
@KronoS is this a member function?
right?
get name should be a member function...
Bob
Bob
05:17
i.e. is it declared/defined within the class?
if so, use the since argument. if not, use two arguments
u meant single argument?
ok, at least say yes, no, may be, I think is quite rude, to just leave other people expectation of an answer just hanging in the air ;L
screw it... I just migrated to this:
// Add a child node to the parent.
void Graph::AddChildNode(Vertex * const aChildVertex, const string aParent)
{
	for(list<Vertex>::iterator it = mInternalGraph.begin(); it != mInternalGraph.end(); it++)
	{
		if(it -> getName().compare(aParent) == 0)
		{
			it -> addEdge(aChildVertex));
			break;
		}
	}
}
Bob
Bob
well
your original one should have worked :P
@Bob but was too much for me to try to figure out ATM
Bob
Bob
provided you used -> and dereferenced the string, of course
wait
is it getting passed pointers or.. argh
I remember why I abandoned C++ now
05:23
ha ha, pointers screw things if use wrongly
Bob
Bob
ok, forget anything I said in the last hour :P
5
Q: What's the ampersand for when used after class name like ostream& operator <<(...)?

OmarI know about all about pointers and the ampersand means "address of" but what's it mean in this situation? Also, when overloading operators, why is it common declare the parameters with const?

lol
I hate c++ right now. I'm sure it's got its advantages, but right now... I don't like it one bit
reference
Bob
Bob
oh. pass by reference.
facepalm
how did I forget that
I remember that & was for reference
lol
Bob
Bob
05:26
must be too much C# ref, VB ByRef, Python WhatTheHeckIsGoingOn
ha ha, doing C#, cool same here ;)
Bob
Bob
so, basically, your first code snippet looks alright @KronoS :S
just passing the place the actual space of the variable is, not actually passing a copy (as per argument does) so if the value of variable is modified, the actual variable changes, as opposed with pass-by-arguments (copy)
Hey bob had you work with XNA/C# specially with SB?
Bob
Bob
@fr33 yea, I know what passing by ref does :P just the meaning of & slipped my mind
Yeah I know you know what it was, just want it to mention it, tho...
Bob
Bob
05:31
@fr33 I've only done WinForms and Console with C#. Tried XNA once, but never had the time to really learn. No idea what SB is.
:L ok, cool, SB is SunBurn, just an game engine made with XNA/C#
thanks tho :)
@Bob glad I wasn't the only one
isn't the whole point of C# being C# is outwit C++?
lI know it similar to Java, but it is C++ on steroids... Or that's too much...?
BUMP!
@fr33 I wouldn't go that far... C# is lacking in a lot of areas that C++ excels in
Yeah, but those areas might sometimes be advantageous at some aspects and sometimes not
like for example pointers, yes good, but in the hands of an inexperienced programer is too dangerous
you can always do wrappers if you need exactly a special functionality of a language in your program
06:38
hey @Bob how do I copy directly contents of a list in c++?
for example say I have a list<vertex> foundVertices that I want to pass into a constructor of a class Graph
Grrr... I'm having a problem with my pointers...
06:51
What are you trying to acomplish as a whole?
like are you building an engine, a game, a visual library? What?
I'm building a graph
lol
that's about it right now
ohh ok, and for a graph you passing such bunches of trouble... ;D
look unnecessarily tedious
looks*
lol
Bob
Bob
@KronoS what, create a copy of the entire list?
06:58
@Bob I've got a list of pointers that no longer point to anything after returning the list
it's actually like this:
list of vertices
each vertex has a list of pointers to other vertices in the top list
this second list isn't working properly
so basically is a list of list?
Bob
Bob
o.O
self...referential...lists?
list of vetex which each one contains a list of pointers?
let's say I have a graph like this
isn't that a graph data structure?
07:00
1 -> 2 && 1->3
The graph would have 3 nodes (top list)
yes it is
the first node, would reference the other two (edges or second list)
Bob
Bob
ahhh
The second list is a list of pointers. These pointers point to actual nodes in the graph
inst a graph works with trees and leaves
Bob
Bob
07:01
and you're using linkedlists.
@Bob yes...
(I think lol)
Bob
Bob
normally, I'd just to this with an array (if int indexes) or a map (if unique key indexed)... but if yo uwanna do it this way.. :P
class Vertex
{
private:
	string mName, mColor;
	list<Vertex *> mEdges;
	Vertex * mPredecessor;
	float mDelay, mDist;
	int mFinish;

public:

	// Constructor
	Vertex();

	// Getters:
	const string getName() const;
	const list<Vertex *> getEdges() const;
	const Vertex * getPredecessor() const;
	const float getDelay() const;
	const float getDistance() const;
	const int getFinish() const;
	const string getColor() const;

	// Setters:
	const void setName(string aName);
	const void addEdge(Vertex * aEdge);
That's my Vertex class
using linked list it ain't bad, but a linked list of linked list is too much spaghetti code?
Bob
Bob
why are you using a llist anyway?
any specific advantage?
07:04
@Bob I don't know the size of the graph before hand
but I guess I could use arrays
just set them to a max size of something ridiculous (since all I'll ever hit is like 20 nodes tops)
I just don't know how TBH...
Bob
Bob
hm.. llists are great for insertion/removal, but if you're only adding to the end of the array/list (relatively rarely) then there isn't too much penalty in using a vector
@Bob vector?
Bob
Bob
vector.
dynamically sized array, essentially
part of the STL
1 colum, many rows data structure
Bob
Bob
vector<int> myVector;
myVector.push_back(5);
but then you can access it like an array
myVector[0] == 5;
bleh, nothing wrong with llists
07:08
@Bob push_back(someValue) sets the value to the back of the list?
Bob
Bob
@KronoS the end, yes
I don't think though this is going to solve my problem... somehow my pointers are getting lost
Bob
Bob
it's a dynamically sized array
yea, there is that :P
wait a sec
list, vector, array... shouldn't matter
Bob
Bob
anyways, you wanted each node to have a list containing a pointer to every other node?
07:11
@Bob right
@Bob here's my prob... I have a GraphReader class that creates the graph
Bob
Bob
I'm just running a few things through ideone as a basic proof of concept :P
I assume you don't want the node to refer to itself?
The graph within this graphReader is fine, BUT if I try to return that graph... the pointers get lost
@Bob no
I take that back
the graphreader class graph isn't good
I'm thinking that it's a scope issue
So here's what I do (I'm turning to the rubber ducky method so feel free to ignore):
1. I have a constructor for the GraphReader
This constructor read the file for the graph and converts that file into a graph
the graph that is parsed there is good (has the correct pointers and such)
As soon as the constructor is done, those pointers are lost
Bob
Bob
hm
could you paste that constructor?
most likely using a stack variable :\
It's nasty... I'm warning ya...
Bob
Bob
egads that's long
07:24
I told you
@Bob look at line 306
Bob
Bob
and you're losing all the pointers when it leaves the constructor?
@Bob ya
Bob
Bob
erm
brb testing something
hey @IvoFlipse
Morning :)
07:34
@IvoFlipse It's almost morning here :P
about 26 mins away ;)
and I'm still stuck on pointer issues
Here I thought my AI-class stuff was annoying :P
I'm frustrated becuase I don't feel like I'm actually learning the skills I should be learning, but rather having to deal with debugging stupid issues that take up way too much of my time
I need to calculate the sum over all possible transitions between s and s' and stuff, blegh
@KronoS That sounds like a useful skill to me :)
sadly I still don't know enough C++ to be of much use to troubleshoot a pointer issue
Bob
Bob
yay, massive overflow of STL errors :P
@Bob lol
Bob
Bob
07:43
ok, so make of this what you will: ideone.com/AzsXmW
for me is still night
I know is 3:44 AM but, haven't got to sleep so...
@Ivo
when I see it I let you know if is annoying ;p
@Bob Not a bad idea, @KronoS rip out the offending loop and try to simulate how it works in a barebone file
Though perhaps you don't have to, just strip make sure it stops doing anything when it hits that function, so you can see what the heck is going on
Bob
Bob
@IvoFlipse that was just to check/prove whether or not the pointers were lost when exiting the constructor
:S
appears not
oh, wait, I forgot
@Bob ya those aren't pointers...
or am I reading this wrong?
Bob
Bob
no problems here: ideone.com/8DtshX
I'm gonna reread your code :P
07:51
Maybe it's when I return the Graph it's return a copy
and therefore those pointers do point to nothing...
but then, why wouldn't the GraphReader's graph be incorrect :/
Bob
Bob
you're saving it in mParsedGraph?
@Bob ok I see what you're doing.. and ya that does prove it works... Except the extra step that I'm doing is pasing that list out to another class
@Bob yes
So it's like this:
1. Main Execution Class:
- calls the GraphReader, who creates a Graph
- Saves the GraphReaders Graph into a new Var
After execution of the Constructor, the graphs pointers aren't correctly pointing...
@KronoS Doesn't this return a pointer/reference you can just keep track off?
@IvoFlipse Ya I was thinking about that... but even then the pointer wouldn't matter, becuase the pointers within the object are the issue
Could you put your code into a pastebin again?
Bob
Bob
07:56
@KronoS Is that done by GraphReader?
@KronoS So test them before you pass it and after you pass it
GraphReader takes a file input, and read the file, and then creates a basic graph, and stores it internally
Before exiting the Constructor, everything looks fine:
	mParsedGraph = Graph(mParsedVertices);
}
line 106 of GraphReader.cpp is executed and the graph processes correctly
Don't you have to return that graph or is the processing function just part of graphreader?
why don't you pass graph a pointer and say: make that darn graph over here
Now that's an interesting Idea....
Bob
Bob
@IvoFlipse it's a constructor
a constructor is called when a class is created
iirc, it returns, well, itself as an object
08:00
yeah, but what happens to mParsedGraph? He creates it, then its immediately destroyed, because its not bound to GraphReader is it?
in Python you'd have to say: self.mParsedGraph = blabla
without the self reference, it would execute then happily let it go out of scope
Bob
Bob
I assumed mParsedGraph was a member variable...
that is, a heap variable that lives as part of the object/class
C++ doesn't require this (equivalent of self). When I first used Python, self through me off...
though it could very well be the problem
that it's not assigning to the correct variable :P
Hence, just pass Graph something along you want to store it in/at
Bob
Bob
that kinda defeats the point of a constructor, which is to initialise member variables (among other things)
in any case, nothing wrong with copying: ideone.com/s69tXP
so, yea, go listen to @IvoFlipse :P
I'm probably wrong about everything, as usual
OH HEY!
It worked!
by golly @IvoFlipse you're a genius!
well kinda lol :P
@Bob you were quite helpful as well
Now you get another error :P
08:10
Yes.... but I still have another half bottle of diet Dr. Pepper... :P
In Python I would have spotted this, because the default return value is None. So if you expect a value and get None, well you didn't return anything :P
@IvoFlipse I actually don't know what was wrong here and I'd be interested to see why this worked and the constructor didn't (but on another day)
I'd be interested to know why my calculations were off too, but guess we'll never know :P
Fact is, my specific case, the constructor somehow loses the pointers within the graph, BUT NOT the actual objects themselves. They passed through just fine
Doesn't it just pass a null pointer or something in that case?
08:13
@IvoFlipse no... the other thing that makes this more sucky is that I have to use CMake
so things get even weirder
Don't get me started, that part really put me off C++
like I said... let me work with Python when it needs to be multi platform
Lets see to Qk+1(s,a) = Sum of all prime (T(s,a,s') * [R(s,a,s') + gamma * max Qk (s',a')]
So if I'm in s=A and the action a=Clockwise, then I have two possible s': B and C
T = 0.8 * [R = 0.0 + gamma = 0.5 * Q(s',a') = 0.8] = 0.32
Unless, Q(s',a') is another value, because s' in this case is B or C, so if I assume B, because that's where I'm heading, it could be 0.0 or 4.32. You take the max, so its 4.32
0.8 * [ 0.0 + 0.5 * 4.32] = 1.728 for B
0.2 * [-4.0 + 0.5 * 1.76] = -0.624
Add them up = 1.104
Voila, I found my mistake :)
You guys are such great rubber duckies
@IvoFlipse we do what we can :P
Bob
Bob
08:30
I should change my gravatar :P
Now where's a good rubber duck picture...
Bob
Bob
@KronoS Is it correct at the very end? After that last assignment?
@Bob what do you mean?
Bob
Bob
@KronoS Have you checked for correctness after mParsedGraph = Graph(mParsedVertices);?
@Bob ya... it actually looks like this:
return Graph(mParsedVertices);
// Constructor
Graph::Graph(list<Vertex> aRawGraph)
{
	mInternalGraph = aRawGraph;
}
08:36
argh, I hate exercises where one mistake means all numbers are reset :(
Bob
Bob
@KronoS wait.. why return in a constructor?
That makes no sense whatsoever
@Bob IM NOT TOUCHING IT :p
Bob
Bob
4
Q: return type of the constructor in C++

skydoorI know that there is no return type of the constructors in C++ However, the code below compiles right. What is returned by the constructor in the code below? class A{ public: A() {} } A a = A(); //what is returned by A() here, why? Is there any conflict here?

It's returning a new object, if I understand correctly
Bob
Bob
A constructor does not have a return type, much like a void function
bleh, whatever works :P
08:39
I don't know...
now you got me all scared...
Bob
Bob
...
I DON'T KNOW WHAT'S GOING ON WITH YOUR CODE
LET'S JUST SAY IT WORKS
Take it out of the constructor, put it in a function, create the object, call the function
Bob
Bob
</shout off>
@IvoFlipse perfect :P
How about do it C style and forego objects entirely? :D
seriously, though, objects and classes in C++ give me a headache
You should try Scala :P
Bob
Bob
part of the problem is I keep forgetting ot end class prototypes with a semicolon...
the one place (I think) where a semicolon should go after a }
08:41
@Bob ya that's annoying
Bob
Bob
oh wait, that applies to enums too
Grrrr.... where's @TomWijsman when you need him
Error	3631	error LNK2019: unresolved external symbol "private: class std::list<class Vertex,class std::allocator<class Vertex> > const __thiscall Graph::TopoSort(void)" (?TopoSort@Graph@@AAE?BV?$list@VVertex@@V?$allocator@VVertex@@@std@@@std@@XZ) referenced in function "public: float const __thiscall Graph::DAG_CriticalPath(void)" (?DAG_CriticalPath@Graph@@QAE?BMXZ)	D:\Repositories\ECE474\Project 3\synthesizer\build\src\Graph.obj	critpath
I hate these errors
Link error, can't it find some library?
there's something DAG_criticalpath that it can't find
Oh! Man it's getting late... I haven't implemented that method #facepalm
Bob
Bob
haven't?
08:51
That's how late it is ;)
Bob
Bob
lol
which reminds me, gotta fix it to return positive and negative infinity properly

« first day (777 days earlier)      last day (1624 days later) »