« first day (543 days earlier)      last day (4388 days later) » 

5:01 PM
@JohnSmith vector<vector<int> > v(3, vector<int>(5, 0)); // Makes 3x5 vector set to 0
 
user1182183
hmm seems to make logic
 
@ereOn yeah, but we've still got a lot of customers who use XP. This particular project has to run on XP. We've got a few others where we can be more picky
 
user1182183
does anyone know how to get the vertice index from a reverse path iteration from boost graph? :P
 
@nulltorpedo since you need to wait for the result, why not use the platform-equivalent of system() and then open its output file? system() will wait for execution to finish before returning control to your program
 
@OrgnlDave the 0 is not required there, but is recommended.
 
5:05 PM
@MooingDuck Indeed, he had it correct, except the 0 is indeed recommended...but it should do it anyway. I think it makes it more clear
 
Damnit, I got lost on c2.com again :)
 
@OrgnlDave I have access to system() but I see online its not the recommended approach (Haven't found out why)...
 
@OrgnlDave well, except that it doesn't. Any OS which supports fork also implements it as a copy-on-write action, so pages and resources only have to be duplicated if they're actually modified.
 
@jalf OK, go write a 100k+ line program and put fork()'s in there on small functions and see how copy-on-write performs... especially since there'll be tons of writes when classes destruct, let alone file handles and network sockets issues... or just use threads instead! :-P
 
I have developed an appreciation for stews.
 
5:11 PM
@OrgnlDave You're moving the goalpost. You claimed that it is "an extremely intensive process that involves duplicating EVERYTHING". I pointed out that's not true. Now you're trying to pretend that I instead claimed that forking is basically free, that you can put it in every tiny function and it won't be slow
fork is much, much cheaper than you'd expect. It's not free, but it's cheap enough to be a widely used tool
 
Is it normal that WMVs crash linux players regularly?
 
@sehe The "goes to" one was a well played prank. I dunno about the ************ pointer one though... But yeah, dumb things to tend to get heavily upvoted - but very few of them make it to stellar status.
 
@Mysticial When you say "******* pointer", do you literally mean "******* pointer", or do you actually mean "fucking pointer"?
 
@FredOverflow I meant this question: stackoverflow.com/questions/10087113/…
Which everyone seems to agree that it did not deserve that many upvotes...
Speaking of which, I was mildly surprised at how many upvotes I got for this answer:
21
A: Why is modulo operator necessary?

MysticialUm no... that only works when Range is a power of two. For all other values, you still need the modulus % operator. There are also some subtle (possibly implementation-defined) differences when working with negative numbers. As a side note: Using the % operator is probably more readable too.

 
@Mysticial Do you want me to downvote? ;)
 
5:20 PM
*oh and if anyone wants to upvote the accepted answer - please feel free to do so. I might get badge from it. :)
 
@jalf So when your forked() version executes, it's free when classes destruct et. cetera?
 
@FredOverflow lol, no.
If anything, upvote dwelch's answer...
 
@OrgnlDave yes, the sky tastes of cinnamon. That is precisely what I said
I'm sorry, if you can't read, I'm not going to engage in a text-based discussion with you
> Now you're trying to pretend that I instead claimed that forking is basically free, that you can put it in every tiny function and it won't be slow
 
@jalf Is there also rice pudding in the sky?
 
@FredOverflow wednesday
@OrgnlDave Please let me know if you should decide to actually relate to what I said
 
sbi
5:26 PM
I am (well, a former cow-worker of mine is) in need of a standard reference.
Someone claimed that C++11 guarantees that local static variables are initialized exactly once, even if the functions containing them are invoked from different threads.
1. Is that true?
2. Where in the standard is that written?
 
@sbi Yes it is. It's in an anwer of mine. Sec
 
I'm 99.99% sure it's true (for C++11)
 
