« first day (917 days earlier)      last day (4040 days later) » 

12:00 AM
"jon.doe10994" wut
damn it Data.SE
 
Yeah, it defaults to crap like that.
Just change it.
 
Is this new?
> This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Maybe I should read description of Close as Duplicate more
 
@LucDanton I basically agree with that, especially if it's internal stuff. If there should only be one of it, just make sure you only create it once. That's pretty much what i did here. It's still singleton-like, though. Not sure what to call it.
 
@DaggNabbit Glossing over your code rapidly I get the feeling that you're doing some form of type-erasure. Irrespective of that though let me make the following observation: do the type adapters really need state? Because if they don't, then you can exchange the type hierarchy to using only functions. And if you do, then you don't have globals anymore.
Let me write you something real quick.
@DaggNabbit 'Globals'.
 
12:05 AM
yuck
 
Is DaggNabbit new to C++?
 
@Rapptz sorta, i never really studied it formally
studied c years ago
 
I ask because isn't on the first page of your tags.
 
eh
it's SO
 
It's not singleton-like. The relationship is that singleton means 'global, only ever one of'. If you remove the latter, you get a global. Mammals are not cat-like!
 
12:06 AM
@DaggNabbit yeah but most people here at least have it on their first page from what I've seen
 
there is only ever one of it, though, its just not enforced.
and it's not global, but it's a member of the variant class that gets used for everything
so it's always accessible when you need it
also it's not type erasure, it's more crude
 
var?
That sounds like Any
 
yeah, var
it's a variant
but it's also sort of a play on JavaScript var
 
Ah.
 
@DaggNabbit To clarify 'type-erasure' in the C++ community has a meaning that's not the same as what you may have seen elsewhere.
 
12:08 AM
since it's a value from JSON data
@LucDanton basically the variant is a has members that can represent whatever type, like intVal, stringVal, etc
and another member that says what type to actually use
 
Eh, actually not in the mood to write an example.
45
Q: Type erasure techniques

Xeo(With type erasure, I mean hiding some or all of the type information regarding a class, somewhat like Boost.Any.) I want to get a hold of type erasure techniques, while also sharing those, which I know of. My hope is kinda to find some crazy technique that somebody thought of in his/her darkest ...

 
I have one ready I think
nah too lazy
 
Can anybody think about what I could work on in asteroids that does not involve trig or collections?
 
@Pawnguy7 Collision detection?
Shouldn't involve trigonometry if it's a basic bounding box
 
12:12 AM
I could do that, but it looks like at this time it will be radial.
Think there is a trig tutorial somewhere?
 
Trigonometry isn't hard yo.
What do you need help with?
 
I didn't think it was either.
But then there is this mess with radians, and... it seems to have a sign issue.
 
That's pretty vague.
 
0
Q: Asteroids Movement

Pawnguy7I have been making an asteroids clone, in C#. However, the ship's movement is... not quite right. My plan is this: there is a speed, and two directions, namely the direction the ship is facing (visual), and the one is is going (motion). The ship would travel its speed in its motion direction co...

 
Yeah, i looked into type erasure but didn't feel like trying it, it's simpler like this
variant has a pointer to a type converter, and it does all the work
one converter for each type
 
12:16 AM
I thought I was doing so good, then this halted everything for days.
 
The top answer offers really sane advice dude.
 
I took it.
 
Oh sorry. I mentioned that to underline how the global part wasn't even necessary, much less the 'only ever one of', as an exercise -> remove state, reduce to functions.
Actual advice would be 'use a variant'.
 
I tried adapting his code as well as I code.
 
12:18 AM
I didn't know trig had sign issues, but it worked for 180 degrees and not the other half.
 
There are no such things as sign issues.
 
I don't know what it was. I never heard from jimmy again though.
 
lol
 
Commenting like mine does notify him, right?
 
Yes.
It's just his personal choice to help or not.
 
12:21 AM
Hm.
I know.
 
user142019
Man.
 
user142019
I with I had f.lux for my keyboard backlight.
 
user142019
It's so white.
 
