« first day (267 days earlier)      last day (4664 days later) » 

7:00 PM
@Martinho: Why, yes, I believe that I can
I don't know if they're in the Sample Packs now, but I think they are, or whether they're for Dev11
 
Later everyone. And thanks again
 
the download page has some code samples on
give me a sec to find the videos
 
Xeo
Gnah, I want VC11 already
 
Thanks.
A quick look gives me the impression that is pretty similar to the existing .NET TPL (Task Parallel Library).
Yes that can be done in a library. It has been already.
 
7:04 PM
yes, I believe that the TPL is built on the PPL
how is it different to async and await?
 
Maaaan if your question isn't answered almost immediately it pretty much isn't going to be answered :(
 
give it time
 
I asked for more information.
Here's what OP gives.
I just... can't. Comprehend.
Shoot me.
 
I hate Android 2.1 GAWD
 
7:10 PM
@DeadMG For now I'll take a look at the rest of the links you gave. (And I'll have to read some more stuff on async too.) We can continue this later then.
Now I'm going to have dinner.
 
ok
hf
 
And I'll plonk a specific person that is repeatedly asking Android stuff here.
Bye.
 
So what? This is the only chatroom with people
 
Wait, JS a low-level language? Did I miss a Skynet revolution, or something?
3
 
just my opinion
 
7:21 PM
Jesus christ anybody in here experienced with Android development?
 
Nope.
 
not me
 
mru
isn't this the wrong room? ;0 but yes a little bit
 
no
 
No other rooms have people....ever...just this one
 
mru
7:23 PM
but not with the ndk
 
The Android Room has 8 people in there right now.
 
....really
 

Android

