« first day (547 days earlier)      last day (4402 days later) » 

4:04 PM
@Mysticial You said yesterday that you’d never seen three wrong answers on a simple question? It actually happens pretty commonly …:
0
Q: Add a vector to a vector

user996056 Possible Duplicate: C++: Appending a vector to a vector Can I easily sum a vector to another vector? What I mean is, push_back a vector to another vector: {1, 2, 3} + {4, 8} = {1, 2, 3, 4, 8}; Do I have to do this manually: for (int i = 0; i < to_sum_vector.size(); i++) { fir...

 
eh
the guy in the first answer with 1 upvote was perfectly correct
he just made a stupid typo on his C++03-only answer
 
No, see my comment
ah, ok
 
if you look at the C++11 answer, it's fine
 
I fixed it
thanks
for the hint
 
so most likely, he just typed it out again wrong
 
4:07 PM
what's the advantage of this: first_vector.insert(std::end(first_vector), std::begin(second_vector), std::end(second_vector)); over the C++03 way
 
It also works with arrays.
 
@Tony: second_vector doesn't need to be a vector, it could even be a plain array.
 
@FredOverflow C arrays?
 
ah I get it
 
4:09 PM
For the second container, anyway. The first has to support insertion.
 
oh man, my poor Octree
containing points, spheres, and boxes and being looked up in for points, spheres, boxes, rays, frustums
 
frustums?
 
capped pyramids
 
they're like rectangular pyramids, but truncated a bit
 
4:13 PM
aha
 
the top is your screen
And what's inside the frustum needs to be drawn.
 
and the bottom is the far clipping plane?
 
or selected, if you're doing box-selection in the RTS
 
@classdaknok_t correct
 
we just say "capped pyramids" :)
 
4:16 PM
Hmm
 
fuckles
I fixed one bug in my code and it exposed another
 
I am a PHP coder and know enough Javascript and jQuery to be able to design and implement web applications. I want to start learning both C and C++. Are there tutorials targeted at novice C / C++ learners who are attempting these as a second/third language?
 
let me give you some advice
do not bother learning both C and C++
 
Why so?
 
C is a worthless piece of junk. If you have a genuine choice, you'll never use it.
4
and if you don't have a choice and are forced to use it, then your C++ knowledge is useless.
either way, you won't benefit from knowing both instead of just one
 
4:23 PM
I see. So are there good tutorials for C++ as a second language?
 
Don't learn C++ as a "second" language. Learn it from the ground up.
 
I want to learn Scala and Haskell, but the names aren't very similar :( What do I do?
 
have a look at the C++ book FAQ.
 
From a good book.
 
also
PHP/JavaScript knowledge is really not worth very much at all when learning C++
 
4:24 PM
@MajidFouladpour most often googling something like "learn c++ as a java programmer" works quite nicely for a start. I recommend reading a good general book on C++ too
 
And dive into C++11 at once.
 
so I wouldn't stay attached to those ways of doing things if I were you
yeah
also get a new compiler :P
 
@DeadMG Agreed. Much to unlearn. However,
 
user406009
@DeadMG False. Functional style from Javascript can easily be applied to C++11.
 
user406009
People just like to bash languages here.
 
4:25 PM
MSVS 11 Beta or GCC 4.6+ or if on a Mac, a modern Clang.
 
php and ecma script have loops, variables, scope, and functions. There the likeness ends
 
you're right! How could I possibly have missed that?
 
I know. I mean something that does not show page after page how to install and set up ide/tool chain.
 
@EthanSteinberg You have to excuse DeadMG. All he sees is "Java......" and his brain goes nuts.
 
user406009
Codeblocks is nice and simple(codeblocks.org).
 
4:26 PM
you can use one paradigm of limited application which is similar but absolutely everything else is totally different. I should totally have concluded that they're absolutely alike.
@FredOverflow Admitted. It's a bit of a primal instinct to start predating on the weak.
 
@EthanSteinberg Yes that was my next question: What envo should I look to set up?
 
