« first day (625 days earlier)      last day (4324 days later) » 

good morning everyone :D
 
@thecoshman Relativity has only been around for ~a century (well, knowledge of it, I mean), and yet, no time API supports it :P
 
@RMartinhoFernandes aha. And a metric year would still be based on the revolution of the Earth around the sun?
 
No idea.
I've said before that I believe the easiest solution is to just fix Earth's orbit.
 
lol
It is "fixed". Ellipses are solutions to general relativity, heck even basic Newtonian mechanics.
 
2:04 PM
No, it's broken because it fucks up timekeeping.
 
Metric time would be great for the economy though.
Think of all the new watches that would be sold.
 
We need to force it to agree with our timekeeping methods, and pronto, no more leap second/leap year/whatever fuck ups.
 
oooooor... use a sane timekeeping method.
Not some random Ce isotope that happened to decay just as a random definition of a second before we could measure the decay was.
 
What kind of definition of second do you want? A variable one?
 
@rubenvb er, that has nothing to do with leap seconds
 
2:06 PM
That's... worthless and completely unrelated.
Leap seconds are a result of Earth's movement.
 
The problem with leap seconds is that the Earth's orbit varies, and our definition of a second is fixed
I don't think it's a good idea to use a variable definition of a second to "fix" it ;)
 
Making the definition of second variable is just moving the problem around.
 
and amplifying it
 
I wouldn't care if the leap seconds just didn't exist.
Nothing would break.
Seasons are related to Earth's orbit anyways, it's not that Winter would come 5 seconds earlier...
 
@rubenvb but then you're suggesting the opposite solution of what would make sense. Then a second should just be defined by the decay of a Ce isotope, and we just have to ignore that it doesn't exactly match the Earth's orbit
 
2:10 PM
Why bother making sense.
 
@jalf you just argued defining seconds by Earth's orbit is impossible cause it varies. Now you're saying it makes sense. Which is it?
Radioactive decay is also not as deterministic as you may think.
 
@rubenvb I think you misunderstood me. I argued that it makes sense to let our timekeeping drift relative to the Earth's orbit
 
I honestly thought a second was defined by the vibration of a Ce (or was it Cs?) atom, not its radioactive decay.
 
@rubenvb I dunno, haven't checked :)
I just used whatever you said ;)
 
the duration of 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the caesium-133 atom.[5]
 
2:14 PM
aw, you beat me to it
 
Not radioactive decay, but transition time. Which is some sort of decay
 
> This definition refers to a caesium atom at rest at a temperature of 0 K
 
yeah, obviously :^)
 
a lambda inside std::remove for the predicate, where the container is a map, what do you pass to the lambda as argument? a std::pair ?
 
It's a physicist's definition :-)
 
2:14 PM
lol, I got invited to the C# room... uh...
 
@Mysticial lol since your freaking awsome answer youve gotten popular haha xD
 
Funny, the # of residuals seems to have gone up today... no idea why.
 
@Mysticial Also happens when someone bins messages (by you) to that room... :)
 
@sehe How do they do that? I've never posted anywhere else besides here.
*and the occasional "continue in chat" threads
 
@Mysticial Soooo, I'm merely suggesting one of your message could (theoretically) have been moved to the C# room
Not likely, but has the same symptom
 
2:18 PM
hmm...
 
@rubenvb it's the period (inverse frequency) of the radiation emitted as a result of the decay. The atom has to be at 0K as otherwise you get Doppler shift
 
bob
If a is an object (instance) of class A, b an object of class B and c an object of class C, and if class C contains a member of class B, and if class B contains a member of class A, and if I'm given c, then I can get to a with c.b.a. But could I modify A so that I can get from a to c ?
 
@ecatmur oh, the radiation emission's frequency.
 
> Check out the C++ book guide and list. Also, come hang out in the SO C++ chat. – DeadMG just now
Trivial answer converted to comment edit
wtf, trivial answer converted to comment?>
 
bob
2:27 PM
So could I add to the grandchild of a class, a pointer to the grandfather ?
 
@DeadMG Woah, new feature.
 
@RMartinhoFernandes Apparently not. The Meta question complaining about it is a year old.
0
A: Answer appears automatically converted as a comment