I just... well, I feel like I cannot really test anything till this if fixed, and C# collections and me are not on speaking terms right now. I was getting... I thought, fairly decent progress, and now nothing :(
 
Uh there are harder things in Asteroids (I think?) like rotational force of the bullet and its acceleration.
heheh.
 
12:27 AM
@DaggNabbit I just happen to have written a JSON parser that can "do stuff" in C++ based on the rfc this week: github.com/sehe/spirit-v2-json
 
How do you define rotational force?
 
Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis, fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or ...
 
@DaggNabbit I don't know if that helps you or not. A 'nice' application is in the branch for a java question on SO: github.com/sehe/spirit-v2-json/blob/16093940/test.cpp
 
That is a cool gif.
 
Why would bullets have that? But yes.
 
12:29 AM
What would happen if the ship is spinning in a circle and shoots a bullet?
How would you determine the direction of the bullet?
 
I assumed as the player, you would assume it goes straight.
Might give it velocity of the ship, but that is seperate.
 
I wouldn't assume it goes straight :(
 
Bullets are spinning :v:
 
Did they spin in the original game?
 
I actually don't remember
Hence the "I think"
 
12:31 AM
Ah.
I added master volume. I think that is all I got done in the last four days.
 
[–]amigaharry -55 points 3 hours ago (17|65)
bam! take that GPL GCC scum. real free software > GPL communism!
lol ^ reply to Clang being C++11 feature complete
 
Bad reddit posts? Well I never
 
The cat is ratted. So am I. On Abbot Ale since 20:00. I go bed, fucked up.
 
user142019
GPL takes away freedom.
 
Now that Clang is feature complete can I get it on Windows :(
 
user142019
12:34 AM
But it's completely irrelevant to feature completeness.
 
I knew I should have made snake...
 
You can make that in a day if you wanted
 
As in I can make it, or as in it is much easier?
 
user142019
Unless you use OpenGL, in which case it will take three days and a black screen.
 
lol
the latter
 
12:37 AM
I had an idea for a Snake.
I was thinking, make it multiplayer.
And then throw in six extra computers, a much bigger randomly generated level...
Something like that.
 
That would be hard
 
Not networked, I mean.
Just... same computer.
 
Start small.
 
user142019
Make 3D snake with a 3D grid.
 
I am not sure where my small is. Is it somewhere above console applications, but... not by much.
 
user142019
12:39 AM
And Kinect lol.
 
As in "Get the core functionality out of the way and then expand"
Snake is a simple game.
 
I'm tempted to commit the changes and have e.g. std::is_constructible<_, _> be shorthand for std::is_constructible<Arg1, Arg2>. It would however be severely limited compared to Boost.MPL's own _. I'm not keen on making mine more powerful -- right now all the implementation does is pack expansion, and I like that it's that simple. Making it smarter requires an actual algorithm. @Xeo wat u think buddy?
 
Yes. Although, I remember, I always used to get segfaults. Those were the days.
I just got a blog post idea.
I can probably get pages of content talking about my past failures :D
 
@sehe thanks, will check that out
yeah, this looks good
some of it is actually similar to what i wrote, probably a good sign
you should write your own variant, that was the fun part :) some of this stuff i don't understand yet...
 
@Rapptz ever made any games?
 
12:47 AM
Just basic ones.
 
@sehe is there no stringify? Just a parser?
 
I have 1065 lines of that fun. And ~300 lines for the recursive variants.
 
Art too hard.
 
Speaking of art, see my new... do you call it avatar or gravitar? Anyway, that was pretty bad.
My sand was colored water, or the other way around.
And I only got that thanks to GIMP.
 
@LucDanton my JSON variant is just short of 500 lines, but that doesn't include the "adapters"
hmm, those are only another 130 lines or so
 
12:50 AM
did anyone here use variadic templates in vs2012?
 
Well, as it's a generic container it doesn't do anything as such. It's a C++11 reimagining of Boost.Variant.
 
@DaggNabbit Mmm. Can't read? See test.cpp:
static JSON::Value roundtrip(JSON::Value const& given) {
    return JSON::parse(to_wstring(given));
}
 
