« first day (2036 days earlier)      last day (3135 days later) » 

07:05
I want to get metadata when application starts
then if someone makes another request, I want to wait till metadata is loaded
var a = [1,2,3]
[4,5,6].forEach(a.push.bind(a))
why doesn't that work as intended?
not supported by iE8, forEach...
who cares about IE8?
Well, I don't, and it still doesn't work
07:07
that's a bad luck then :|
how the hell is it luck?
Do you play die with your JS programs?
why are you pushing and binding at same time ?
because I want 4,5,6 to be pushed to a?
I don't think I understand your question.
Aren't there params before the function?
I wanted an equivalent of function(x) { a.push(x); }
07:09
And why bind?
@towc before which function?
@towc to make this in push equal to a?
Also, ever heard of concat?
var a = [1,2,3]
console.log([4,5,6].concat(a));
why not using concat ?
@towc Knowing JS it probably doesn't work on the version I happen to be using, but I'll check that
concat doesn't work?
07:10
> probably
I think his account is hacked...
what ES version is it?
@BartekBanachewicz ES3, I guess
@Mathematics it doesn't specify the ES version
07:11
@BartekBanachewicz IE 5.5 , what do you think ?
k, sounds okay. But still no one has been able to explain why my original solution didn't work.
I petty for your employer
what are you binding there, there's nothing to bind...
@Mathematics I am binding the a object.
Hardly nothing, isn't it?
@BartekBanachewicz I petty you too
lel guys seriously you're supposed to be js super experts
@Neil I wonder if he meant "pity"
07:16
@BartekBanachewicz Don't sweat the petty things and don't pet the sweaty things
@BartekBanachewicz what actually happens?
On mobile, my brain does work tho
at least I didn't said "pretty"...
07:17
I didn't want to try again because I was afraid it would break my PC
It could have been something else
when I ask a question, everyone's knowledge here comes to an end ! :|
@Mathematics Because you're a vamp, and your questions are usually hard to comprehend.
morning
07:18
@Mathematics you've found the ancient elephant idea grounds where ideas come to die
!!> var a = [ 1,2,3 ], b=[4,5,6];b.forEach(a.push.bind(a));a
@towc did you meet Jan? were you prepared for the grammar and spellings exam?
@towc "undefined"
!!> var a = [ 1,2,3 ]; [4,5,6].forEach(a.push.bind(a)); a
@littlepootis [1,2,3,4,0,[4,5,6],5,1,[4,5,6],6,2,[4,5,6]]
@towc [1,2,3,4,0,[4,5,6],5,1,[4,5,6],6,2,[4,5,6]]
07:19
Dafuuuuq
Oooh
Yes, for each has multiple params
!!> a=[1,2];a.push(3,4,5,6,[1,5,8]); a
@towc [1,2,3,4,5,6,[1,5,8]]
That's what happens @BartekBanachewicz
@towc no, push has multiple params :/, that's the real problem
07:22
Why are you binding?
god damn it
@BartekBanachewicz that's a feature, not a bug :P
@AwalGarg my ass
I wonder how many idiotic misfeatures I'm yet to discover in JS
!!> var a = [ 1,2,3 ]; [4,5,6].forEach(["some", "weird", "array"].push.bind(a)); a
@littlepootis [1,2,3,4,0,[4,5,6],5,1,[4,5,6],6,2,[4,5,6]]
07:23
@BartekBanachewicz You're just touching the surface ;)
@BartekBanachewicz why are you using bind in the first place? just create a lambda?
!!> a=[1];a.forEach(function(a,b,c,d){console.log(a,b,c,d)})
@towc "undefined" Logged: 1,0,[1],"undefined"
Great way to screw up an array
@BartekBanachewicz ^
07:23
@AwalGarg because I don't have access to ES6 lambdas and the regular ones suck
For each passes multiple parameters
@towc yes I know what forEach does.
Anyway though, concat is ES3, use that.
@BartekBanachewicz what are you developing and what browser would it be for ?
what I didn't know was that push can take multiple params
07:23
So it is expected behaviour
Oooh
@BenFortune yes, we already did find that and I've fixed it
N00b
Oh, sorry
Was too concentrated typing code on mobile
How is there not a genious mobile ice yet?
Ide*
This is the javascript room. For once we're on topic and you ask them to stop?
6
anyway thanks @towc
Np
Sorry again
07:28
@BartekBanachewicz I helped you yesterday and today, or at least tried it though :|
I just noticed the pin
wow
He's unfamiliar with the rules, give him a break
ok, am on break, brb
@Mathematics bartek is a respected member of this community, he comes here rarely know, but he knows his stuff. He has the right to ask questions like that, we all love him #nohomo
He also doesn't like fun... that math guy
07:32
31 messages moved to JS trash
Grow the fuck up, y'all.
Sheesh.
Had to get that out of my system.
If someone is unfamiliar with a certain function and wants to know more about it, don't belittle him.
Or she her
*her ;-)
4
Q: Why is apply not already bound to functions in Javascript?