@MajidFouladpour don't forget you can always procrastinate. Or just close this chat and get to work :)
 
@MajidFouladpour then skip that part, and move on to the good stuff. Every book on that list is a nice start.
 
@MajidFouladpour Win/Linux?
 
@MajidFouladpour Depends on your platform.
 
4:27 PM
Win, but preferring Linux really ;)
 
Then get a commandline and GCC
 
@MajidFouladpour sudo apt-get install build-essential vim make valgrind gdb
 
@sehe Linux != Ubuntu/Debian. Damn.
 
Visual Studio is the IDE for Windows
 
@DeadMG but not for Win, but preferring Linux really ;)
 
4:28 PM
I'm not on ubuntu. s/apt-get/yum/ or whatever. It's the packagenames that count, silly
 
Where I am, you cannot get a legit copy of commercial software ...
 
@sehe build-essential is not universal... silly.
 
@rubenvb Well, you started it with the rather unwarranted 'damn'. What did I do to make you loose your cool over a single message?
@rubenvb Also, it's not my fault that it's not universal. Do you know why it is wrong to give an example?
 
user406009
@MajidFouladpour Here is a quick rundown of the major options for linux: 1) Codeblocks(simple, but not that many features) It has a nice gui though. 2) Qtcreator(tons of features, specifically tailored to writing qt application(gui builder, templates , etc), but more complicated to use. 3) Ground up(basic text editor + gcc/clang + make) All command line, more complicated, but less limitations.
 
The assumption that Linux means apt-get and build-essential.
And please don't take that personally, that would be daft.
 
4:30 PM
@rubenvb That wasn't an assumption. It was an example. Damn :)
@EthanSteinberg I'd say IDE's are overkill unless you need to build GUIs
 
@EthanSteinberg "Ground up (VIM + clang + not make)" FTFY
 
@EthanSteinberg Thx. I think I'd start with codeblocks and after gaining some confidence would try notepad++ + gcc/clang + make
 
eh
all I know is, GDB is legendary for being suck compared to Visual Studio's debugger
 
@MajidFouladpour Clang is a fail on Windows for the moment, but please use it on Linux, its error messages are the best.
 
every time GDB comes up @sbi tells 999999 horror stories
 
4:33 PM
yet all of the Unix world uses it
 
He also does that when GDB doesn't come up…
 
except mac, cause they're gaining lldb
 
@rubenvb All of the Unix world uses C too and awful scripts and stuff, but I'm still gonna skip that :D
@classdaknok_t True. But not normally about GDB :P
 
Meh until LLDB understands libc++ I'm hating it.
 
@rubenvb That would not be an immediate issue as I'd be using codeblocks for a good half year ;) Thank you all for the link and the advice.
 
