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

7:02 PM
@jalf Despite that failing unit test all the other tests pass and the program seems to run well. ...At least for a while :D
 
Something.
@TonyTheLion Ok, but you want a bridge in a shitty language or a good one?
 
Hehe, there's this:
> Declare an array of integers, westboundHollandTunnelTraffic that can store the number of vehicles going westbound through the Holland Tunnel on a particular hour (numbered 0 through 23) on a particular day (numbered 0 through 6) on a particular week numbered (0 through 51) over the last ten years (numbered 0 through 9). The innermost dimension should be years, with the next being weeks, and so on.
Love the answer:
int westboundHollandTunnelTraffic[10][52][7][24];
@Potatoswatter I might have an answer for you when I'm done with college.
I am majoring in excuses and minoring in procrastination, after all.
 
Week numbers from 0 to 51 just don't cut it.
 
@RMartinhoFernandes lol
 
@BenVoigt One does not simply declare a year to have 52 weeks.
 
7:10 PM
@BenVoigt Fix Earth's orbit.
 
@Moshe That's what I mean.
 
@BenVoigt One does not simply mean things.
 
@Moshe One does if one is Chuck Norris, Jon Skeet, or, on Sundays, myself. Today is Sunday.
 
@BenVoigt One does not simply do things often, but when I do, I simply do them.
Ok, I'm done.
drops joke in the trash can and walks away
 
I don't think that means what you think it means
 
7:15 PM
@TonyTheLion I'm gonna just pretend.
 
> Consider the testPIN function used in Program 7-21. For convenience, we have reproduced the code for you below. Modify this function as follows:change its type to int
change its name to countMATCHES
make it return the number of corresponding parallel elements that are equal
int countMatches(int custPIN[], int databasePIN[], int size) {
	for (int index = 0; index < size; index++) {
		if (custPIN[index] != databasePIN[index])
		return index;
	}
	return size; // If we make it this far, the values are the same.
}
This seems to fail one case. Ugh.
 
that's because you don't properly account for trailing matches
 
I'm apparently not allowed to declare anything in there.
 
i.e., given 1011, where the databasePin is 1111, you will return 1 where the correct answer is 3
 
7:18 PM
Complains if I do.
 
you need to keep track of how many you've hit and not exit early
 
I wonder if I can use the first element of the array to do that...
 
Is a recursive solution allowed?
 
I don't see why not.
I can try anything until the program complains that it's not doing it the way I want it to.
 
I also don't see why you can't declare variables in it
 
7:21 PM
return index + countMatches(custPIN+index+1, databasePIN+index+1, size-index-1)
 
that's really a kind of "I'm a stupid pointless exercise" thing
 
@DeadMG I know, I know.
@BenVoigt You win.
Have a cookie.
That was probably it.
 
Course, that takes MUCH more time and space than just keeping an extra variable.
 
@BenVoigt Poor you. :P
 
7:24 PM
@DeadMG: Just return (*custPin == *databasePIN) + countMatches(custPin + 1, databasePIN + 1, size - 1);
 
or that
keep forgetting that the morons in the Standard committee made bool an integral type
 
It isn't really. But it's implicitly convertible.
 
> Declare a vector named scores of twenty-five elements of type int .
Never did Vectors
Yay
Neeext!
more vectors.
 
@BenVoigt Actually, it is an integral type.
 
Anyone care to 'splain vector syntax?
 
7:27 PM
@Moshe splain what?
 
> Declare a vector named scores of twenty-five elements of type int .
 
But it's values aren't integral. They just convert to integers (much like enum).
 
@Moshe std::vector<int> scores(25);?
 
@DeadMG You can redeem your prize at the ticket counter!
I'm not learning it like this... Well, before I was.
Now I'm messing around.
 
@StackedCrooked yeah, I'm still not sure if the error is in your code or mine. Couldn't reproduce in my own test framework, and haven't looked at it in yours yet
 
7:29 PM
BTW I like this one better, no extra stack space required: pastebin.com/S5QFiwsW
 
been busy playing around with node.js :)
 
@BenVoigt Except he's doing one of those "We like stupid pointless exercises" things where they arbitrarily restrict you to make you come up with the most arcane worthless unmaintainable solution ever
 
Sounds like a challenge!
 
Ok, I see how vector declaration syntax works - how do I read an element from a vector?
 
just like an array, since operator[] is overloaded
 
7:35 PM
1. Invent a language to be used only on this silly exercise; 2. Write a compiler for it; 3. Write the solution in that language as a string literal, and a program that compiles and runs it; 3.1. The solution consists of a web service that computes the solution and communicates via SOAP, along with an SQL database to cache answers, and a client that queries that web service.
 
@RMartinhoFernandes Actually, meet MPL.
 
