« first day (804 days earlier)      last day (4143 days later) » 

6:00 PM
It's because he messed up his subtraction
 
user1182183
wjere are all the solution for project euler?
 
oh, right, it gives a negative output if you don't use abs.
they are right to reject it
a negative difference makes no sense
 
user1182183
@BenjaminDangerJohnson __try __except ?
 
will have to keep an eye on her...
 
user1182183
and compile with /EHa option
 
6:01 PM
@GamErix won't that just suppress the issue? I'm hoping to fix it rather than ignore it
 
she seems more the happy playing with it
 
user1182183
@BenjaminDangerJohnson print the line where it happens
 
@BenjaminDangerJohnson Try upgrading your compiler- Managed C++ is quite old.
and secondly, that exception is a memory-related error, so I'd look through your memory allocation and use routines.
 
user1182183
@BenjaminDangerJohnson also, what about step-by-step debugging?
 
user1182183
6:02 PM
with breakpoints
 
@GamErix that was the first thing I tried, but it doesn't throw excpetions until a method returns
and that is only returning a string value that uses no custom code
 
It's snowing. I like the snow :D
 
@DeadMG it might be the compiler, but I doubt it. I'm using Visual Studio 2012 so it should be pretty up-to-date
 
user1182183
@Rapptz I want snow too, only rain here in the - fucking - netherlands :/
 
@BenjaminDangerJohnson Then you are not using Managed C++ at all. It is C++/CLI now and had some fairly significant changes done to it, IIRC.
 
6:05 PM
Because of std::int64_t().
 
which accumulate am I looking at?
 
second I think
 
user1182183
	int sum = 0;
	for(int i = 0; i < 1000; ++i)
	{
		if(i % 3 == 0 || i % 5 == 0)sum += i;
	}
 
user1182183
problem 1 solved, right?
 
@DeadMG second one is not qualified, but should (I think) be found by ADL
 
6:06 PM
@GamErix Yes
 
I think that ADL is supposed to look into the namespaces of template parameters - which in this case would be std::int64_t
 
user1182183
@Rapptz yay lol I solved something
 
but
if std::int64_t is just a typedef, then the actual type might reside in the global scope, and not be in the std:: namespace.
and I don't believe that ADL looks into the namespace of the typedef, only the original type.
 
sourceforge.net is down
grrr
 
@GamErix That's how they suck you in.. Easy 10 problems then they you begin to hate primes and fibonacci.
 
6:08 PM
so in fact, I think that your program is not guaranteed to compile at all
 
user1182183
@Rapptz :P
 
@DeadMG I suspect something along those lines.
 
it will have unspecified or implementation-defined behaviour
 
user1182183
lol, where is cout in? which include ;o
 
lol iostream if you're serious
 
user1182183
6:10 PM
#include <stdio.h>
#include <cstdio>
#include <sstream>
 
user1182183
still getting cout error
 
He's serious.
 
user1182183
std::cout "std has no cout"
 
Sigh.
 
user1182183
endl works perfectly fine ;F
 
6:10 PM
nice
 
user1182183
that happens when you always just include everything that's exist in the include directory >_>
 
@GamErix probably in <sstream> for your implementation for some reason or another.
 
iostream is the first header I always include
 
I almost never include it directly. I have a nifty debug class.
 
user1182183
@Rapptz oh well this one has cout, thanks xD
 
6:12 PM
I can even selectively output debug info at runtime.
cause I tend to output a lot :P
 
user1182183
hm, is it possible to write a exception handler which also can report at which line in which source file the code crashed? I've seen them in a few games..
 
user1182183
or do thos game use som special data files?
 
@GamErix you could use the C99 macros when throwing.
 
user1182183
to determine where the code crashed
 
user1182183
@rubenvb linke __LINE__ and __FILENAME__ okok?
 
