« first day (84 days earlier)      last day (4865 days later) » 
00:00 - 21:0021:00 - 00:00

sbi
12:59 AM
@JohnDibling Count me in.
Although never is to strong. But I do try to avoid checking in stuff right before I leave, leaving it to the others to clean up after me if I did something stupid.
 
 
5 hours later…
5:46 AM
@wilhelmtell Ha! Awesome.
 
 
4 hours later…
10:12 AM
Hi all
I'm almost a bit embarrassed to ask, but how can I generate all possible bit combinations in an array of bits of length n. If I start with all zeros in my array then there are n possibilities to place the first bit and then for these n possibilities there are n-1 possibilities to place the second bit.. unit all n bits are set to one.. But how do I program this out with, let's say two loops?
 
@Nils You could do all the "zero bits set" patterns, all the "one bit set" patterns... or you could just count in binary.
 
humm and how?
I don't want to count, since that's not implementing an actual algorithm
 
@Nils I thought you wanted to "generate all possible bit combinations". Counting is the easiest algorithm to implement to do this (IMHO).
 
yes, but that's not implementing an actual algorithm, right?\
 
If you're bit array is small enough to fit in an unsigned data type the problem is trivial.
@Nils What's unalgorithmic about counting?
 
10:23 AM
the machine does the counting for you, you don't have to place the ones and zeros
your telling the machine to count and it does it, otherwise you are telling it where to place the ones and zeros
and the second idea is harder so I want to know how to do this properly
 
@Nils I don't understand the distinction that you are making. You seem to be trying to make this more complex than it really is.
 
I'm just doing this to learn.. so I want to know how to place the bits properly
so you have to use recursion, right? You cannot do this in just two nested loops..
 
@Nils No, even you do the "zero bits set" first approach that you describe you can still do it iteratively.
 
How?
Well you can turn recursion into iterations, but I don't see how
 
@Nils for each number of set bits in pattern, for each set bit in pattern, place bit in free location, print pattern.
 
10:40 AM
trying to program that out..
print pattern must come first, otherwise it does not print the 00000 pattern
 
@Nils You are perorming an optimization that I didn't intend.
 
for each number of set bits in pattern: (for each set bit in pattern: place bit in free location; print pattern).
@JohannesSchaublitb gals.
 
what's that primsa pick of @icecrime about? I've seen it once
*pic even
i think it belongs to some music band
 
Pink Floyd Dark Side of the Moon album cover
 
10:49 AM
@JohannesSchaublitb Pink Floyd: Dark Side of the Moon.
 
< Pink Floyd fan
 
why doesn't the chat allow me to say ohh a second time
weird thing
 
@JohannesSchaublitb ohh?
 
10:50 AM
Vary with punctuation.
Why didn't GWW stick around to explain his comment, I wonder. stackoverflow.com/questions/4632314/conditional-operator-usage
 
that isnt UB ...
 