StankalankAssume, for the sake of this question, that I want to be able to create a function in Javascript that appends all of the elements of one array to another array. One way to achieve this, if you have access to the destination array, is to say: var destination = [1,2,3]; var source = [4,5]; Array.p...

Nothing quite kills a room like an angry RO stepping in... *cough*
07:38
RO ?
Room owner
@Mathematics Racial Oppression
@littlepootis that too
Radical Orwellian
"I'll be watching you..."
Big brother is watching you
07:41
Red onions
Ripe Olives
Now I am getting hungry
I have a requirement to check all the input fields are filled or not. If the input field is disabled then I have to ignore. So for this my function is as follows
$('#ctSchedulePopUp').find('input').each(function () { //console.log(this)
if($(this).is(':disabled') || $(this).is(':hidden'))
{

}
else
{
if(this.value==null || this.value=="")
{
alert('All fields are mandatory');
return false;
}}
});
as if($(this).is(':disabled') || $(this).is(':hidden'))
				{

				}
looks ugly
@littlepootis That site is broken.
07:44
@SpringLearner Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
so I modified the code as below
$('#ctSchedulePopUp').find('input').not(':disabled').not(':hidden').each(function () { //console.log(this)

      if(this.value==null || this.value=="")
          {
          alert('All fields are mandatory');
          return false;
          }
  });
