« first day (2763 days earlier)      last day (2407 days later) » 

15:02
Why you would need a mutable String object is beyond me. I think you're overthinking it, or just stuck on a weird track. I would reconsider if you really need it.
mutable String object would not take extra space for copy operation
for what purpose are you trying to copy a string?
when you say str = 'abc' and perform any operation like charAt or indexOf or whatever, it first wraps primitive to wrapper object and then performs the operation charAt
internally
user8608046
Guys, can someone please review this
@JohnSam Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
user8608046
15:07
0
Q: How to allow language change even after detecting country?

JohnSamSo, I have developed a simple script: function checkForCountry () { let lang = '' let loc = window.location.href switch (code) { case 'DE': case 'AT': lang = '/de/' break case 'IT': l...

@ndugger Did I answer your question?
okay it looks like preventing default on drag start causes the problem with it not firing onDragEnd :\
@overexchange I'm not sure that's accurate. I know that in JS, primitives do have access to their Object equivalent's prototype, but I'm not sure it "wraps" it in the object internally when the prototype is accessed
Do you have documentation on this?
primitive type data are not objects in JS
String.prototype.charAt
@ndugger He's correct
15:11
they are both...
Oh, TIL
all the operations that you apply on primitive types come from their wrapper objects
!!> String.prototype.magic = function() { console.log(typeof this); }; 'abc'.magic()
Where is the behaviour documented?
@MadaraUchiha "ReferenceError: magic is not defined"
@MadaraUchiha "undefined" Logged: "object"
Chr
Chr
15:11
Hello everyone, where i can share my node project?
@ndugger ^
@Chr Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
there are primitive values in EcmaScript, but they get casted into their object representation if required internally
Well, I mean, like I said, primitives have access to their equivalent's prototype
@Chr As in, to get help with it?
15:11
But that doesn't mean they get wrapped in the object at execution of the prototype's methods
I could very well be wrong, but I haven't read the technical docs on primitives
@ndugger Inside the function, this is of type "object", and not "string"
Chr
Chr
@MadaraUchiha Yeah I will like to gather volunteers
would*
> JavaScript automatically converts primitives to String objects, so that it's possible to use String object methods for primitive strings
TIL
@Chr Volunteers for what? Maintaining the project?
If that's the case, GitHub is a good start.
@overexchange overall, I think the differences either way are so nominal, that it really doesn't matter. You either save on memory up front by dealing with low level primitives, or you deal with processing when converting the primitive to its object equivalent. I don't think you'll notice a difference either way
15:15
@ndugger If you are not applying any operation on primitive type except storing it, then you are good
Chr
Chr
@MadaraUchiha Yes, so that people can participate in the development, it would not commit to anything
@overexchange Copying the string is meaningless.
A string (even a boxed one) is immutable
Even if you are, the amount of addition processing time it will add isn't going to be noticeable. We're probably talking about single digit milliseconds, here
All of the so-called manipulations on strings always return a new string anyway.
Chr
Chr
@MadaraUchiha Yes my repo of my project is already initialized, but to make known the project it would be necessary that I could share them somewhere
15:16
@ndugger not sure what you guys are talking about, but a millisecond is a long time
In my case, it is more important for me to stick to paradigm(OOP), it is not important for me to know whether whether primitive is converted to wrapper object
@Chr Yeah, you want GitHub.
you're a long time
always a pleasure
@ndugger Most string manipulations are measured in nanoseconds, not milliseconds
user8608046
15:17
0
Q: How to allow language change even after detecting country?

JohnSamSo, I have developed a simple script: function checkForCountry () { let lang = '' let loc = window.location.href switch (code) { case 'DE': case 'AT': lang = '/de/' break case 'IT': l...

@overexchange Using primitives does not conflict with OOP
@MadaraUchiha yes, sure. My point is that you won't notice a difference in JS if you have an object or a primitive in 99% of all scenarios I can think of
performance-wise
@ndugger Also not performance-wise.
I agree.
Chr
Chr
@MadaraUchiha Okay, but how do I present the project? Here is the link to the repo github.com/log4b0at/jsreferencer-env-js
@Chr Share it on Twitter/Facebook, tell your friends, write blog posts about it
sassy
15:18
Maybe change your name to Dan Abramov
From OOP aspect, if my api returns a primitive and the user starts doing something like result1 + result2
Is there a layout manager that helps in designing user interfaces in SVG?
@littlepootis SVG has no layout manager
It's all absolute coordinates
@overexchange you know in JS you can add pretty much anything together by overwriting internal methods on the prototypes.
@ndugger No you can't
15:20
So that's not really valid
Chr
Chr
@MadaraUchiha I presented the project as best I could but as it is not long that I use github I do not know how to make known the project
That is why I'm looking for one. Right now, I've been manually trying to place the components by generating the x, y coords. It's a mess.
Chr
Chr
In fact I have trouble finding the community
You can't overload +, at best you can change toString()
@MadaraUchiha Can't you overwrite valueOf
15:20
@Chr Your question is a marketing question, not a technical one.
@ndugger Only if you return a number
JS allowing is different from relying on JavaScript constructors which are equivalent class(in ES5 world)
!!> Object.prototype.valueOf = () => 'asdf'; new Object() + 'ghjfghj';
You can't say that objA + objB === {...objA, objB} for example
@ndugger "SyntaxError: expected expression, got keyword 'return'"
oh, oops lol
15:21
@ndugger "asdfghjfghj"
yeah, you totally can
@ndugger Alright, you can with what's already addable
Chr
Chr
Ok
But you can't overload + for new types
Why OOPS now? Because TypeScript is trying to bring us on those lines.
15:22
Sure
You can't create a Vector class and overload + between two Vectors
!!> a = { valueOf() { return 2 }}; b = { valueOf() { return 3 }}; a + b
@overexchange No it doesn't
@littlepootis 5
No one is forcing you to use classes
Functions work perfectly well with TypeScript, in fact, we have several projects with TypeScript and very few classes.
15:23
!!> const foo = { [Symbol.toPrimitive] : () => 'hello world' }; console.log( foo + 123 ), 'lemon';
@rlemon "ReferenceError: Symbol is not defined"
ohh piss off cap
The notion that "types === classes" is a purely a Java notion.
is firefox really that far behind?
@ndugger No
15:23
Functional abstractions are alternative but that is also OOP. But that is not class based OOP
no, it's not in the whitelist
for whatever reason
@rlemon Because the whitelist hasn't been updated since Symbols were introduced to the language? :D
no it has been, I think it was just forgotten
Not using class does not mean....
15:24
@overexchange In what world are functional abstractions OO?
What do you think the characteristics of an OO system are?
it has objects and it's oriented
@ndugger Doesn't sound very oriented to me
Ah please visit SICP course from UoC Berkeley, they are better source for it, to explain. That is a long story... how to OOP using functions. I did this using C, sometime back
I don't think my object orientation is relevant to professional javascript discussion
@overexchange because universities are such a great source of information
But I can't explain you in chatroom, please visit my github repo, there is lot of code using functional abstractions that includes SICP assignments
15:27
I'll pass
@MadaraUchiha here is the code following pure OOP using C
4 mins ago, by Madara Uchiha
What do you think the characteristics of an OO system are?
finally I'll learn what OOP is
Chr
Chr
@overexchange Sorry to be insistent but I do not know any other developer NodeJS with whom I could share my project
orientation oriented programming
15:29
It sounds like you're confusing functions with functional..
Chr
Chr
@MadaraUchiha *
Just like having objects doesn't mean your code is OO, having functions doesn't mean your code is functional
@Chr What exactly are you hoping to get from me?
@overexchange Hmm, doesn't look very OOP to me, nevermind "pure"
@MadaraUchiha :*
@Chr Don't ping random people
Chr
Chr
15:32
@MadaraUchiha I would like to meet developers, but I can not find any open community on the web
@KendallFrey well they'll get something from Madara that way
@Chr Look for meetups near your area
Chr
Chr
@KendallFrey sorry I made a mistake
That is fine... may be am wrong in my understanding of OOP.
@Chr You are in such a community
15:32
then you would say "OOPS"
@AndrasDeak The main technical feature that differentiates OO from the rest is polymorphic dispatch.
The fact that I have a function in which what's usually referred to as this is different depending on the circumstances of the call
Hey people
Hmm. I'm wondering if python falls into that category :)
@AndrasDeak It's right there on the border
oh, yeah, it is I guess
15:33
Because the polymorphic dispatch in Python is very explicit
I have polymorphic code there implementing vtable, please visit the code... I shared
just to be sure: does that imply that python is not very OOP or does that imply that the short definition you gave is not comprehensive?
Sid
Sid
I'm really struggling to get my head around this: https://stackoverflow.com/questions/50273715/how-to-implement-a-multi-step-navigation-filter-form-in-reactjs

anyone please?
@AndrasDeak It means that Python is less close to the classic definition of OO
I see, thanks
15:34
It doesn't reduce from its power as an OO system, of course
Different languages implement this feature differently
JavaScript, for example, is on the other end of the spectrum
I never gave it a thought (mostly because I'm not well-versed in programming paradigms), but I took it for granted that python is OOP due to the whole "everything is an object" thing
prototypal inheritance is my jam
this (barring special cases) is whatever is found before the .
But you can, at call-time, change this to be literally whatever you want
Even if it's outside of classes/objects
yeah, I caught your lecture the other day about this :)
then again this seems to come up a lot
In Common Lisp, for example, you define the dispatch predicate for each method
You can say "this method applies to all objects of class X" but even "this method applies to all objects of class X with property "name" that starts with "M""
And even "this method applies only to instances that are === to THIS instance"
15:37
that sounds awful
And powerful. Powaful?
@ndugger It's definitely powerful, and enables you to do some pretty nifty shit
For sure, but I can imagine the confusion when one instance has a method and another doesn't, both of the same class
The default is what you're used to from normal OO languages, i.e. "this applies to all objects of class X"
@ndugger Remember that Common Lisp was conceived when "OO" was a new exciting concept that wasn't very well defined, and implement almost nowhere.
fair enough
15:39
also, CLOS, the Common Lisp Object System, was added afterwards, and is implemented 100% with Common Lisp macros
@MadaraUchiha For your point of functional abstractions providing OOP, I use array of structure of function pointer in C to provide polymorphic dispatch.
@overexchange That's fine, but that's not a functional abstraction
It uses functions, sure. But it's not a functional abstraction.
having functions does not necessarily equate to having functional code
Functional abstraction has nothing to do with providing polymorphism using that same function
I think we've hit a language barrier
15:41
Functional abstraction is an abstraction
red is a color
@overexchange higher order functions is an example for a functional abstraction.
[1,2,3].map(x => x * 2) is an example of functional abstraction.
Yes am just looking for right code in my repo, instead of talking here
15:45
|_o_|
is it okay if I ask you guys a JS question?
!!welcome PerrinPrograms
@PerrinPrograms Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@Caprica Six got it. Thanks
How do I loop through an array of objects in javascript.. in C# it would be..

foreach(objecttype object in theObjectArray) but I'm having trouble finding something similar in javascript.
@PerrinPrograms Look into for..of and Object.entries() ah, it's an array
15:49
I don't mean to be rude, but how are you having trouble finding how to loop in JS? That would be like the #1 google result for "how to loop in javascript"
for (const object of theObjectArray) {
  // use object here
}
I'm not having trouble looping in JS
@MadaraUchiha This is what I meant by an abstraction
4
Q: Building Data abstraction and ADT for rectangle using "objects"

overexchangeFor the below given exercise: Exercise 7: Abstracting Rectangles Implement a representation for rectangles in a plane. (Hint: You may want to make use of your procedures from exercise 5). Then, in terms of your constructors and selectors, create procedures that compute the perimeter and ...

I've wrote a million loops in JS
I've never really worked with classes in JS before
@PerrinPrograms Why do classes matter in this case?
15:50
I don't see what loops has to do with classes, but as Madara said above, for..of is the closest thing we have to what you're looking for
You have an array of "things" and you want to iterate that array
you do not always need higher order function for writing an abstraction
But i have one more example for it
I usually write loops like this in js. for(var i = 0;i < array.length; i++)
but in this case I want to write an array like
I haven't written a loop like that in years
@PerrinPrograms you've already been given the answer
15:52
fair enough
-6
Q: How to permanently hide the JavaScript warning?

lovemyjobIs there a way to get rid of the "Meta Stack Overflow works best with JavaScript enabled" that sits on top of the page? Bearing in mind I do not want to enable JavaScript in my browser. BTW - I wanted to ask that question without JavaScript but was stopped by the reCaptcha which requires JavaS...

I like the tag on there
You could also target that element with a userscript to remove it. :P — yivi 7 hours ago
Obligatory :D
it's the JS mafia forcing us to use JS
@ndugger that sort of makes sense
Nobody is forcing anyone to enable javascript, but don't expect the web to work at all these days without it
15:56
it's not a FR nor a bug nor a discussion post, so...
@AndrasDeak right, but StackOverflow is about programming questions, and meta is more about questions about the site and community. I don't think asking how to modify the expected behaviour of the UI is on topic.
hmm, good point, I was thinking within meta
The description is "A request for assistance with one of the site's features."
Fits pretty well imo
But then "how do I get rid of this JS warning in my browser" might be a non-programming question, so off-topic for SO? Ask on superuser? :P
It's kind of just off topic for everything, unless there's a userscript exchange
15:59
Stack Apps? :D
so we really do need r/programming!
it is on topic for meta
for the same reason "how do i remove the ads" is on topic
Does the fact that removing the ads is a feature, unlike removing the JS warning, make a difference?
I would argue yes
I would also argue that disabling JS in your browser is a really weird thing to do these days
I actually can't believe that modern browsers still offer that option at all
there's also noscript (and the like) that would do it for you anyway
16:07
Hi there
I need to create an object of my custom response and send that object back to the angular component
How can I do that?
This is a method of my Provider
signUp(signUpDetails: SignupDetails)
	{
		return this.http.post(SIGNUP_URL, signUpDetails).subscribe((response : ApiResponse) =>
		{
			response.doSomething();
		});
	}
I need to access the response.doSomething() in my component
Is there any way so that I can automatically create an instance of my "ApiResponse" in the subscribe ()
user6086034
user6086034
did anyone know about this
user6086034
so cool
how do you guys do authentication with your react/redux applications?
Do you use server side rendering + handlebars/pug for login and signup pages,
then react router for the app?
Or is your entire application single page?
Also, do you use tokens or cookies?
Hi guys
16:22
ohhi
How can I convert 'a,b,c,d' to ['a'],['b'],['c'],[d] .I have tried spread operator but its not compatible with IE
I have function call like this funct_call(['a'],['b'],['c'],['d']);
apply after map
@Exception .apply for older browsers
16:26
.map to make it an array of arrays, then .apply to call the function with it
ohh okay
Didn't this get answered in here already? It looks familiar
    var string = "a,b,c,d";

    string.split(",").map(letter => {
        return [letter]
    });
undoubtedly
@Exception How about that?
16:27
async.forEachOf(venue_1_split, function (venue, key, callback) {

pool.query("INSERT INTO peminjaman_venue VALUES (?,?,?,?,?,?,?)",
                        [id_event, venue, id_google_calendar, waktu_mulai_1, waktu_selesai_1, tanggal_peminjaman_1, tanggal_peminjaman_1],
                        function(err, rows, fields){
                            if (err) throw err;
                        });

                            req.flash('message_success', 'Berhasil mengajukan event');
                            callback(res.redirect('/pengajuan_event'));
3 hours ago, by rlemon
!!> "['a'],['b'],['c'],['d']".split(',').map(a => a.slice(2,-2)).reduce((a,b) => (a.push([b]),a),[])
hi guys why my loop above stopped on 2nd iteration?
@ndugger yes this one
@hfbachri_ there is no loop in your code
@ndugger that async.foreachof
16:28
that's a function
in what way did it stop
HAMMERTIME!
@ndugger that is Async foreach
@hfbachri_ I'm almost certain you're only allowed one res.redirect()
@hfbachri_ sure, but it's still a function
16:31
you're not helping
is this the async module?
@ndugger Don't be purposefully dense, it's npm's async
It's not very welcoming to call people names
@MadaraUchiha yes. I only want to call res.redirect once. But dunno how haha
@ndugger ya it is
oh, I stand corrected
16:32
@hfbachri_ You should probably drop the async package altogether
how how
And move to Promises
how to do iteration with promise?
@MadaraUchiha
there are async iterators now, right? Where did that land?
yes @ndugger
16:34
Chrome got it in v63, which was 3 versions ago
that's your answer
@MadaraUchiha so what i should use?
Promises are standard objects; you can just use them directly
Bluebird tends to be a popular promise library, though, if you're looking for something a little extra
ok thankyou
16:49
promiseFor(function(count) {
							return count < venue_1_split.length;
						}, function(count) {
							pool.query("INSERT INTO peminjaman_venue VALUES (?,?,?,?,?,?,?)",
							[id_event, venue, id_google_calendar, waktu_mulai_1, waktu_selesai_1, tanggal_peminjaman_1, tanggal_peminjaman_1],
							function(err, rows, fields){
								if (err) throw err;
							});
							 return ++count;

						}, 0).then(function(){
							req.flash('message_success', 'Berhasil mengajukan event');
							callback(res.redirect('/pengajuan_event'));
why it doesnt work? @MadaraUchiha
I don't see a Promise in your code at all
well, if you fix the crappy formatting.
there is something that we can assume is a promise
pool.query?
promiseFor() returns a promise
presumably.
promiseFor(function(count) {
  return count < venue_1_split.length;
}, function(count) {
  pool.query("INSERT INTO peminjaman_venue VALUES (?,?,?,?,?,?,?)", [id_event, venue, id_google_calendar, waktu_mulai_1, waktu_selesai_1, tanggal_peminjaman_1, tanggal_peminjaman_1],
    function(err, rows, fields) {
      if (err) throw err;
    });
  return ++count;

}, 0).then(function() {
  req.flash('message_success', 'Berhasil mengajukan event');
  callback(res.redirect('/pengajuan_event'));
});
little easier to see formatted
I couldn't tell what the .then was on
16:54
@rlemon thank you
so can you fix my code guys?
I have no idea what your problem is, I just was trying to help other people see the code properly
@rlemon i want to generate the success message and redirect the user to specific page when the iteration is done
> I have no idea what your problem is
me when I meet most people
@hfbachri_ I don't know what promise lib you're using, and I probably wont learn it to fix the problem.
now, with that said, assuming pool is from pg, that already returns promises.

« first day (2763 days earlier)      last day (2407 days later) »