I can't find anything in C++0x which forbids having rvalue references data members, but am I correct in thinking that there isn't much sense to do so (the reference can't be anything but dangling after constructor exits) ?
 
@JohannesSchaublitb Are you thinking C++0x ?
 
i'm thinking standard c++
 
@JohannesSchaublitb Oh really, why not UB?
 
10:53 AM
11
A: Undefined Behavior and Sequence Points

Johannes Schaub - litbSequence points Sequence points are points in an execution of a program where all side effects produced by evaluations prior to the sequence points have been completed. Side effects produced by evaluations that occur after the sequence point will therefor be separated from side effects produced ...

 
You're going to downvote me now, right?
 
"Afer evaluation of a in a && b and a || b and a ? b : c. Also after evaluation of a in a, b - this operator is called the "comma operator"."
oops i had a typo there. going to fix...
 
@JohannesSchaublitb Yes! after evaluation of a in a ? b : c there's no extra sequence point after eval of b or c if the conditional isn't the end of the full expression.
 
why would that be needed in his code?
the condition is evaluated first (of course, to determine whether the first or second branch is evaluated). then there is a sequence point. and then one of the branches is evaluated
i'm not going to downvote this early on the day
 
The condition is 1 which preceeds the ? sequence point.
Nothing stops both += happening after the ? sequence point.
 
10:57 AM
oh noes it's a trick question!
i read it as if the condition was (a+=1)
 
@JohannesSchaublitb litb fail? I don't believe it!
3
 
lol
why does the question have such an utterly fail whitespace use
 
@icecrime I agree, there is no point in rvalue reference data members, only in parameters.
 
so it's undefined in c++03 and defined in c++0x
 
It's clever, dangles the "obvious UB", you think you've avoided the trap because you spot a sequence point and walk straight into the unobvious UB hidden behind the whitespace fail.
@JohannesSchaublitb I'm not up with the sequencing rules in C++0x so I defer to your (supposedly ;-) ) superior judgement on that.
 
11:02 AM
i'm teh c++0x noob. so i guess i can't help :(
 
an I just too dumb or is this really not so easy to program out?
 
@Nils It's probably not completely trivial, if you hit a genuine code problem a real question on SO proper might be helpful.
afk, reading n3225.pdf from cover to cover.
 
@Nils You can generate all possible bit permutations of width n by counting from 0 to (2^n)-1 and printing the number in binary. Done.
 
so can i post ur algorithm proposal?
 
a += (1 ? a : b); would be valid
 
11:04 AM
@FredOverflow I know, but I wanted to program an algorithm which places ones into an array of zeros.
 
So instead of printing the number, you put the bits into an array. Ask a question on SO and we will provide code examples.
 
:)
 
@Nils What is the element type of the array? Char? Int? Do you mean zero as in the number 0 or the character '0'?
 
How is this mathematically correct called? All permutations of 0 and 1 of length n with repetition allowed?
just int will be fine
doesn't matter
 
in c++0x, an array of all-1 can be created at compile time
i.e "statically initialized"
 
11:09 AM
@FredOverflow Please scroll up! @Nils doesn't want to count. chat.stackoverflow.com/transcript/message/234124#234124
 
in c 89 also? int a[] = {1,1,1,1}
 
i mean with a compile time known N
better not set N too high though. it needs compile time space
 
ah ok.. how?
 
tricky variadic templates!
 
0
Q: Algorithm to generate all possible arrays of ones and zeros of a given length.

NilsHow can I generate all possible bit combinations in an array of bits of length n. If I start with all zeros in my array then there are n possibilities to place the first bit and for these n possibilities there are n-1 possibilities to place the second bit.. unit all n bits are set to one. But so ...

@JohannesSchaublitb Code example?
 
11:14 AM
i think it's too early on the day still
 
I hate my inability to program things out directly
afk
 
i guess it would work with a recursive constexpr function too
 
Tek
hi everyone
 
oh, nopes :(
 
Tek
What should I check for when I'm not able to include a header file that's in the same directory as the cpp? I keep getting an undefined reference error from g++.
 
11:21 AM
@Nils: There you go:
0
A: Algorithm to generate all possible arrays of ones and zeros of a given length.

FredOverflowThe following program generates all possible combinations by mutating a sequence: #include <iostream> template <typename Iter> bool next(Iter begin, Iter end) { if (begin == end) // changed all digits { // so we are back to zero return false...

@Tek How does your include line look like?
 
Tek
#include "aux.h"
 
@Tek "undefined reference" is almost never about #include directives. It's usually about linking.
 
Tek
I'll go read up more about linking then.
@CharlesBailey Actually, the thing is that it is defined in "aux.h"
the function in the main cpp
 
@Tek What exactly is "the thing"?
 
Tek
I mean, the situation is that the function I'm trying to access from main.cpp is defined in aux.h
 
11:27 AM
@Tek Defined or just declared?
 
Tek
The function in aux.h is a prototype.
It's defined as an "extern void" type
 
urgh
3d transformations are going to be the death of me
came back to it in the morning with a totally fresh approach and it doesn't love me :(
 
@FredOverflow Thank! :)
 
@Tek Where's the definition? In a library or a source file? Are you linking the appropriate file in when you are building your program?
 
@Tek extern marks a declaration, not a definition.
 
11:37 AM
@FredOverflow Sometimes, and then sometimes both. ;-)
 
Tek
@CharlesBailey @FredOverflow I'll double check then and come back if I have any further questions.
 