DeadMGThis is terrible. If it's another question on the same site, then I get it- it's a duplicate, effectively. But if the question is on a different site, then it's not a duplicate and the questioner could not have found it by searching the site he was on. Come on guys, this is definitively unnecess...

 
@RMartinhoFernandes I know! what an outrage!
 
@rubenvb yes, the radiation emitted has a period that (subject to the atom being at 0K) is constant (relative to all other methods we have of measuring time). It's because the energy levels themselves are constant, because of quantum.
@bob yeah, why not. You'll have to forward declare the grandfather class because of recursion.
 
bob
@ecatmur what do you mean by 'forward declare' ?
 
2:31 PM
@ecatmur I know. Don't worry ;-)
 
I just abused the fact that Java generics suck to throw checked exceptions unchecked.
Woot, dragon slain.
 
I should update my SO profile to read: "Doctorate Student" (or is there a better way of saying that in plain accepted English?
 
@bob class A; without defining A.
 
bob
@ecatmur and where would I define it then ?
 
@bob A.cpp?
 
2:34 PM
@rubenvb I hear 'PhD Student' or 'Doctoral Student' more often
 
bob
@Neil instead of A.h, you mean ?
 
Q_Q I want my rapsberry pi so badly >.>
 
@bob Ah yes, technically you're correct. Declaring is A.cpp
 
@Collin Ah, PhD. Of course. Dr. Freeman ftw :)
 
bob
I'm lost :(
 
2:35 PM
@bob pretend I said class C; without defining A. You'd need that in A.h.
 
is PhD specific to a scientific field? Should I say "PhD in Physics"?
 
77
Q: When to use forward declaration?

Igor OksI am looking for the definition of when I am allowed to do forward declaration of a class in another class's header file: Am I allowed to do it for a base class, for a class held as a member, for a class passed to member function by reference, etc. ?

 
@bob You can't have cyclic dependencies
 
bob
@Neil I understood that I can't have a cyclic dependency, but I didn't understand what to do to prevent it.
 
So in order to be able for C to refer to A (directly or indirectly) and for A to refer to C (directly or indirectly), one must be a forward declaration
Meaning, you don't really define A or C in one of the two, you simply say it exists somewhere.
Lets you return an instance of one without the compiler complaining about the fact that it doesn't know what type it is.
 
bob
2:38 PM
so assuming it's C that I want as a forward declaration
 
@bob Is that clear?
 
bob
@Neil not really, sorry, but your explanation is good I'm just slow. Let me try to explain what I've understood and you'll correct me
 
@bob then you'd have class C; class A { ... C getClassC(); }
 
bob
so if C is the one with the forward declaration, I can create A normally and add C to the members of A, right ?
 
@bob only pointers or references to C.
 
2:40 PM
Yes, so long as you don't use C directly
 
bob
ok, so I add a pointer to C in A.
 
A isn't supposed to know how C works, simply that it exists.
 
bob
and where do I define the contents of C?
 
bob
later where
 
2:41 PM
In its own header C.h
 
@bob Just like you would otherwise.
 
Where you need it.
 
bob
in C.cpp and C.h as usual ?
 
@bob yes.
The linker will take care of linking all the "C"'s in your code together.
The compiler just needs to know about the type.
 
bob
then the only difference between a normal usage is that, in A.h, I add the line "Class C;" and in the members of A, I make a pointer to C, right ?
 
2:43 PM
Or reference, sure.
 
bob
ok, thanks.
not so complicated after all :)
 
@bob yes. Remember you can't use any members of C in A this way.
 
bob
@rubenvb so what's the point of having a pointer to it if I can't use any of its members ?
 
Java is far less complicated in this respect. No includes, thank heavens.
 
@Neil You pay for that with the blood of crappy checked exceptions.
 
