« first day (689 days earlier)      last day (4250 days later) » 

user784668
2:00 PM
@sbi No wonder, spammers gonna spam.
 
sbi
@Fanael But that is one of the most important reasons why I like SO more than I ever liked Usenet: Spam can effectively be banned!
 
close votes
7
Q: Why is my program slow when looping over exactly 8192 elements?

user1615209Here is the extract from the program in question. The matrix img[][] has size SIZExSIZE, and is initialized at: img[j][i] = 2 * j + i Then, you make a matrix res[][], and each field in here is made to be the average of the 9 fields around it in the img matrix. The border is left at 0 for simpli...

 
Hey, I received my Raspberry Pi yesterday. I'm still trying to figure out what I'll do with it though.
 
@LuchianGrigore Why should this question be closed?
 
Xeo
@kbok Eat it! /cc @sbi
 
2:07 PM
@kbok Join the club
 
@Chimera exact duplicate
 
@LuchianGrigore oh :-)
 
sbi
@Xeo But beware of the malware!
 
@sbi Yeah, might get you a stomach virus
 
@kbok Hook it up to an LCD, accelerameter, sonic range finder, etc etc.. ?
 
sbi
2:09 PM
@Neil Actually worms in raspberries just taste terribly.
Hello, serial downvoter. It's been a while since I've had one of you around. Ah well.
 
@sbi He just needs to take small bytes at a time.
 
Xeo
0
Q: could not declare BH::iterator in templated binomial heap

vaxo datuashviliin my templated binomial heap code #include<iostream> #include<list> #include<functional> using namespace std; #define slist list template<class Key> struct binomialtree { binomialtree(){}; binomialtree(const Key& k):key(k){} Key key; slist<...

close votes
 
@Chimera Sure, why not, but to which end ?
 
@R.MartinhoFernandes Very relevant. Which is why you should always retreive the most actual number of month for the current year using the timezone of the user. This may not be the same timezone as where your server resides. Note also, that historical archives for number of months for specific years may be gotten on CD for integration with your software. Only $35 USD
 
How many times does that guy need to be banned before he gets it
 
user784668
2:12 PM
@TheForestAndtheTrees k-d tree times.
 
@Chimera Hey. I read Accelerated C++ today. (Well, accelerated read, as well). Erm. Can you check whether you have some kind of newer edition that I should have bought?
 
@DeadMG You know what would be awesome ? Inlined interpretors of the C++ code, like the 6502 course does.
 
I did give out links to liveworkspace and ideone
 
Information and Integration are very different things
 
Xeo
Okay, screw that vaxo guy.
 
2:19 PM
@sehe Sure, when I get to work.. I have my copy there....
 
> c:\users\dato\documents\
 
Ira Baxter is most definitely violating the spirit of the rules here.
 
I told you he was a dato smurf!
first time I saw his damn question#
 
@Xeo Man his code gave me cancer
 
Xeo
@DeadMG What's dato?
 
2:20 PM
@kbok To have fun, learn?
 
@Xeo A troll who popped up yesterday who got banned.
 
Maybe I'm weird, but the doing is the end.
 
@Xeo he likes k-d trees
 
@TonyTheLion lol he got banned?
 
@Xeo They guy who liked trees a bit too much
 
2:21 PM
@DeadMG banning is not very effective if he can just create a new account then
@Chimera that's what puppy says
 
Xeo
ah
 
@Chimera Sure, that's the point of the raspberry anyway. But it would be better to have an idea of application for the device, otherwise I'll just hook stuff up and won't learn much.
 
@kbok Well, build a little robot that can roll around on the floor avoiding walls and objects...
 
By the way, is C++ Primer 5th worth 35 bucks for a digital edition?
 
Or build a little MP3 player..
The LCD would be useful for that.
 
2:24 PM
@Chimera Yeah, that sounds like fun
 
@kbok st.com/internet/imag_video/product/66143.jsp ( very easy to use and popular MP3 decoder chip )
Or you could hook up your own SD card interface to one of the SPI ports and learn about the gory details of SD card signalling...
 