@Rapptz do you know of any place where I could find a project programming with somebody else?
 
There are to_string, to_wstring and a number of parse functions (see also at the bottom of JSON.hpp
 
ah, ok
i was looking for something like JSON::toString
 
12:53 AM
@DaggNabbit Then it is beyond me how you missed it :)
 
lol, idk
 
note, it is C++ (so I hope you don't go searching for toString case-sensitively). The to_string() style of function is very much in C++ tradition. Also, making them free functions is in C++ spirit
 
@sehe Out of curiosity is there a specific reason that you used wide thingies like std::wstring? Did some OP need it? Do you like working with those?
 
"[P]rogrammer's needed! 2D Pixel Online MMORPG called Vorlia Online" - I wonder what percentage of these actually got down.
 
12:54 AM
@sehe, didn't have the underscore =p
 
I've never used std::wstring..
@sehe Also this is encapsulating a problem I currently have.
 
Was it unicode characters? I haven't either.
 
@LucDanton I liked working with those for simplicity. This way, I could literally traduct 4HEXCHAR tokens into a single codeunit (I'm aware that this is gcc/clang specific, I fear)
 
My style conflicts with the C++ style and it feels wrong sometimes but I don't dislike my style. It just looks weird to have a mixed bag of styles sometimes.
 
@Rapptz Mmm?
@Rapptz Ah
 
12:56 AM
Oh right, char32_t is a closed world with current implementations :(
 
i just figured JSON.toString and JSON.parse were already well known, so I used the closest thing I could.
 
Oh, well, a good API doesn't get in the way. I don't mind if jars a little.
 
@Rapptz PascalCase<foo, bar> aliases still feel weird from time to time :s I still like it better than the std::remove_reference_t convention that will apparently be our future.
 
@LucDanton Indeed. I was completely inexperienced with Spirit + Unicode so I tried to minimize complexity. If I were to do it again, I might take the 'utf8 internally' approach. Maybe. That migt not play out too well with Boost String Algorithms, though. It's the same old problem again -> ICU/ogonek
 
Yup.
 
12:58 AM
that parser is a beauty though
 
@DaggNabbit Thank you. I do concur. I especially like the simplicity of the AST classes. All hail Boost!
 
I suck at writing parsers!
 
@sehe mine is just a monster by comparison github.com/gitbuh/jsontool/blob/master/src/parser.cpp
 
Also, note that to make it really user-friendly, I'd have to go and add a zillion (default) (explicit) (conversion) constructors to them. This would make uniform initialization a lot more succinct (see e.g. initializer_test() right now...)
 
even ignoring all that extra whitespace :p
 
1:00 AM
lol
> // TODO UNICODE
 
hahah
 
That was the only hurdle I saw after reading the RFC
 
yeah i never did scientific notation either
 
Can't you just cast it to a double?
 
@Rapptz I used to. But let me tell you, something about fiddling with Spirit for a good few hundred hours tends to make that a lot smoother
 
1:02 AM
I actually have never used the 1e-4 notation when it comes to casting from a string.
Unless you mean 1 x 10^-4 then I guess that's hard too..
 
@DaggNabbit In fact, I have a shortcut in the implementation where I use qi::double_ to parse doubles. I should actually make sure I disallow INF, -INF, NAN and friends because the JSON RFC specifically disallows it :|
 
@sehe My variant should support that when GCC can deal with it :)
Which is to say, it works unless there's some recursive data type involved right now.
 
@LucDanton Does it work with Clang now?
 
Hard to tell, but likely not.
 
@sehe i wondered how to handle NaN myself... can't remember how i ended up dealing with it
 
1:04 AM
@LucDanton It's supposed to be c++11 complete now :)
 
i think i just skip the key and keep going
 
@LucDanton Ah, there is in JSON. Anyhow, I don't mind sprinkling an occasional typename here or there, but string/number literals ought to be 'implicit' if at all possible...
 
@sehe Well it's not like I'm using any feature that either of those doesn't support!
 
@DaggNabbit Cough.
 
@sehe lol
let me check
 
1:06 AM
Only parsers I've written were command line and INI.
Oh.. and a mathematical expression one.
 
I parsed HTML once. Sort of. I am not very good at parsing.
 
I wanted to write a markdown parser but didn't want to reinvent that wheel.
 
actually i don't think i ended up checking for NaN
 
I guess making a homemade server fell heavily into that category, and I now use Apache. However, I did learn a lot.
 
so it should just break on the receiving end =p
 
user1357851
1:07 AM
I parsed HTML once, because some kiddies online enemies were breaking the chatroom I had written using stylesheet
 
@DaggNabbit Anyways, it looks... impressive too. I'm pretty sure I'd never handroll a parser like that unless I could prove it was necessary for performance. CoCo/C++, bison/yacc, ANTLR and Boost Spirit are the way IMO
 
I wrote something similar to highlight.js for C++.
 
@Rapptz That's one conflicted statement
 
How?
 
"I wanted A, but I didn't want to A"
 
1:09 AM
"I wanted A but decided against it"
 
That's more sensible
 
@sehe TBH the whole thing was kind of a learning exercise so i wanted to do as much by hand as possible
 
Ya know what, you've motivated me to update and rebuild Clang.
 
Good luck.
 
I sort of figured as much. Well, JSON is a nice "lightweight" example. And the structural elements are very regular, making it less painful than most any other grammar.
@LucDanton Sorry
 
1:11 AM
@sehe Every time I tell myself 'it won't be that bad, surely they've stopped all the hardcoded path nonsense'.
 
reddit.com/user/rapptz.json is it easy to parse that?
 
@DaggNabbit Anyways, if you want to use it, it's free. And if you want to upvote it, here's the answer I wrote it for:
1
A: Parse a substring as JSON using QJsonDocument

seheI rolled a quick parser[*] based on http://www.ietf.org/rfc/rfc4627.txt using Spirit Qi. It doesn't actually parse into an AST, but it parses all of the JSON payload, which is actually a bit more than required here. The sample here (http://liveworkspace.org/code/3k4Yor$2) outputs: Non-JSON p...

@Rapptz Mine? Should.
 
user1357851
json is just a data structure what holds nested maps/dictionaries & arrays/lists
 
Wonderful analysis.
 
user1357851
I have parsed it using Objective C, perl & java
 
user1357851
1:14 AM
not that hard :p
 
@Rapptz Here's what it prints back on std::cout << document;:
 
It broke the modhash
 
@Rapptz What's that
 
ctrl + f "modhash"
:O
 
You know how control + a is usually select all?
 
1:17 AM
Yes
 
@Rapptz What's broken about it? You are aware of the fact that objects are dictionaries, right? And they are unordered, right?
 
Is there any sort of select line shortcut? I hate using the mouse to do it because if you hover off the line, it jumps.
 
@sehe I meant.. "modhash": "3l4ps94wrw213ceca0c53092740d5c0cb6fab66684be8f5b57" on rapptz.json but on your print it shows up as "modhash":""
 
@Rapptz Well, it's empty in the original. It might be that I'm not logged on. I used wget to get the json...
 
Oh I see.
 
1:18 AM
:)
So, reddit broke the modhash (or surprised you)
 
I just noticed it changes every time I refresh.
 
LOL
 
hehe.
 
not too shabby, for the rest. It's a shame that the unordered nature of Object values make comparing the roundtrips useless for now. That is, until I actually implement user friendly JSON comparison operators.
 
@sehe thanks, upvoted :) does msvc do c++11 yet?
 