2:44 PM
@RMartinhoFernandes Sad, but true. :(
 
@bob You'll need to keep the class definition of A clear of usages of C's members. You can of course include "C.h" in "A.cpp", and in the member function definitions, you can then use C as you wish.
You just need to make sure the compiler has the information it needs.
 
@Neil Modules. Wants. So. Much.
5
 
@Neil it has import
 
@bob Suppose you have a TreeNode, you could use forward references to allow the TreeNode to contain the instance of Tree, the container
 
bob
oh you mean I can't use the members of C, but just from the definition of A. If the elsewhere in the code, I create an object of A, I will be able to use the members of C through A, right ?
 
2:47 PM
@rubenvb That doesn't really count. It's more of a formality than anything else
 
Xeo
@RMartinhoFernandes import std; and you'll never have to figure out what exactly to include again..
 
@rubenvb That's actually optional.
 
@RMartinhoFernandes oh. Didn't know that. Only programmed java for ~3 months in my life.
 
It's just a keystroke saver, basically.
 
Close votes please
0
Q: Changing BibTeX "format.names" function in .bst file to force "et al." citations at > 3 authors

user1125946Dear stackoverflow members, I'm using natbib package for my reference list. I have been struggling with BibTeX. I'm writing for Journal of Finance, and they want > 3 citations to be in "et al." format for the body of the paper. But the Journal's .bst file makes it such that no amount of authors...

 
2:48 PM
@bob C can use A if C is the forward declaration, but A can't use C
 
bob
ok thanks
 
Is operator^ overloadable?
 
@rubenvb Probably, though it really shouldn't be
 
or better: overwritable?
^ should be equivalent to std::pow.
 
@rubenvb except for set, where it should be intersection
 
2:49 PM
@rubenvb Not positive, but isn't that the binary operator xor?
 
Well, only ^ being std::pow for floating point would be better.
 
@rubenvb I think there's a reason why they didn't do it that way
 
Probably because powering is not a trivial single-instruction operation.
 
#define double my_class_with_overloaded_xor_operator
of course, the precedence will still be all wrong
 
template<typename T> std::enable_if<std::is_floating_point<T>,T>::type operator^(const T& base, cont T& exponent) { return std::pow(base,exponent); }
Save for typos...
 
2:52 PM
@rubenvb Next step, proving P=NP.
 
but that would get lower precedence than plain functions.
@Neil whatwhat?
 
@rubenvb Being power for floats and not ints doesn't sound like a good design to me.
 
@rubenvb Kidding of course. :)
 
@RMartinhoFernandes the problem is lots of code relying on integer xor, and not so much (I may hope) floating point xor.
 
@rubenvb That will cause ambiguous overloads.
 
2:53 PM
C++ is bad design by design.
@RMartinhoFernandes how so?
 
@rubenvb There's no floating point xor.
 
@RMartinhoFernandes C++ can make anything work!
 
@rubenvb Either that, or it won't ever be chosen. I'm not that versed on the overload resolution rules, but there are pseudo overloads for the built-in operators that conflict with yours.
 
Take a class frog and a long double and xor them together and you will get an answer!
 
Hey guys, is this use of inheritance/templates valid?
http://ideone.com/hTuvZ
 
2:55 PM
Not that you should, but, still
 
(They're "pseudo" because they don't really exist unless you're resolving overloads, i.e., can't refer to them by name or get their address or whatever)
 
@RMartinhoFernandes yeah, that's the problem, normal (even pseudo unadressable) functions will be chosen before template functions :(
 
@Olumide sure, why wouldn't it be?
 
You don't need the forward declaration though.
I think.
Hmm, looks like you do. Damn, I need to review POI rules.
 
Anybody know node.js?
*crickets*
 
3:02 PM
@ecatmur Thanks. I just wasn't sure. I routinely come up with code that compiles but isn't legal. Its one of my special talents :)
 
Sorry to break this to you, but when we're talking about C++, that's not a talent.
 
@RMartinhoFernandes Or you could just do it by trial and error like me :)
@RMartinhoFernandes Don't take away my super powers
 
ARgh, my hack to screw checked exceptions has a fatal flaw! I can't catch the things now.
 
@Olumide Once had a well-hidden ; after an if that had me stumped for several days
 
@RMartinhoFernandes ROFLMAO
 
3:04 PM
If it had been anywhere else, I honestly think I would have realized my mistake sooner
 
@sehe It's not funny :S
 
@Neil wow. an if(cond); usually completes rather quickly :) Did you also have a #define if while lingering around?
 
BTW, I came up against the following method declaration in class template while reading C++ the Complete guide:
`template<typename T>struct Foo{operator T() const;};`
 