@FredOverflow if ((*end & 1) == 0) So this just checks if the last bit is set to 0 and if so 0 & 1 == 0?
@FredOverflow Thanks again your quick :)
 
@Nils Yes, it checks the last bit. This allows the algorithm to work both for int (where 0 is really 0 and 1 is really 1) and char (where '0' is 48 and '1' is 49).
You could also use it for 'B' and 'C' if you like :-)
 
I wonder what you do for living?
 
@Nils Well, I had a head start... while you were writing the question, I already started programming ;-)
@Nils I teach programming at a university.
 
11:48 AM
@FredOverflow : Is your answer in this thread correct?
17
Q: Why is T() = T() allowed?

RimoI believe the expression T() creates an rvalue (by the Standard). However, the following code compiles (at least on gcc4.0): class T {}; int main() { T() = T(); } I know technically this is possible because member functions can be invoked on temporaries and the above is just invoking the...

 
lol really? My programming teacher was kinda dumb, at least I didn't really learn to program at my university
 
@FredOverflow: T& operator=(const T&)& = default; doesnt seem to work on my g++ 4.5
 
Tek
Where can I find an updated tutorial of starting OpenGL?
 
@PrasoonSaurav Does g++ 4.5 support ralue on *this stuff? No, it does not.
 
11:51 AM
@Nils Being smart and being good at teaching are mostly orthogonal, though ;-)
@Tek What do you mean with "updated"?
 
I thought this has something to do with deleted and defaulted functions.
 
i dont know why my answer has a downvote
i must have done something wrong lol
 
@PrasoonSaurav No, it has to do with the ampersand after the closing parenthesis.
 
Hmm I see.
 
Tek
@FredOverflow A lot of the tutorials are really outdated and aren't active. The aux file was supposed to be a header file for "the redbook" OpenGL tutorial (from the official site) but it requires other dependencies (that I can't find) and I've read online that it's an outdated guide and should use other solutions.
 
11:54 AM
@FredOverflow What about the complexity of the iterative version? Looks like n^2 to me
 
@Tek: Try Direct3D, Frank Luna has written some excellent books on starting it
following one myself and it's very good
except for the part where he isn't too great on the 3d math :(
 
Tek
@DeadMG I'm using Linux :P
 
@Tek: Ah. Your loss :P
 
Tek
XD
 
@Nils It has the same complexity as the recursive solution, it's a simple "compiler transformation", if you will. Do you mean n^2 for generating a single number or all numbers?
@Tek If I were you, I would simply ask a question of SO about a good, recent, up-to-date opengl tutorial
 
Tek
11:59 AM
@FredOverflow Thanks for the suggestion, there's just a bunch of questions there but I guess since there aren't really any good answers my question should be valid.
 
@Tek Yes, I would think so, too.
 
maybe
instead of having a 3D vector
I should keep around the Quaternion of rotations
who would have known that "forwards", "up" and "right" would be such irritating concepts to implement?
 
@FredOverflow Two loops for all numbers that makes it n^2..?
@Tek Nehe?
 
I hate that there is no downvote button for "I downvote the acceptance of this answer"
2
 
@tek This is still on my TODO list: duriansoftware.com/joe/…
 
12:13 PM
@Nils Yes, but I doubt there is a better algorithm. Note that 50% of the time, only one bit has to be changed, and 25% of the time two bits, and so on. So for the average case, it is quite fast.
If you think about it, incrementing an int is also linear in the sense that up to 32 bits have to be changed, it's just that the CPU is super-good at this ;-)
 
Tek
@Nils That link actually looks pretty awesome from just the skimming. I also forgot about nehe, but something kept me from using it, don't remember what. Thanks!
 
@Tek Nehe does not program in C++, but rather C with classes. Lots of globals and arrays and pointers. Yuk.
 
Tek
@Nils I'll take my chances trying SFML library, the thing is that libraries are kind of overkill since I just want simple 2D objects and make them do stuff on mouse click, etc.
 
@Tek I played with SFML once and found it quite nice. Had moving pictures up in less than half an hour.
 
Tek
@FredOverflow Thanks for the reminder, I think that's it.
 
12:17 PM
didn't know about SFML.. However I've used processing which is Java based and very easy to use, just not fast
There is also libcinder.org which looks promising
 
