« first day (2812 days earlier)      last day (2358 days later) » 

00:51
i guess we will never know what maciej was going to ask
01:03
morn
@towc am I on time today?
01:16
@oboecat heh, that is neat appleinsider.com/articles/18/03/15/…
what are the best practices to handle a code like
findQueues(cfn, options)
    .then((queues) => selectQueue(queues))
    .then((queue) => triageSelection(queue))
    .then((data) => actions[data.action](sqs, data.queue))
    .then(() => callback())
    .catch((err) => callback(err));
in async await
what do you think will it be ?
the first step is to make all the code that uses findQueues expect it to return a promise, rather than passing it a callback
and then you simply change the .thens into a series of normal statements with awaits
try {
   const queues =  findQueues(cfn, options);
   const queue = selectQueue(queues);
   const data = triageSelection(queue);
   actions[data.action](sqs, data.queue);
   callback();
} catch (err) {
   callback(err);
}
That is assuming all your code is sync, which from your function names it sounds like if its not add an await. Also in PromiseLand
oo there is one thing, every next method should be called only if there is some value in the what the previous one returned
01:20
your .then will not do that, afaik the chain will still execute unless something throws ahem rejects, coughs hair ball out
so call triageSelection if selectQueue returned something
Hey I just met you and this is crazy, but I am if, so use me maybe?
😃
@ShrekOverflow won't you get a callback not defined error?
I am assuming your callback comes from somewhere (are you trying to callbackify an async await function?)
like in your code
.then(() => callback())
.catch((err) => callback(err));
  const main = async() => {
    console.log('inside async()');

    const options = {
      stackName: process.argv[2],
      region: process.argv[3] || 'us-east-1'
    };

    const sqs = new AWS.SQS({ region: options.region });
    const cfn = new AWS.CloudFormation({ region: options.region });

    const actions = { purge, writeOut, replay, triage };
    try {
      const queues = await findQueues(cfn, options);

      const queue = await selectQueue(queues);
      const data = await triageSelection(queue);
no, i don't have a callback
from the previous non async/await i'm able to make sure that the next method is not called if first one returned a promise.reject
but with this uhoh
have any ideas?
01:26
this one does the same
rejected promises throw exceptions in async functions
@david more precisely, async functions convert catch blocks to .catch() handlers
You have exhausted the entropy-pool in my head 😛, your code should just work vOv
it isn't, test fails
1. due to it going to subsequent calls
2. as i don't think i'm handling the error returned from any of the message properly
  const queue = await selectQueue(queues);
  if (!queue){
         return;
  }
although, @KendallFrey suggested throwing an error earlier today and letting the main function just die.
async function findQueues(cfn, options) {
  console.log('inside findQueues');
  const res = await cfn.describeStacks({ StackName: options.stackName }).promise();
  console.log(res);
  try {
    if (!res.Stacks[0]) {
      return await Promise.reject(new Error(`Could not find ${options.stackName} in ${options.region}`));
    }
  } catch (err) {
    console.log(err);
    return;
  }
01:32
5 hours ago, by ShrekOverflow
so asically inside await discoverPhoto(); do something like catch(e) { throw new Error("Unable to download photo"); } and let the main function exit ?
this is how return a promise.reject in findqueues
ouch return await Promise.reject(new Error(Could not find ${options.stackName} in ${options.region}));
it sounds like the code you showed us isn't the code you actually have
you can just do
throw new Error(`Could not find ${options.stackName} in ${options.region}`)
Btw if you throw an error flow of control will automatically stop at that point and the catch block will capture it / will be executed.
i added something like
   const actions = { purge, writeOut, replay, triage };
    try {
      const queues = await findQueues(cfn, options);
      let queue;
      if (queues) {
        queue = await selectQueue(queues);
      }
      let data;
      if (queue) {
        data = await triageSelection(queue);
      }

      if (data) {
        await actions[data.action](sqs, data.queue);
      }
    } catch (err) {
      console.log(err);
    }
  };
the first method throws something like
async function findQueues(cfn, options) {
    console.log('inside findQueues');
    const res = await cfn.describeStacks({ StackName: options.stackName }).promise();
    console.log(res);
    if (!res.Stacks[0]) {
      throw new Error(`Could not find ${options.stackName} in ${options.region}`);
    }
01:54
morn
@TapasweniPathak noo noo noo
if you just want hte flow of control to stop with the error just throw the error :|
(node:30498) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:30498) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
if i throw an error like
const main = async(callback) => {
    console.log('inside async()');

    const options = {
      stackName: process.argv[2],
      region: process.argv[3] || 'us-east-1'
    };

    const sqs = new AWS.SQS({ region: options.region });
    const cfn = new AWS.CloudFormation({ region: options.region });

    const actions = { purge, writeOut, replay, triage };
    try {
      const queues = await findQueues(cfn, options);
      let queue;
      if (queues) {
        queue = await selectQueue(queues);
    if (queue) {
        data = await triageSelection(queue);
      }

      if (data) {
        await actions[data.action](sqs, data.queue);
      }
    } catch (err) {
>>    throw err;
>>  }
  };
async (callback) => oh dear
no sorry
random things
remove that
basically i want to catch error throwed from one method
02:00
It's too late
> In ES2016+ assignment of an anonymous function to a variable names it after the variable if it is declared there.
I didn't know this. Interesting.
02:38
guys
I need help on this one , i need a regex that requires this
1234/ the '/' is required
as well as the 1234
/1234\//
wow thank !!! ^
did this haha
cant paste
03:07
I was trolling, how did I actually end up solving your problem?
Hi, I am a junior C# programmer (2 years exp) looking to contribute to nodejs open source project as a first step to the open source world.
I have a fair understanding of javascript and even made a few simple projects with it.
What should my JS level be in order to handle first steps toward node project?
I am planning on a soft landing with the most minor issues I can find or be tasked with by a more advanced contributor.
Thanks ahead.
@monogate Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
If you need to talk to someone who's already involved, @BenjaminGruenbaum
@evabb Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
03:34
haha
someone downvoted the shit out of my questions/answers for some reason
18 votes
it didn't bring me into the negative so i didn't even notice
Probably shouldn't joke about it.
i mean
why not
heck those were the first downvotes i've received this month, but i've also not been that active on so main
you've been hit by, you've been struck by, an angery developer
hmm...
that post i downvoted, i don't recall even visiting it
Who did you hurt?
03:39
that was at 6pm this afternoon, i left my computer at 5:30
so no idea
it'll probably be in response to a comment somewhere maybe... did you post comments on anyone's question/answer?
pottis hahaha by including \/ on the regex it actually helped me lol
deployed my changed to the main server now lol singaporean now using it
 
1 hour later…
04:51
the only post i had commented on recently was one where the user was mostly positive, we just hit a dead end.
05:12
what is the best way to learn angular 5
@GautamKumar Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
depends on the person
!!justdoit
@KevinB That didn't make much sense. Use the !!/help command to learn more.
and can i start learning angular if i have very basic knowledge of html /css
well, you need some js knowledge
05:14
so first i need to learn javascript
well, again, it depends on you
i am working on java , so cant i start learning angular directly
@GautamKumar Do you have health insurance?
That's a prerequisite.
05:21
@lit
@littlepootis thank you
05:41
@KevinB could it be a long time salty person who periodically checks your stuff to downvote it? The stuff they downvoted, was it all recent stuff or did it go far back?
I'm super curious now
I also see some the list has some questions/answers twice... which means it's more than one account downvoting
nah
they downvoted both questions and answers
and if they downvoted the few questions i have, they're not a repeat customer
06:21
can someone help me with react-final-form?
@littlepootis +1 the day starts good it seems
can jQuery load be used to create a SPA like application.
I have a web app which has a variable central area and remaining things fixed i.e header,left menu,footer etc.
tonight signing the new contract for my new job :)
I'll be working on onboard car software
06:36
I have divided the central portions in template files which are injected via jQuery.load but console shows "Synchronous XMLHttpRequest on the main thread is deprecated" because some templates include a JS file via a Script tag.
yes, that's certainly possible
but it won't be without its troubles
@KevinB the JS which are referenced in templates are all local even still?
@Neil Congratulations.. :)
it's best to not .load things that include script tags.
if you must, use .ajax instead and remove the scripts before you insert it into the document
then insert the scripts once you are ready for them to run
beware of events not being cleaned up if you bind them to elements that persist between... "pages"
!!afk 😴
@techie_28 Thanks :) Somebody congratulated me at least ( ͠° ͟ʖ ͡°)
@Neil Where ya going?
06:40
@monners it's a subdivision of Samsung called Harman which deals with such development
@Neil hey, give us a moment of silence. We have our own chores to do. But congratz anyways. How long would it take to drive to your job?
@KevinB perhaps it is better to use methods like jQuery.getScript() to page wise load the scripts rather than referencing them directly inside the templates?
@techie_28 KevinB is afk: 😴
07:29
@KarelG If I drove, 10 minutes. If I took the tram, probably more like 20
:) I can't wait
that is much better
hi
I have a single page application, I have two js files, 1st one checks if user is logged or not, using firebase, if logged then downloads the Reactjs code that handles the SPA part. How can I check if user is logged or not in 2nd script where I can't run firebase code again?
@littlepootis can't use cookies since we dont have server side code
07:45
hello guys! I am really struggling with one thing, can somebody help me out please, I need the answer ASAP. This is a question: stackoverflow.com/questions/51045041/…
@mycupoftea Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
Basically thing is working if I start it in console piece by piece but when I call it inside ready - click event form is sending no matter false parameter is returned. Like it is not recognized at all.
@edwardtorvalds how do you handle login? o.O
firebase authentication
it gives me async method to check user or not. for that it contacts its server to check the status
it gives you cookies to use
or that
(I prefer the latter)
2
Q: Firebase JS Authentication cookies