Sometimes we even talk about Android. Please read the rules (r...
 
@lespommes what I don't understand, though, is why ask on an off-topic chat room, when you've got the world's biggest, most successful programming Q&A site at your disposal
 
Chat rooms are not meant for asking questions, anyway.
 
7:24 PM
Because the Q&A section doesn't get you an answer sometimes?
 
don't take this the wrong way, I really don't have a problem with you asking questions here. I just don't understand why people expect this room to be better at getting them answered
 
And I can't talk in Android without getting permission first
 
@lespommes link me to the question
 
I don't "expect" anything
 
SO is offline for maintenance!
 
7:24 PM
I thought it would be worth a shot
Nothing wrong with that
 
@lespommes read what I said. Once again, there is nothing wrong with it, and I don't have a problem with you asking the question here
 
I don't know what the criteria is, but when I asked for it, I was given permission immediately.
 
ah
 
I'm just saying I would personally expect to get better answers on SO :)
 
Chat rooms are for acting silly and flaming PHP and discussing se^Wstuff.
I for one do not care about Android one little bit.
 
7:26 PM
I bet all the regulars in the Android room hang around the tag.
 
That's two ones in one sentence!
 
but as @CatPlusPlus says, this room is perpetually and chronically off-topic. While it is possible a question might get answered here occasionally, I personally wouldn't count on it
since it has to happen in between the discussion of monkeys, sex (and monkey sex), PHP, singletons, murder and weight lifting
that doesn't leave much room for answering questions
 
lol
 
mru
sounds like reddit
 
Except without all the server downtime.
 
mru
7:28 PM
it got better though, but i just started using so -> can't compare
 
Singletons are murder, and they eat kittens!
 
mru
and so is offline atm
@CatPlusPlus the java singleton detector from google?
 
You don't need singleton detector in Java, it's pretty much guaranteed find.
> First, GSD doesn't only detect singletons; it detects four different types of global state, including singletons, hingletons, mingletons and fingletons (see the usage section for descriptions).
Wait, what?
 
mru
Singleton A class for which there should only be one instance in the entire system at any given time. This program detects singletons which enforce their own singularity, which means they keep one static instance of themselves and pass it around through a static getter method.

Hingleton Derived from “helper singleton,” a class which turns another class into a singleton by enforcing that class's singularity.

Mingleton Derived from “method singleton” a class which has any static method that returns some state without taking any parameters.
ok better
 
Saw that, I'm just amazed by the sound of those names.
 
mru
7:33 PM
never heard of them before
 
room topic changed to Lounge<C++>: We don't murder anyone here. Except for singletons, hingletons, mingletons and fingletons.
 
and we don't much like tingletons or zingletons either
 
a tingleton?
 
Tactical singletons, and zombie singletons?
 
is that like, when you get pins and needles?
 
mru
7:36 PM
btw. for what are you using so? i'm new and for me it is currently just something to play with and answer stuff
 
I use SO to get my questions answered
 
mru
zingleton attack!
 
I could play on the double meaning of SO here, but that's murky water.
 
also to annoy other expert C++ programmers, such as myself
 
I answer stuff, mostly to verify my knowledge, I guess. Because some people are so damn stupid I don't know why I'm bothering.
Well, that and points and shiny badges.
 
7:38 PM
yeah, these days I mostly answer hard questions if I can find them, else I like to congratulate myself on how expert I am
 
@DeadMG you use it to annoy a group of people which includes yourself?
@CatPlusPlus ooh, shinies
 
mru
somehow i'm not sure if i should stick with it…it is quite hard to formulate questions/break stuff down, it is much faster to ask some colleagues of mine
 
Maybe he likes to annoy himself. Don't judge.
 
lol
@jalf: Yes. Because I'm a C++ expert.
obviously, that went a little over your head
 
mru
but i find it quite hard to find questions to answer
 
7:39 PM
@mru Digging into problems is what you should be doing anyway. :P
 
mru
yeah c++ experts are fun ;0
 
I'm sure that @sbi would also utterly not have gotten it whatsoever
 
Breaking stuff down is kind of redundant, since stuff tends to break down on its own.
The most annoying thing about answering questions on or is that if you don't do it in the first 15 seconds, you'll find 4 answers already posted by the time you send your own.
And my answer is the best, obviously.
Fuckin' hijackers.
 
mru
i'm new but i saw multiple time that ppl posted code which should work but the problem would be not in their pasted code/environment. and tidying up everything nicely etc and make everything self contained…
@CatPlusPlus of course it is. you remind me of a friend of mine (also c++ expert)…
 
Well, people are idiots, in general. It takes several attempts to get proper info from some posters.
I'm hardly a C++ expert.
Compared to most regulars here, I'm not even that good.
 
mru
7:44 PM
oh sorry i mixed your answers with deadmgs one
.oO(is there an irc interface)
 
There was one attempt at IRC<>SO gateway, but it's half-broken and probably forgotten by now.
 
mru
im unsure if i like this interface…
 
It's okay. Features make up for a fact that it's HTML and JS.
Steam sales will make me go bankrupt someday.
 
mru
my notebook is too slow and i barely use windows on my personal notebook…
btw. tbh most c/c++ questions are imho really simple to answer incomplete/broad that it is really hard to answer it...how do you find good questions to answer?
 
8:08 PM
many people in the chat will despise you for even mentioning C/C++
 
mru
We don't murder anyone here
 
IT DOESN'T EXIST.
 
mru
@DeadMG i didn't say they are the same it was just a list
 
@mru nice save ;)
 
mru
no comment ;0
 
8:24 PM
@DeadMG C/C++. Despicable Me! :-)
 
Why would I have to request permission to chat in the Android channel....? Ugh...
 
@lespommes you could always just create a new, better, Android channel
sounds like it shouldn't be too hard
a chat people are able to talk in always beats one where you can't
 
Come on nobody would join that when they have one people already regularly join :/
 
@lespommes Why wouldn't they? If I see two channels dealing with the subject I'm interested in, and one allows me to chat, and the other doesn't, guess which one I'll join
 
mru
.oO(maybe the guy setting up the channel came from ios and it seems normal to him that everything has to be reviewed before publishing, even chat messages)
 
8:37 PM
Man it's frustrating having one tiny little problem keeping you from publishing your first android app haha
 