Tek
@FredOverflow That sounds pretty encouraging.
@Nils Nice find, options are always nice. Too bad it's only available for Mac and Windows. (I'm on Linux)
 
Heh your fail :P
 
@Nils: That's what I said! :P
 
Tek
LOL.
 
Well Linux OpenGL is pretty much Nvidia.
 
Tek
12:19 PM
Yeah, I have an Nvidia card and it works awesome with Linux.
 
man
my 5770 can only render my sphere at 1500fps
 
@DeadMG How many fps with two spheres?
 
still 1500, since one occludes the other and it's EZ-clip#
 
are u guys on projecteuler?
 
and I can't write the code to move the camera properly to view both at once
then again
 
12:21 PM
LOL
 
my entire game idea takes place with just two spherese
so I could go further
maybe instead of 10k vertes 1mil verts
whoops
 
@Nils Yes, but I forgot my user name :) Is there a list of user names I could search in?
 
forgot they're limited at 65,535 verts per mesh
 
I don't know
well problem 165 is the most complicated I solved so far
 
I never really liked Project Euler
seemed to me like languages with very large existing libraries like Python had an unfair advantage
the C++ Standard library is mostly data structures, containers, and algorithms, not things like arbitrary-precision mathematics
 
12:24 PM
There is a list of users by level, for example projecteuler.net/index.php?section=scores&level=1 So if you know your level..
@DeadMG yes, it's not fair. Also your ranked by how many problems you have solved, regardless of the difficulty of the problems.
@DeadMG However I think I learned something while solving some problems, so it's not bad ;)
 
well
in all my time as a programmer, I've learned one major thing
always eat well
brb lunch
 
Tek
lol
 
I'm off thanks for the help
 
@Nils You have to be logged in to view that site :)
 
nom nom
 
Tek
12:38 PM
@FredOverflow I was trying SFML and I'm getting an error at runtime about not being able to find the shared object file. I used a direct url to the library, even.
 
@Tek I think that has to do with a linker option.
You have to tell it do use the static library.
For visual studio, the tutorial says:
Open your project's options, then go to the Linker / Input item. In the Additional dependencies row, add the SFML libraries you are using. Here we only use sfml-system.lib.
This is for the dynamic version of the libraries, the one using the DLLs. If you want to link with the static version of the libraries, add the "-s" suffix : sfml-system-s.lib, or sfml-system-s-d.lib for the debug version.
The static hint for linux is found here at the bottom of the page (just search for STATIC).
 
@DeadMG a c++ programmer that can't find and use an arbitrary-precision math library has much to learn about c++ before doing project euler in c++
that's some of the most basic c++ knowledge for any project, much less one like PE where you'll literally spend hours and hours if you want to solve very many or any hard ones
 
@Fred Nurk: Of course. I could find or write one- but that's still not as fast or easy as having one in-built into the language.
 
@JohannesSchaublitb there is, it's called "add comment"
@DeadMG: C++ isn't the best tool for every job; it isn't the best for PE
but if you do choose C++ for PE and finding/using a math library isn't the least of your concerns...
 
@Fred: You seem to have a project euler account. Can you go to projecteuler.net/index.php?section=scores&level=1 and post all the account names with "Fred" inside them? I forgot my account name :-(
Or maybe I was already at level 2, I can't remember.
 
12:52 PM
No, not spending the time on these damn matrix transformations is my greatest concern
 
sec
@FredOverflow: it's 1600 names spread across 16 pages... sure you can't find it somewhere? :}
 
That's what ctrl+f is for? :P
 
feel free to do ctrl+f yourself if it's so easy
 
heh
don't have a PE account :P
 
@FredOverflow 1547 at level 1, none have "fred" in their name
 
12:57 PM
but then I'd have to stop wasting my life on Starcraft II :P
 
@FredOverflow 1305 at level 2, only one match: "frozenfred"
ack, was expecting fewer at level 3 (instead it has 2090), I'm stopping here
 
@FredNurk Hm, that might well be, I'll give it a try...
 
"Please note that once a member has solved 100 problems they will be immortalised in the score tables. However, level 1 and level 2 tables only show active members (solved a problem within the last 30 days)."
 
@FredNurk Nope, that's not it. I guess my account name does not include "fred" after all
@FredNurk oh
Guess I'll have to start over then.
 
