« first day (1544 days earlier)      last day (3398 days later) » 

9:00 PM
@BenjaminGruenbaum but of course, that's the whole point of reference parameters
 
ok, I almost know what's going on!
 
C# is much the same
 
@KendallFrey yes, C# makes you be explicit about that but you can change nested properties freely always. In C# that's not the case
void f(MyType i)
{
    i.x = 42; // does not update the variable outside the scope, does update it in C#
}
 
*C++
 
No, C# makes you explicit about it, when you call a function you have to write ref - that's not the ase with C++
 
9:01 PM
@BenjaminGruenbaum That's one thing I don't really like about ref/val types in C#. They don't behave consistently
 
int i;
foo(i); // that can change `i` in C++, but not C# no matter what (Except if it has a closure over it or something)
@KendallFrey oh, I don't like them either but to be fair all C++ does is be consistent about those types of mutations. C# on the other hand is more pragmatic in a way.
 
wait, what's the C++ equivalent of a value parameter of a reference type?
 
All I'm really saying here is that C++ is definitely worth learning. A lot of people scare people about it because it's unmanaged. C++ has a lot of issues in the edges but to get the general hang of it is relatively easy.
@KendallFrey In C++ a reference just "refers" to an object, there are no reference types, just types and references.
 
Is there a decent DOM parser for Node?
 
@SecondRikudo cheerio
 
9:04 PM
@BenjaminGruenbaum I already said that :P but answer my question
 
@BenjaminGruenbaum Something that's not jQueryfic?
 
It's not like C# where you can't put a DateTime on the heap or a DBContext on the heap.
 
oh yes you can
 
@SecondRikudo jsDom, it's worse and has a worse API but enjoy your ego :P
@KendallFrey iirc doesn't guarantee actual placement on a stack or a heap ever anyway.
 
object now = DateTime.Now;
 
9:04 PM
It might allocate anything anywhere it deems.
 
@BenjaminGruenbaum Yeah, it's horrible.
 
@KendallFrey oh that's nice you boxed it.
 
I'll just go with Cheerio
 
@BenjaminGruenbaum stackalloc guarantees stack, I'm guessing
@BenjaminGruenbaum brilliant, right?
 
@KendallFrey yeah, C# can play a double game with unsafe, it's an extremely pragmatic language. It's an outliar though.
 
9:06 PM
So, what's the reference version of void f(Thing *i) and f(pi)?
 
guys wwhats good
 
@KendallFrey yes, but you don't have a DateTime on a heap, you have a wrapped datetime on a heap.
@meda charity
@KendallFrey you rarely have pointers in modern C++ just references (which refer to something - which is what you usually want when you have a pointer in C only you have to us reference and deref operators (* and &) a lot).
 
@BenjaminGruenbaum I know, I use C when I can
 
In fact, in modern C++ you'd just pass a value in and the compiler would just move it in the background.
 
9:08 PM
not cv, it was a bad answer, but it was removed
 
@BenjaminGruenbaum If you have raw pointers lying around these days, you're doing something funky.
 
@ssube or coding in C, they are still unavoidable and used a lot in C. There are a lot of things C does better than C++ - namely because it's a much smaller language there are compilers for a lot more CPUs and platforms for C.
 
@BenjaminGruenbaum But I still don't know the answer
 
Now that compilers are fast and someone besides boost has smart pointers, everything may as well be an Optional<T>
 
@ssube why would everything be optional o_0? Only optional stuff should be optional.
 
9:10 PM
@BenjaminGruenbaum meh, that's optional IMO
 
yeah, I guess you hardly ever use weak refs
 
