« first day (316 days earlier)      last day (4641 days later) » 

4:00 PM
@awoodland I saw on your CV that you are good with numbers, have you ever implemented sieve of Atkin for testing primality?
 
can't say I have, but it looks like a fun one to abuse the compiler with a few templates at compile time with...
 
hehe
yes :)
 
mostly what I've done is solving PDEs
I did some compile time symbolic algebra for that once too...
 
if you have long std::string how can you split it on multiple lines?
@awoodland those sound complicated
 
Insert newlines? :P
 
4:04 PM
@CatPlusPlus I mean in the IDE
 
you mean make it into a collection of strings?
ah
you can legally write:
 
"abc"
"def"
 
"hello " "world"
which becomes "hello world"
 
4:17 PM
^^^ an example of cooperative message writing
 
Blah.
I mean, hi.
 
@CatPlusPlus I've used this technique to embed blocks of JavaScript into my C++ code. (For a IE plugin.)
 
@Mahesh My algorithm is quadratic on "20" though, not on "232792560" :)
 
@RMartinhoFernandes Bleh.
 
what's the best way to do atoi in C++?
 
4:28 PM
boost::lexical_cast.
 
boost::lexical_castl
damn
 
istringstream if boost is not available
 
have a ★ :)
 
@TonyTheTiger write your own conversion function for fun ;-)
 
4:30 PM
You can use Spirit, too.
 
sscanf also works
 
No, sscanf is ugly and not type-safe.
There's no reason to use it.
 
parsing strings is inherently not type-safe
 
You know the output type. sscanf disregards it and relies on the format string instead.
 
Adding more type-unsafety on top of it won't help.
 
4:34 PM
these retorts were to be expected
foolish me
 
Rule #1: kill libc I/O with fire.
 
You could write a typesafe sscanf with variadic templates though :)
 
@FredOverflow hmm, honestly I'd have no idea how to
 
4:46 PM
I was just wondering
Can you get on this room via something like Jabber or IRQ or is it just web based
 
I think, AFAIK, it's only web based
 
I think it should be possible, speaking from a software development point of view.
 
I suspect that it may be possible under the hood, but no public API.
 
if I have std::string numbers = "73167176531330624919225119674426574742355349194934"; what would be easiest way to get a single number from that in an int ?
and not the asci value, which you get if you do int i = numbers[1];
maybe I can overload operator >> on the stringstream to do it?
 
4:54 PM
It would be nice if XML accept headers were supported for this page. Then you'd have your API.
 
@TonyTheTiger That's probably too big for int.
 
switch on the character return corresponding digit
 
Or do you mean, a single digit?
 
@RMartinhoFernandes lol, true, but I only want asingle digit
 
Then you can just int i = number[i] - '0';.
 
4:55 PM
switch (string[i]) { case '0': return 0; case '1': return 1; etc...
Or what @RMartinhoFernandes says
 
(Note: only works on ASCII or UTF-8. But covers almost everything.)
 
No.
Guaranteed to work as per the Standard.
 
Guaranteed?
What about EBCDIC?
 
0-9 must be 'contiguous' for an implementation to be conforming.
 
Oh wait, numbers as contiguous in EBCDIC as well.
 
4:57 PM
Who the hell uses EBCDIC.
I mean, seriously now.
I've downloaded CryENGINE SDK. I keep doing that for some reason. I have Unity, UDK and now this. I never even run their editors more than once. Why do I keep doing this. :.
> Password: Must be between 6 and 100 characters.
Makes sense.
As usual.
 
Arrrgh, that wouldn't work for me.
Stupid people, if I want to use an entire freaking poem as my password, that's my problem.
 
I am new to this forum. Just wondering what people think about some of the questions. To me C/C++ you can do some stupid things. So why are some questions are to try to do some stupid (IMHO) things with the language. What do others think?
 
Written in PHP, who would've guessed.
 
the only truly stupid thing is relying on undefined behaviour whilst trying to pretend it's not
 
I care mostly about the smart things :)
 
5:09 PM
(and some smart things may at first glance appear to be stupid abuses)
 
