« first day (3143 days earlier)      last day (1796 days later) » 

2:58 AM
Using a Proxy, is it possible to intercept chained accessors/prevent them from being executed? For example, take the object configuration with the expectation that it will contain the property credentials, but credentials can either be an object of its own or could be null. If I wanted to access the property username of credentials, I'd obviously access it by configuration.credentials.username. Is it possible to prevent .username from executing if credentials is null?
 
 
5 hours later…
7:38 AM
is anyone here?
 
 
4 hours later…
11:48 AM
@cubesnyc Yes
 
12:17 PM
How can i delete from array if key is index?
const array = [0: {}, 1: {}, 2: {}]
i want to delete item if key == 1
 
12:50 PM
How to fetch data to jquery dataTable with form submit
 
@lipon 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.
 
How to fetch data to jquery dataTable with form submit

I am inserting data with jquery Ajax using form submit, And fetching data to dataTable after form submit, following code giving DataTables warning: table id=mainTable - Requested unknown parameter '1' for row 0, column 1. . . . .

var mainTable = $('.mainTable').DataTable();
$('#Form').submit(function(e) {
e.preventDefault();
var form = $(this).serialize();
$.ajax({
url: "result.php",
type: "post",
data: form
}).done(function (data) {
mainTable .clear().draw();
 
1:02 PM
@lipon when trying to display a block of code in the chat
highlight the block of code and type Ctrl + K , this will format to the code
 
@HelloWorldPeace ok i will try now
@HelloWorldPeace should i delete and repost the question
 
if you can, i think it may be too late
 
    How to fetch data to jquery dataTable with form submit

    I am inserting data with jquery Ajax using form submit, And fetching data to dataTable after form submit, following code giving DataTables warning: table id=mainTable - Requested unknown parameter '1' for row 0, column 1. . . . .

    var mainTable = $('.mainTable').DataTable();
    $('#Form').submit(function(e) {
    e.preventDefault();
    var form = $(this).serialize();
    $.ajax({
    url: "result.php",
    type: "post",
    data: form
 
which line/statement is throwing the error ? I can't find it in the code you posted.
 
its just showing an alert box on the screen giving warning: table id=mainTable - Requested unknown parameter '1' for row 0, column
 
1:15 PM
is there an error message in the browser's console?
 
@HelloWorldPeace No there is no error message in the browser's console.
 
Well, I would suggest first finding where the error is occurring by using console.log() and a try-catch on the ajax code
FYI, I'm not familiar with jQuery at all.
Yes, log the value of the data parameter
in the .fail log the value of the error
 
its giving correct data in response but not displaying it in datatable
 
try defining the callback for the .fail() it appears to be empty
 
1:34 PM
@HelloWorldPeace the question well formatted here stackoverflow.com/questions/56304674/… .
 
Well hope you figure it out, I'm limited when it comes to jQuery or PHP
This link might be helpful
 
@HelloWorldPeace ok thanks.
 
 
1 hour later…
3:04 PM
Is there package that can handle my data in normalize way, with functions like addOne, addMany? not store...
for example I have articles array. and something wrap it with functions addOne, removeAll ..
Is there javascript version for @ngrx/entity (without ngrx)?
 
3:27 PM
var e = window.webpackJsonp;
window.webpackJsonp = function(n, i, a
if webpackJsonp is unassigned to at the moment of the first line
does e still inheret the function that is then assigned to window.webpackJsonp
i am tryign to go through some javascript code but am confused as to what var e actually winds up containing
 
 
3 hours later…
6:55 PM

facepalm

21 mins ago, 41 seconds total – 6 messages, 1 user, 0 stars

Bookmarked 5 secs ago by JBis

 
 
1 hour later…
8:08 PM
anyone here?
 
 
1 hour later…
user8729657
9:16 PM
@JBis
 
user8729657
read email
 
1 message moved to Trash can
@HappyHands31 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
1 message moved to Trash can
@HappyHands31 Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
9:33 PM
How was my code not formatted? I hit Ctrl + K before sending?
 
youre arguing with a bot?
lol
 
user8729657
lul
 
9:56 PM
How to connect reacta with api built in the php framework?
 
now it does webpack lol
getting it to make the files was a lot less time consuming than figuring out how to make webpack work with making a chrome extension, and it still needs work (the webpack config)
 
10:37 PM
Hello everyone - I need help dealing with a tricky issue
I want to treat a string that is going to have a voice command
can be something like "change color square blue"
and I want to know that the command is "color", the color is "blue" and the "square" is what should be changed
how would you go about this?
I'm using RegEx to find the keywords I define... but the exec isn't really working for me
 
10:50 PM
@Thaenor Need more info
Are all things always seperated by space?
And are they always 4 keywords?
 
This is part of the speech recognition API.
I'm capturing the voice and getting it as a string.
 
Yes, I understand that. But you define the semantics of the "valid strings"
Do you require your users to always say 4 words?
For example, is it always "COMMAND THING OBJECT REQUEST"
 
I want to capute certain commands and certain parameters. And do things with them.
actually I can send you the codeSandbox
 
You're not answering the question. Your API is giving back a string. What is the format of the strings?
 
sorry :D I'm trying to say too many things at the same time.
No, it's no required 4 words for input.
 
10:53 PM
As a user, I am going to speak some words. You're not writing an artifical intelligence agent, so you must have some sort of contract I must obey with the program
Must my request always begin with a command?
Such as "CHANGE" or "MOVE"?
 
well, no...
my current solution, it's not working so well
but I'm using regEx to filter out wether the keywords are said
 
You need to flesh out the problem, then
Can I say things like "Please change the color of the square to blue?"
 
if the user says "color" I can assume he wants to change the color of somehting, then expect to capture a color name and an element to change it's color.
like "color blue square"
colors the squares in blue
 
Can I say it naturally like I said above?
 
yes you could
 
10:55 PM
You are looking for naturla language processing, then
 
it would capture "color", "square" and "blue"
 
You can find a bunch here: https://www.google.com/search?q=nlp+javascript&oq=nlp+javascript&aqs=chrome..69i57j69i60l4j69i59.2156j0j7&sourceid=chrome&ie=UTF-8

Regexp is not the answer
Use NPL to capture a "verb", "noun" and "adjective" and that's what you want
Should be easy after that
 
my advice is to just search the string for color
 
I was expecting I could've used SpeechRecognitions grammars to do that.
 
and then search it for shape
you dont need to process the grammar
 
10:57 PM
yeah, they don't really work like I thought they did
 
@cubesnyc Agreed, if there's a small finite set of things to do and you can wrangle it
It just depends on how sophisticated you need to be
 
exactly
 
but there is a finite amount of things.
 
i am totally new to javascript
very unfamiliar with syntax or order of processing
can someone pls exaplin to me what is going on with this syntax
 
If there's a finite amount and you want something specific, then just ask for it
Scan a string for your command and then scan for other things after that
 
10:58 PM
I just have a set of 3 or 4 commands.
@VaughanHilts but for that I gotta use RegEx right?
 
No, just write a loop.
Let me edit this a bit
Actually
 
1 message moved to Trash can
@VaughanHilts 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
 
Why don't I just write you an example?
 
do you want me to repost the codeSandbox?
 
No, it's fine
Give me 2 mins
Are you familar with a finite state machine?
 
11:02 PM
kinda... I remenber learning about it...
 
Let me whip you up an example using a FSM
It might take more like 5 mins though :laugh:
 
did you see the expressions.js where I detailed the commands I wanted to support?
 
I didn't but it doesn't really matter
This can all be handled the same using a simple FSM
 
(color | move | increase | decrease | duplicate) ( square | rectangle | circle | ball | triangle ) ( up | down | left | right )", "ig") (and pretty much all standard CSS named colors)
I can "trim" the string into an array and then iterate it, looking for each of the keywords...
 
You sure can
One moment
 
11:06 PM
but a regEx seemed more effective.
 
Regular expressions like easy of tracking state
 
!function(t){...}({"+/J2": function(){...}})
does this both define the function and exectute while passing in whats between the parentheses as the parameter?
and if yes, how is this actually processed by the interpreter
 
you can try it out on the console
@cubesnyc it does work
 
how does it work
 
the way I read it, you are declaring a function and calling it right after
but only the first function you declare is executed
 
11:11 PM
why is it executed?
i guess because function(t) returns a pointer to a function
why is it not
(function(t){...})({"+/J2": function(){...}})
 
it's executed because you followed a function() {... } with () meaning it's an evocation
I don't know why exactly but the ! is doing the same service as wrapping the function in ()
the way I write self evocating functions is
( function(a) { console.log("I'm a self evocating function") } ) ()
 
what do you mean self evocating
thats not self evocating
but whateer i get what youre saying
 
normally a function doesn't do anything, unless you explicitly call it.
but you can wrap a function and imediately call it
 
right i get all that
i am just wondering the exact order of operations and scope
 
like function log(t) {...} log("I want to call this function right away")
 
11:16 PM
because without the exclamation point it doesnt work
it throws an exception
 
yeah, I noticed that
 
Almost done
 
that's because JS won't know what you're calling with ()
!function() {console.log("aaaa")} - returns false
@cubesnyc maybe we can try running these code snippets in astexplorer.net and figuring out how JS parses these
 
Here you go
This obviously won't handle things like:

1. "the square AND circle" You're going to need NLP or some dirtier parsing to do this
2. You will have to implement things other than "color" on your own but it should be easy enough to do
You could do it with regexp as well, but it might be a bit harder
 
@cubesnyc maybe this will help - stackoverflow.com/questions/13597481/…
 
11:26 PM
you can just have it loop / pop the search matches
 
@cubesnyc You mean for mien?
You certainly can, but then you don't get names for them
 
i dont know whose it is
for all needle in needles
if needle in haystack => remove needle from haystack
process needle
 
hi, pls what's the js equivalent of jquery last() method
 
const lastItem = arr[arr.length - 1]
 
@VaughanHilts thank you very much!! that looks like one heck of a solution...
 
11:29 PM
Hopefully it makes sense
You can find the examples at the bottom
 
I'm a bit burned out from looking too much into this ... 😅😅😅😅 I think I'll take a look at it later.
 
Let me link you to a an easier one as well, give me a min or two
@Thaenor Here is your regexp version: codepen.io/anon/pen/PveOmr
 
thank you very much, I'll take a look in a minute @VaughanHilts
 
The regexp version has a couple deffiencies from a full FSM version in that it can't branch or parse from different states, for example if it encounters "color" it can't tell to just search for "colors" in the next regexp
 
I'm watching the Dragon Ball Ledgends stream 😅
 
11:38 PM
So if the attribute was "size" and the value was "52px" your regexp would probably look like (blue|cyan|yellow|12px) etc
 
oh.. for size I'm just considering "big" or "small" ... at least for starters
 
You will note the FSM solution delegates to some info on a table to figure it out and uses functions where it can't figure it out (i.e: a value that is dynamic, such as a color, instead of checking all colors, we just ask the browser if it's valid)
Sure, regexp would still need (blue|yellow|big|small) etc.. anyway, you will figure it out when you compare the two
With this, you should be able to figure out the differences between two different implemenations and how they are good & bad
 
what is the type of req and res when using typescript?
app.get('/', function (req, res) {
 
@SuperUberDuper You can look at the TS definitions for example github.com/DefinitelyTyped/tsd/blob/master/typings/request/…
It's probably a "Request"
 
11:43 PM
This is more up to date: npmjs.com/package/@types/express
My turn now. :) Can anyone tell me if it's still true that node is using UCS-2 encoding for their strings under the covers?
 
cant find examples
 
Are you not using an IDE with autocomplete?
VS Code should be able to show you how to interface with it for example
 
how does it know from this?

exports.sendMail = (req, response) => {
 
You won't; you have to add typings
 
first time its declared
 
11:51 PM
So specify the type
 
yeah thats what I dont know
I have @types/express
dont know the type name
 
The entire thing is RequestHandler I believe
So type the function as RequestHandler
 
exports.sendMail:RequestHandler = (req, response) => {
?
 
I think you put it after the arrow function
(req, response) : RequestHandler
 
cool
hmm it allows me to miss params:
exports.sendMail = (req):RequestHandler => {
no res
ok, works now
 
11:58 PM
:)
 
exports.sendMail = (req:Response,res:Response) :RequestHandler=> {
doesnt force the types
you need const sendMail:RequestHandler = (req:Request,res:Response) => {
 

« first day (3143 days earlier)      last day (1796 days later) »