1:21 AM
It does some (a lot?) of C++11.
 
@DaggNabbit yes. But I doubt this parser would work, because std::wstring probably doesn't use 32bit chars on MSVC. Nothing too difficult to fix, but, needs a fix (basic_string<uint32_t>, likely)
 
does it do the cool assignment stuff with brackets
not sure what it's called
 
nope
initializer list constructors
 
yeah those
 
Nope. Doesn't have them
 
1:23 AM
@sehe yeah i didn't want to sound ingorant but i've never even seen the std::w* stuff
not on windows, just don't write much C++
 
IIRC it's only "useful" in on Windows.
 
How was it that C++11 changed it? Was it you can call constructors now? (on the same instance)
 
mm lemme see
 
@Pawnguy7 I have a shitty example sec
 
@Rapptz Depends on the requirements. It was useful for me here, because I don't want to go full ICU and still want to be able to iterator codeunits that are codepoints. GCC handily gives you (near?) L1 unicode support by using 32bit wchar_t
@Pawnguy7 That as well. But this was uniform initialization. It also works in parameter lists or return values. Sweet potatoes.
 
1:25 AM
@Pawnguy7 I think this is it:
TEST_CASE("adapter/object/tostring", "Object to string") {

  var v = O_ {
    { "foo", A_ {1, "b", false}},
    { "bar", O_ {
        { "x", 1.5}, {"y", null}
      }}
  };

  // object properties are sorted alphabetically!
  CHECK((string)v == "{\"bar\":{\"x\":1.5,\"y\":null},\"foo\":[1,\"b\",false]}");

}
 