@RMartinhoFernandes Also: "Java?!" And "Use the IDE?!"
 
@sehe No I meant, it seemed to be working correctly, but a behavior sprouted later in the program caused by that cursed ;
 
3:06 PM
@Olumide What about it
 
@sehe Use the IDE for what? I'm trying to subvert the type system here. I doubt the IDE can help.
 
@Neil I got it. As the robot will confirm, I was trolling lightly
 
What's the difference between templates and generic?
 
The operator had no return type!
And another method `bar` used it like so:
`bar(Foo<T>())`
 
Before I used stricter warning messages it happened a few times that I wrote a; instead of return a;. Even when stepping through the code with the debugger I didn't see the error.
 
3:06 PM
@RMartinhoFernandes Robot? What's your verdict?
 
Sorry, verdict on what?
 
@RMartinhoFernandes Well, I assume you have a goal with that. I also assumed the goal might be to make checked exceptions less painless -> use the IDE for that
@RMartinhoFernandes That I trolled ^^
 
@RMartinhoFernandes Did he troll?
 
@RMartinhoFernandes What exactly did you do?
 
@Olumide ?!
 
3:08 PM
@sehe I'll look for the link to the listing
 
@sehe Yeah, Eclipse's code generation makes Java programming somewhat bearable.
 
@DeadMG Took advantage of the crappy generics type erasure to fool the compiler into thinking I'm throwing an unchecked exception when I'm clearly not.
 
@RMartinhoFernandes ^^^^ * less painful
 
3:09 PM
:)
 
@RMartinhoFernandes any reason?
 
Its the line enum_check(ConsumeUDC<T>() that I cant figure out
 
@Olumide Well, what's your point?
@Olumide Having a look
 
The problem is that operator T() const; declares no return type!
 
@sehe And yes, that's the goal, but it is more fun to do it as a library solution that abuses what is often considered a flaw of another feature.
 
3:11 PM
@Olumide operator T doesn't need a return type, it returns T
that's why it's an operator T
 
It does!? ... Always?
 
if it returned U, it would be an operator U
 
@RMartinhoFernandes So, you were manipulating JVM bytecode to remove the exception lists
 
I mistook it for operator()
 
@Olumide ahh, yeah that would be T operator(), clearly quite a different animal
 
3:12 PM
I've got to read about operator T()
 
@sehe No, not that at that level. It's based purely on well-defined language semantics :)
 
@Olumide ecatmur made my point :) I wasn't able to quickly figure out what the TMP bit was trying to achieve with all that.
 
@ecatmur Thanks man!
The book C++ Templates - The Complete Guide should be given an acronym. Its too long to type.
Should we just call it the templates book from now on? ;)
 
@Olumide C++T-TCG.
 
flubbleshlubble
 
3:15 PM
@RMartinhoFernandes oh, I like Trading Card Games
 
@DeadMG worksforme
 
@RMartinhoFernandes Is that what its called? Or are you suggesting an acronym?
 
@sehe No fancy bytecode crap: ideone.com/VjqEP
Now I need to get the catching working.
@Olumide Suggesting.
 
I like it! :)
 
simple things, simple minds
 
3:17 PM
Someone add it to the wiki. I'm tired of typing "C++ Templates - The Complete Guide"
 
@Olumide get auto hotkey then
 
@thecoshman Auto what? (we learn new stuff everyday)
 
auto DeadMG why do you keep BUYING FUCKING COOKIES
 
type less, do more
 
3:19 PM
@RMartinhoFernandes Oh thanks. I was curious already
 
@DeadMG because COOKIES ARE FUCKING AWESOME
@sehe good job you're not a cat
 
@thecoshman :)
 
@thecoshman Thanks
 
@DeadMG I'm pretty sure I'd appreciate fucking cookies a lot better than fortune cookies or tracking cookies. What shops carry those?
 
Sex shops. Duh.
 
3:22 PM
Sex sells. Woman shops.
@RMartinhoFernandes Ermmm... isn't that slightly less useful anyways, because it require modifying the throw-site? And if you can do that you could replace the thrown type with any other type (like, a regular java.Throwable)
 