6:14 PM
@GamErix yeah, but with backticks
USE BACKTICKS FOR CODE
this: `
 
user1182183
but won't that print the line and filename of where the exceptionhandler is located?
 
nope, where the thrown exception is created.
They're simple macro's.
you pass them to your exception class thingie constructor or something.
 
by the way, does anyone here know anything about handwriting recognition?
 
BOOST_THROW_EXCEPTION
 
user1182183
@rubenvb will have to find that constructor -not-mine-code
 
6:17 PM
0
Q: How to sum all values in the std::map?

Chesnokov YuriyHow to sum all values in std::map<std::string, size_t> collection without using for loop? The map resides as private member in a class. Accumulation is performed in public function call. I do not want to use boost or other 3rd parties.

I'm confused
 
user1182183
SetUnhandledExceptionFilter( unhandledExceptionFilter );
 
user1182183
DAT.
 
user1182183
no constructor
 
that's Windows specific IIANM.
 
yes
 
6:21 PM
I have absolutely no idea about such devilish magic.
 
user1182183
somehow dark reign 2 managed to do it, well, but that's old code (1998)
 
No. I have to feed my children now. Look for 4 parameter version. — Tomek 2 mins ago
 
user1182183
projecteuler.net/problem=407 <- isn't this one easy if you know c++ a bit?
 
@ChesnokovYuriy then use a lambda. — rubenvb 8 secs ago
ffs. I don't want this. I don't want that. Blablablablablabla. Screw you.
 
@GamErix Yeah.
 
6:25 PM
crap, found my error. I was trying to delete constant values in one of my destructors
 
Just know that the obvious solution is very inefficient.
 
user1182183
what does the = with a _ above sign mean?
 
@Rapptz I don't see a more efficient solution.
 
Because you suck
 
modulo's are nice critters
 
6:27 PM
@GamErix it's a mathematical definition
 
@DeadMG Try it then. :P
 
often you also see := instead.
a:=b+c defines a to be the sum of b and c
disclaimer: this does not work in C++.
 
user1182183
@rubenvb aww if you guys don't say what that sign means I have to google it
 
user1182183
xD
 
@Rapptz Eh. I would if the intricacies of modulo and square were useful to me for another purpose.
 
user1182183
6:29 PM
I'n already connected here, my pc explodes if I open another socket :(
 
@DeadMG They are.
 
and that is?
 
@Rapptz Secondly, I just don't see how it's inefficiency is going to be a problem. 10^7 just isn't that much, especially if you throw in a couple obvious optimizations.
 
6:31 PM
When I originally did it, it was very slow.
 
well, one 64bit integer can hold the result and intermediate values- even if you squared 10^7 you'd still only get 10^14 which is in range, so there's no need for any big-integer or non-hardware-supported integer operations
 
Well, overflow is never really a problem. It was the way I was doing it more than likely. I did get the answer though.
 
My code style occupies 6x loc as the avarage solution... I wonder if I'm being too verbose? :)
 
user1182183
you all like solving math problems, just go try to do anything with calculations in GTA San Andreas and all your math and programming skills will explode because of the difficulty level ;F
 
I think Project Euler might be harder than San Andreas math. :P
 
6:34 PM
Nobody cares about your GTA
 
user1182183
@Rapptz nah xD
 
user1182183
@CatPlusPlus whoa mine gta? :D wow, it's mine but I don't have the source code -.-
 
Why does mplayer suddenly turn off Aero
 
user1182183
@CatPlusPlus told you it was an application requesting it
 
user142019
Hello friends and enemies.
 
6:35 PM
Aren't I nice?
0
A: How to sum all values in the std::map?

rubenvbYou can do this with a lambda and std::accumulate. Note you need an up to date compiler (at least MSVC 2010, Clang 3.1 or GCC 4.6): #include <algorithm> #include <iostream> #include <map> #include <string> #include <utility> int main() { std::map<std::string...

 
It's different situation
 
what is the correct output, Rapptz?
 
cause mplayer sucks.
only crappy apps turn of aero.
 
user1182183
for video: Media player Classic Homecinema , for music: foobar2k (with mp4 extension plugin)
 
@GamErix exactement!
 
6:37 PM
Ahahaha no
 
MPC-HC has very superior sound output to stuff like VLC.
foobar2k is kind of barebones but swiss-army-knife-like
 
@DeadMG Uh.. 407 is the most recent Project Euler problem. It's okay to share?
Oh, 225 have solved it.
 
do I look/sound like I care about getting points on PE?
 
Welp, looks like ClearType problems are caused by DirectX
 
I don't care either.
39782849136421
 
6:39 PM
Driver downgrade time
 
@CatPlusPlus huh wut?
 
It switches on its own between CT, non-CT AA and no AA at all
 
user142019
@sehe you're on TV on channel two.
 
user142019
And you're bleeding.
 
Are there any redists for DX10 and 11?
 
6:42 PM
crap, does anyone know how to fix this error: "error C2662: 'Location::ToString': cannot convert 'this' pointer from 'const Location' to 'Location &'"?
 
user1182183
btw... a c++ compiler just translates code into assembly, right? so if the c++ guys who add new functions and standards add something, you only need to update the compiler.?
 
I assume it has something to do with me using a const object but not a const function?
 
@BenjaminDangerJohnson You tried to call a non-const member function on a const object.
 
Ah well it's updated via WU
 
@GamErix "only"?
 
user142019
6:43 PM
@GamErix Depends on the compiler.
 
@DeadMG how do I make the function const?
 
@GamErix they usually ship a standard library, so upgrading one gets you the other. I'd say mostly yes.
 
if you don't know, then go and get a C++ book, read it, and come back.
 
user142019
PIN IT :P
 
@DeadMG I tried declaring it as "const std::string ToString()" but it didn't work
 
user142019
6:44 PM
Y u return a const object by value.
 
@Rapptz Maybe you're right. Even with concurrency, I couldn't get the solution out.
 
user1182183
I think even most of us here can't answer that question
 
user1182183
:P
 
@BenjaminDangerJohnson That's irrelevant, try reading the previous statement I made.
 
about reading a book? That's not really helpful
 
6:45 PM
well, look
 
user142019
Yes it is.
 
marking a member function as const is really kind of basic stuff.
 
user1182183
mhmh pizza
 
also most books I find kind of ignore talking about consts and obsess over pointers
 
user142019
The book helps you understand C++.
 
6:45 PM
if you can't get that right, you're not going anywhere fast, and me helping you with this specific section of syntax won't change that in the slightest.
 
user142019
@BenjaminDangerJohnson you read the bad books.
 
@BenjaminDangerJohnson Get a decent one instead of one of the C with Classes ones.
 
user142019
1943
Q: The Definitive C++ Book Guide and List

grepsedawkThis question attempts to collect the few pearls among the dozens of bad C++ books that are released every year. Unlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a good C++ book...

 
user142019
Those are the only good C++ books.
 
Beat me.
 
6:46 PM
tinyurl.com/so-cxxbooks if you're lazy like me
 
user142019
SlowMG
 
the best book is the lounge<c++> book except it doesn't exist
 
user142019
@Pubby it did exist!
 
so Rapptz what is the trick to getting the faster solution?
 
user142019
But I deleted the GitHub repo. Maybe @sehe still has a fork.
 
6:46 PM
I'm curious
 
@Zoidberg'-- Where?
 
user142019
@ShotgunNinja on my GitHub but I deleted it.
 
@Zoidberg'-- You mean the one started several months ago or the one I recently started?
 
user142019
There was also an list of topics on Google Docs but I cannot find that back either. Wait a second.
 
hmm
 
user142019
6:47 PM
@Pubby the one from several months ago.
 
maybe I can change this into O(n sqrt(n))
 
user1182183
so all of you here have jobs as programmers?
 
@DeadMG Uh. Mathematically speaking, primes and full sums contribute nothing to the final result.
 
user1182183
or do programming for a living
 
So you can skip those
 
6:48 PM
I'm a software engineer, so yes.
I do (unfortunately) Java web application development for a sheet music company.
 
@Rapptz I have no idea what a full sum is, and the effect of being a prime does not appear to me immediately.
 
user1182183
hm okay
 
It's no dream job, but it pays the bills. Plus they've offered me $60k on graduation, and a decent pay rate until then.
 
user142019
@Pubby docs.google.com/document/d/… /cc @ShotgunNinja
 
user1182183
@ShotgunNinja ;o nice
 
6:49 PM
heck, reading [c++-faq] on StackOverflow helps a lot too.
 
@ShotgunNinja Sheet code in sheet language eh
 
user1182183
what bout the most famous nickname on the television, @Zoidberg'--, and the star-ruler of the room, @CatPlusPlus?
 
@DeadMG oops, full powers, as in a^2
 
so if n = x^y for some x and y (positive integers), then it has no effect?
 
yeah, you can essentially factor it out to find out that n = a(a-1)
 
6:53 PM
Is the robot gone for the holidays? Anyone know when he will be back?
 
user142019
@Pubby He segfaulted.
 
@Rapptz So does that mean that you can produce a solution which is O(n)?
 
My solution took about 21 seconds.
 
user1182183
ah c'mon guys, no one wants to talk bout what job they have? :P
 
hmm
 
6:54 PM
@Zoidberg'-- was there anything ever written for that old book beyond brainstorming?
 
user1182183
*me does filling stockz @ supermarket
 
user142019
@Pubby the front page of the book.
 
user1182183
nothing spezial
 
user142019
We could start over if people are interested.
 
Let me remake it.
 
6:55 PM
@Rapptz Oh, I think that I just figured that out.
 
user142019
 
if you have 6*6, then that's 36, so 36 mod 30 = 6, but you also know in advance that 36 mod 10,15 is 6. So you don't have to check it.
 
yep
 
@Zoidberg'-- I already had this: bitbucket.org/pubby/book (except I have to figure out how to make it a team or something)
 
user142019
@Pubby repo settings > collaborators > add daknok
 
user142019
6:56 PM
or uh
 
user142019
just let people fork that's better
 
ok
 
user142019
they can then do pull requests
 
user142019
That way nobody will fuck it up.
 
and since you can find all factors of a value in O(sqrt(n)), that should be just O(n sqrt(n)).
 
6:57 PM
Use LaTeX
 
probably O(n sqrt(n) log(n)) for some binary tree ops
 
user142019
LaTeX: the sexy typesetting software!
 
Could I get a message pinned for a few days about lounge book?
 
Write it
It should be cool
Oh hey driver installer sure you can change my resolution to 320x240
No problems there
 

« first day (804 days earlier)      last day (4143 days later) »