sbi
Well, I also think it's true, but I'm not sure, and I can never cite chapter and verse for anything. :(
 
@jalf firstly, I feel your pain for mandatory XP support. just remember the pain of the people who have to maintain those XP systems. the programmers and IT people will all be crying together over this
 
@sbi well, sounds like @sehe is digging up a reference, so I don't need to either :D
 
5:29 PM
@jalf secondly, I can't think of a non-trivial program in which the first wouldn't write to data space "shared" by copy-on-write with the second. If the first one changes a class, time to copy to the second... when the second closes, time to copy all data from first just so it can be destructed...
 
@sbi damn can't SO-search find it. I'm sure I can find it in the standard again. slightly more secs :)
 
@OrgnlDave Then you haven't seen many programs which use fork
 
Where's the "walking standard" when you need him. :P
6
 
Most do it relatively high in their call tree, before millions and millions of C++ objects were constructed
so that the two processes don't actually have too much state in common
 
@sbi I also remember Scott mentioning that in a podcast.
 
5:30 PM
@jalf that's my point, the OP was talking about in the middle of a database program...generally you've got tons of C++ objects all over the place
 
and again, it is pretty widely used in high performance tools and applications
which proooobably wouldn't be the case if it was "extremely expensive" and required every single page and handle to be copied, which was your claim
 
@sbi Paragraph 4 of 6.7 Declaration statement [stmt.dcl]
 
@jalf it would be if, as you say, it does it relatively high in the call tree
 
sbi
@LucDanton Great! You win!
Um, where again do I find a copy of (a recent draft of) the standard?
 
isn't there a new draft out after the standard?
 
5:33 PM
Hi everyone
Could someone help me?
 
@sbi I think @RMartinhoFernandez has a pdf he builds regularly from the git repo of the standard document thing
 
sbi
@unNaturhal Wait for your turn! Please stand in line (that is: behind me) until people have helped me!
 
@unNaturhal don't listen to @sbi ask away
 
@Sbi it's in 6.7 under 4
damn already mentioned now :)
 
sbi
5:34 PM
@rubenvb Yeah, I think this Intel guy publishes the std in a git repo.
@sehe You lost! :) Thanks anyway.
 
@sbi I didn't, actually. I had the correct answer (just not the paragraph number) within about 15 second :)
 
sbi
@FredOverflow Yep, that's a very fine link you got there! :)
 
4
A: Initializing global variable class

sehe1. Straightforward answer If the class is assignable/copy constructible you can just write QFile file; //QFile class int main() { file = QFile("C:\\example"); } 2. Use indirection If not, you'll have to resort to other options: QFile* file = 0; int main() { file = new QFile("C:\\e...

 
I need a C or C++ algorithm to put an element into an array, saving the order.
For example:
{1, 2, 3, 4, 7, 8}
I want to insert 5 after the element 4, but first of the element 7, in this way the order is saved. Could someone give me the code? I'm too bored to write it, and I know that is too easy, and I have a programe somewhere in my hd with this, but I don't have time to find it
 
@sbi It's the most recent version as far as I can tell.
 
sbi
5:36 PM
Thanks, folks, that's all I need. Someone will be seriously impressed by my abilities to dig this up.
@FredOverflow Yeah, I was surprised that a draft of the C++11 std would have a 2012 date on it. :)
 
@unNaturhal std::vector or std::list are your friends
@unNaturhal also when you're bored is the best time to write code...
 
@rubenvb It's linked on my profile page.
 
sbi
You're fine now, @unNaturhal (if a bit unnatural), ask away.
 
@unNaturhal What happens to the 8? Does it disappear?
 
5:40 PM
@unNaturhal My reflex would be: use std::set
 
I hate waiting for people to come back and appreciate my genius. stackoverflow.com/questions/10109091/… . I dug through boost headers for that. I mean come on.
boost headers
 
@OrgnlDave: yeah, I know. But I'm helping a friend to learn to program, I repeated these things many time, and now I'm too bored to turn on my brain to think how to solve this problem...
 
@sehe who starred that?!
2
 
boost headers should have their own courses at universities
@unNaturhal can't help ye bud. anyway, off to clean gasp
also, to Boost in general: we love you, we hate you more, we need you yet more still. may C++/11 and its successors drive you from the face of the earth, amen. now please come save me in the meantime.
 
5:44 PM
Related to DeadMG's starred post, I saw one poll that found that 100% of people said they "take polls occasionally".
 
Haha
 