Throwable is checked.
@sehe The advantage is that you don't need to wrap it in RuntimeException (which basically amounts to type erasure as well), so your catch-site doesn't need to do the unwrapping and type testing manually.
It also doesn't mess up the stack trace.
 
@RMartinhoFernandes Well, you know what I mean, use the unchecked variety :_ We don't all have encyclopedic memory. Besides, it's Java
 
That is, once I get the catch-site working.
 
@RMartinhoFernandes Ok, so you can solve the "can't touch catch this" WTF?
@RMartinhoFernandes hehe
 
Stupid compiler will complain that the try block doesn't throw that exception.
I have a less-than-pleasing workaround so far :S ideone.com/rQyZG
 
3:28 PM
can you say "fuglytastic"?
 
@DeadMG fuggleshlubble
 
can you say "fuglytasticfperjgpoiawehgpoejrgperjogwpojefgiweahgpoaurjfawjg"?
cause I'd be pretty impressed
 
@DeadMG Get on mumble tonight
 
3:30 PM
are you kidding?
I'm gonna go to bed soon
 
I can say supercalifragilisticexpialidocious, but that's all.
 
@RMartinhoFernandes Don't lie
 
Why would I be lying?
 
sbi criticised my life choices, or lack thereof, today
so I figure I'mma leave a couple hours to cry myself to sleep about how I've ruined my potential
 
Feb 7 at 5:06, by R. Martinho Fernandes
> Hippopotomonstrosesquipedaliophobia – fear of long words
 
3:32 PM
@DeadMG What happened to your stalwart confidence?
 
@sehe Oh dear god, no!
 
@RMartinhoFernandes Never really had any.
 
 
@DeadMG Are you saying you're a complete farce?
 
well, except the genius part
 
3:34 PM
Wait, maybe that's not the right word.
 
@RMartinhoFernandes I'm pretty sure you'd agree you can pronounce the name of titin. And I happen to know you knew about that, because.... you mentioned it:
Mar 22 at 10:05, by R. Martinho Fernandes
Titin (), also known as connectin, is a protein that in humans is encoded by the TTN gene. Titin is a giant protein that functions as a molecular spring which is responsible for the passive elasticity of muscle. It is composed of 244 individually folded protein domains connected by unstructured peptide sequences. These domains unfold when the protein is stretched and refold when the tension is removed. Titin is the largest known protein. Furthermore the gene for titin contains the largest number of exons (363) discovered in any single gene. Titin is important in the contraction of st...
 
@sehe Not from memory.
 
@RMartinhoFernandes Well, I'm certainly not going to memorize "fuglytasticfperjgpoiawehgpoejrgperjogwpojefgiweahgpoaurjfawjg" - IOW irrelevant, no one said anything about reading or reciting from memory
 
Do you know those guys that lurk around parking lots to earn some change by "helping" people find parking spots?
There are two outside the window and one of them is shouting at the other because, apparently, the other one doesn't know how to "properly" direct cars to parking spots.
It's hilarious.
 
And sad
 
3:41 PM
Wait, why is it sad, exactly?
 
@RMartinhoFernandes Only sad if you're not a heartless robot
 
@RMartinhoFernandes I don't claim it is. I'm merely stating my feeling about it
 
But I want to understand!
Really, I often don't consider myself heartless, so I'd hate to be so unknowingly.
 
Think about it. Would you be happy when your outlook is so dim, that you actually have to care about this kind of stuff? It is a struggle for income (at least, partly)
 
In the meantime, they lose precious customers
 
3:45 PM
@Neil Who said people can be/are rational
 
@sehe I don't know, who?
 
@sehe Oh dammit. Now I feel bad. Can I hate you for a few moments?
 
Hey guys
I have an interview day tomorrow
It's a mock one at school
Do I make a badass infographic CV, or go with the classic one?
 
@RMartinhoFernandes Why do you need a reason to hate @sehe? Look at him, looking all smug and shit with his paw on his face.
@KianMayne Classic.
 
@EtiennedeMartel Any particular reason?
 
3:50 PM
@KianMayne Classic
 
Because most employers won't take it seriously otherwise.
 
I wanted my first CV to include curly brackets { }...
 
It's stupid
 
@sehe Not thinking about it is better, because I don't get this feeling of "there's nothing I can do to help". Warning, cultural references ahead: Ignorance is bliss, and ignorance is strength.
 