I think preventing default generated copy constructors is probably easiest. D& operator=(D const&) = delete;. If you must have it copy-assignable, then at least relay implementation to the virtual method for the base case. Very quickly this becomes a candidate for the Cloneable pattern, so you can use private virtuals as in GotW18 as well as being less confusing. In other words, polymorphic classes don't mesh well with value semantics. Never will. The code shows that hiding is hard. The onus is entirely upon the developer... — sehe 2 mins ago
 
@BartekBanachewicz He better not own a printer then.
 
"c:\users\dato\documents\". I knew you were a smurf of that guy who kept asking the K-D tree questions. — DeadMG 8 mins ago
 
LMFAO
 
2:29 PM
@kbok Or just hook up a speaker or piezo element to a PWM port and make funky sounds. :-)
@kbok Or just cross-compiling your own custom Linux kernel could be fun...
 
@Chimera So much things to do... if only I had more time
 
@kbok yeah, I'll stop. Just some ideas.
 
> "c:\users\dato\documents\". I knew you were a smurf of that guy who kept asking the K-D tree questions. — DeadMG 8 mins ago
3
@R.MartinhoFernandes ^ better for the starboard
 
10
Q: Why is my program slow when looping over exactly 8192 elements?

user1615209 Possible Duplicates: Why is transposing a matrix of 512x512 much slower than transposing a matrix of 513x513? Matrix multiplication: Small difference in matrix size, large difference in timings Here is the extract from the program in question. The matrix img[][] has size SIZExSIZE, and...

can we get a re-open vote?
:D
 
@LuchianGrigore Done. Good argument :)
 
2:32 PM
@Mysticial take your shot.
 
Though it did look like a duplicate... maybe there's more going on there.
 
0
Q: templated binomial heap version in c++

vaxo datuashvilii am trying to implement templated version of binomial heap,here is what I have tried yet #include<iostream> #include<list> #include<functional> using namespace std; #define slist list template<class Key> struct binomialtree { binomialtree(){}; binomialkey(c...

And here we go again...
 
that guy needs to GTFO
 
@Mysticial is a beast with optimization ... good lord I bow in his presence.
 
i have another error and will update my question — vaxo datuashvili 50 mins ago
 
2:35 PM
I hate when they do that.
 
I hate when they do that.
 
I just hate.
 
I hate
FTFY
 
I hate when...
 
I just hate to chime in!
 
2:37 PM
LOL!
 
The ways of the Internet
 
He seems like a decent guy
 
@Neil who?
 
 
@TonyTheLion nah, that would be I HATE YOU ALL. Now tits or gtfo
WOW!
Just had an idea.
 
2:38 PM
@TonyTheLion Whoever you guys are hating, apparently.
 
@LuchianGrigore lol
 
What if we adapted that to SO... code or gtfo?
 
@Neil Currently we're on a massive hate spree of anything and everything that comes along :P
 
Is that like "tits, or it didn't happen"?
2
 
2:39 PM
code or it didn't happen
 
nooooo
core dump or it didn't happen
 
Combo breaker
 
core dumps are useless without source code
 
I kinda hate software design. Somehow it feels like one comes always up with a sub optimal solution.
 
unless you fancy reading assembler?
@Nils I don't think any better than a sub optimal solution exists
 
2:40 PM
profiling results or it's not inefficient
/\ lame
 
I hate reading assembler, much easier to read machine code.
 
@Nils I always consider the perfect solution to demand an infinite time of design.
 
I remember when you could read the contents of memory with your eyes.. Magnetic core memory.
 
@Chimera wut? Assembler is as low as it goes
Microcode is not available to you on most platforms
 
@TonyTheLion Assembler is still one level above what the CPU uses.
 
2:41 PM
Not to implement things like a sorting algorithm.. if you do it in n log n time you can't do better.
 
@Nils So everything boils down to optimizing between design and actually boing productive.
 
@Chimera yes I know, CPU has microcode, you can't go look at that
 
I flagged that dato/vaxo whatever dude. AFAIK creating a new account to circumvent a suspension is not acceptable.
 
Software design is just like "Was it a good idea to do that?"
 
@Nils That's not software design IMO.
 
2:42 PM
@Chimera which is still one level above, because it appears to run on some sort of electricity...
 
@kbok of course
 
@TonyTheLion the machine code I'm referring to isn't the microcode.
 
@Nils Yeah, that's why every other year new development techniques appear and it turns out after everyone in the industry adopted them that it sucks
 