Anyone know what file contains the linux kernel boot log? I'm trying to get it from my android phone, but I can't execute any usual logcat commands, although I can pull files from the device...
 
Where is std::begin and std::end declared?
 
<iterator>, I think.
Oh, I forgot to post this before I went away ideone.com/W68xN
 
Damn, ideone doesn't seem to have std::begin :(
 
5:47 PM
@RMartinhoFernandes That's correct.
 
Fuck revision. I'm gonna learn some cool stuff instead.
 
hey
 
@FredOverflow so it doesn't
 
@unNaturhal here you go:
 
ideone Y U NO GCC 4.7?
 
5:49 PM
I think std::begin and std::end were added in GCC 4.6, Ideone uses 4.5.
 
int numbers[] = {1, 2, 3, 4, 7, 8};
int key = 5;
int* p = std::equal_range(std::begin(numbers), std::end(numbers), key).second;
std::copy_backward(p, std::prev(std::end(numbers)), std::next(p));
*p = key;
Oh wait, is it okay if the ranges of std::copy overlap?
 
No, use std::move.
 
How about copy_backward?
 
std::equal_range(/* ... */).second means you want std::upper_bound, no?
 
@FredOverflow copy with reverse iterators?
 
5:52 PM
@LucDanton Oh wait, misread your post. Maybe that's what I want, let me check.
 
hey
 
Oh, there is a copy_backward. I thought it was a joke.
 
@RMartinhoFernandes lol
 
If someone created WPF for C++ by whatever magical means, would people use it?
 
sbi
@Mysticial Thinking up new prank questions, no doubt.
 
5:52 PM
@avinash Hi.
 
@Xaade I doubt it. Bloated or something.
 
"...the destination range can overlap with the source range provided the _First position of the source range is not contained in the destination range. copy_backward can be used to shift elements to the right but not the left, unless there is no overlap between the source and destination ranges. To shift to the left any number of positions, use the copy algorithm." msdn.microsoft.com/en-us/library/h5ayh65f(v=vs.80).aspx
 
@RMartinhoFernandes ... but if it would be bloated, WPF is bloated more so.
 
i have started learning network programming
 
@FredOverflow §25.3.1/3: Requires: result shall not be in the range [first,last).
 
5:54 PM
and have a question
 
@RMartinhoFernandes Not actual WPF, but WPF-esque separation of data and layout.
 
std::copy_backward(p, std::prev(std::end(numbers)), std::end(numbers));   // fixed
 
std::do_what_i_want(std::guess_the_arguments_while_you_are_at_it());
6
 
is in_addr_t not supported in ubuntu?
 
Aight, std::move isn't what you should use. I thought it was named in the style of memcopy/memmove but it's not that.
 
5:55 PM
@RMartinhoFernandes std::reflection
 
@avinash Did you include the appropriate header?
 
@LucDanton I think it's ok if ranges given to std::copy overlap, and MSDN agrees.
 
yeah...netinet/in.h
 
@avinash So what's the error you get? Post some code.
 
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
This is what the man page for inet lists. Sadly it doesn't say which has what.
 
5:56 PM
> Requires: result shall not be in the range [first,last)
 
@RMartinhoFernandes Isn't arpa like the predecessor of the Internet or something? :)
 
As someone else has already quoted.
 
yep i did added all three
 
Ok, what if someone made something that parsed XML, and built controls that were rendered using vector rendering in C++
 
i was just trying out the function getpeername
 
5:57 PM
 