Thanks guys :) Bit of a let down - I hope they do setup XMPP support or whatever it's ccalled
 
They really won't, why would they.
If they wanted to use something existing, they wouldn't have poured resources into this frontend.
 
Which is cool.
Except for the stupid Markdown.
 
Should I start downvoting answers that recommend using enable_if for enforcing constraits on template parameters? I'm getting tired of them.
 
5:17 PM
I have it already :P
@LucDanton What, like concepts?
 
Yes.
 
isn't the better solution to get the newer answers upvoted higher?
 
There isn't one so I'm writing my own.
 
5:34 PM
Boost.Phoenix is cool.
 
It is!
 
sbi
5:45 PM
@CatPlusPlus You know, I keep boasting about all of us here being anally obsessed with details, but visiting every section of the FAQ?! WTF? That takes taking to a whole new level to a whole new level. Are you even human?
 
@CatPlusPlus did you do that just to get a badge?
 
It's a couple of mouse clicks.
 
Whatcha think of my solution?
no one thinks anything?
 
Hah, you have a warning :P
 
lol
tail grabbin'
a cool subreddit
worlds largest LAN party!
 
6:04 PM
where's that one? i43?
 
don't remember, it's under reddit/r/geekporn if i remember correctly
 
@TonyTheTiger I'm not sure about that. I think Einstein proved that wrong.
 
o rly?
 
You know, all that relativity thing.
Time flows at a different rate if you move at different speeds.
 
oh yea, lol, but I still have 24hrs in a day, wether I do nothing all day or race cars at 200mph.
 
6:13 PM
24 hours... and a tiny extra bit!
 
but time here on Earth is measured in terms of rotations around the sun, and me driving fast, doesn't change that rotation
it only allows me to get more things done in less amount of time
afaik
 
That's not how relativity works; or: the twin paradox. Tl;dr: you're wrong Tony, sorry.
 
You don't get the same time as anyone else, unless you're both stationary in relation to each other.
 
@LucDanton it's confusing nevertheless
 
Not wrong by that much though: "it only allows me to get more things done in less amount of time" should be "it only allows me to get more things done in less apparent earth rotations". Plus, I think that'd require moving the Earth about i.e. the planet should be the moving twin.
Unless there's the right curve to follow.
 
6:21 PM
oh I see
 
If you keep a clock on you, it gives you 'proper' time. The less apparent earth rotations however is a clock that is left on Earth.
Relativity helps you describe how the two get out of sync!
 
@Tony: your solution has the wrong product.
I think.
There is a sequence of "99879" which gives 40824 as a result.
 
oh damn
 
Meh, I can't figure out a good code for config system. What I wrote last time seems so clunky now.
 
6:25 PM
woah, in Haskell, cool
 
read . (:[]) I lol'd. Is read String -> Int?
 
Yes :)
Read a => String -> a more precisely.
 
Because read [x] is so pointful!
 
oh hai
 
That's ugly.
Hah! I knew that split function was around somewhere! Now with arrow stuff: ideone.com/OW77U
 
6:28 PM
I fixed mine
you were right, there was an error
 
What's &&&?
 
It's the same as the split function I had before.
Applies two functions to the input and produces a pair with the results.
 
Haskell is so compact
kinda cool :)
 
I was trying to figure out a way to make fives without that nasty pattern, but it would probably be uglier with zips and tails all over.
 
@DeadMG oh hai
 
6:32 PM
How comes numbers is used before definition?
 
Order is irrelevant in Haskell.
 
I have no idea why I thought it did.
Inside where perhaps? Which would happen in module definitions?
 
oh man
I ate some Pringles
just a few
I think it might have been a terrible idea
 
4
A: Producing a subList from a vector<int> in C++

Magnus HoffYou can do: vector<int> x; // Put some data into x at this point // Then, create a copy of a subsequence/sublist of x: vector<int> slice_of_x(x.begin() + 3, x.begin() + 7); assert(slice_of_x.size() == 7-3); This will make a copy of the requested part of x. If you don't need a co...

 
@LucDanton No, I don't think so.
 