4:35 PM
@classdaknok_t Untill Clang/LLDB understand Windows I am torn in a hate-love relationship :(
 
argh
visual studio y ur intellisense suck :(
 
I don't care about Windows. I hope they don't require me to use it next year at university.
But since we'll be doing only Java and PHP (FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU‌​UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU) I don't think they will…
 
that FU... isn't quite long enough.
 
user406009
PHP is probably the worst language in widespread use.
 
Probably? It's worse than Visual Basic and Java combined.
Visual Java :P
 
4:38 PM
I have to admit that Java is just really really stupid, whereas I see PHP as both really really stupid and very poorly implemented
 
I prefer even C++ over PHP when writing web apps…
Or Befunge-93 if I could use it with CGI and MongoDB.
 
lol
 
user406009
Web programming sucks anyways.
 
Nah, I quite like it.
As long as the languages and frameworks I use don't get in my way.
The only thing that really sucks is authentication, but once that works it's fine.
Oh and the web design. :P
 
puppy: she needs cuddles
 
5:19 PM
Ok, my current clang version fails to compile this:
#include <string>
#include <vector>

int main()
{
    std::vector<std::string> vec;
    vec.push_back("Hello");
}
 
I was a idealistic young programmer full of potential, projects and ideas. Then I took a Minecraft to the hard drive.
 
Guess, I might have updated at a bad revision number or something.
@EtiennedeMartel Huh?
 
@StackedCrooked You are using Mac OS X, right? Did you just do svn checkout this that && make && make install?
 
@StackedCrooked Minecraft entered my life. I'm late to the party, but, yeah, now the only thing I do is move blocks all day.
 
@classdaknok_t yep
 
5:22 PM
@StackedCrooked Is that usable with Xcode?
Xcode seems to use the clang that's in its application bundle.
 
@classdaknok_t Dunno, I just use make files. (CMake to be more specific.)
 
Ah k.
I think I'm also going to do that. I'm getting sick of clang segfaulting on lambdas.
 
But I'm quite certain that I'm using the right binary. Doing an svn update and rebuild right now to check if it already has been fixed.
 
I was just writing that script. :P
 
Probably everyone has such a script somewhere :D
 
5:25 PM
Does --enable-optimized=yes do a release build? I don't want a debug build of clang.
 
@classdaknok_t Indeed.
That is, AFAIK.
 
Thanks for the scripts. :P
 
Which script should I run?
 
@classdaknok_t checkout-clang.sh && rebuild-clang.sh
 
5:28 PM
./checkout-clang.sh && ./rebuild-clang.sh right?
 
Thx!
Yes, it does a release build. Now on to waiting about an hour till it's done…
 
The bug still occurs after update. Actually I can reduce it to this now:
std::string str;
str = std::string("abc");
 
wow
what compiler bugs on that test case?
 
In file included from ./test.cpp:1:
/usr/include/c++/v1/string:1952:10: error: no viable overloaded '='
    __r_ = _STD::move(__str.__r_);
    ~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
 
5:32 PM
@DeadMG clang
 
I thought _STD was a macro used in the VS Standard headers
 
I don't really understand how the headers work. Clang installs the compiler to /usr/local/bin but doesn't install any headers. It takes the headers from /usr/include/v1.
 
Maybe it doesn't care if the headers are already installed?
 
Headers aren't in the repository either.
 
Well, you need the headers to install clang in the first place… :P
The headers are here, in a separate repository.
 
5:40 PM
@classdaknok_t Right! I probably don't build that.
Brb.
 
Yo dawg I herd you like build systems so I built a build system so you can build build systems while you build build systems.
 
user406009
So, does the suckiness of this build system contaminate the build systems you build with it?
 
user406009
An infinite chain of increasing suckiness and number build systems.
 
In a way…
Build systems really SUCK!
 
man
for a 3D space of n x n x n volume, I'm looking at n^3 log n just to build the search graph for A* to run in
this makes me disappoint
 
5:46 PM
@DeadMG the usual thing is to generate the search paths (recursively) on the fly?
 
user406009
3d path finding? Are you having like spaceships flying around asteroids or something?
 
@EthanSteinberg Each other, mostly, but also planets and stuff
 
no need to store the graph, just have a (deterministic/heuristic) traversal order
 
I'm going to write a build system…
And then build it using itself.
 
@classdaknok_t why? what's wrong with waf or scons?
 
user406009
5:49 PM
Have nocolliding spaceships and planets. Problem solved.
 
lol
 
user406009
You can even add a fancy animation of the spaceships flying around each other.
 
sbi
@DeadMG Really, you are exaggerating grossly. Even if I would want to tell only one story every time GDB crashes, I'd die within days due to malnutrition, dehydration, and sleep deprivation.
 
user406009
Or flying around the planets.
 
@sehe I don't say there is anything wrong with them. I'm just bored and I need something to do.
 
5:49 PM
@sbi It's the principle that counts :P
 
@EthanSteinberg I already don't have spaceships (too expensive). And I think I'm (kind of) leasing/renting a tiny part of the planet
 
sbi
6 hours ago, by Potatoswatter
What's the cure for procrastination?
@Potatoswatter Procrastinate now! Don't put it off!
 
@classdaknok_t Oh. Long time since I encountered that. This week: not a chance :)
 
I guess that
if I simply partitioned the volume into fixed-size chunks
I could simply look up the status of each point on demand
but I'm concerned that it'll give really low-resolution paths and they'll be, well, inaccurate and jagged
 
sbi
I explained how cannibalism is the new recycling but the hitchhikers in the trunk kept screaming anyway. #SecondaryWorldProblems
 
5:51 PM
ohai fellow procrastinators
 
@DeadMG how playable is your game?
 
well, since I don't currently have pathfinding, all you can do is zoom around and select things
 
@TonyTheLion Rule nr. 1 of Procrastinator club: You don't talk about Procrastination
 
I also guess
 
5:53 PM
@DeadMG selecting things is usually non-trivial in 3D spaces (assuming non-fixed viewpoint) - so: gratz
 
nothing is trivial in C++
 
@sehe Selecting wasn't that hard (and I do have a non-fixed viewpoint).
 
sbi
 
and even less than nothing is trivial in C
 
I think that pathfinding is more likely to be a problem
 
5:54 PM
I don't need pathfinding, I've found my path already :P
 
or, more accurately, the scale of pathfinding is going to be a problem
you can use A* to get super-accurate paths easily, but my intended game sizes are simply very large
 
sbi
There's always XPath to help you find your path.
 
ugh XPath
 
@sbi lol
 
I don't need pathfinding, I've found my path already :P
ok, this one got through
 
5:55 PM
@sbi Yeah. Like XSLT-FO :) Simple as XML and more cumbersome than java
 