@KendallFrey void f(Thing i) f(pi)` where pi is not created with malloc but on the stack or void f(Thing& i) where i is either a Thing or a reference itself.
 
I actually don't remember the last time I did. I have, but not often.
shared_ptr ftw
 
@KendallFrey Optional in C++ (and Scala as Option, and Java) is like Nullable in C#.
 
@BenjaminGruenbaum so, I think the latter. It would allow updating the object but not the variable, right?
 
9:11 PM
I don't remember all the smart pointer types and their semantics anymore. :(
 
@BenjaminGruenbaum I know :)
 
All I'm getting at here is that C++ is not bad because it chooses to be unmanaged, being unmanaged has advantages and C++ and is a legitimate design choice and some people prefer tha.
 
Desperately need to write some real code again one day, instead of this mushy J* stuff.
 
@KendallFrey the latter would allow you to update the variable too.
 
@BenjaminGruenbaum ew, is there a way to not do that?
 
9:12 PM
@KendallFrey const
 
@ssube we're like 10 years after that attitude, C++ programmers aren't more real as programmers than people who write HTML or make games in flash.
 
(largely, sometimes forcing a copy)
 
@KendallFrey you have a notion of const correctness in C and C++, like ssube said you can declare a variable const indicating the function may not change it.
 
then it can still change the referenced object?
 
@BenjaminGruenbaum It's somewhat exaggerated, but not untrue. Writing in languages that help you for too long definitely lets you get sloppy. Going back to unsafe code every so often is good to keep your critical thinking sharp.
It's like occasionally free climbing, even if you go to a gym.
@KendallFrey depends on how const it is. You can say that you have a const variable, which is roughly Java's final and won't allow you to assign. You can also have a reference or pointer to something which is, itself, const and then you can't mutate any part of that.
 
9:16 PM
@KendallFrey if you pass x as a const you can't change x.y if that's what you mean
 
On top of that, in C++ classes, you can mark methods as const, which allows them to be called through a const reference/pointer to an instance.
 
@BenjaminGruenbaum well shit. is that something C++ can't do (without pointer) then?
 
It allows you to mark variables, references, and methods as safe from mutability/mutators.
 
The general point here is that C++ has a lot of fine grained control over ownership and who can access what that's not really needed in c# but is interesting and can sometimes solve prolems better.
@KendallFrey access raw memory nicely. Pointers do that well.
 
@BenjaminGruenbaum what?
 
9:18 PM
@BenjaminGruenbaum discouraging void * definitely made fudging with broad swathes of memory more difficult.
 
Got an embedded device and the boot sector configuration is always at 0x3000? You can point to it very easily with a pointer.
 
that doesn't answer my question
 
In C++, if you want to get the address of a method on an instance and write that to a location in memory, there are 3 or 4 casts involved. C will happily let you write most anything anywhere.
 
Apparently Terrorists killed cartoonists in France today? wat
 
Sometimes you just want to access an actual address in memory. You can also add more indirection with *, you can't have a reference to a reference (it doesn't make sense)
@NickDugger yup, that's insane.
 
9:19 PM
@BenjaminGruenbaum which is why the reference-reference operator, if it had existed, was used for move
wasn't it?
my C++11 is not good
 
@ssube it's interesting but I don't think it is true. The same can be said about declarative, or markup or other types of languages.
 
ok, let me try to write a sample illustrating my question
 
@ssube rvalues and move semantics, yes but this can get confusing and we don't want to discuss things that are not essential right now. It all makes sense though.
For example how can you point to 5 if it's not saved in any variable?
 
@BenjaminGruenbaum I'd say hitting all the various families regularly has value. Keeps you sharp on the rules for each style and what not to do. Unsafe languages remind you how memory works.
 
@ssube right, I agree and I think @NickDugger could benefit from learning one but I don't think that makes Java or PHP developers any less "programmers" than C++ ones.
 
9:22 PM
But what's the point in learning and programming in C++ if you can't be smug and superior to all the people who don't?
 
@Retsam that goes for any language but PHP
 
I'm already smug, just think of what I'll become after learning C++
 
@Retsam you can be smug and superior
People are :D
 
@BenjaminGruenbaum But they drink mountain dew, you can't possibly take them seriously. :P We have to conform to the social expectation that all developers are smug assholes with no social skills.
 
@ssube you can be a smug asshole php programmer :D
 
9:24 PM
Otherwise product management might think we can be reasoned with.
 
and if prod mgmt starts suggesting reasonable compromises, then the designers will have to make decent UIs
 
I just found a neat app that gives you points for using apps for 2 minutes and then you can delete them
 
and if the designers make decent UIs, the consumers will get what they want
 
~80 points per download, and at like 6000 points you can get a $10 itunes gift card or other stuff
I hope it's legit
 
9:25 PM
and if the consumers get what they want, then the C-levels won't have anyone complaining to them, and will suddenly be out of jobs.
 
I just heard a design lecture yesterday where the speaker boasted about refactoring their code base "day and night" for 3 months straight in Java so it's better OOP wise and then they sort of didn't touched it and moved to do something unrelated in JS.
 
and if the consumers get what they want, you'll have to give them a glass of milk to wash it down
 
In C#:

void Test()
{
	Thing one = new Thing();
	Thing two = new Thing();
	Foo(one, two);
	Assert(one.Name == "foo");
}

void Foo(Thing one, Thing two)
{
	one.Name = "foo";
	one = two;
}

---------------------------------
In C++:

void Test()
{
	Thing *one = new Thing();
	Thing *two = new Thing();
	Foo(one, two);
	Assert(one->Name == "foo");
	delete one;
	delete two;
}

void Foo(Thing *one, Thing *two)
{
	one->Name = "foo";
	one = two;
}
 
tl;dr: if developers stop being smug and anti-social, the 1% will stop existing.
 
@BenjaminGruenbaum ^
 
9:25 PM
And I was like "you fucking retard, you just wasted 3 months of development time and burned your whole team because you get a woody from uncle bob?
 
Can I implement that in C++ without pointers?
 
@SomeKittens "image not found"
 
function connect() {
  if ( sp ) return sp.close(function() { sp = null; connect() });
  sp = serialPort.SerialPort(comName, options);
  sp.on('data', processSerialData);
  // close/open/error handlers here
}

// this works the first time, then when I change the baud or something I run the connect again, which successfully closes the connection and removes the object, on the second attempt to connect I get access denied. This persists until I actually go as far as closing the application and restarting it.
 
@KendallFrey those new and delete are hurting me.
 
in the C++ portion, what are the asterixs doing?
 
9:26 PM
I hate serial ports!
GHA!!\
 
@BenjaminGruenbaum Did I get them wrong, or just...
 
Just physically :D
 
right
so my question is, how to avoid that?
 
void Test()
{
	Thing one;
	Thing two;
	Foo(one, two);
	assert(one.Name == "foo");
}

void Foo(Thing& one, Thing& two)
{
	one.Name = "foo";
	one = two; // why am I overriding one with the othere here?
}
 
9:27 PM
first, let me see if this is an issue on linux.
I think windows is holding the port open for whatever reason
 
@BenjaminGruenbaum for testing purposes
will that not change one?
 
@KendallFrey Ah, I get it, in my C++ code above two will override one.
 
@BenjaminGruenbaum what's the benefit of foo = *bar over foo = bar? I see that it sets it to equal what bar equals, instead of bar, but does that save memory, or what exactly?
 
@NickDugger this takes a while to explain, probably more of a tutorial than a chat message. Try "Learn C the hard way"
 
very well
 
9:29 PM
@NickDugger they are quite different actually
*x references the value at x, x by itself is the numerical value of the pointer
 
@KendallFrey all the bits are backward in that example. ideone.com/hrqoue
 
!!google byref vs byval
 
is it fair to say; this^ will help him understand it?
 
@rlemon With things like this, probably a tossup :P
if he only reads the VB stuff, probably not
 
9:32 PM
well I wasn't expecting to get all VB answers ;)
luck of the draw
92
A: Which is faster? ByVal or ByRef?

user50612Byval and byref arguments should be used based on requirements and knowledge of how they work not on speed. http://www.developer.com/net/vb/article.php/3669066 Edit In response to a comment by Slough - Which consumes more resources at runtime? Parameters are passed on the stack. The stack i...

isn't bad
 
you googled two vb keywords...
 
@KendallFrey touche
I see them more as concepts and forget VB owns those keywords
 
They helped a bit
 
@KendallFrey rough version with any stars, sans setting-of-params: ideone.com/ywrrBm
someone could probably make it much better
 
10 minutes, and you can't even do what C# does by default?
I find that disturbing
 
9:42 PM
that shouldn't reflect on C++. It's been years since I wrote any.
 
So more work is disturbing to you, even if the end result is better?
 
had to look up the docs on shared_ptr :(
 
@NickDugger Well, based on the fact that you aren't writing everything in hand crafted assembly...
 
Sure, but assembly doesn't disturb me... scares me, yeah, but I don't complain about how long something takes
 
@Retsam Unlike one of my favourite games as a kid :)
I love it that RCT is mainly assembly
 
9:44 PM
roller coaster tycoon?
 
yeah
 
it was written in assembly? why?
 
Because that's the language Chris was comfortable in, I guess
 
@NickDugger I think something being more difficult in one language than another is a perfectly valid thing to discuss when evaluating languages. If it's not, then you'd write everything in assembly.
 
@NickDugger C and C++ used to be really slow.
 
9:46 PM
a long long time ago.
 
Compiling complex languages like that takes fast computers, and the languages will always become more complex as the compiler becomes faster.
There are libraries doing that to this day (boost spirit)
 
long long time_ago; // in a galaxy far away
 
I was under the impression that a decent c compiler could out-optimize humans.
 
0
Q: What is the most correct form for comments declaration for JavaScript?

deniI wonder, what is the most correct form for comments declaration for JavaScript? By asking such a question I meant some form/concept/rules for declaring them. In different projects I've seen some comment declarations. There are some, which are preparing the format of comments in projects, whic...

 
@Luggage I think so, especially now
 
9:48 PM
@Luggage C often can, cause you get what you write with it. C++, less so.
 
Lisp doesn't become more complex
 
It starts that way.
 
What's a good library for implementing a websocket server that websocket clients can connect to (so no socket.io)?
 
The alias problem, I think, is a big reason why C++ compilers can't always out optimize humans.
 
<- doesn't know any lisp, so ignore me.
 
9:49 PM
There is a ceiling, but whether lisp or perl will hit it first, I do not know.
@Retsam C++ definitely has a lot more context than C.
 
@BenjaminGruenbaum Holy shit
 
<3 that
refreshing the page breaks it
reloading the application is fine
 
why is OAuth in Angular so frustrating.
 
9:59 PM
@corvid both oauth and angular are overcomplicated?
oauth sort of has an excuse, since it's security-related, and that's allowed to be complicated
 
took no time to do serverside OAuth
 
ok im really confused with my console log. I did this in my javascript:

console.log(myObj);
console.log(myObj.offsetX);

Yet I get undefined for offsetX
any reason why it might do this ?
 
u dun goofed
 
I can't think of one. The code you pasted looks all properly cased and spelled..
 
@Luggage spalled lol
 
10:08 PM
:)
I.. uhh.. meant to do that. It was a joke.
 
Are you sure the "undefined" isn't just the return value from console.log?
 
@Dave One reason would be that the value was modified between the two calls
 
@Retsam has a point.
 
@Retsam i don't follow?
@OliverSalzburg there is no code between the two console logs
 
console.log('hello') will output hello, then undefined
 
10:10 PM
!!> console.log('hello')
 
@Retsam "undefined" Logged: "hello"
 
My money is on offsetX changing between the time it's logged and the time you expand the object in the console
 
See, the "undefined" is what was returned by console.log (and the logging is just a side-effect). I'm pretty sure the "undefined" in your screenshot is the console.log return value.
Though, I'm not sure why you're not seeing anything logged for the offset, still
 
@Retsam I'm pretty sure you're wrong
 
What he says is valid but it might not be the problem.
 
10:12 PM
unless he's running this code in the console, it won't show the return values
 
ohh.. yea.. we never asked if that was int he console.
 
I tested it, and expending an object in the console shows the object at the time of expansion, not logging
 
@Luggage only in the console
if the console.logs are in his code, then they won't (also) result in undefined.
 
its not in console im calling it in the script
 
^ exactly
 
10:14 PM
Ah, nvm then.
 
@Dave can you show us some of your script?
 
I caught a wild goose.
 
Bare with me in just trying to find the point where it becomes undefined
 
GitHub question: github.com/MadaraUchiha/se-chat-client why is the author on the last commit not link to my user?
 
Try logging: console.log(JSON.stringify(myObj, null, 4)); instead of console.log(myObj)?
 
10:16 PM
@SecondRikudo Your gitconfig has a different email?
 
That won't have the issue with myObj changing between running the log statement and expanding the console object
 
@Luggage Yes
Ah, it wasn't configured
My bad
 
@SecondRikudo see deleted message.
 
@SomeKittens I know
I'll be removing this framework and making a new one anyway
@Luggage And delete it too please
Thanks
Not deleted message history is still public :P
 
I assumed that wasn't a real email when i posted it. :) sorry.
of course.. it's on github.. so not too big of a secret
 
10:18 PM
Any mail under the madara.ninja domain belongs to me
And they all converge on the same inbox, so you can send an email to whateverthehellyouwant@ and I'll get it
 
a commercial TLD?
 
@Luggage I bought it for myself, but yeah
There, now it looks good
 
I mean .ninja as a whole
 
Oh, yeah, I think.
 
Oh my gosh, guys, I found it, the worst commercial I have ever seen:
 
10:22 PM
Interesting.
 
This just played before my YouTube video and I watched the whole thing waiting for the punchline... and there wasn't one. It was just that dumb.
 
It's sad because that thing has a purpose. They just show it doing the most useless tasks.
 
I mean, sure, some macro keys are useful (though, uh, maybe just put them on a keyboard, not buy a whole separate box)...
 
A limited purpose, mind you. But a bunch of extra keys for things like video editing isn't the worst use.
right..
 
but really, a key that says "1200px"? I cracked up.
 
10:26 PM
yea..
 
Who wants to explain the most WAT moment I've had yet?
I have two tabs open to localhost. Different pages. We have an error reporting mechanism that pops up a modal with a stack trace when an error happens. I'm on page A debugging something, resulting in three errors (through four refreshes). I go to page B, and the error modal is open with all three errors I just had.
....how?
Said error ONLY happens on page A.
 
Pretty much.
 
So I've seen that gif a million times... but just learned from the url that that's Shia Leboeuf... weird.
 
@Retsam hahaha wth
if that keypad thing was fully customizable with lcd screens in the buttons it might actually be cool
 
10:37 PM
@Retsam oh yeah, hunt and peck. That's fair
 
@Loktar Yeah, but it looks like there's physical labels you'd have to change? Of course they don't show the 5 minutes it takes to print those out, cut them out, put the labels in, set up the macro...
 
user1596138
@Retsam hahaha what is this shit
 
user1596138
10 seconds to type your email
 
I'm surprised they don't have a "password" key on there, too.
 
user1596138
"hunter12" key
 
10:40 PM
^ Also, just noticed the logo at the end. "The No Slogan Company"? What the heck?
I'm seriously debating whether or not that whole thing isn't some elaborate parody.
 
What's a good HTTP error code for "I only support JSON but you sent me something else"?
(Violation of Accept headers)
 
> 406 Not Acceptable
The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request.
 
If I'm reading that right, isn't that if the server can only send resources that the client won't accept, not the other way around?
 
ooh, good catch
 
@SomeKittens I should put that on my business card
 
10:45 PM
Personally, I tend towards just using a small and simple set of error codes, so I'd just call it a 400, anyways.
 
@SomeKittens Yep, so don't even think about coming over here!
 
I suppose I'd especially do 400 in this case, because that's what I expect if I send garbage to a server, and the server doesn't really have a way of distinguishing "format I don't recognize" from "garbage".
 
After adding a class to an element, how can I refresh it's css?
When I add the class, the css does not change.
 
@BenBeri - CSS specificity is your issue, not refreshing anything
!!mdn Specificity
 
@adeneo "SyntaxError: missing ; before statement"
 
10:53 PM
what do u mean by that?
 
I'm not sure if specificity is your issue, but you don't need to "refresh css". As soon as you add the class the CSS is applied.
 
I mean that when you add the class to the element, the CSS just works, there's nothing to refresh, so either your CSS is wrong, the class wasn't added, or other styles are more specific. It's usually the latter.
 
var foo = '321 + -1.291e-08 * 12345'; is there a way to calculate/eval this? it works with normal numbers, but I can't get it to work with the scientific notation
 
I mean, I just did eval("321 + 1.291e-08 * 12345") and it seemed to work in my console. Though I'm not really recommending using eval to calculate math expressions necessarily...
 
hmm the real formula is much longer... let me check, I might have messed up something else in there
 
11:01 PM
Why are you storing your formulae as strings?
 
it's just for an admin tool and running in the browser, so eval should be fine
@Retsam they can be changed
 
@Patrick So you're letting the the user supply a string that's passed into eval? That sounds dangerous.
 
That's....kinda the definition of XSS
 
@Retsam no it's in a config file (php). I just need to be able to change it quickly
 
Speaking of, everyone read this: owasp.org/index.php/Top_10_2013-Top_10
Great docs here for securing node apps: npmjs.com/package/helmet
 
11:07 PM
ah I think it's the power operator (**) that js doesn't support... nevermind :)
 
Yeah, you'll need Math.pow
 
@Loktar imgur.com/gallery/LKkR6dG the occulus right strikes again! Russian style
 
Possible? Make a function that accepts a callback which returns a boolean, and return a callback the returns the opposite of that.
 
var invert = f => () => !f.apply(this, arguments)
I think?
seems to work
 
Yeah
var not = function(callback) {
    return function() {
        return !callback.apply(null, arguments);
    };
};
This binding....
No, I don't care about it.
Thanks :D
requiredFields.filter(not(presentIn(request.body)))
You gotta love functional programming :DD
 
11:16 PM
lol nice... I guess
Remind me to try LISP some time
 
Meh, use array comprehension
 
@copy array comprehension?
Does that even work in node?
 
Probably not
 
@copy Therefore this argument is invalid :P
 
11:31 PM
@copy You mentioned earlier not liking "Log in every day" bonuses. How do they compare in your mind to systems like WoW's rest?
 
Well, it's the same, just a bit more hidden
WoW's rest doesn't feel so bad. Maybe because it is only about experience
 
Interesting fact about the "rest" system. It used to be a penalty for playing too long and the players hated it. Then they reduced all exp gains and gave a corresponding bonus, giving the exact same result and players loved it.
 
@monners You're amazing.
 
@copy How so?
 
11:46 PM
@SomeKittens It's about experience, which I don't care much about (as opposed to items, especially ones that have real money value). It's not so much in my face. And the value doesn't increase every day
 
So you don't like the advantage going to players who log in all the time?
 
I don't want to feel like losing something if I don't log in
 
ah, that makes sense. In WoW, you're not losing anything, it's waiting there for you.
Cool, thanks
 
Ugh
 
What game is that?
 
11:49 PM
Guild Wars 2
 
MMOs make me sick
 
I like WoW's system, as it works particularly well for what we want SPACESHIPS to become (something players of different skill levels can play together).
 
and sad
and addicted
 
i.e. the full-time guy can still play with his unemployed friend and the time difference doesn't interfere.
 
@SomeKittens it was never like this in WoW
bonuses were just that, and capped
 
11:51 PM
But there were still bonuses
 
well rested etc
I think GW2 raises player levels according to the highest level in the group
which is kinda better but it's all about the gear in the end
experience means very little after a fairly early point
in almost all MMOs
 
Another thing I like was Borderlands - The lower level you were, the higher the proportion of XP you were given.
@Mosho Current plans for SPACESHIPS involve no XP at all
it's ALLLLL gear
 
don't know what spaceships is, really :P
 
It's a <canvas> project I build and am expanding with my brother
 
nice :D
can play?
 
11:56 PM
 
me so sad
 
My first lisp
 
@copy nice
 
Relatively easy to write considering the paren soup
 

« first day (1544 days earlier)      last day (3398 days later) »