6:35 PM
second comment on that answer is priceless
 
@RMartinhoFernandes How is your relative_pointer keeping up?
 
I made the copy ctor and assignment private and everything's fine.
I'm still not sure about the legality of that.
But GCC asserts PODness, and treats it as POD.
 
You can trade UB with implementation defined behaviour if you switch to integer arithmetic I think.
 
Hmm, I think I might have an issue with constness on line 71.
 
6:52 PM
Interestingly Boost.Interprocess has decided not to use 0 as the null value for their own offset_ptr.
 
for any specific reason?
 
Their rationale is that a pointer pointing to this is commonly used as a sentinel value, e.g. linked list node (member in first position would be able to have the same address as the most derived object).
 
Commonly? I never saw that.
 
In turn, it means that an offset_ptr can't point to the byte that follows it?!
 
Not that I have years of experience.
@LucDanton That's fine, because that is still inside the pointer.
 
6:54 PM
@RMartinhoFernandes I've done it for an attempt at a lock-free tree structure.
 
Unless you have an 8-bit implementation.
 
> In practice, this limitation is not important, since a user almost never wants to point to this address.
Is part of the rationale.
 
Why the hell would you want to point to the middle of a pointer?
 
being the uh, point, they're trying to make, I believe
 
But it says "almost".
 
6:57 PM
Also it's copyable.
 
Interesting. opens up the docs
@LucDanton It has a user-provided copy ctor!
 
> A process could construct a C++ object in that memory so that the second process can use it. However, a mapped region shared by multiple processes, can't hold any C++ object, because not every class is ready to be a process-shared object, specially, if the mapped region is mapped in different address in each process.
Can someone parse that from me? O_O
 
That's not POD!
 
@RMartinhoFernandes Yeah, I'm looking at how stuff gets put in shared memory.
 
7:00 PM
Well I assume they don't memcpy?
And don't persist memory across process restarts?
Wait no I'm pretty sure that last one is a use case.
 
Then it's just for shared memory? No mmaping?
@LucDanton I think it means that only objects without absolute pointers are ready for process sharing.
 
Oh.
That's one crucial any.
"can't hold just any C++ object"?
 
not "can't hold any C++ object at all"
 
Hmm, I'm not sure if the English is correct or not, but that interpretation wouldn't make sense at all, so... :)
Dinner now. See ya.
 
7:10 PM
 
7:59 PM
the silence....
 
8:15 PM
it's empty!
 
Everyone is contemplating.
 
contemplating what?
 
your quote
 
I've solved 3 project Euler problems today
it's from /r/QuotesPorn
 
@sbi concerning the surfer, that's what I also thought when reading that on the news this morning. that or suicidal recklessness.
 
8:19 PM
@DeadMG how's DeadMG++ going?
 
sbi
@StackedCrooked You know, the NY police had to get two guys in a kayak out of the water today. I don't know what they were thinking, but things like these really bring out the cynic in me. The world would likely be a better place without their genes.
 
@sbi I call that pure idiocy
 
neurovariance, it's a natural phenomenon
 
@TonyTheTiger progressing slowly- I'm pondering some stuff and mainly worrying about university and other "important" things right now
 
@DeadMG oh yea, when's your coursework due?
 
8:20 PM
handed it in, but I've still two exams to go
 
oh damn, which subjects?
 
Formal Specification and 2D graphics
 
the first one sounds boring, and the second sounds quite cool :p
 
they're both pretty awful
 
8:22 PM
you can imagine that I find Formal Specification to be an incredibly mindless pile of theorycrafting
 
I have only one main thing to wrry bout right now, that is getting a job
 
2D graphics could have been fun but instead it's completely not fun at all, we do useless things like the formulae for various kinds of transformation matrix
 
oh gosh
 
Formal specification must be fun aspergers.
 
that's math instead of 2D graphics
 
8:23 PM
2D graphics is mostly math
 
oh shizzle, I forgot to watch Torchwood this wekend
 
if you go beyond rectangles and circles.
 