mru
whats your problem?
 
0
Q: Android Static in OGG Audio using SoundPool

lespommesI'm creating an app where I need to load OGG audio files into a SoundPool, but it must be compatible with Android 2.1 (which does NOT support onLoadingCompleteSetListener). Because of this, there's no way to tell if the sound file is loaded before playing it. To bypass this, I put a Thread.slee...

Basically I'm getting static in my audio, it sounds horrible
It didn't get static isn't a previous method as described in the question, but THAT method doesn't work with Android 2.1
And it's essential that my app works with 2.1, so I changed the way I loaded the audio
Now I'm getting a bunch of static
 
@lespommes: Seriously, find somewhere else to spam about it, yo've been in here for hours.
 
I don't see anyone else talking, what does it matter to you, people get so aggravated over little text on their screen haha, ridiculous
 
mru
@DeadMG i asked him sorry, i didn't had a look at the last link
 
8:42 PM
it matters to me because I'd rather see something I haven't seen a million times before
 
You care too much about a little text on your screen, unless you're constantly looking at this chatroom for new info 24/7 and keep seeing my question every 2 hours or so, and on the off chance that seeing that even bothers you the slightest, I don't see a problem, but okay
 
I have two screens, this chatroom is on the off-screen, so I do see almost all of it, almost all of the day
 
9:19 PM
@DeadMG: Are you here? Or @mru?
Any of you good in resolving memory leaks in STL string?
0
Q: What do I need to do when a memory leak resides in std::append()?

TomWijFor a school project, we have to send big files across the network., we must use Poco::XML for our data. After our files are send over the network, it appears that the memory does not free. valgrind --leak-check=full --show-reachable=yes -v ourExecutable parms returns: 12,880,736 bytes in 37 ...

This and a similar bug with += elsewhere are bugging us in writing this project properly.
 
> When you hear hoofbeats, think horses, not zebras.
Are you sure the leak is in the STL?
Zebra is a medical slang term for a surprising diagnosis. Although rare diseases are, in general, surprising when they are encountered, other diseases can be surprising in a particular person and time, and so "zebra" is the broader concept. The term derives from the aphorism "When you hear hoofbeats behind you, don't expect to see a zebra", which was coined in a slightly modified form in the late 1940s by Dr. Theodore Woodward, a former professor at the University of Maryland School of Medicine in Baltimore. Since horses are the most commonly encountered hoofed animal and zebras are very...
I'm rebooting. Let's see how much time will three months old Windows Updates take away from me.
 
9:45 PM
room topic changed to Lounge<C++>: All your Base are belong to Derived
3
 
Back.
Let's see... 15 minutes. Ugh.
 
sbi
10:02 PM
@DeadMG What wouldn't I have gotten?
 
Apparently, you didn't.
 
something about him liking to annoy himself
 