your account should still be saved, just not listed in the scores
(if you can find the name) :)
get keepass[x], and keep PE stuff in a repo :)
 
1:07 PM
@FredNurk no there isn't... adding a comment is not anonymous
and it make give the questioner drop rep
 
you already want to disagree with the OP about what the OP themself found most helpful, but you don't want to do so with a discussion? just want to become another anonymous downvoter, which make some so cranky?
 
who else thinks that the "N subscribers" display on the tag tooltip sucks
would be much better if it displayed the number of tag-hilighter-users
 
@JohannesSchaublitb Yes, I can't see why anyone would subscribe to email updates for a tag. Some sort of spam deathwish?
 
just saw that box, after wondering wth you were talking about; interface- and feature-itis at it again
 
1:31 PM
@CharlesBailey I can see it being useful for low-traffic tags
i.e. if you're an expert in a niche tag that doesn't get much traffic
 
@marcog Perhaps, but I think I'd just use the RSS feed.
 
@CharlesBailey That's true
 
1:50 PM
"I tried this, i don't get any error but i can add more than 30 length, so the length ain't fixed at 30"
sigh :(
0
A: constructing protected fixed length

marcogIt's difficult to understand exactly what you want, but perhaps this is what you mean? class sid { protected: string wq; public: void setWq(string x); sid(string x) { setWq(x); } }; void sid::setWq(string x) { if (x.length() != 30) // raise exception wq = x; } The above co...

 
@marcog WTF?
 
@CharlesBailey I think this is a combination of english 4th language and C++ 42nd
 
@marcog It doesn't help that there is no question; just a couple of comments in the code with question marks.
 
Tek
@FredOverflow Hi I'm back from eating breakfast and I just wanted to say thank you so much for the static libraries hint, finally works.
 
no problem Tek
 
2:05 PM
"I need to do it with int main()" - lolwat
 
2:23 PM
@Tek You're welcome. Happy hacking :)
@marcog That Rin guy seems to be a main-o-sexual
 
what on earth is a main-o-sexual?
 
@DeadMG Someone who says
> I need to do it with int main()
 
:)
 
Hey, we all have needs!
 
lol
but that's not very specific, really
what if I wanted to do it with int main(int argc, char*[] argv)
or LRESULT WinMain(HINSTANCE, HINSTANCE, LPCSTR, UINT)?
 
2:30 PM
@DeadMG Well, perhaps there are specialized LRESULT WinMain swinger clubs? Dunno.
 
I prefer abs(..), because I couldn't find boobs(..).
 
anyone can find boobs(..), use google
 
But beware of std::, you should definitely be protected!
 
Tek
lol
 
@DeadMG google didn't show me acceptable boobs. Guess I'm too picky.
@FredOverflow LMAO.
 
2:32 PM
Pretty sure you can find virtually any boobs you want on google
just be more specific
 
@DeadMG /me searches for a boobs-adjectives book.
 
@jweyrich I suggest "Effective Boobs", "Swinging With Boobs" and "Boobs for Dummies".
 
Scott Meyer's Effective Boobs?
 
@FredOverflow oh, thank you! What about Thinking on Boobs 2nd Ed?
 
@DeadMG exactly! :)
@jweyrich Dunno, how does it differ from the first edition?
 
2:36 PM
@FredOverflow I'm still just a boobs newbie, afaict. I'll hopefully find my way to the specifics and internals though.
I feel really sad for Apple not bringing GCC>4.2 to macosx (natively). I suppose GPL3 is too scary.
 
This is the C++ of boobs. Totally bloated, and nearly crushes under its own weight.
 
I give up with this Rin dude, I really can't get him to understand what I'm trying to say :-/
@FredOverflow lol!
 
@marcog "maybe now it is more understanding what i want" LOL
 
"I ain't confusing anything, the teacher wants it exactly as i asked, i know many other ways how to do it also."
 
@marcog LOL
 