But anyways, bad attempt at a joke. :-(
 
@Chimera what is it then?
 
2:44 PM
@TonyTheLion Assembler code is turned into a stream of 1 and 0's which is machine code.
 
5v highs and 0.5v lows that represent 1 and 0 respectively?
 
@TonyTheLion if it's TTL
 
@Chimera yes something along those lines
 
@Nils I usually consider that a given software design can never be perfect, so if you find mistakes that proves you actually make progress. If you can't find any it's just that you don't see them :)
 
2:45 PM
Can you imagine way back in the day before assemblers and compilers? Wow...
 
@kbok Well I think we can separate between stuff which is clearly rubbish (Singletons, etc) and stuff which we are not soo sure.
 
@Chimera A friend of mine was telling me when he started, they wrote the program, compiling and running would happen once a week, and then see what the output is
if you made an error, start all over
no IDE's or debuggers
you had to manually check syntax and everything
 
@TonyTheLion Those were way simpler programs though.
 
@kbok true, yet still.
 
@TonyTheLion Yeah, sounds like fun.
 
2:47 PM
@Nils Yeah, the point is to find mistakes afterwards. As in "no obvious deficiency at the time of writing"
 
mehh
 
But I often get the impression that people aren't even trying.
 
yeah
 
@kbok The fact that design pattern books exist are a testament to that.
 
Even though you can't blame people for being noobs
 
2:49 PM
@Mysticial re-write: lol
Original code:

8191: 1.499 seconds
8192: 2.122 seconds
8193: 1.582 seconds
Interchanged Outer-Loops:

8191: 0.376 seconds
8192: 0.357 seconds
8193: 0.351 seconds
beast I say!
 
@R.MartinhoFernandes I think people reading DP books are actually trying (the level of success they achieve, though, is another discussion)
 
g++ has aggressive constant folding right into the parser/semantic analysis, meaning that (e)-(e) is immediately evaluated to 0 and thus deemed usable as a null pointer value... even though semantically it is an int. Clang however will not fold the x case, and an int cannot be implicitly converted to a pointer value, so x is not. — Matthieu M. Apr 23 at 6:32
 
@kbok In my view, they're looking for ready-made solutions, for escape routes from having to think.
 
^ Above is a description of how some simple code in an answer of mine, works. Does anybody understand why it needs description?
 
man#
I wrote five one-page tutorials on C++, and the fifth had to be about UB
 
2:51 PM
Woah, 8 upvotes already... Do people really trust me that much?
 
@Mysticial Oh, sorry. Downvoted.
 
@Mysticial Well, you showed the proof
 
@Mysticial no, you either quoted the standard or put it on some "social" site
 
@R.MartinhoFernandes Which is exactly what DP are for :) Don't get me wrong, I don't think it's a good idea. But I think it's still better than doing no effort at all
 
@Mysticial well, rep is a measure of trust, so yeah :)
 
user784668
2:53 PM
@Mysticial What Alf said.
 
It usually takes a few hours before it can make front page of a "social" site.
Looks like I'm capped already. That was easy...
Anyways, back to reading papers...
 
0
Q: The thread 'std::vector<foo *,std::allocator<foo *> >::_Insert_n' (0xf4) has exited with code 0 (0x0)

satuonWhen closing my application, I got this strange line in the debug output. The thread 'std::vector<foo *,std::allocator<foo *> >::_Insert_n' (0xf4) has exited with code 0 (0x0). I'm used to seeing messages like ... The thread 'Win32 Thread' (0x1ad0) has exited with code 0 (0x0). ...

 
Yay, my interactive picker is working
It's not easy to pick a 3-d point on a 2-d screen
 
I guess this won't surprise you, but I didn't find it too challenging
 
3:06 PM
@DeadMG Well, it was easy for me, since I asked the renderer "pick this point and give me the actor and cell I picked". VTK is quite handy.
 
rofl
real men write their own octrees and bounding boxes and shit like that
 
I thought the whole point of "using boost is so you don't have to rewrite boost" was the whole idea.
when you replace boost with VTK, it still applies.
 
well
it is full of disgusting Singletons and Managers and Observers and AbstractShit
 
Uh, Kitware.
 
@DeadMG real men write their own shit
 