@SpringLearner It looks ugly because of bad indentation
do this:
if (cond) {
not
@SpringLearner Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
if (cond)
{
It's better to check later than use jQuery's not.
07:47
!this.value.length
if (cond)
    {
Is using `.not('disabled').not(':hidden')` equivalent of `if($(this).is(':disabled') || $(this).is(':hidden'))
{

} `
@SpringLearner Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
@SpringLearner It is, but don't
@littlepootis do you want me not to use .not
07:49
@SpringLearner no, in one case you're filtering results and in the other you're using it as criteria for an if
@SpringLearner: Could you read what CapricaSix keeps telling you?
Oh wait nevermind, you mean as a selector
@Neil so how would I impreove that piece of code
@SpringLearner don't. Because jQuery filters your elements twice.
@Cerbrus I am using `` in between the codes but I dont know why its not formatting here
07:51
READ what Cap is saying.
Then follow those instructions
brb lunch
@littlepootis ignore all the notifs please just testing something
now its not allowing me to edit
next time I will post codes, i will format
You can edit a previous post for 2 minutes.
Then it's locked
ok
do you have any ansnwers for my questions?
07:53
@Cerbrus nah, I actually went out to grab a coffee, but now the storm seems to have settled
Yea, I figured I'd step in... The discussion was getting nowhere
@SpringLearner you could actually filter for your last if as well
just remember that jQ passes the index as the first element to the filter callback
You could handle it in another way: only hide or only disable inputs. Don't mix and match, or if you do, disable inputs when you hide them so you need only search for inputs that are not disabled
@Cerbrus I didn't intend on asking for permission to write to jstrash. :p
I found myself there and it was hard to distinguish from this room on mobile
08:11
Oh maaaaan, with JavaScript now, when you want to start a new personnal project, you spend so much time to look at "what build system to use", "React or Angular ?", "handlebars? Jade?", "sass? stylus? less?" that you get fed up with your project before creating the freaking project directory.
You forgot babel, bluebird
Nope, those have no equivalent. You use them and that's it
hey morning guys.
need help. what's wrong with this. appreciate any advise
function func1(name, profession, prof1, prof2) {
	console.log('My name is ' + this.name + ' and my profession is ' + this.profession + ' he is ' + prof1 + prof2);
};


var person1 = {
	name: 'johnny',
	profession: 'policeman'
};
func1.call(person1, 'jon', 'nurse');
@Ming, func1.call(person1, null, null, 'jon', 'nurse');
@dievardump I use bluebird so it is mostly that I am playing devil's advocate, but what's wrong with Q?
08:20
@Ming, your func1 actually not using its arguments "name" and "profession"
@dievardump Traceur, Q
@ru_volt thanks for the help. meaning my num of arguments in call() must equal to args in my function?
@Ming, actually not) When you are using "call" you are passing arguments to your function
Last time I checked (it was a long time ago, I must say), bluebird was aiming to be 100% compatible with the official Promise definition, when Q was not
@Ming, now first 2 arguments of your function just useless
08:22
I don't know if it changed since then
Calling a JS method from multiple different classes...

This JS method is a web service call, so I want multiple sources to wait till request is completed. (don't want to make multiple calls to server)

if request is completed then give them cached data

is this possible ?/
1 message moved to Trash can
@ru_volt Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
function func1(prof1, prof2) {
	console.log('My name is ' + this.name + ' and my profession is ' + this.profession + ' he is ' + prof1 + prof2);
};
@ru_volt thanks. i got it.
@ru_volt :)
@ru_volt if i did this. func1.apply(func1, arguments). what idea what it means?
@Mathematics Please don't add that many empty lines.
08:25
I won't next time :), thought it would be more readable
@ru_volt the full code. I just don't get that particular part.
var memoize = function(f) {
  var cache = {};

  return function() {
    var arg_str = JSON.stringify(arguments);
    cache[arg_str] = cache[arg_str] || f.apply(f, arguments);
    return cache[arg_str];
  };
};
@Ming,
the same:
context.func(arg1, arg2)
func.call(context, arg1, arg2)
func.apply(context, [arg1, arg2])
@ru_volt any example? can't fully get it.
because it seems like using the same func to apply to itself
@BartekBanachewicz disabled fields can appear at any place
So I can not use last
which would be the correct word to describe the process of r.js (require.js) when creating from many modules a single file. Hope my Q is understandable ;) It isn´t compiling or?
08:30
bundling?
could fit
are these the same?
f.apply(f, arguments)
f.apply(this, arguments)
If f === this sure, otherwise no.
@BenFortune how to know if f === this?
isnt this pointing to f ?
@Mathematics something like that should work
var myWebServiceCall = (function () {
	var cache = null;

	return function (callback) {
		if (cache === null) {
			request(...).done(function (data) {
				cache = data;
				callback(cache);
			});
		} else {
			callback(cache);
		}
	};
}());

// in module one
myWebServiceCall(function (data) {
	// do whatever with the data
});

// in module two
myWebServiceCall(function (data) {
	// do whatever with the data
});
08:34
@Ming, no time to clearly explain. There are a lot of articles about it

this - is a special object realted to function
@Ming, when you are using f.apply, and f.call you are actually not dealing with f anymore, only with function
and using first argument of apply and call to specify "this" object of function
@dievardump Thanks, going to go through it now
@BenFortune Not always :P
@Mathematics you also can use Promises, which would be nicer
@ru_volt thanks. sort of get it. will look it up further.
But try first t understand what I did here
08:37
I am already using promises, I am not sure if
for example let say 2 requests call same method, they both going to have there own promises - which is fine... but I don't want to make 2 web requests
@Ming, typo:
when you are using f.myFunc.apply, and f.myFunc.call you are actually not dealing with f anymore, only with f.myFunc
in C# its done using a singleton class, I believe that's what I need in JS as well, let me google it
Hi all, I have requirejs question:
How can I async load module from define() callback?
@ru_volt ah. i see. alright. thanks.
Im trying to do some kind of router inside define module
08:44
@Mathematics singletons are discouraged, even in c#
Maybe you're thinking of something more like a factory? An instance creating other instances?
guys can i understand a (ERR_CONNECTION_REFUSED) while i use $.post ?
if (status == "success") //everything ok
but what is the status message when ERR_CONNECTION_REFUSED ?
@gtzinos try it
nothing returned
this is the problem
method never called
There should be a http code at least
$.post("./GetDetails.php",
{
    "server-id": server
},
function (data, status) {
    alert(status);
});
never called
when ERR_CONNECTION_REFUSED
08:52
@gtzinos that is success callback
You need to add a .fail callback for error case or .always for both cases
how ?
using $.post
MongoDB announced 10,000,000 downloads! Or, as their other two partitions reported, 9,999,323 and 10,001,403 downloads.
09:09
@littlepootis awal.js.org/free-private-gh dude I already got 11 token requests. not far away from world domination
@AwalGarg wow. So, just a PoC.
world domination on a PoC. That's how this world works anyways
If only I had known that it were so simple!
They're pinky and the brain, they're pinky and the brain. One is a genius, the other's insane. .
09:17
@littlepootis just yesterday someone was telling me how it is impossible to create anything with vanillajs now
@AwalGarg that's a blasphemy
I have a premium account. How do I generate tokens for others to use?
greg
@littlepootis ever heard of bitcoins?
It's nothing like that
09:24
@AwalGarg No... how do I do it myself?
hmm, the downside is that now my gh notifications are full of crypto tokens :(
great
Submit to HN
( Í¡° ͜ʖ Í¡°)
I did. probably that's where all the reqs are coming in from: news.ycombinator.com/shownew
Aw, I already have a paid account :(
hey jungs
I want to do some react.js with express.

is that possible?
"It renders static markup and does not support mounting those views on the client."
how can I do dynamic markup with express + react?
09:37
Hey everybody, can anyone recommend some opensource projects built with react + alt.js? Trying to figure out a good project structure and there's nothing better than looking at other people's projects.
@GlebKost 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.
lel, I just had to play the devil's advocate in the TS vs JS discussion
so no one has me a hint? react + express tutorial?
09:54
I am so, so glad I don't do web development
the utter chaos is just stunning
why?
what do you do?
is there something else than web?
Oo
web is the futureeeee
@PomeGranate is that a serious question
@PomeGranate nodejs perf monitoring
no its not..
what do you have to do there? isn't it just download a tool and start it?
and than wait till someting brokes
@PomeGranate I am writing a thing you download and start.
aha YOU are the creator of such a thing
ok ok nice
I have a big project, and maybe I need also such a monitoring tool, which one do you recommend? I've never used such things
09:59
I work at ruxit.com, it's free to check out
wish js had an email method
what do you mean by "js"?
@SuperUberDuper there are a few reasons why that would be a bad idea
@SuperUberDuper Like, browser JS?
yes in browser
jquery code is 2nd class code
10:14
you want to send email with javascript?
hey why do I have so many downvotes here:
-2
A: Create User with Avatar in Sails.js fails when Avatar is an image/png

PomeGranateI searched over 2 weeks and found this: https://github.com/balderdashy/sails/issues/2326 You don't have to install skipper and require('skipper') => Sails comes automatically with skipper! Also don't use it as a policy, it won't work ( didn't for me). What you have to pay attention to for a mul...

is the language bad?
@SuperUberDuper a malicious script takes control of your Web page and sends access information that it finds to an anonymous and temporary email address
@SuperUberDuper lolwat
@PomeGranate It's wrong.
@BenFortune no its not. I tested it. that works for me. why do you think that its wrong?
@PomeGranate You're spreading misinformation.
> the order of your input fields in your html form matters
10:21
yes it matters
@BenFortune why do you say that? I tested it!
@BenFortune have you tested it?
If it matters, then the parser fucking sucks
@BenFortune Protip: parsers suck
handed out 15 private repos till now. I wonder how long until github bans me :P
hey @Bartek, you seem to be the architecture expert, any guidline for improving asnychronus code, me messing around with all kinds of promises and callbacks and everything went bad :[
10:27
why would they ban you?
@BartekBanachewicz because this feels wrong to me.
@ClemensHimmer "I did something, and it went bad. What should I do instead?" - I have no idea what was that you actually did and why was it bad.
@AwalGarg um? But they said it's unlimited now.
@BartekBanachewicz it is unlimited for personal usage, not to exploit loopholes in their system to give everyone unlimited free private repos :P
@AwalGarg how did you do that? Added people as contributors and then left?
Hi, do You know a good library to cropping images in JS?
10:30
@JacekGzel 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.
@BartekBanachewicz oh well, i probably worded non-optimal, my bad. do you have any guide, tutorial, book or something to recommend on asynch coding? that was what i was basically wanted to ask, nothing specific :)
@BartekBanachewicz read the readme github.com/awalGarg/free-private-gh/blob/gh-pages/readme.md that explains
@AwalGarg I wonder what happens when the original creator stops paying
all repositories are locked
that's in their documentation
I suppose they will fix that by expecting contributors to private repos to be on paid plan
that's what I'd do
10:33
that would break a lot of workflows, though
have you contacted them with that already?
because you really should
no. if the invite requests go above a large number which could potentially harm github, then I would.
So I'll do it.
Writing a PoC to show it works is one thing. Exposing that for people to use is another.
You're already potentially harming them, because users of your service could pay instead.
@BartekBanachewicz well they need invites to use the demo. And I manually hand out invite tokens.
@AwalGarg Now try proving you're not actually taking money for that
10:35
fair enough. lemme ping them on twitter.
https://github.com/awalGarg/free-private-gh is this within your toc @github? NB: Just a PoC. I won't give more than 50 invite tokens on the demo.
@BartekBanachewicz ^ done
And they pinned twitter.com/github/status/730292560074153985 which says "unlimited possibilities"
@AwalGarg heh, someone summed it up nicely; bitbucket has had free private repos for quite some time anyway
@BenFortune lol
Guys any simple app that would make one understand the concept of an event loop in javascript...
I took to the idea of counting visitors online in a web app that uses express...
Is there anything more simple?
while(queue.waitForMessage()){
  queue.processNextMessage();
}
you get an event, you process it. Loop.
10:50
node's event loop and why the code is executed async
@deostroll it's an implementation detail
it works in exactly the same way except you don't see the loop
the event loop is not async. it is synchronous (just like in bartek's code). the "processes" that run are async.
you're just responsible for "process next message" part
I know it isn't async, but I kind of want to humor it to someone somewhat new to javascript...
teaching is hard
10:58
Hi guys
Based on this fiddle:jsfiddle.net/ur37dvzt/1
I am trying to achieve same like in above fiddle but getting messy output with canvas tag
@BartekBanachewicz you know it does a lot more than that though, right? it never blocks because of page faults
This is my question:
@Learning You learnt that quick, nice.
1
Q: Update html canvas tag on every ajax request with new data

LearningI want to update my canvas on every ajax request if new user is found or there is new connection of existing users. I have users and connections between them: var data=[ { "Id": 38, "Connections":[39,40], "Name":"ABc" }, ...

@BenFortune:not really.still trying my hands on it
@doug65536 sure it does
11:01
@BartekBanachewicz the cool part of node's event loop is, it will prefault all the memory involved with I/O events and it will never let a page fault cause it to block
I'm in Moravia; team building activity :-D
is it possible to update canvas tag
i am confuse'
... And moments of happiness have been shattered by a vague and unclear question
11:35
@JanDvorak is "have" correct there? shouldn't it be "has"?
if yes, then your license to correct grammatical mistakes in this room has been henceforth revoked.
Moments are plural
@AwalGarg Plural, pleb
nvm I spoke too quick
Your license to whine about my grammar imperfections has henceforth been revoked.
@github Unlimited possibilities: https://github.com/awalGarg/free-private-gh
11:39
You may still notify me about them.
@littlepootis lol nice snark. but I pinged them already :P
I know
I'm trying to be funny
success rate: 4/10
you are the worst possible evil dude of the century
11:45
i want to believe that there is an parallel universe where that song never existed
@GeoPhoenix There is. You can get access to it through information embedded in the lyrics
it's friday
:D :D :D
true ^
link please
nodejs on a satellite? wat
11:55
One of the guys you ignore shared this: reaktor.com/blog/…
lol who wants left-pad again
> With JavaScript, developers can also update the software in the satellite, allowing them to extend the functionality after the launch

« first day (2036 days earlier)      last day (3135 days later) »