gah. Why does Explorer run so poorly in XP :(
 
@avinash Something else is amiss.
 
@MooingDuck You mean it takes ages to start and hangs regularly?
 
@MooingDuck It's rather that everything else runs in a way to avoid XP running things so poorly.
 
sbi
@FredOverflow That is truly beautiful! (Says me, who hasn't watched TV in 20 years...)
 
5:58 PM
@avinash Show us the code, preferrably on ideone.
 
@FredOverflow When I go to "My Computer" and it freezes for ~30seconds
 
@MooingDuck I suggest reinstalling Windows XP. Or another operating system.
 
Whenever HTML5 catches on.... we won't need a browser anymore.
 
The solution is to create a folder named "007" in your desktop.
 
@FredOverflow work machine
 
5:59 PM
@MooingDuck Boot from USB stick then ;)
 
@Xaade Btw, have you seen C++/CX?
 
sbi
@MooingDuck It's likely a shell extension. Those TortoiseXXX can cause that, for example.
 
@jalf I believe it uses WPF or something similar.
 
@RMartinhoFernandes I'm assuming that I didn't or I wouldn't be asking these questions?
 
6:01 PM
@LucDanton Huh, Spec does indeed say that. Interesting that MSVC's docs directly disagree with that :/
 
@RMartinhoFernandes what about it?
 
I know there are extensions that can help you interop with WPF from native C++, but.... that's not quite the same.
 
it doesn't use WPF. They use XAML (the markup language), but not WPF
 
@MooingDuck Is it? It doesn't make them non-conforming: every valid use of std::copy will be accepted and produce valid code.
 
@jalf For more context, see @Xaade's latest messages.
 
6:02 PM
@jalf Can you spot the typo in WPF? ;)
2
 
@LucDanton True, it accepts all correct code, but it's interesting that they don't even note that as microsoft-specific like they normally do.
 
Does anybody have the published C++11 standard and not the draft? At §25.3.12/2 in the n3242 draft, there's a formatting error where a line goes off the page, I'm wondering if that made it into the final version.
 
> provided the _First position of the source range is not contained in the destination range.
 
@GManNickG I have it, I'll check.
 
6:03 PM
Doesn't this mean that if _Dest = _First - 1 it UBs?
The standard one doesn't.
 
@GManNickG no formatting error here…
 
@FredOverflow Yeah, they misspelled Fun.... F--o--un--dation--
 
sbi
@FredOverflow I know there's something in the cabbage family that looks like this, but this looks a bit more like a fractal than a real piece of cabbage. (Ah, yeah, Romanesco, that's what it's called.)
 
@daknok_t Okay, thanks. Just wondering. FWIW, this is what I see: i.imgur.com/m6Eku.png
 
@sbi You can find the image here.
 
6:06 PM
@GManNickG It's fixed in the latest repo version. No idea about the official one.
 
sbi
@FredOverflow Oh, so this one is indeed real. :~/
 
@FredOverflow Actually here.
 
@RMartinhoFernandes Off GitHub? I should really figure all that out...
 
@sbi Yep, it is. Must be the lighting and the out of focus background that makes it look unreal.
@Xaade Just scroll one page down and you'll see it on the page I linked to.
 
@GManNickG Get it from here stackoverflow.com/users/46642/r-martinho-fernandes. I only charge three quarters of your soul.
2
 
6:08 PM
@FredOverflow Weird, I don't see it on that link at all.... even when I scroll down.
 
@Xaade Really? It's the fourth image from the top. Right next to the headline "Nutzung".
 
@FredOverflow For me, that image is a zoomed in snap with a blue background....
 
@Xaade Can you post the image?
 
@RMartinhoFernandes lol at the note on the front page. :P
 
What front page?
 
6:10 PM
 
@RMartinhoFernandes !!! Thanks. That leaves me with 2/3499392977ths of a soul :/
 
@RMartinhoFernandes of the draft.
 
Oh. That's a classic.
 
I like it.
 
@GManNickG You know you're a geek when you look at a long rational number with a simple nominator, and check to see if the denominator is reducible.
 
6:12 PM
@Xaade Ha, I was crossing my fingers hoping I picked an okay fraction.
 
@Xaade I can see the image you just posted. Must be an error on your computer.
 
@GManNickG 2/x, where x%2==0, is a safe bet.
@FredOverflow The image link is a full shot with black background, and the wiki link is a zoomed shot with a blurry blue background.
 
10 mins ago, by FredOverflow
looks tasty
^ black background
v blue background
8 mins ago, by FredOverflow
@sbi You can find the image here.
 
ok
it says about sys/sockets.h.....no such file or directory..compilation teerminated
 
6:15 PM
Yep, I posted two different links, but I was always talking about the second.
 
@FredOverflow ...
 
@avinash You're likely missing some package.
 
