« first day (3664 days earlier)      last day (1267 days later) » 

Jay
1:11 AM
how can I have the field for an email address on a form validate that the address they typed in doesn't already exist in the system before they submit the form?
 
 
4 hours later…
5:11 AM
how could i load a component when its in the view? in angular
 
 
2 hours later…
7:40 AM
okay, i am new here
 
@Jithin 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.
 
 
5 hours later…
12:39 PM
hmm forgot and cannot find the info how to add codesnippet to chat :-/
found it facepalm
Anyone good at promises?
function delay(time) {
    return new Promise(function(resolve, reject) {
        let timerId = setTimeout(function() {
            resolve("timer expired");
        },time);
    });
}

delay(3000).then(function(input) {console.log(input)});

for(let i = 0; i < 100; i++) {
    setTimeout(function() {
        console.log('hej');
    }, 1000);
}
expected the delay function run somewhere in the middle of the execution of the loop, but it either comes first or last. And I dunno why :-o
 
@brat i can try, but i can't promise i'll be able to help
;)
 
ok
 
r/wooosh
 
going for a smoke, no reason for stressing people. Im all pooped out after trying to munderstand it -_-
 
aybody have any idea why these change events arent triggering dpaste.com/DEJFPSQQN these are for the following: dpaste.com/B33J29VFP
 
12:47 PM
@brat this sounds like an event loop problem
i'd watch this
 
Thing I dont understand I have implemented a similar mechanic on two other aspecis of this form the same way and it is working well just this isnt...
 
@brat could be wrong but i think "timer expired" should always happen last
 
Yah I remember reading something like that as well. But thought erm, maybe the .then call would somehow be called out of sync with everything. Trying to create small "lab environments" to learn the behaviour of promises. But perhaps you are rigtht. Maybe cant be done unless its the "real deal". Thanks though, wil check out the vid thumbs up
 
1:10 PM
Hi guys

is there some way to set only the files to be covered by the code coverage report in karma-jasmine?
 
@ajgo 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.
 
i'm using angular 10
 