@RMartinhoFernandes You forgot the machine emulator for the bytecode instruction set targeted by said compiler.
 
@RMartinhoFernandes That's almost exactly what MPL is.
 
I have no idea what that is, but the fact that they decide to present it by using pictures of smiling people of various ethnic backgrounds makes me think it's not even worth talking about.
 
7:43 PM
> Given an array temps of double , containing temperature data, and an int variable n that contains the number of elements in temps : Compute the average temperature and store it in a variable called avgTemp . Besides temps , n , and avgTemp , you may use only two other variables -- an int variable k and a double variable total , which have been declared.
epic failure
 
Why? Because there's one lonely comma with proper spacing?
 
aaargh
I submitted a simple solution and it bitched at me that I hadn't initialized a variable
but it's the one who did the declaring
goddamnit
 
There are demos?
 
Where is this thing from?
 
7:45 PM
@DeadMG Welcome to my entire semester.
 
@Moshe Find another course :(
> Write the int-valued function fib, that takes a single int parameter (say n), and recursively calculates and then returns the n'th element of the Fibonacci series.
 
@DeadMG The professor wrote the system with a colleague, not bad entirely, but it's like my plugging my blog. It happens.
 
y u teach people crappy recursive version of Fibonacci algorithm?
haha
 
@DeadMG mwahahaha
 
it only has 3 demo problems, and you click "next" and it just comes up with "null" as the content
well programmed, my epic fail
 
7:47 PM
lol
 
Haha
 
CORRECT SUBMISSION 2 (0%, 22 submissions):
a[0*1*2*3*4*5*6*7*8*9*10] = 3*1*2*3*4*5*6*7*8*9*10/1/2/3/4/5/6/7/8/9/10;
 
I hate that it's flash and that I can't use it on my iPad.
 
WTF? who submitted that?
 
haha
@DeadMG trololololololololololo.com is the answer.
 
7:49 PM
oh fuck me
if I allow diagonal movements then each node has 26 links.
that's gonna add up so damn fast
 
Whatcha messing with?
 
pathfinding in 3D space
 
Oh, that. I remember.
 
Nice.
 
not really
all the existing pathfinding algorithms don't really seem to scale well to above two dimensions
 
7:54 PM
How do I get the size of a vector? v.size()?
 
even though I've found a pretty swell algorithm, JPS, I'm still struggling with the scale of it
 
Wait, maybe I'm confusing. I was discussing this with a friend the other day, not you.
 
so really, I need to split my problem down into the two problems it's really composed of
#1: Convert 3D space and associated obstacles into graph.
#2: Use JPS to find optimal path.
 
My friend was convinced that somehow flood-fill was an efficient algorithm.
 
lol
 
7:56 PM
> Assume v is a vector that has been declared and initialized. Write an expression whose value is the number of values that could be additionally stored in v.
Halp!
:P
 
What's JPS? Jamaican Public Service?
 
is quite clearly trolling now for HW help
 
capacity(), or maybe capacity() - size()
@RMartinhoFernandes Jump Point Search.
it's an A* derivative specifically optimized for graphs whose edges are uniform cost
 
Oooh, someone suggested that to Toady on the DF forums.
 
Ell
 
7:58 PM
yep
 
Ell
(One does not simply walk into the c++ room)
 
> I mean that if DF has been done as it has been done, it must be the best way to do such a thing, because Toady One never fails.
lol
 
> Installing from our distributed tarball is relatively straightforward ...
Usage of the word relatively results in empty statements :D
 
in any case
I need to derive a graph from my 3D space plus obstacles, and I'm not totally sure WTF to do
 
sbi
@Ell Actually, the room's tagline isn't from MP, but from LotR.
 
8:03 PM
Fixed.
 
Ell
@sbi I know :L but I was expressing that I had not simply walked into the chat room :D
 
@DeadMG Can't think of an approach/algorithm to do it?
 
yeah
my main problem is that the maps are quite large relative to the obstacles, which are themselves of highly varying sizes
so I end up with either piss-poor resolution, or 99999999 nodes
I've been thinking about trying to derive the nodes from my octree of obstacles, but that'll only get me a bunch of points, and I'm not sure how to edge them up without raycasting between every single pair of points to see which are traversable
 
OK. Not my domain...
 
> Assume v is a vector of integers that has been declared and initialized. Write a statement that adds the value 42 to the vector.
How do I do that one?
 
8:11 PM
just use the reference at MSDN or something
 
emplace_back, hopefully
 
these are really basic "read the documentation and easy answer" questions
 
Ell
v.push_back(42) :D
 
found it, thanks
 
No, no. You shouldn't waste time learning C++98. Definitely prefer v.emplace_back(42);
 
8:12 PM
@BenVoigt More accurately, did his utter moron professor update his idiotic tool for C++11?
 
Roundabout (i.e. silly) way: v.resize(v.size()+1); v.back() = 42; :P
 
Ell
@BenVoigt emplace back?
 
@Ell C++11.
 
@DeadMG Well, I was hoping to find that out.
more roundabout way: those back_inserter thingies.
Did C++11 add a back_emplacer iterator?
 
no idea
 
8:14 PM
@BenVoigt How would that work?
It would only be useful for single argument ctors.
 
8:26 PM
hmmm
one ray-cast in an octree should be relatively cheap, right?
 
What the hell happened to this answer?
3
A: std::function constructor not found when calling a function

Ben Voigtcmp() isn't actually a std::function at all. The fact that the copy-initialization works may be confusing the issue, but that uses a converting constructor which must be using some sort of wrapper object, and I'm surprised that it works against a temporary functor object (ah, checking the standa...

 
cause I could be looking at doing way too many of them per frame
@LucDanton What's wrong with it? I only see edits by the original answerer.
 
@DeadMG Answer, not question?
 
yes
 
Suppressing deduction is not a very good idea in the OP's case.
> If for some reason you really wanted to use std::function (you need the virtual dispatch, for instance)
And what does that mean?
 
8:29 PM
no idea
ask him, he was just here
 
@BenVoigt Fix your answer!
 
@Moshe You know what really sucks with that site? They have some kind of javascript enabled input widget, which (gasp) silently transliteraterates (should I say obliterates) any < into >.
That is a daft way to ensure that about 99% of submission for Exercise #2 (average) in Arrays and Recursion sections of the C++ CodeLab will be wrong. I finally copy/pasted the correct conditional from another browser tab. Go figure
(Anyways, it is an applet. )
 
humm i cant sleep
 
@sehe Flash, methinks.
 
@Moshe could be. lost interest :)
 
8:42 PM
@sehe Heh, me too. But I actually have to finish the exercises for my class.
 
@Moshe link to more exciting ones?
 
Am I able to do that?
I don't think so.
 
@Moshe That would be rather daft indeed
But given the 'rich' experience on that site I just tasted, it wouldn't surprise me one bit if you could
 
Haha
Nope, just RELOADRELOAD=RELOADRELOADRELOADRELOAD
It's a flash app, if you are that desperate for C++ problems, hack the swf. :P
 
That query string kind of takes the biscuit, don't you think
 
8:48 PM
Haha, yea
 
The funny thing is, the link 'worked' (but only because i'd implicitely been logged in as 'thin flash' of the 'TC' school :))
 
Ell
what should I google when I want to learn about game networking? e.g. what says what to the client/server, how are invalid moves handled etc. etc.
 
@sehe Really? You have access to more exercises now?
No idea what people's political stances are in here, but I'm going to kick up a storm... :-D
Just gonna leave this here:
 
@Moshe Is this actually for real?
 
@KonradRudolph I don't know, been floating around Facebook. Comes from an account that appears to be that of the PM (link), but FB doesn't have the verified status that Twitter does.
I can't know.
 
8:58 PM
what's going on over here?
 
@KonradRudolph Why do you ask?
braces for flame war
@bughi C++, of course.
 
@Moshe +1
@Moshe Why? That's a strange letter, with missing context and no way to verify either intent or veracity. Meh
 
@sehe indeed.
Yes it is a strange letter.
 
I can form opinions about the subjects, but I don't need a letter to jumpstart that, and I will happily continue not-discussing them in Lounge<C++> like I have been for quite a while now
 
Ok, agreed.
Found that to be a provocative letter regardless.
 
9:02 PM
@Moshe I wonder whether there is a target audience for it. If so, where :)
Oh my. I'm gonna burn my quota for typos at this rate.
 
@sehe pulls out torch for flame war
@sehe I think the letter clears that up on line 0:
> Dear activist
 
My second type in this message nicely demonstrated that I'm still using qerty family layouts :)
@Moshe What activist would that be? It can't hardly be the palestinian citizen because they'd not be flying in on a commercial airline...?
 
> Where good content takes root and grows is not nearly as important as the content itself.
^ Reminds me of SO. (This is a complaint about a popular reddit post that got removed because the moderated found that it was not posted in the right place.)
 
@StackedCrooked That strikes me as conflicted. Since it doesn't matter where it roots, it should remind you of the internet, really
 
@sehe Indeed, the letter doesn't say "Dear Palestinian citizen" it says "Dear activist". Why would you think that it would be addressed to them? What does commercial airlines have to do with anything?
And instead of spending money on commercial airlines, write out a check to the poor starving martyrs, eh?
Ok, seriously, I'm not flaming anymore. Done.
 
@Moshe I wonder what flights they spam this letter to? What activists actually go through the hassle of flying /somewhere/ to 'protest Israel' (the wording... ouch). I presume the targeted flight destination would be Israel....
 
@sehe Indeed.
(removed)
 
So that leaves the very very slim profile of activists that actually bother to fly into Israel to 'protest Israel' and, apparently, would be persuaded not to by a semi-polite letter they receive in-flight, with no clear sender (the logo should be a hint, but not to me)
@Moshe fixing
 
@sehe Heh, I don't think they would be persuaded, you're right. The logo would be obvious to anyone who is flying in.
 
I quote 'protest Israel' because I find the wording a bit grotesque
 
9:09 PM
@sehe What do you mean?
 
@Moshe Not when they're already there, anyways. Cognitive dissonance, anyone :)
 
not folks who are already there. I believe the letter is directly related to this: welcometopalestine.info
 
@Moshe I mean it is overly broad/vague
 
The FB post had a teensy bit more context.
And I quote:
> This is the letter that the flightilla activists will receive when they arrive in Israel
{image here}
 
> This is the letter that the flightilla activists will receive when they arrive in Israel
Aha
 
9:12 PM
Yup, Facebook does that, pulls context.
 
Aw crap, you posted it before. So, the target audience is well defined and it is a one-off.
 
@sehe one off? what do you mean?
 
Well, hen, since I cannot asses that activist group, nor their intent, I'll simply note this rather lucid 'PR stunt' - I think it feels like fair game and really rather nice: thought provoking, against all odds
 
Context^^
 
@Moshe That sentence we both quoted seems to suggest this is an actual event. It doesn't suggest (to me) that they will dispensing these letters to many groups of activists in many years to come?
 
9:14 PM
Doubt it.
 
one - off = isolated event, incident, onetime occurrence
 
Just a response to a stunt.
ah, got it
:-)
I'm game to go back to complaining about the C++ lab thingy. Still annoying me.
But four donuts later doesn't see me any more clear on half of these labs or the instructions.
They may even be awesome coders, but a lot of CS professor's are just awful at writing assignment specs.
 