2:56 PM
FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
SO CLOSE :(
 
@marcog I had to downvote after his comment on the question.
 
@marcog "That is how the teacher wants it, if you don't know OK, but don't be a smart ass. I know to do it also on different way, i made many programs in other languages, so give me a break." LOL
 
what question?
 
@jweyrich eish, why do people have to become so aggressive like that. :-(
-2
Q: constructing protected fixed length

Rin#include<iostream> #include<string> using namespace std; class sid { protected: string wq[30]; int zu[100]; public: sid (string x, int y) {wq = x; zu =y;} }; int main () { string wa; int zb; cin>>wa; cin>>zb; sid siO(wa,zb); return 0; }

@DeadMG ^
 
oh dear god
closed that tab right away
 
3:11 PM
I thought he wanted something like
template <typename T, size_t N>
A(T (&a)[N]) : str(a, 0, N) {
if (N < 5 || N > 30)
throw std::invalid_argument("param a is of wrong size.");
}
argh. how do format multi-line code here? I guess I should refer to the HELP page.
 
not sure you can
 
@DeadMG sadly not.
 
3:28 PM
@jweyrich Of course it's possible, this is C++!
 
:234612 I wouldn't try to explain SFINAE to him. Not even if I had 1000 years of life.
 
@FredOverflow go for reversal? :P
i dare you!
 
Why doesn't code format work???
template <bool b, typename T = void>
struct enable_if;

template <typename T>
struct enable_if<true, T>
{
typedef T type;
};

class A
{
std::string str;

public:

template <typename T, size_t N>
A(T (&a)[N], typename enable_if<(N >= 5) && (N <= 30)>::type* dummy = 0)
: str(a, 0, N)
{
}
};
 
@FredOverflow oh well, I tried indenting with 4 spaces (and tabs). What am I missing? I guess it doesn't work here.
 
I think when you type multiple lines you need to press the 'use fixed width' button.
 
3:32 PM
@marcog Some people get really offended if you say your trying to get reversal badge on their question even if your answer is helpful.
 
@CharlesBailey true, but do you think this guy would understand?
you don't need to be upfront about going for the badge
 
Okay, I give up about the code formatting. Horrible.
 
accepted answer @ -4 ... wow
 
@marcog -5 now :P
 
return in a constructor, lol
 
3:34 PM
I've voted to close because the question has been edited and no longer makes sense.
Errr... well makes even less sense.
 
i'm out of close votes, unfortunately
oh wat, he edited it again
should i rollback?
 
@marcog I'm out of reputation, unfortunately.
 
rolled back to initial version
which made the most sense, if any
 
 
2 hours later…
6:05 PM
hi
 
Hello.
 
how long should you try to fix a bug before just hacking around it?
 
It would probably depend on the seriousness of the bug and the hackiness of the hack.
 
well
I have a series of matrix transformations
the result is always off by a tiny bit
so I was thinking of adjusting it manually
if I can work out how to do that
 
Oh. When I worked in 3D graphics, I always punted math problems to one of my colleagues.
 
6:11 PM
heh
well, the thing is, I have some transformations for turning the camera
 
"I'll take the race conditions; you just go fix the damned transform matrices!"
 
up/down, left/right
but it always spins just a tiny little bit
I wonder if it could be FP error, since I have to chain about four matrices per frame?
at 1500 frames per second
hm
maybe I should just leave it for now
can always go back and fix it later
 
I'd probably see if I could clamp the numbers to get the result I wanted and then add a bug to go back and put a real fix in.
(And assign the bug to someone else, of course.)
 
can't clamp
the error only shows up post-transformation, the input is a literal so I know it's good
trouble is, I'm just calling a bunch of black box D3DX functions and don't know what's happening in the middle, and can't verify the results except by testing
well
I guess I could spam call it with 0,0,0 to verify that it handles 0 inputs properly
 
 
2 hours later…
8:47 PM
#include <file>
#include <file>
int main() {
    int a = 0;
}
 
I find your code epic
and a significantly life-changing experience
 
works fine!
 
:)
 
hey, you multi-line formatted it
 
@FredOverflow ^^
@jweyrich hey what answer is at -5 ?
@marcog ?
i wanna downvote too
to feel happy
ohh i see now!
 
8:54 PM
@JohannesSchaublitb haha. Welcome back stdlitb.
#include <mc_silly_donalds>
int main() {
	double mc_chicken = 0;
}
 
00:00 - 21:0021:00 - 00:00

« first day (84 days earlier)      last day (4865 days later) »