yea I know, but at least you could do something in code
linear algebra
 
yeah
not a scrap of code involved
not even when we did clipping algorithms & stuff
 
oh
did you learn the projection transform?
 
8:25 PM
2d? doesn't require a projection transform
 
damn... oh
 
oh, and we also covered some completely out-of-date stuff, like 256-colour screens
 
I remember I had to calculate the new angle after a collision for my little breakout game. but that was pretty straightforward.
 
so what's the coolest transform in 2D graphics then?
 
8:27 PM
you kidding? I have no idea, and if I wanted to know, I'd Google it
 
I believe old console games implemented panning by changing the offset of the video memory.
 
@StackedCrooked I've started writing a tetris game in C++ using Qt but I haven't figured out what the best way is to define the bounded rectangle in which the tetris blocks will move inside my window, can you give me some tips?
 
@TonyTheTiger First make sure that there is a clear distinction between the logic and the view. In the logic part of your code the game field and blocks are represented as grids (2d arrays). Rectangles only come into play when for the view. (If this is already the case then good :) )
Then the view is pretty straightforward I think. You only need to define 1 constant: the height/width of a single block unit.
 
Let me see if I can find a relevant piece of code.
 
8:33 PM
cool yes
 
7
Q: Does Node.js enforce a minimum delay for setTimeout?

Jeremy BanksIn browsers, if you use setTimeout from within a function called by setTimeout then a minimum delay of 4ms will be enforced. Mozilla's developer wiki describes this behaviour, and mentions that it has become standardized in HTML5. Node.js's documentation for setTimeout does not mention a minimum...

 
my next project euler challenge :)
 
@TonyTheTiger Or perhaps I'm not understanding your question.
 
quick, close it as "too localized" as it is just for "a moment in time", and you win free tshirt
27
A: Any plans for celebrating the 2 million?

Adam DavisThe current plan is to send free t-shirts to the 5 people who close the 2 millionth question, as it's assumed that just like the one millionth question it's more likely to be a dud than a good question.

 
@StackedCrooked I am just thinking about the moving tetris blocks on the screen, inside my window, should be in some sub rect of that window, I'm not sure how I can define the subrect, so that blocks don't move outsite it?
 
8:35 PM
lol
 
@TonyTheTiger You should implement the gamestate-view as a QWidget and let the Qt layouting mechanisms take care of that.
 
@StackedCrooked can you specify what you mean with Qt laying mechanisms?
 
For an example see TetrisWidget.h and TetrisWidget.cpp.
@TonyTheTiger The layouting mechanisms allow you to define whether your widget should stretch along when you resize the window. Or if they should be centered horizontally/vertically etc..
 
oh ok
 
@TonyTheTiger Can you tell what was the number of that one I solved in Haskell?
 
8:43 PM
@TonyTheTiger A good starting point: doc.qt.nokia.com/latest/layout.html
 
@RMartinhoFernandes this
 
@StackedCrooked kewl
I wonder, could you reverse the digits in an int at compile time using TMP?
 
Most likely.
 
template<int N> struct Reverse {
    enum {
       value =  N >> 31 | ...
    };
};
I think it would look like this. Too lazy to further implement.
Oops, I'm reversing bits. Not quite what you asked :)
 
8:54 PM
I think Tony means decimal digits.
 
Yeah
If one can do the 8 queens problem at compile time, then this should be a piece of cake. @Fred
 
@RMartinhoFernandes Say, what did you want to memcpy in the first place for?
 
I did it at runtime
 
Also, keep in mind that you can only do this at compile time if the value is known at compile time.
 
8:57 PM
@LucDanton Oh, I didn't want to memcpy per se, but I assumed I needed the trivially copyable requirement for the persistence part.
Am I wrong? (I'd be happy to :)
 
Dunno, it's very implementation specific.
 
> lexical error at character 'i'
WTF? And then I realized I should have chosen C++ instead of Haskell.
 
I'm finding tea to be more mentally stimulating than coffee. Strange...
 

« first day (316 days earlier)      last day (4641 days later) »