1 hour ago, by Moshe
is quite clearly trolling now for HW help
@Moshe That is soooo true
 
I'd substitute that with "they're just awful"
 
Win.
 
9:18 PM
@DeadMG because they can't think of anything other to solve recursively. Well, not until they do DFS
 
factorial?
 
@Moshe Might wanna star that instead
@DeadMG Absolutely no need to do that. Use closed form
 
@sehe Star what?
 
@Moshe fixed
 
@sehe Better than fibonacci
 
9:20 PM
I've hit the threshold for the required number of exercises, to quote the professor:
> As long as you do about half of them, you'll be fine.
A scientific amount too, "about half".
Hehe
 
@Moshe CS is an Arts study anyway
 
havastar
 
@Moshe Is that a new Hollywood blockbuster?
 
I think programming is largely orthogonal to CS, anyways.
 
9:23 PM
@sehe agreed
 
what is this all about...
 
I know almost as many graduated professional pianists who wouldn't be able to play 'Happy Birthday' to save their lives (without sheet music) as I do graduated CS majors who can't program their way out of can of biscuits.
@MladenJanković What?
 
i just saw the link to Lounge<C++>... chat room for c++-minded people?
nice...
 
@MladenJanković Well, duh. That's hardly newsworthy :) We've been here a while
 
Yea
 
9:27 PM
well it is for me :) i'm not regular on SO
 
@MladenJanković Welcome, anyways
 
Ok, HW then more HW.
And donuts
 
@sehe danke
 
9:42 PM
@Moshe So, one of two things is going to be reached: lethal body volume or a degree
 
Hello
I am struggeling to understand header and implementation files ( pure C). Are the included header declarations compiled or what is happening?
 
@Viper yes they are compiled
 
But why is the code separeted in two files?
 
Header contains declarations that can be imported by other .cpp files.
 
because you want to put declarations of common functions and data structures in a single file, so you can use them from different .c(pp) files
and you put definitions of those functions in another .c(pp) file
 
9:52 PM
But why isn't this needed in say Java?
 
Java is more clever in this regard.
 
so you have nicely structured code, instead of a single 100000 lines long file which contains all the code
java/c# compilers/ide stores metadata mumb-jumbo about your code
c/c++ doesn;t
 
@Viper Learning about "compilation units" will help you understand why the distinction between header and source files is needed in C and C++.
 
So C and C++ are put together in one big file?
@StackedCrooked do you have some links that would help?
 
saying #include <something.h> is nothing more then instructing preprocessor to copy content of 'something.h' file at that location in a file that is being compiled
 

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