sbi
@MartinhoFernandes Are you talking to me? (Because, if you do, you haven't gotten the difference between "have" and "would have".)
@jalf I tried to read upwards from that message to get it, but it was somewhat convoluted (what with several messages of him praising himself for something I hadn't found yet) and then I wasn't patient enough to pursue that. I am on holiday, after all.
 
10:33 PM
> If we ever could produce a true artificial intelligence in a box, we’d probably find it utterly useless for any productive purpose — more inclined to watch Reality TV all day, troll the internet, or invent crankish new religions than to open the pod bay doors on demand.
I think I've met some of those.
 
10:48 PM
@MartinhoFernandes Well, that's how I read it. I've updated the question if you want to take a new look...
 
I'm not saying it's impossible to find bugs in the STL or in POCO. Just much more likely to find them in user code.
Why aren't you using an AutoPtr in handleClientPacket, like you do in deserialize?
 
Because initially, the code in the deserialize and getChildNodeStrValue were pointers, but the same problem occured in that case.
We changed it to AutoPtr because we saw that the examples were like that.
I've never used auto pointers before...
But I do get the point that they use reference counting and when they all get out of scope the pointer will be deleted.
XMLString result = tempNode->innerText();
return fromXMLString(result);
 
Looking up AutoPtr the responsibility of the ref-counting and deleting is all in your class.
Did you implement duplicate and release correctly?
 
@MartinhoFernandes: AutoPtr is used on Poco objects.
So it's their thing...
 
Ok, Poco object should have that ok.
No exceptions are thrown?
 
10:56 PM
No exceptions.
 
No early returns in that // CUT: Access some properties of command, let the command execute. portion?
(Or any of the other portions you stripped)
 
No return in the cut.
There are returns in the deserialize, but I don't know if these are considered early.
 
An early return is one that doesn't happens right at the end.
 
All returns in deserialize are near the end, there is no other code executing after it and the xml parser is properly deleted.
 
Hmm, have you heard of RAII?
You seem to be deleting everything at the right spot, but RAII would make it much easier to ensure that.
(Irrelevant to the problem here, but it could also be used for the locks.)
 
11:04 PM
Hmm
In the deserialize, I have a DOMParser * pointer. But the Poco examples have DOMParser, would this be a problem?
I do delete them in the right spots, so I would think not...
 
It probably would be better to just have it as a local non-pointer variable.
You're not storing it anywhere outside the function.
And then you wouldn't need all those deletes all over the place.
 
Err
I seem to have copied an older version of the NodeProtocol, let me update the PasteBin.
(Funny, had the NodeProtocol.cpp open from earlier)
In our latest revisions we've changed the DOMParser to not be a pointer.
And we used AutoPtr on both Document and Element
So I'm really thinking that it's somewhere in Poco that it's going wrong.
Might perhaps be better to replace that XML part by another XML parser
 
Oh btw, there's Poco::SharedPtr that you can use with any class.
 
and not such complicated one like Poco where searching problems is a mess.
 
Can't really suggest any other :(
 
11:12 PM
So, where are you suggesting I use SharedPtr on?
 
Ideally, everywhere you take a pointer and then delete it manually.
deletes should be scarce in C++ code.
 
So, from the Queue, the add code to the queue, handlePackets and down the call stack?
 
But wait, look at line 81 in your latest paste.
When is that Command* deleted?
 
That code is not run in this case
because we are testing a client sending a file to a node, the code there is for in between different nodes.
Good point that the delete is missing there...
 
If you used smart pointers... :)
 
11:17 PM
Yes, but we learned to use * so never got around to using those implementations... :/
There are STL implemenations of that too, right?
 
The current standard only has auto_ptr which is not at all like POCOs, and has several shortcomings :(
 
shared_ptr and auto_ptr from TR1, I wonder if they would do the exact same thing.
 
auto_ptr is not recommended and will be deprecated in the next standard.
shared_ptr is like Poco's. And that one is good.
There's also unique_ptr when you don't need sharing.
 
From Wikipedia: The upcoming C++0x standard is due to make auto_ptr deprecated, replacing it with the unique_ptr class template.[3][4]
Yeah, seems like auto_ptr was meant to be unique_ptr.
 
Like I said before, if you can, use smart pointers everywhere. But if you can, don't use pointers at all and just pass values around.
If the problem remains after that, yes, for sure there's a bug down below.
 
11:22 PM
Yeah, you'll notice that there can be quite some pointers in the code, I've learned myself the habit to use them a lot. But I've recently learned (there was a SO question on that) that they aren't necessarily in a lot of cases.
 
Just curious, you did Java or C# before?
 
Yes, @MartinhoFernandes, C#'s my main language.
Pointer management is one of the many reasons I don't like to work in C++...
 
One of the things you need to learn is this: you only need to manage memory and pointers if you start using them.
Don't use new unless you really need to.
Most of the time you can write return Foo(...) instead of return new Foo(...).
 
So, I should be able to port a program in C# to C++ without adding pointers?
 
Or Foo x(a,b); instead of Foo* x = new Foo(a,b);.
Sometimes you do need them.
 
11:25 PM
Unless C++ functions give me back pointers or require me to give the function pointers?
 
But you shouldn't use them naked.
Wrap them in the smart versions.
 
What about priority_queue< PriorityElement*, vector<PriorityElement*>, ComparisonFunction >
 
Naked pointers should be reserved for "non-owning pointers", that is pointers you don't own and don't need to release, because they belong to some other object that is in charge of that.
 
Could that just be priority_queue< PriorityElement, vector<PriorityElement>, ComparisonFunction >?
 
Probably.
What is PriorityElement?
 
11:27 PM
Struct of an Info object and a string
The Info object is a class holding some ints.
(ids of client, src, dst, packet)
 
So, it is copyable, right?
 
I guess so
Or do you mean that I should explicitly write the copy constructor?
 
No, only do that if you need special copying stuff.
Or if the compiler can't generate one.
It isn't polymorphic (a base class of something), right?
If that's the case, no pointers is probably a better idea.
 
In the struct there is a Info *, that should probably be Info too?
 
Hmm, is that Info shared with another object?
Or each object has their own?
 
11:31 PM
Each object on it's own
 
From the description you gave, seems like each PriorityElement has its own.
In that case, yes, a value is preferred.
 
when I need it apart I probably could make a reference to it rather than a pointer.
Dunno if that's the problem here though, but thanks for the hint.
 
Probably not the problem.
 
Writing in a do-not-use-a-pointer-unless-necessary manner is not a bad idea...
 
But I can't see what it could be :(
 
11:34 PM
Rather than use-a-pointer-because-it's-dynamic.
I always tend to think that you need a pointer for adding things to a list, but I guess that's wrong too, right?
 
I don't know why C++ isn't taught more like that.
 
Because you could have something as simple as a list<int>.
 
Yes, a list<int*> sounds stupid.
 
Dunno, we got explained RAII in theory, but the proper practical writing style of what to use when and how was kind of missing...
What about a list<PriorityElement*>?
 
Depends. Like I said above, you could want to share PriorityElements among objects, or it could be a base class.
 
mru
11:36 PM
depends, may make sense, especially if its polymorph
 
In those cases, it might make sense.
 
Hmm
 
Btw, are you sure you want a list<T> and not a vector<T>?
 
Just an example...
 
mru
but imho always keep in mind if you use new, who is responsible for deleting theobject
 
11:37 PM
Ok, just making sure. Because a list<T> is not like a C# List<T>. The corresponding class is vector<T>.
Yes, what @mru said is the important part. If you end up using new you need to know who is going to own that object.
If it's owned by a single object, use unique_ptr, if available.
 
mru
and if you are using 3rd library parties try to understand who is responsible for a object, sometimes its you, sometimes it's the lib
 
Let's say I have some IDs of my Nodes. Thus class Node {int * id;}; and then a list<int*> somewhere that contains those id, and whenever a node changes his id it will change there too. In that case a pointer makes sense, right? Because this is not possible with a reference at run-time?
 
You can also have vector<unique_ptr<T> >.
 
(Or well, a shared_prt instead of a pointer)
 
Why not just store pointers to the nodes?
 
11:40 PM
@mru Yeah, that's confusing me when using Poco. How can I figure that out easily?
 
(And to answer the other question, no, you can't have containers of references).
 
@MartinhoFernandes Think I gave a bad example, perhaps it would be useful to have this list/vector available to easily pick an id from but I could as well use the node.
 
mru
@TomWij i don't know the library, sorry. typically they should write something in their documentation. But you should be only concerned if you get a pointer
 
@mru: Yeah, the library doesn't say that in the case of Poco or I'm missing a piece of documentation.
Hmm, @Martinho. I could probably just use list<Node> too I guess.
 
mru
then it is safe to assume that you have to take care of it
 
11:44 PM
@mru: If I do a double delete or use a shared_ptr or unique_ptr on something that will get deleted internally later on, I would get a warning for double deleting from valgrind, right?
 
Yes, smart pointers rely on good ole delete.
 
@Martinho: Perhaps when I write something I should try to start implementing it using list<Node> until I need it to be a pointer because I need to use it elsewhere and a reference won't fit...
 
mru
oh the other usecase for using pointers is if you don't want to copy the object. for performance reasons for example, but only use it if you are sure its important
 
@TomWij Yes, that's a good rule. And it applies everywhere really including arguments and return values. Prefer pass-by-value to pass-by-reference to pass-by-pointer.
 
So, I should remember a rule of thumb: value > reference > pointer
 
mru
11:46 PM
@TomWij depends on the runtime with multiple deletes. and yes you will get a warning from valgrind if you delete something and access it later
@MartinhoFernandes why prefer by-value over pass-by-reference?
 
@mru: But also a double delete, I think...
Dunno if that's considered an access.
 
Yes. I think pass-by-reference should be reserved for when: 1) you want to mutate the argument and see the changes outside, and 2) the object is really big and it is bad to copy it, or not copyable at all.
If you don't want to mutate it and end up needing to pass by reference because of reason 2, use a const reference.
 
Hmm, I've noticed something...
2
Q: What do I need to do when a memory leak resides in std::append()?

TomWijFor a school project, we have to send big files across the network., we must use Poco::XML for our data. After our files are send over the network, it appears that the memory does not free. Here is an example for a file of ~9 Mb on the receiving part: valgrind --leak-check=full --show-reachabl...

 
mru
@TomWij typically the runtime will also prevent multiple deletes…
 
11:49 PM
Check deserialize and pay attention to rootElement, now check getChildNodeStrValue and pay attention to elem.
Would it make sense to make both a SharedPtr?
 
mru
@MartinhoFernandes ah i always use const references by default (if it's a complex object)
 
@TomWij No.
By using an AutoPtr in deserialize, you're taking ownership of it there.
 
Oh
 
getChildNodeStrValue takes a naked pointer, and does not delete it, that is somebody else's problem.
You could, but it would not help much.
 
const string NodeProtocol::getChildNodeStrValue(Element * elem, string child)
{
    Element*  tempNode = elem->getChildElement(child);
I'm not deleting tempNode nor turning it into an AutoPtr, perhaps I need to?
 
11:54 PM
Hmm, lemme see if I can find the docs for that.
That pointer is probably owned by the elem object.
 
And I dunno if I'm supposed to pass a AutoPtr<Element> into a parameter Element *, I don't know what behaviour I should expect.
 
It would make some sense. Let me confirm it.
It wouldn't make much sense to dynamically allocate a copy to return.
So it probably returns a pointer to it's internal child object.
It owns it, and it releases it itself.
 
AbstractContainerNode::~AbstractContainerNode()
{
	AbstractNode* pChild = static_cast<AbstractNode*>(_pFirstChild);
	while (pChild)
	{
		AbstractNode* pDelNode = pChild;
		pChild = pChild->_pNext;
		pDelNode->_pNext   = 0;
		pDelNode->_pParent = 0;
		pDelNode->release();
	}
}
 
If that is the case, using an AutoPtr in AutoPtr<Element> rootElement = doc->documentElement(); might lead to double deletes.
@TomWij Is that from Poco's code?
 
AbstractNode::~AbstractNode()
{
	delete _pEventDispatcher;
	if (_pNext) _pNext->release();
}
Yes, Element only deletes the first attribute, its' derived from AbstractContainerNode which is derived from AbstractNode::~AbstractNode() and I'm now looking further.
 
11:57 PM
Ah, it uses the AutoPtr release mechanism internally.
Ok it plays safe with you using AutoPtr on the root element.
Forget what I said above.
So, it's okay to not release the pointers returned from those Poco classes, because you're not given ownership of them.
 
AbstractNode is derived from Node which is derived from EventTarget which is derived from (finally) the base DOMObject
 
That is, except from the parse.
 
Okay
 

« first day (267 days earlier)      last day (4664 days later) »