@Xaade I simply forgot about the first after posting it, sorry :)
 
@FredOverflow So, I'm not crazy, just a bad listener.
 
@avinash try sys/socket.h (singular form).
 
6:20 PM
Does this result surprise anyone else?
 
@Maxpm No, why?
You specialized bar for foo (and thus for int).
 
@Maxpm no
 
@daknok_t I didn't think typedefs worked in reverse like that.
 
@Maxpm They don't work in reverse. They're interchangeable.
 
6:21 PM
@Maxpm they're the same type. a typedef isn't a new type
 
i@daknov_t...that worked
 
@Maxpm: Typedef's are merely aliases to existing types.
 
@Maxpm maybe you're looking for a "strong typedef"?
 
@Maxpm Basically when you typedef you have one type with the two names. Think of it as two pointers that point to the same object.
 
@Maxpm No. If you expect the unspecialized version to be called, you're looking for a "strong typedef" -- one that creates a new type, unlike the normal typedef which just creates a new name for a type.
 
6:22 PM
@daknok_t More like alias.
 
@MooingDuck I am looking for a strong typedef. D used to have one, but it was removed for some reason.
 
@daknok_t Thanks.
@MooingDuck Of course it does.
 
@MooingDuck what's it do, contain the old type and use implicit casting?
 
@Xaade yup
 
6:23 PM
Yeah, I'm checking out the source now.
 
In fact, this is what makes template errors so ugly: any typedef's that were made are seen in "expanded" form when the compiler spits out an error. std::string is much easier to read than std::basic_string<char, std::char_traits<char>, std::allocator<char>>.
 
@GManNickG clang doesn't, it says "std::string (aka std::basic_string<char, std::char_traits<char>, std::allocator<char>>)".
 
@GManNickG MSVC only expands sometimes
(which is it's own problem, when it won't tell me what it expands to :/ )
 
@MooingDuck It's clunky.
C++'s fault.
 
Okay, so I suck. I'll be over there.
 
@RMartinhoFernandes Whoa, ideone supports Boost?
 
Only in non C++11 mode.
For some reason.
 
@RMartinhoFernandes strong_typdef requires explicit casts to, implicit casts from
 
Cool.
 
6:26 PM
@RMartinhoFernandes More like, LINK ALL THE TVTROPES
 
@DeadMG No, anything but that. I have work I need to get done sometime this week...
 
@RMartinhoFernandes wait, I corrected you, and I was right? something is wrong with the world!
2
 
the robot is exceptionally bad at linking TVTropes at every opportunity
 
sbi
@DeadMG Actually he is pretty good at that — which, I agree, is pretty bad.
 
6:29 PM
So maybe I'm just late to the party, but did you guys see Neil Butterworth is semi-frequently posting on a blog (and has posted a few more letters)?
 
I didn't see that.
 
@MooingDuck Are you throwing a party?
Am I invited?
 
@RMartinhoFernandes no, but I might need a psychologist
 
shut up
yes, there is a party, and you are invited
my place
 
Woah, what?
 
6:43 PM
what, you can't read? :P
 
@DeadMG No, the party's at my place, and you're both invited. Strange how much safer it is to invite people who live on a different continent than you do.
 
robot lives on the same continent :P
 
@DeadMG Same as who?
 
as me
 
@DeadMG Yes, but different from me!
 
6:45 PM
@JerryCoffin Now you have an excuse for not showing up.
 
@StackedCrooked I guess an excuse is nice, I'd rather have the money to travel to Europe on a whim...
 
I guess you could also turn the reasoning around and say that DeadMG's party is an excuse for you to go to Europe.
 
@StackedCrooked Maybe, but I somehow doubt my wife would buy that particular excuse...
 
Just tell her a puppy from Great Britain invited you to a party.
I'm sure she'll understand.
 
@RMartinhoFernandes Yeah, that's gonna work! I'm sure of it!
 
6:52 PM
@RMartinhoFernandes woof woof!
speaking of puppies
 
-8
A: When to use volatile with multi threading?