@TonyTheLion So did the other one.
 
oh rly?
 
sbi
@sehe I have once implemented (96% of) an XPath 1.1 parser for a proprietary DOM. It was actually fun to do that.
 
ye
 
ah well
 
5:56 PM
@sbi I'm pretty sure getting one of those old Russian tanks wouldn't be too hard.
 
@sbi Oh. I can share that. I still have a partial XPath implementation floating around from another project. I inherited it (on both AIX and Win32)
Needless to say, by the time I left the project it had been replaced by libxml2
Then again, a (subset) XPath implementation well-done would be quite nice to have and to make
 
sbi
@EtiennedeMartel Yeah, but every time your foot shakes on the gas, you'll have a swirl in the gas tank. It's gonna cost a fortune to drive that thing shopping.
 
@sbi It'll just reduce the amount of shopping you do. Just get a tonne of canned food and camp out, military style
 
@sbi Yeah, an Abrams, maybe, but most tanks run on diesel. If you already have the money to buy the fucking tank, fueling it should be easy.
 
maybe I should just implement some really cheap-ass pathfinding
and then come back to it later
 
sbi
6:01 PM
@sehe The one I inherited was full of new, delete, memory leaks, and crashes. I was to fix it. I stabbed at it for two days (which ended a streak of never checking in a crash that had lasted for more than half a decade), and then, after consulting my unit head, I scrapped the thing and started from a clean slate. The trouble with the thing was that it was used in a real-time 3D app, and needed to be really fast.
 
you know what they say about premature pathfinding
@sbi Would be kind of nice to rethink that using C++11 and ropes/string atoms, don't you think?
 
sbi
@EtiennedeMartel YOu could apply the solution for the problem of financing the purchase of the tank to the purchase of fuel.
 
user406009
I still don't know how you would get the tank around. I hardly imagine it would fit nicely on the road.
 
sbi
@sehe I think I would like to have an opportunity to play with C++11. Does it have ropes? I didn't know that!
 