$('#step3').change(function() {

    if ($('#typeofclass3').val() != 'None' && $('#academy3').val() != 'None' && $("#lengthofclass3").val() != 'None') {
        run_ajax3()
    }
});
$('#lengthofclass3').change(function() {
    console.log('length pressed')
    show_options3()
    if ($('#typeofclass3').val() != 'None' && $('#academy3').val() != 'None' && $("#step3").val() != 'None') {
        run_ajax3()
    }
});
$('#typeofclass3').change(function(){
    console.log('typeof pressed')
    show_options3()
anything in this that would cause the change events to not trigger
 
1:31 PM
@Kwsswart is the js included at the bottom or top of the page?
 
bottom this is the thing that bugs me is i have three different forms within this each using a similar way of manipulating to allow user experience to be better and allow dynamic changes and for first two it works but the third it doesn't dpaste.com/ETUAYQEVS this is the example of the template
 
Hm, what language is that?
Maybe if you delegate the events... Replace $('#typeofclass3').change(function(){ with $('body').on('change', '#typeofclass3' ,function(){
 
Hello everybody!
 
@mmaismma 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.
 
1:46 PM
@Cerbrus jinja2 templating to work with python flask backend
as so triggering everytime the body changes but won't that be a problem with all the functions running at different changes
 
Hi everyone. I'm uploading some files using <input> element with type = file and sending file over to a flask API for processing which involves at some point, moving the file from fixed source directory to a fixed destination directory in Windows 10. I'm using shutil.move(src, dest) for this.

I'm getting PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: "C:\\path\\to\\source\\folder\\file"

Now, I've used Handle utility (which lists all processes that have an object opened) and it always outputs No matching handles found with inp
 
@apooravc mate this is python related just saw you post this in the python chat
they won't be able to help you here
@Cerbrus this doesn't seem to change anything
 
Then I can't help :-/
 
thanks anyway mate appreciate it
 
np
 
2:18 PM
Hey. Don't suppose there's anyone awake here familiar with vue and vuelidate?
 
there might be
 
I'm in the middle of a pretty complex page that uses a stepper. Each step has it's own validation. It's triggered when a user moves between steps. However we've found a rare instance where data can change while a user in in mid-step and I need to re-trigger the validation
I've identified the correct point to do this and made a call to $touch(). This renders the desired form element as $dirty but it's not registering as $invalid. The functions that are called to validate don't get re-called just bc something is $dirty
If the user changes any of the data on the form, it triggers. But I need to do this automatically. Do I just need to manually call all the validation functions again after $touch()?
Or ... what else am I doing wrong?
 
Do you know what's causing the change mid-step?
i'd assume it's a programmatic change, hence the change event not being triggered. Should the programmatic change trigger a change event?
or kick off the validation?
 
Yes, I know what's causing the change. The user can actually save the form and come back later, and one piece of data can change while they're away.
When we reload the form, we need to revalidate the data.
I had presumed just $touch() on the data required would be enough, but it doesn't seem tobe
 
I don't know any vue, so that's about as far as i can go with it, conceptually you'd need to trigger the validation, if the value is changing between user imposed changes, what that means within vue i can't really help with atm
 
2:31 PM
OK, thanks. I can't boil this down to a simple reproducible problem for SO as this step alone is 3k lines long and there's 7 steps in the process.
I did not create this monster
 
3:26 PM
 
4:16 PM
WHO is active in AR?
 
posted on October 27, 2020 by Richard Lau

Notable changes deps: upgrade npm to 6.14.8 (Ruy Adorno) #34834 n-api: create N-API version 7 (Gabriel Schulhof) #35199 expose napi_build_version variable (NickNaso) #27835 tools: add debug entitlements for macOS 10.15+ (Gabriele Greco) #34378 Commits [b83f9a56fc] - build: expose napi_build_version variable (NickNaso) #27835 [020ba1a2b8] - build: enable backtrace when V8 is built for P

posted on October 27, 2020 by Richard Lau

Notable Changes This release marks the transition of Node.js 14.x into Long Term Support (LTS) with the codename 'Fermium'. The 14.x release line now moves into "Active LTS" and will remain so until October 2021. After that time, it will move into "Maintenance" until end of life in April 2023. Commits [5b7a08c902] - doc: add missing link in Node.js 14 Changelog (An

 
user14520680
4:35 PM
whats new in node 14?
 
@expressjs123 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.
 
user14520680
im on node 12 should i upgrade?
 
function addrows(rows) {
        let postList = $("#post-list");
        $.each(rows, function (i, row) {
            let rowHtml = `
                    <p>`+row.title+`</p>
          <?php
                    $sqlstep30 = "SELECT COUNT(*) AS total FROM lit WHERE p_id = `+row.id+` ";
                     $rowNumstep30 = mysqli_query($conn, $sqlstep30);
                     $countstep30 = mysqli_fetch_assoc($rowNumstep30);
                     $lit = $countstep30["total"];
          ?>
          <?= $lit; ?>
Encountering problem at WHERE p_id = +row.id+` ";`
How do i echo a variable value at p_id = ``
 
user14520680
Sorry, not familiar with jquery
 
Jay
5:04 PM
how can I do a post to check and see if an email address exists in the system before the user clicks submit on the form?
 
user14520680
backend right?
 
Jay
no it needs to be on the front, I was thinking some combination of ajax and jquery focusout() so I can check right when they finish typing their email address and move the cursor to the next field
 
user14520680
what system? mongodb? mysql?
 
Jay
mongodb, the post sends a javascript object
 
user14520680
setup a route to an ajax request that checks if email already exists and call fetch before submit
 
Jay
5:11 PM
oh okay, make a route for it
trying to make it pretty automated so it just checks once their done typing their email address without having to click anything
*they're
 
user14520680
did it work
 
user14520680
?
 
@expressjs123 finally beeing allowed to use import in v14.0
 
user14520680
what the one that throws "cannot use import statement outside a module" in frontend js?
 
5:33 PM
Hi all
 
6:10 PM
Hi.
!!||
 
|| say ||
 
I have ajax script to post to a php page
  var Room_Id = $("#Roomnum").val();
 alert( Room_Id);
        $.ajax({
            url: 'getStudents.php',
            type: 'post',
            data: {Room_Id:Roomnum},

            dataType: 'json',
 success:function(response){
              alert("success");
this script alert Room_Id but doesn't alert success!
 
is your php returning json?
 
no
 
then that's why it is failing
dataType: 'json', specifies that the server is going to return json, and that jquery should parse it before sending it to the success callback.
 
6:18 PM
now I changed it to
 var Room_Id = $("#Roomnum").val();
 alert( Room_Id);
        $.ajax({
            url: 'getStudents.php',
            type: 'post',
            data: {Room_Id:Room_Id},

            dataType: 'json',
 success:function(response){
              alert("success");
             var len = response.length;
            $("#StudentsSelection").empty();
            for( var i = 0; i<len; i++){
           var Student_Id = response[i]['Student_Id'];
           var Student_Name = response[i]['Student_Name'];
It alert success but doesn't return values from php page
 
what are the values
 
$Room_Id= $_POST['Room_Id'];
$stmt = $connection->query("SELECT * FROM students WHERE Room_Id = '.$Room_Id.' ");
alert(response); alert window is empty!
 
i mean
so far you haven't shown any php that would return anything to the browser, so that checks out
 
<?php
include "database_connection.php";

$Room_Id= $_POST['Room_Id'];
 $stmt =  $connection->query("SELECT * FROM students WHERE Room_Id =   '.$Room_Id.'   ");

 $students_arr = array();
 while ($row = $stmt->fetch())
    {
    $Student_Id = $row['Student_Id'];
    $student_Name = $row['Student_Name'];

    $students_arr[] = array("Student_Id" => $Student_Id, "Student_Name" => $Student_Name);
}
echo json_encode($students_arr);
   ?>
My php page If I understand you
I get Notice: Undefined index: Room_Id in \getStudents.php on line 4
[]
 
sounds like there's some debugging that needs to be done
 
6:37 PM
@KevinB Where can I alert(data);
 
you would want to console.log it
alert won't give you useful feedback
 
I prefer alert
well
 
that doesn't matter
alert won't give you useful feedback for an object/array
it converts it to a string
 
where to write console.log
 
whereever data is available, likely somewhere in the callback
 
 
1 hour later…
7:47 PM
php in the js room
 
8:23 PM
posted on October 27, 2020 by Srinivas Sista

 The Dev channel has been updated to 88.0.4302.0 for Windows and Mac and 88.0.4300.0 for Linux platforms. A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Google Chrome&nb

 
9:12 PM
@rasfuranku Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
 
paste teh text and code separately
doesn't all have to be posted in one giant message
 
Thanks Kevin, I am editing it now.
Hi everyone,
I am playing a little with inheritance, chaining and method binding and I am kind of stuck. I would like to be able to concatenate strings by creating an object and passing down the constructor, so every time it is called it keeps the references of the previous one.
foo = Chain("h")
bar = foo("e")("l")("l")("o")

foo.toString() == "h"
bar.toString() == "hello"
bar.ancestor.toString() == "hell"
 
9:38 PM
👍
 

« first day (3664 days earlier)      last day (1267 days later) »