3:12 PM
@Neil I prefer RealShit over AbstractShit.
by the way
how do you portably tell cin to discard all the bad input?
MSDN suggests numeric_limits<int>::max(), but I'm wondering if this is the portable
 
What does "bad input" mean?
 
when the stream failed
like if you ask from an integer from "fuck your shitty input validation"
then obviously you can't just discard 1 character of the bad input
you need to get rid of all of it.
 
There's no way to make that work without manual intervention.
 
user784668
Characters are extracted until any of the following occurs:
— if n != numeric_limits<streamsize>::max() (18.3.2), n characters are extracted
 
I don't get it, where does the "good" input starts then ?
 
3:18 PM
@kbok When the stream receives more. And it's not really "good", it's "The next lot to be checked".
 
You could try while(!(cin >> some_int)) { do_the_error_cleanup_dance(); }
 
@R.MartinhoFernandes Yes, I'm implementing do_the_error_cleanup_dance();.
 
@DeadMG The standard streams are blocking. There's no "when the stream receives more".
When the line ends?
 
@R.MartinhoFernandes Sure there is. It's just that the stream waits until then :P
 
@DeadMG At least IMO, you almost never want to really do that. I'd typically ignore up to 100 bytes or so, and try to get back in sync at that point. If that fails more than 2 or 3 times, it's probably better to just stop and tell the user there's a problem. With numeric_limits<int>(max), you can waste a lot of time reading through the entirety of a long file for no reason.
 
3:21 PM
@DeadMG It's a call to clear() and another to ignore().
 
@R.MartinhoFernandes Indeed. But I am questioning as to the parameters of ignore().
@JerryCoffin Indeed. But I am not covering such a case. It's for a simple "interaction with the user on a console" scenario.
 
If it's for console interaction, I'd ignore until the line ends.
 
@R.MartinhoFernandes For an arbitrary-size line, that would be numeric_limits<streamsize>::max(), '\n'
 
Right.
This kind of crap is one reason why Bjarne uses a custom header file in his book for programming virgins.
2
 
@R.MartinhoFernandes ...and I'll repeat: you almost never really want to do that. Limit the amount you discard to a few hundred characters (or so) at most. Otherwise, you're probably dealing with redirected input (or something on that order). Ignoring a lot more just wastes time.
 
3:24 PM
@JerryCoffin I don't have to deal with redirected input.
@R.MartinhoFernandes Eh. I think that overall, it's a valuable lesson- one, the API design of iostream is shitty, and two, always validate ur inputs.
 
Yes, but it distracts and frustrates neophytes.
If you have programming experience, it may be fine, but if you're new it's a mess that brings too much to the table that raises questions.
 