I'd almost be tempted at an XPath engine. Mind you, I'll stop short of XSLT (since it is too fuzzily spec-ed, noone agrees on the current version (1.0 is still the most widespread) and I just hate the 'bureaucratic' nature of it
 
6:04 PM
@sbi And then, you could apply the same solution to the problem of having all those officers telling you to step out of the tank.
 
sbi
@EthanSteinberg I suppose they have (the equivalent of) a steering wheel.
 
@sbi No it doesn't come with ropes. I just thought of them as a way to prevent allocating memory for xml nodes
 
sbi
@sehe XPath 2 is insanely complex. If you try to implement an XPath 2 parser, a C++ parser might materialize as a side product.
 
@sbi Haha that's one way of putting it
 
sbi
@sehe Mhmm. Not sure what you're talking about. But then, I dug all day (with all the trenches filled, my garden now doesn't look as if it is a battlefield anymore, it looks like it was a battlefield), I am now ravenously hungry, and there's that lasagna I need to put into the oven. And I need to clean up the kitchen, which I have pretty much abandoned in favor of the garden... All this makes it hard to think properly.
 
6:09 PM
Ok I'll leave you to it, while I flatten my kids into their beds
 
you "flatten your kids" ?
dafuq?
 
sbi
@TonyTheLion I always bully them to bed. They are scared of me. :-/
 
oh :(
 
@TonyTheLion You know, the objective is to get them oriented horizontally
 
ah right
I'm not thinking today
like most days
 
6:28 PM
Anyone here?
Trying to plow through some old exercises, and I think the website is being moody.
@TonyTheLion Might I ping you since you're the last active on the transcript?
> Given a two-dimensional array x of doubles, write an expression whose value is twice the value of the element in the 3rd row and the 2nd column.
Why is 2.0 * x[3][2] incorrect?
 
user406009
It should be 2.0 * x[2][1].
 
user406009
C arrays are 0 indexed.
 
Whoops!
I'm stupid.
7
facepalm
 
user406009
Good job with array[y][x] though. That always confuses me.
 
so tempting to star that
 
6:30 PM
lol
 
Ugh.
I've been writing iOS apps for 2 years. I know how to program. feels stupid
It's a Sunday... that's it.
 
> Any sufficiently advanced technology is indistinguishable from magic.
this explains everything :P
 
who said that again?
 
@TonyTheLion Heh, my professor mentioned something like that in one of his lectures this semester. Feel free to comb my notes (link).
 
user406009
6:32 PM
@rubenvb That's just begging for a lmgtfy link.
 
Also, I hacked around popular iPhone game, Draw Something. Blogged about it too. (Link to Part 1, which links the others.).
 
@EthanSteinberg oh bugger off. I can't google everything at once
 
Lol.
Wish I was alert enough to change that "I'm Stupid" to something else during the edit time.
Here, have this instead:
 
user406009
@Moshe Very interesting work. I always assumed that they were sane and just stored the hashes of the words.
 
@EthanSteinberg Thanks. Sane? Course not. That would make it too easy. I'm targeting Angry Birds next. After this HW.
I'm a bit behind.
There's that FB vulnerability to worry about. Anyone wanna play Draw Something? :-D
@EthanSteinberg Although actually they technically have hashes in three places.
1. The file is a calculated hash. 2. The corresponding etag file has a hash 3. Presumably on the server, there's a hash which confirms the other two.
Ok, one more problem:
> You are given a 6x8 (6 rows, 8 columns) array of integers, x, already initialized and three integer variables: max, i and j. Write the necessary code so that max will have the largest value in the array x.
max = x[0][0];

for(int i = 1;i<6;i++)
  for(int j= 1;j<8;j++)
    if(max < x[i][j]){
      max = x[i][j];
     }
 
user406009
6:49 PM
Wrong, what if x[0][1] is the largest location?
 
user406009
I would just cheat and do


max = x[0][0];

for(int i = 0;i<6;i++)
for(int j= 0;j<8;j++)
if(max < x[i][j]){
max = x[i][j];
}

Technically wasting one check, but who cares.
 
if you really don't want to compare x[0][0] to itself, you can write for( int j = (i == 0); j<8; ++j )
 
@EthanSteinberg I realized that while I was in bathroom a moment ago. Yea, that's it.
 

« first day (547 days earlier)      last day (4402 days later) »