vector<int> foo() { return { 1,2,3 }; };
 
the assignment to v
 
Death By A Thousand Examples
 
lol
 
1:26 AM
@Rapptz That's a lot of collateral code :/
 
@melak47 Splitting it up in code manually is hard q_q
 
@Rapptz Uniform initialization actually.
 
I don't exactly know what I am looking at.
 
Peeps, I'mma sleep. Like. The fuck, now. 3:27am. I have a concert day tomorrow.
Laterz
 
@sehe I made this when I was bored a long time ago to learn how to do basic C++11 things.
 
1:27 AM
@ThePhD I thought you were doing a blender script
 
I guess we've chatted about this briefly, but if anyone is interested, they caught the second bomber in Boston
 
@melak47 o.0 No, I'm doing it in C++ now.
 
later sehe
 
'Cause Blender confuzzles me. :c
 
can't you just...get the data out of the FBX object things?
 
1:28 AM
What appears in e.g. int i = { 42 }; is called a braced init list but that's boring. 'Uniform initialization' is the snazzy marketing term.
 
you used to be able to do something like this in C i think
or maybe it was a weird gcc thing
oh, i think you could just cast stuff
like cast the whole list
 
C has its own compound initializers.
 
@DaggNabbit You mean for structs?
 
@melak47 That's what I'm doing now.
I'm getting out the data, generating data structures that define which vertices have which materials, and then splitting everything up by myself, manually, while perfectly preserving the Mesh Skin.
 
UE4 Details /cc @EtiennedeMartel @DomagojPandĹža @ThePhD
 
1:40 AM
I am divided. I kind of want to use C# and SFML.NET to make my next game, but... well, it isn't portable. But at the same time, I am thinking, I doubt I will port it at all. Thoughts?
 
Yes. No. Whatever you like.
 
Although, I don't know why, but I don't like C# properties :\
Other features of C#, though, help.
 
Just make a choice and stick with it. If you keep pondering the what ifs you'll end up like Zoidberg and never finish a project. :P
 
user1357851
@CatPlusPlus Have you passed drunk?
 
1:44 AM
@Telkitty What?
 
user1357851
3 hours ago, by Cat Plus Plus
I'm drunk and fuck programming
 
@Telkitty passed drunk as in sobered up or even drunker than drunk?
 
user1357851
good question
 
@Borgleader I think I have already reached that point.
 
I feel really dumb, I've been reading the intel paper on engine framework, and deciding on implementation details and the more I do that the more I realize I have no idea where the game specific code should fit =.=;
No link dumping
 
1:55 AM
Oh, sorry
 
Also read this plz
 
2 messages moved to bin
 
user1357851
Once I read a maths model I was going to implement in C++, I spent 2 hours in the late afternoon, and all I could think of was ... food
 
Do you think I will ever be a good programmer? :\
 
user1357851
1:58 AM
I wanna this:
 
user1357851
 
@Borgleader Of course, it only addresses the engine.
@Telkitty I wanna that too.
@Pawnguy7 Stop asking if you will be and start being a good programmer.
 

« first day (917 days earlier)      last day (4040 days later) »