e4stwoodI'm intending on using PHP to manage my application. I'm using JS to register and signup to auth. I then intend on using cookies to get this in PHP. I just wondered how Firebase keeps its authentication peristant. I assumed cookies but when I checked there were no cookies from that site. If the...

TIL they used localStorage
I am using the async method in 1st script and would want to store the state somewhere I could access on demand in 2nd script
@monogate shoot me an email, my email is available under "Collaborators" in github.com/nodejs/node
08:07
I have edited my question. Again would be very thankful if somebody checks it out
08:27
I have 2 column table, Payment and Fees, I need to find out the formula of fees calculation
but got no clue how
@mycupoftea replied
you have to return false if the form is not correct
Is this valid js ? function(dirty, useWhitelist=true) {...}
yes
lookup for "default parameters"
08:43
IE does not support, that might explaing it ....
oh sure it doesn't
if something goes wrong on IE, my first reflex is to check the compatibility :P
most issues are related to being unsupported 😐
that is an emoji. lol wtf
@ShrekOverflow I don't have him on Facebook. Ping him for me too!
how do you create a border that is in the middle but doesn't show in front of text?
09:09
neat:
const a = () => a;
a``````````````
@SuperUberDuper a border cannot be in the middle. Then it is not a "border" anymore. Right?
@Tavo doing great :))
@towc hmmm ?
@KarelG Thanks for answering. I am trying to process what you just wrote. Just to understand it better. So if I understood it right:
function isEmpty(elemInput){
var elem = $(elemInput).val();
if (elem == "") {
return false; <---- This false doesnt have to do with anything with submiting a form, it is not being called in submit part, and it refers to this function - whether input is empty or not. Because at 1st I understood that this will be called inside of submit part and it will stop form from being exectued.
>>> const a = () => a
undefined
>>> a
() => a
>>> a()
() => a
09:23
hello
@BenFortune I want to find pattern between numbers
@mycupoftea when calling a function, you are leaving the scope of submit. You can return the message but how can you pass the message to Submit if there is nobody to catch it? :)
of course you can do return isEmpty(name) && isEmpty(surname) but I advise to not do that because if isEmpty(name) fails then isEmpty(surname) is not handled anymore because of short circuiting. So check the fiddle and do it by that way
@KarelG but when I am trying your code jsfiddle.net/cz6x8on2/9 code is not being stopped
why I am actually doing this...without function errors will be return for each input field, field by feild...and I would like to have all displayed msg-s at once
I am struggling with this for couple of days, I am -_-
This is the right link: jsfiddle.net/cz6x8on2/10
Not working
Ohhhh thanks for updating! You are a savior! I will try to implement it and get back asap! Thanks again!
10:01
@KarelG i know there must be some hack
split in two divs
@mycupoftea uhmm you need to check jsfiddle.net/cz6x8on2/8 If that helped please mark my answer as answer that helped you
10:30
@KarelG thanks for helping me out. I have apply this to whole form. Just one more question if you can help me out
umh sure
I have a work lunch soon btw
I have a dropdown
function checkIfSelected(elemInput, elemFormGroup){

var country = $("#Country :selected").val(); <--- how to pass this elem

if (country == ""){
printErr($(elemInput), $(elemFormGroup), 'You have not selected anything');
return false;
} else {
printSuccess($(elemInput), $(elemFormGroup));
return true;
}
}

If I want to call function with this parameters:
checkIfSelected("#Country", "#countryFormGroup");
What do I need to pass here instead of
var country = $("#Country :selected").val();
I guess the answer is trivial, but I couldnt figure it out...btw thanks for taking time to read it
Hey guys, I'm completly new to angular and I'm trying to do a simple timer.

So basically I want to decrement a value by one every second
this.date = Observable.interval(1000).map((x) => { this.date });
I've got this
But shall I do something like
.map((x) => { this.date = --this.date })
Well basicaly I dont get how does work this timer...
  this.date = this.launch.launch_date_unix - Math.round(Date.now() / 1000);
  Observable.interval(1000).map((x) => { --this.date });
There is no return right ?
Or is it due to the fact that my parameters is not dynamic ?
Something like this ?
11:31
Hello, everyone. Does anyone know how to embed a pdf file into a website in a similar fashion to using a link tag in the html? (e.g. <link rel="stylesheet" href="/App/Portal/assets/styles.theme.css" />). If I write a link tag on the html when I load the website it will make a get request and retrieve the file which is loaded to the cliente browser. Is it possible to do the same thing with a pdf file?
11:43
no
but yes
@KarelG what a trivial mistake...
I didnt have white space ... ":selected" => " :selected"
alright, dont mind that question!
12:02
@Neil Ciao!
@Kanth Ciao!
How are you doing?
12:27
I've been busy
about to switch jobs
Anyone here have experience with web components? I'm interested to see if there is any plan to include data-binding similar to how angular or react do it, and if there's a current best practice for doing this?
Because currently without that I think I'd rather use innerHTML with template literals to get this functionality but then my view is in the component code itself which is visually not as pretty.
@BenjaminGruenbaum Harman
subsidiary of Samsung
@Neil that's cool! What are you going to be working on
seems I'll be dealing with onboard computer software on cars :)
not the navigation side of it, but the rest
12:40
Oh cool, that sounds like a lot of fun!
yeah, can't wait :)
@Vap0r React doesn't do it, you have to explicitly do it yourself by calling setState or using a library like MobX. Angular uses Zones and basically wraps setTimeout Promise and every async API to know when they're called. Web components do it with getters and setters but don't have "full blown" binding. The problem is that if you change innerHTML or whatever anything the user changed gets lost (like focus, scroll position etc).
Vue does the same thing as React + MobX does, stuff like Cycle is manual like React without MobX, angularjs did the same thing as Angular but without wrapping the globals and in a more global way for itself (one apply cycle through evalAsync).
Knockout does the same thing as MobX or Vue, Backbone does everything manually but without diffing and vdom. Aurelia does something similar to Knockout, MobX and Vue.
is it not possible to keep the scroll level by setting the height of the container div on the place where you want to use innerhtml?
@BenjaminGruenbaum wow great answer, thanks.
then you can adjust accordingly. But my experience tells me that playing with the scroll level is a path to hell
12:45
@Vap0r Sure, I also have a Q&A on SO about this
I can look for it if you want
@Loktar found on reddit (could be a repost): i.imgur.com/bQenjl6.jpg
seems somewhat right?
@BenjaminGruenbaum please. I can't seem to find it through your profile but I don't quite know how to navigate all the stuff they have there now, so it's probably my fault :)
Thanks. Now as far as templated variables, I think it was provided for (kind of) by using slots, but they don't necessarily work the same way as angular's <span>{classVar}</span>... Is there anything like this currently or in the works?
@Vap0r Like Angular 1's thing? Hmm, read this: teropa.info/blog/2013/11/03/…
12:58
@BenjaminGruenbaum wow awesome. Thanks! Looks like I have some reading to do.
Sure, have fun - it's one of those things that's worth spending time reading and getting into
ha mutationobserver and object.observe
but benjamin, should you not proxy the input.value thing?
or gets input.value='foo' being detected by the mutationobserver?
13:29
We came to the one truth people need to know:
in C#, 2 hours ago, by Lee Butler
But using javascript to LOAD THE FUCKING CONTENT is dumb
Please dont do everything with javascript, just saying.
why not
because it makes websites load slowly and sometimes strangely
And badly for ppl who deactivate javascript
and is really hard on mobile devices
Not if you do it right
13:31
Which usually doesnt happen
That's a bad argument
Honestly I know like 3 websites that work really well on mobile
one of them is surprisngly SO chat
The argument should be "don't do it wrong" instead of "don't do it"
I load a page for content, I expect the content to be there when I load it
@LeeButler Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
13:33
For people who dont know how to do it right, "dont do it" is a good starting point
It also becomes the ending point
Are you also an advocate of abstinence-only sex ed?
No, but I'd tell kids under 9 too they shouldnt have sex. After that, if they really ask, we can at least discuss that its not an absolute thing. But before that, they dont need to know.
Disclaimer: That age is just a random number, I'm not a parent and have no idea when one should start telling their kids the complicated truth
Well I'm glad the random number you chose wasn't 76.
That would overflow if the random number was composed of 5 bits.
0
Q: How to do ng-repeat with filter using angularjs?

its meHere I added my code i want to search based on user input i tried this but filter: first_name_model i am not getting proper result for example : Run code Snippet enter "2" and see the result (we need to get only one record but it showing all records ) enter "as" and see the result (we nee...

13:39
I was thinking somewhere between 5 and 13. A y/o wouldnt even care what you say probably, and doesnt even have the vocabulary yet. A 13y/o probably already knows more than you from schoolmates and internet and...whatever.
oh wait no
5 bits = 63 inclusive
Wait what
IIRC.
Actually 6 bits
14:03
@KendallFrey did you pick that number because of that fallout 76 fuzz?
so a coincidence
Hi
What will happen with Event Listeners, when the element to which the listener is attached to, is removed from the DOM? Is the Event Listener also removed?
Sorry for randomly dropping in, but I need some help. content.replace(/\s/g,"") == "" is true for me when there is only whitespace in content, but not when there is nothing in content. can anyone tell me why this might be the case? I cannot for the life of me figure it out.
@Vap0r Thank you.
@rahuldottech top result: stackoverflow.com/questions/4377480/…
So uh. I guess \s matches whitespace, so it only matches when there is whitespace
@rahuldottech Double check to make sure there's nothing. It works as expected for me
!!> "".replace(/\s/g,"") == ""
@KendallFrey true
14:19
Oh I was interpreting nothing as null
-1 snark
Though null.replace would be an error right?
!!> null.replace(/\s/g,"") == ""
@Vap0r "TypeError: null has no properties"
Right.
yeah fair nuff
That can't work.
@rahuldottech What do you mean by "nothing"?
Ah the old philosophical question
14:22
@Arber Uh, content is taken from the user. If it has only whitespace, then the following code runs. However, if the user chooses to leave the input box empty, it doesn't run.
Please no philosophiesicals
Then check to see what it is
Is it null?
> philosophiesicals
@rahuldottech And how is content initially defined? var content = ""; ?
I was also considering using philosophophiesicals because it's more fun to say
14:23
@KendallFrey It's not. I've tried literally every answer on this page, none are working: stackoverflow.com/questions/154059/…
Well what is it?
@Arber replaceBBCodeUrl: function(content, attribute) {
@rahuldottech what is content when the input box is empty. Don't assume. Check the value
@Vap0r How do I check the value? If I try to print it, nothing gets printed, if I try to check if it's empty using an if condition, it doesn't run through
Debug and place a breakpoint
14:37
@rahuldottech add "console.log("content: ", content)" for debug reason as the first line in your replaceBBCodeUrl function.
reproduce the error and tell us the output.
@Arber been trying that
See:
It's empty
Or it's an invisible char
try to call .length on it
if it is 0 then you are certain that it is an empty string
Well that and if console.log(typeof content) outputs "string"
console.log(content === "")
for some stupid reason console.log just stopped working
give me a minute
Okay. What. Is. Happening.
For some reason, console.log just stopped working randomly
14:54
ohhi
user1596138
So I got asked to help with something from my old company last night
user1596138
Found out the kid is jus saying he remade everything I made because he renamed the files
user1596138
I gave them a flat "no"
user1596138
Said if he wrote it he can fix it. But he didn't write it.
@Arber @Vap0r console.log won't work if there's no input in the text box. It'll work if I put in some text. I have no idea what's happening
user1596138
14:59
I probably shouldn't even care jus seems shitty that someone would do that. I know the boss personally

« first day (2812 days earlier)      last day (2358 days later) »