@DeadMG So do you honestly think there's a chance of a user entering 2 gigabytes of text without hitting the enter key? if not, why say you're going to wait for that? (and if you think they will, you're completely insane!)
 
@JerryCoffin But nor do I want to write example programs with MAGIC_SIZEs in them
 
@JerryCoffin Ok, that makes sense.
You can always getline and parse with stringstreams.
To be honest I'm not at all sure which is worse.
 
yeah, I think that for a more complex use case, I'd rather go with a proper lex/parse/whatever, rather than this kind of design.
 
3:28 PM
@R.MartinhoFernandes That's how I do it. It's less upfront coding cost, but over extended periods, a lexer would be easier
 
@DeadMG And you somehow believe that "numeric_limits<int>::max()` is less a magic number than "256"?
 
@JerryCoffin Well, the documentation does indicate that numeric_limits<int>::max() means infinite, in this context
and I do subscribe, in general, to 0,1,inf
 
@DeadMG Infinity? Bah, we only need to count to about 2 billion.
Anything larger is trivially 2 billion
 
@DeadMG Ignore one at a time!
 
lol
 
3:30 PM
@DeadMG Not so. If you want inf, you need std::numeric_limits<streamsize>::max().
 
@DeadMG Wait. Are you trying to read inf?
 
@JerryCoffin Ahem. The MSDN documentation, effectively, indicates typedef int streamsize; and specifically refers to numeric_limits<int>::max().
 
25
Q: Is it possible to read infinity or NaN values using input streams?

DriseI have some input to be read by a input filestream (for example): -365.269511 -0.356123 -Inf 0.000000 When I use std::ifstream mystream; to read from the file to some double d1 = -1, d2 = -1, d3 = -1, d4 = -1; (assume mystream has already been opened and the file is valid), mystream >&...

 
which is where I originally found the reference.
 
May I suggest ^?
 
3:31 PM
No, that's not it.
 
but the portable version is indeed std::numeric_limits<std::streamsize>::max()
 
@DeadMG That may work for that particular version of that particular compiler, but is not portable.
@Drise No, trying to ignore a (potentially) infinite amount of bad input.
 
@JerryCoffin Yes, I know that. In fact, my very original question was "What is the more portable version of this code"?
 
-1
Q: Good C++ beginners book?

Andy BarlowCan anyone suggest a good C++ book? I have a good understanding of PHP, Python and a little Java but my C++ is very weak. I'd like to improve this from the ground up. Any book, preferably up-to-date, would be great! My goal is to write cross-platform applications or language extensions in C++. S...

 
the point is about how much to ignore, not about what exact value means "All of it".
 
3:33 PM
One dupe vote missing.
 
@R.MartinhoFernandes It is?
 
Oh, that was fast.
 
FGITW
 
That's what she said.
 
@R.MartinhoFernandes Oh hey, look, a 56 rep user to destroy.
 
3:34 PM
@DeadMG Okay, but when I've suggested smaller numbers, you've rejected that as "magic". Make up your mind: do you want it ignore potentially infinite amounts, or just a reasonable amount? If you decide on "reasonable", you're going to have to decide what constitutes "reasonable" for your situation.
 
@DeadMG ermm I remember some episodes relating to a particle collision algorithm that was not dissimilar to your progress with the SHA2 solver. Perhaps you should
 
@Drise What?
 
@DeadMG std::ios::DISCARD_ALL_THE_BAD_INPUT
 
@JerryCoffin Right. Potentially infinite is fine by me.
 
3:36 PM
@sehe Different one :P
 
Nice ! :D
 
@DeadMG Okay, in that case ignore(std::numeric_limits<streamsize>::max(), '\n'); fits the (badly chosen) spec.
 
it's a simple textbook example, not what I'd deploy fo realz
 
@R.MartinhoFernandes Silly 56 rep user answered the book question to a likely useless book.
 
@Drise It's a book mentioned on the book list.
 
3:38 PM
@R.MartinhoFernandes Oh, ok. Well, at least he was less wrong.
 
@JerryCoffin standard C++ has no terminal abstraction. std::cin by definition coincides with a POSIX-ly standard input stream. There just doesn't have to be a monkey typing on std::cin...
 
So much for annoying projects to debug
 
@sehe Yes, that was my point to start with: if you have more than a few bytes of bad input, chances are you're dealing with redirected input, in which case reading and ignore gigabytes of stuff probably doesn't make sense -- better to just stop than waste the time reading through a huge file just to ignore it.
 
@daknøk Dude. While driving I came across the greatest thing ever: bacon jerky
 
while (ignore_input()) { do_something_useful_with_my_life(); }
2
 
3:49 PM
while (ignore_input()) { be_better_husband_and_father(); }
 
@JerryCoffin Erm, unless you are at CERN or ECHELON and your job is to filter through continuous realtime signal data looking for certain information. Or, you are just implementing strings
@Neil Erm... being a better husband and a father requires you to not ignore input :)
while (ignore_input()) { break; }
be_better_husband_and_father(); // FTFY
 
I'mma go play some starcraft
 
@DeadMG Woa.
 
@EtiennedeMartel shewsh yew
 
silly PHP flags
 
3:56 PM
Yeah. What a bunch of weaklings.
 
user784668
@Mysticial Silly PHP fags.
 
@sbi Did you ask about the version of Accelerated C++ I have?
 
sbi
@Chimera NO. I think I saw @sehe asking this earlier. ICBWT.
 
@sehe True if input were coming from your wife and kids
 
3:58 PM
what is it with you guys and bacon
it's horrible stuff
 
@DeadMG It's radek. He's obsessed with it.
 
Poor puppy broke his taste buds.
 
@DeadMG And it's so delicious
 
@Drise Uh, I think you got the wrong end here.
 
user784668
TIL what's the difference between X and D in Football Manager.
 

« first day (689 days earlier)      last day (4250 days later) »