AJG85Good question! Volatile is a keyword which can be used to qualify that the object can be modified by OS, hardware, and/or other threads which tells the compiler it must maintain the order of references to the object in relation to other volatile objects and globals. Because this creates lock an...

 
-4
Q: php login system with redirection for each user

thomi hope someone can help i quite urgently need a login script. i was hoping someone could point to one that i can download or purchase. i need it to be able to create a mySQL database of users with passwords. when each client logs in i need to redirect them to there own custom page which has bee...

> i quite urgently need a login script.
LOL PWNED!!1
 
According to my predictions, he'll repost that question once it's closed.
Anyone has the same problem?
0
Q: "consider adding a comment" pop-up appearing behind gray answers

WTP'--I down voted an answer that was printed in gray (because of the many down votes it already had), but the pop-up appeared behind it. (Possibly a wrong z-index?) I'm running Safari 5 on Mac OS X Lion.

 
7:01 PM
Mmm may be a Safari-only thing then. I'll try it in Chrome.
 
I'm gonna nop for a while. Possibly hours.
Later.
 
Später.
Only 10 seconds?
 
@daknok_t depends on which sleep function, some take seconds, some take milliseconds. Might be 3 hours.
 
I never use that function.
I've seen it used in PHP to limit bandwidth usage. xD
I don't like sleeping. I use libweed, and especially the Cannabis::Weed class, instead.
That's not fun.
sleep is horribly inefficient.
 
Why does pointer decay exist?
 
7:11 PM
@Maxpm before it was used, people thought it would be useful.
 
Pointers don't decay, only arrays do.
 
@LucDanton Array-to-pointer decay. I've heard pointer decay as shorthand.
@MooingDuck How would that be useful...?
 
@Maxpm you can pass an array to a function that wants a pointer. That's useful in C.
 
@daknok_t Couldn't you just do &myArray?
 
Decay of array is equivalent to &array[0].
 
7:14 PM
@LucDanton but only in C, not in C++.
 
Works the same in both.
 
No, in C++, operator&() might be overloaded.
 
You can't overload that for arrays. And if it's not an array, it can't decay.
 
@LucDanton you can overload it for array elements
 
In C++, &array[0] calls operator&() on, or takes the address of the first element in the array, and you can overload it for the type of the elements the array holds.
 
7:16 PM
So array decay was just to save a few characters?
 
@Maxpm effectively, yes
 
In C, yes I guess.
 
I hate C++.
 
@Maxpm std::array doesn't decay
I need a free program to copy/cut/paste wave files. Anyone have a suggestion?
 
Seen that we also have things in C called printf, fopen, EILSEQ and wcsspn I don't think it's strange that the designers of C liked to save a few keystrokes.
 
7:19 PM
@MooingDuck What do you mean?
Like, splice their contents?
 
@Maxpm yes, that. Sorry, I can't brain.
 
@MooingDuck Audacity?
 
@MooingDuck Audacity is good.
 
Looks good to me. I'll try it
hmm, I'm already confused. I opened my wave file, cut a bit, and I can't figure out how to save the wave file.
aha! "Export"
 
sbi
7:40 PM
If you're feeling down, here is a picture of a shaved llama. http://yfrog.com/oevnqarkj
 
Hey all
anyone know any Qt?
 
sbi
@Neal Sure, it's used all over the world, there must be those who know it.
 
@sbi I meant here :-P
 
sbi
@Neal I know one here who uses it, but he isn't exactly a fan, i think.
5 hours ago, by jalf
Fuck you, QThread
Given the fact that this got starred twice, there's a good chance others here know Qt, too.
 
hi
 
sbi
7:48 PM
@jalf Right on cue Q. :)
 
...
Can anyone here help me with QTableModel and QTableView?
 
@sbi I was feeling all right, but that's kind of depressing...
 
Never used those. :) I haven't really done much with Qt gui. But if you have a concrete question, it might be easier to just post it on SO
oh joy, I think I might have a windows reinstall coming up. Windows keeps getting stuck on updates...
 
sbi
@jalf When I once had this, I contacted support (per email, I think; it was for free), and some guy sent me a direct link to an update package that I installed manually. That fixed the problem.
 

« first day (543 days earlier)      last day (4388 days later) »