That we have to write one
because we barely have any qualifications or experience
 
3:51 PM
@KianMayne Do the infographic. It'll be an instant LASSIC
 
@KianMayne I agree, but they want to see a confident professional. Most interviewers won't care about the technical details more than a formality for being sure you know what you're talking about
 
@Neil That's easy.
 
@KianMayne Infographic CV? WTF.
 
@EtiennedeMartel Well, it's still strength.
 
3:52 PM
@EtiennedeMartel Find a parking lot to argue
 
@RMartinhoFernandes Right until the point when cancer kills you.
 
@EtiennedeMartel That wasn't much of a theme with the pigs
 
Rarely will you get an interviewer who knows how to program well, and even then, in all likelyhood, they won't make you super-complicated questions. They make you do simple tests. That's usually all they need to do to make someone do bad on their interviews anyway
 
@sehe OMG, you got it.
 
@Neil I won't even be asked about anything to do with a job I may one day do
I've heard of having to write code in an interview
and that's not going to happen
I'm hoping that I'll be lucky enough to possibly be noted to do some work somewhere
 
3:55 PM
@RMartinhoFernandes Well, whenever I do it doesn't become a news item. That's news bias
 
@KianMayne True, but my point was to nail the confidence and professionalism since that's what counts anyway
 
@Neil Yeah
 
For anyone interested, Stross is doing an IAmA: reddit.com/r/IAmA/comments/vx5kd/…
 
who's Stroess?
 
@RMartinhoFernandes "Ignorance is strength" is from 1984, right?
 
3:58 PM
@EtiennedeMartel Yeah.
@DeadMG A science-fiction author.
 
@RMartinhoFernandes Perhaps plink @sbi about it (and Alf, IIRC?)
 
@RMartinhoFernandes whenever I see 'IAmA <person's name>' I always think of the line from Douglas Adams
"The Zaphod Beeblebrox?" "No, a Zaphod Beeblebrox. Didn't you know, we come in packs?"
 
:)
 
@ecatmur six-packs!
(I admit, I had to look that one up.)
 
Guys, I'm either experiencing a case of serious code blindness here or another massive gap in my knowledge has been exposed.

I'm trying to implement `Foo<void>::bar()` outside specialization `Foo<void>`
http://ideone.com/hTuvZ

(Please be gentle)
 
4:07 PM
// not: template<> void Foo<void>::bar(){}
// but:
void Foo<void>::bar(){}
@Olumide IIRC. The point is, the method is not a function template
 
@sehe Now I remember. There's something about it in C++T-TCG (its catchy). Thanks
 
@Olumide I might hope so
 
(I've been reading that book since October last year)
 
@Olumide Wow. I am still ordering it :)
 
4:11 PM
@sehe Wut?
 
@sehe yeah. Huh?
 
@Olumide C++ The Trading Card Game?
3
 
@Olumide google search turns up nothing on that
 
would it surprise you to know that my first exposure to C++ was C with Classes?
 
@RMartinhoFernandes I haven't read it, in case you didn't get it the first time :)
I have read oodles of books on programming and C++ in particular, but this C++T-TCG wasn't one of them. Strangely
 
4:20 PM
oh starboard had a link to C++T-TCG
 
@sehe I think its a must have for any C++ template fanatic. Pretty much most of the searches I've done on tricky parts of the language link to the book
 
@Olumide Me too. I think it will remove my productivity issues with SFINAE. I'm a template lover, but not TMP so much. I consume TMP-heavy libraries a lot, though
 
IMHO, when people say that its not really important to know TMP I think they mean its not a tool for everyday use. But it can come in handy sometimes.
 
@DeadMG Nope.
 
4:34 PM
@CatPlusPlus sup :)
 
@DeadMG I've sent you an email now
 
just got it
thanks
 
@CatPlusPlus seriously? xD
 
@CatPlusPlus Well, that is a slight exaggeration.
 
4:49 PM
@CatPlusPlus Needs more 'oot'
 
Sorry aboot that.
 
Actually, it's closer to "aboat". Nobody says "aboot".
And that's only near the Atlantic, as far as I know.
 

« first day (625 days earlier)      last day (4324 days later) »