« first day (2802 days earlier)      last day (2145 days later) » 
01:00 - 14:0014:00 - 00:00

1:04 AM
morn
 
1:46 AM
Hi. I have a function that takes only a function as an argument and returns a new function.


const update = createUpdateFunction(handler)


This new function is "wired" to the function given as an argument (handler). The closest I can relate this to is Object.prototype.bind. The new function is bound to handler in the following way:

- Every time you call `update` I update some event listeners and eventually invoke `handler` with the delivered event information.

I am trying to come up with a great name for this function, but all I currently have is:
 
Can you give a simple example of how it would be used?
 
The point with update is to use it within a "render loop", e.g., React's render or componentDidUpdate lifecycle method, but here is a minimal example that shows usage.
          const update = createBinding(console.log)

      update([
        {
          listen: () => "mousemove",
          action: event => `${event.x}⨯${event.y}`
        }
      ])
 
@JorgeBucaran 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
@JorgeBucaran Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
@JorgeBucaran Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
It seems like the intent is to transform an event to one with different data, a la Rx's map. Yes?
 
Yes, you could say that. What I am doing is similar to Rx/observable.
 
1:53 AM
It doesn't seem quite right to call update like that
 
And why is that?
 
It reads like you're attaching the event to the handler, rather than vice versa
makeEvent("mousemove", event => `${event.x}⨯${event.y}`).subscribe(console.log);
That's how I'd tend to write that
 
Yeah, I didn't really want to get into the nitty-gritty of the library, since it means explaining a few other things. I mostly wanted advice as to what to name the function factory. As you can see I went with createBinding(handler), but I am still indecisive.
 
Thanks, what you wrote makes sense. But it's also imperative code.
Think of update as ReactDOM.render or preact.render function.
 
1:56 AM
createLogger? Or is that too narrow?
 
One is meant to pass the entire state of the events.
Yes, too narrow, since you can use it for other things like rendering to the page.
 
I'm having a hard time thinking about the semantics of that because my brain keeps screaming "RxJS"
 
You know, I tried looking for libraries where this pattern occurs: newFunction = someFunction(anotherFunction)
I bet this is 80% an English problem :)
 
If only JS had something like Hoogle ;)
 
Like if I am creating a function, then somehow it feels odd to call the function createNoun, e.g., createBinding, etc.
What do you think about createUpdate, it doesn't really create an update, like say a SQL query or something, it creates a function that updates, hence createUpdateFunction in the list above with my first comment. That, however, is too long.
 
2:01 AM
createListener? createHandler? createEndpoint?
 
So it comes down to create something after all? What would you say of not using createXxxx at all and instead go with something like bindToHandler, bindToDispatch, etc.
 
Well, it's not binding anything at the moment it's called, so that doesn't seem right
It could be maybe getX, or makeX
 
I see. Well, this function is creating a closure that knows of and when to call the handler function you are passing to it.
Does makeUpdate sound alright to native English ears?
 
I'd prefer create over make in almost all situations
createUpdater?
 
Okay, I see. So, "updater" is a noun.
 
2:05 AM
Yeah, using a verb also doesn't seem right
 
Great, I am definitely discarding using a verb like createUpdate.
Well, thank you very much Kendall, you were very helpful. I'll keep thinking about it.
 
The year is 2029 npm is now the primary tool for e-commerce you buy products by npm install @apple/iPhone@latest.
 
2:32 AM
'createUpdateFunction' isn't too long? I've learned to not introduce ambiguity to save on keystrokes
 
3:05 AM
@TravisWhite Right, I hear you, but I'd like to avoid it if possible.
 
@BenjaminGruenbaum are the backticks in the title part of the actual code or just a vestigial attempt at highlighting? If the latter, I'd recommend removing them (CC: stackoverflow.com/questions/50896442/…)
also not sure what you mean by "missing on errors"... I'm assuming you mean code where it says something (in English) "on error, do this", but that phrase could be clarified
 
3:53 AM
Hello! I am making a request and getting the error "POST methods expects all parameters to be submitted as a form, not on the query string". Here's the pseudo-code of the request:

var req = new XMLHttpRequest();
req.open("POST", "some.api.com/method?k1=v1&k2=v2");
req.send();

What should I do here? (sorry if this is obvious, but I am really new to AJAX)
 
4:32 AM
23
Q: Make XmlHttpRequest POST using JSON

Akshay KhetrapalHow can I make an AJAX POST request sending JSON data using vanilla JS. I understand the content-type is url form encoded and it doesn't support nested JSONs. Is there any way I can make such a POST request using nested JSON in plain old JS. I've tried the various serialize methods found here o...

I have been trying to make this ajax get call but its failing

$.ajax({
    type: 'GET',
    url: "http://www.mocky.io/v2/5b0faa523000006900115187",
    dataType: "json",
    headers: {
        // origin: 'http://fiddle.jshell.net'
        'Origin': 'http://dummy.com',
        'Access-Control-Request-Method': 'POST',
        'Access-Control-Request-Headers': 'X-Custom-Header'
    },
    crossDomain: true,
    success:function(data){
        debugger;
     alert(data);
    },
    error: function(){
How do I fix that ?
I have also put Access-Control-Allow-Origin : * . Is there something additional I have to do ?
 
ohhi
 
uhm.
those headers don't belong there
 
There was an SO answer, thats where I took them from. I have no clue as to where these headers should go
 
what answer suggests that?
so i can downvote it
 
4:45 AM
trying to find, it was yesterday
 
i've seen plenty of questions with that mistake
but not any answers
 
sorry unable to find it
any idea, how I can workaround the errors ?
 
 
2 hours later…
6:36 AM
@FlyingGambit you could have checked the docs
look at beforeSend
 
7:16 AM
Can I get some help with async functions?
 
@JacobSchneider I'll let you know later (joke)
 
oh, good one
 
what's the problem?
 
I asked a question: stackoverflow.com/questions/50904061/… and one of the answers was use async functions
Basically, I'd like to recreate a prompt box, but I've never (successfully) used async functions
what I'd like is to call a function, say getdata()
and have it return a value
when the user clicks ok that is
 
    async function foo() {
       // do your stuff
       return data;
    }

    const p = foo();
    // async functions returns with a promise. You have to do use .then(handle)

   // like
   p.then(showPrompt); // where  showPrompt is your function that prompts the user
 
7:22 AM
@KarelG 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
 
my dear :|
ah forgot a space there
i am happy that cap bugged here to not move away the post
 
What my problem is, is not using the function, but actually implementing it. where you said // do your stuff, I do not understand how to get the function to show the box, and then to resolve the promise when the ok button is pressed
 
the show the box is that showPrompt function
// do your stuff is meant to get your data
 
just get the data?
so basically use a querySelector?
for example?
 
yes. But I also do not recommend overriding the window alert thing
 
7:26 AM
yeah, I wasn't planning on it
 
what is your "getData" ?
 
I don't know yet :/
 
I read that as "getting info from server"
 
no no, it's not that
 
ehm when should the prompt appear then?
 
7:28 AM
i'm using this code: $(".input").html(`<div class='prompt'><h2>${displayMsg}</h2><div class="input"><input id="promptValue"/></div><div class="promptContros"><button>ok</button><button>cancel</button></div></div>`)
I'm not sure when and where to implement it
has the community completely given up on me now?
take that as a yes
 
7:43 AM
uhm. i am currently at work. Others are probably at work either. or doing something else
@JacobSchneider that is what I am asking you. when must that prompt being shown? And why is there a ${displayMsg} in your header
 
@KarelG I'm sorry I'm pressuring you, It's 7:00pm here. everyone's finished work.
the prompt is shown when the user clicks a button. and the ${displayMsg} is to show the message on the prompt box, not unlike a prompt(displayMsg) call.
 
@JacobSchneider aah
how do you listen to the click on that button. via jQuery's .click() function?
@BenFortune TIL. and nice
 
just do the prompt in that handler
like
 
7:50 AM
If it's a prompt on click, you need event delegation
Since you're dynamically adding it to the page
 
$('#idOfyourButtonor something').click(function() {
    $(".input").html(......);
})
that should be enough for what (I think) you need
@BenFortune there has been a case of cowpox in your country
got baffled
 
what now
 
@KarelG thanks
 
that is a super rare disease.
 
something something didn't vaccinate something
 
7:59 AM
@KarelG I'm sorry, i must seem like a novice, but I still don't fully understand, Once I add the prompt box, what do I do then?
 
make it interactive?
you have to check the requirements or talk with the person who gave you the task
 
I gave myself the task, the task is to make a program that prompts for user input, and I must be able to style it
I can use any means to do it, just as long as it can be styles
 
Hello I wonder the good way of creating / managing dynamic splitter sets. [layout.jquery-dev.com/index.cfm] jquery layout only have North, South, West, East, Center and nesting them does not look very like what I currently want.
 
@Thiner 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.
 
For example I want 4 rows with each row 3,2,1,4 blocks. I am not very sure how jquery layout does this, nor do I know what other tools I can use ... Any suggestions? (I am not very professional to js enough to reinvent wheels...)
 
8:05 AM
css...
 
1 |2 |3
4|5|6|7
8
9 | 10
 
flexbox?
 
I want the splitter to be draggable ....
 
Ooh aah
there is kinda a flexbox bias method, you could try that
 
8:19 AM
I believe the idea is like you show but the resizing method is so tricky...
 
Don't link to w3schools they're awful :)
Prefer mdn
 
Morning all
 
I heard that, but why? they seem alright to me
 
Fine ... I am now playing with your snippet, and I wonder how to make the row a row in the page, the column being a column, and all columns sum into the whole row...
(I only learnt css last week plz I am a newbie)
 
8:26 AM
that's fine
 
I tried width:100% and the scroll bar appears because the margin is not zero ...
 
MDN is better.
 
yes, yes
@Thiner you got discord?
 
For example, I set the css in row1/row2 to be width:100%
After I have set that I found that the page is larger than 100%
because the 100% did not count the margin+border+padding
 
add this to the top of the code: * { box-sizing: border-box; }
 
8:31 AM
Mmm how can I make the last box extend to the end?
For example the last row extend to the browser window end, the last column extend to row end
 
yeah, set it's width to 100vw;
.row2 { width: 100vw; }
sorry, instead of vw use %
 
I meant to extend the last row "vertically" to the bottom of the page ... Sorry to be ambiguous
I did width:100 before
 
try that
 
?
 
I keep making changes to it, press f5
 
8:49 AM
uh, I just read all the conflict of yesterday
I agree with many things :)
 
What happened?
 
you can read in the transcript
 
9:06 AM
hello guys
somebody help me to understand this thing
../../
and ./../ etc
 
lol
 
because I'm always getting the module not found
 
google for "unix paths"
2 dots mean you go to the parent directory
1 dot means current directory
 
@jsonGPPD if you are in directory / (refering to the root directory - the base), then you cannot go to the parent directory, because there is none, if you navigate then to a folder inside / called documents you are now in /documents once here, you can go back, which, from /documents would be ../ then you would end up back at /
however, if you then navigate to ./ you won't go anywhere, the . means here
 
Oh so the ../ is going backwards to the main folder?
 
9:13 AM
not the main folder, but the parent
the main folder is /
 
Oh thank you sir
 
say you have a tree, the trunk is the /, the branches are folders, when you go to the branch one below the one you're standing on, you are navigating to ../
np
 
@JacobSchneider / is the root folder, to be precise
 
Good morning folk. Question related to vue (not sure if this is the right spot): I'm looking to refactor an existing functionality in order to make it global. Currently, I've got for each component, the same script that goes off by the created hook. I'm looking for a way to not having it every component and I've been looking at Vue plugins (vuejs.org/v2/guide/plugins.html) as mixins (vuejs.org/v2/guide/mixins.html) but mainly, I wanted to get your opinion on it
 
@TiagoMartinho 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.
 
9:28 AM
I'm having an error now about async and await on my axios
async selectSomething() {
        try {
            return await axios.get(`/Something/SelectSomething`);
        } catch (e) {
            return e;
        }
    }
error says, "Uncaught ReferenceError: regeneratorRuntime is not defined"
but when I remove the async and await, it works fine.
 
why not just axios.get(my_url).then(then_func).catch(catch_func)
 
@Neoares well, nick caused it himself.
 
oh
I thought I was because of my "porn" comment
someone pointed out the "porn" comment in the star tab
 
that is a cause, not the effect
 
and you said "caused"
 
9:42 AM
that message itself is ok for me. Nothing wrong with it
 
yeah, it is only offensive to jQuery lovers... but in that case we don't care
 
i am glad that benjamin took time to talk with Yvette
this room is kinda different :P
 
yes
we're special, so we have special needs :v
 
S.P.E.C.I.A.L. ?
 
I hope I was able to find a word for every character that would fit the situation of the chat
but my england is not that good
 
9:50 AM
that is a fallout reference
 
oooh true!
the perk system
 
> my england
Queen intensifies
 
10:28 AM
how come some people dont show up in the @ list?
do they have to have said something in the last x days?
 
user2411267
Guys whats the best way to collect keystrokes/touch screen events and logging them ?
 
@Ali.B 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.
 
use the keypress event
google for "mdn key events"
 
user2411267
I know the the JavaScript basis for keyboard log, is there an equivalent to touch screens ?
 
you can only register when the screen got touched
 
10:33 AM
I think so
 
user2411267
and the bigger question is how to save the information and transfer it, (ex sending request to php page and let it handle it on each key event)
 
hi
 
and where and ect. But touches on a virtual keyboard?
 
before helping you... are you trying to implement a hacking tool?
 
I have a function1()
function2()
 
user2411267
10:34 AM
no, ofcourse not
 
both are asynchronous
 
touching the virtual keyboard does not trigger anything
 
so sometimes function2() runs before function1()
 
I mean, I have no idea but I'm 99% sure
 
user2411267
I'm collecting metadata while filling an exam
 
10:34 AM
since it's not part of the web
 
how can I make it run only when function1() is complete?
 
@Ali.B that's what a hacker would say
 
user2411267
to see if there is a correlation between exam results and how users behave
 
both make calls to ajax
 
@Breathing use promises or call function2 when function1 is done
 
10:35 AM
pass function2 as a callback for function1
 
using promises is a clean way though (Fetch API is a promise itself)
 
they both are called inside another function3()
 
modify function3 then
 
user2411267
@Neoares I'm not a hacker -_-
 
I know, a hacker doesn't ask that kind of questions :P
 
10:38 AM
will this work
$.when( function1() ).done(function2())
 
no because function1 does ajax internally
you have to get that ajax object. Either return it in function1 or refactor it to there
(first option is preferred)
 
I saw the sol here
13
Q: Jquery continue another ajax function after the first ajax function call is fully complete

vzhenI have 2 ajax call in 2 difference functions. I want to use .click to call these 2 functions . The func1 is inserting data in to database, then func2 is to retrieve the data so my question is how to wait until the func1 fully complete then it only execute the func2. I tried .delay(), it works bu...

second one
 
TIL Edge treats duplicate file names differently
original.csv
original.csv(1) // firefox or chrome
original.csv(2) // firefox or chrome
original.csv (1)// edge
a simple space.
@Breathing that is the second option and what neoares has suggested
 
10:56 AM
yeah thanks
 
11:42 AM
microsoft, the original trolls
 
@BenjaminGruenbaum thanks
 
What's up?
 
12:02 PM
Hi, I need to visualize realtime data (2d map with moving parts) as gif/video/ascii_moving_image from nodejs. Any ides on how to do it?
 
canvas
 
ok so i have image drawn on canvas, what next?
 
Animate it.
 
and in between the frames?
 
And?
 
12:06 PM
thats the question what do i do with the frames, i can't finish the gif first and then send it as whole gif, as that wouldnt be realtime
 
Why use a gif?
 
well thats what i'm asking, what should i use
 
canvas
 
i need to generate animation on nodejs, and display it to client
i dont want to generate image on client
 
Why not?
 
12:09 PM
because that would mean some custom transfer protocal that can introduce mistakes
and this is a debug tool
 
I don't see why that's a significant problem
 
ok
 
Sending raw data is almost certainly more efficient than sending image data
 
i dont want to be efficient i want to avoid possible errors, i just wrote that...
 
I'm not sure why you're more concerned about the protocol than anything else
 
12:12 PM
because its a debug tool to visualise raw data
 
That doesn't explain it
 
adding protocol between visualisation and raw data creates more possibility for erros
 
All code you write has a possibility of errors.
That's not an excuse to not write code
 
one may have more than other
still, I agree with kendall: send raw data
would spare you headache if the UI needs a change due of management decision + reusability
 
What if you try to implement image streaming and make a mistake with that?
 
12:14 PM
this is like saying i should create transfer protocol between node and console, so i can later change the way i display debug output in console...
 
People do that for logging
Also, it's not like sending raw data adds a protocol. It just replaces the image streaming protocol.
 
why do you need to do that?
 
normal people do something like logger.info("player is on position 1,2") and not something like logserver.sendpacket({player: 1, position:{1,2}})
 
the existing protocol + console is fine enough to display it. Heck even the network tab (supported by all major browsers) displays the response data nicely.
 
@KarelG because i need to visualise something i have in my node app
 
12:16 PM
which one is better to troubleshoot: a json format response data or a raw bytestream?
 
@Kikaimaru That's because the console isn't on the other end of a network connection
 
@KendallFrey if there is a way for node to display images localy, tell me
 
Wait, is this not over a network connection?
as in node server and browser client?
 
@KarelG it's either node -> raw data -> browser -> canvas
or its node -> canvas -> browser

it the canvas->browser problem is still there, but the raw data -> browwser not
@KendallFrey i need ANY way to display some realtime data from node
 
@Kikaimaru Please explain the difference
 
12:19 PM
it is also incomplete kendall
unfair comparision :P
 
i'll draw it in ascii in node and set broswer to refresh each second
 
good lord why
Use WebSockets, at least
 
why?
so it will be more complex without any benefit for me?
 
Because it's designed for this situation
 
you don't even know what the situation is
 
12:22 PM
Unless you have less than a week of experience with JS, in which case I'm ok with doing it the inefficient way for learning purposes
 
sure...
 
@Kikaimaru I'm just going by what you told me. If what you told me isn't accurate, why are you asking for advice?
 
no you really aren't whats the benefit of using web sockets
"its designed for it" is not a reason
 
It doesn't require the browser to refresh, so it will update the page seamlessly
 
so?
why would i need that?
 
12:23 PM
It won't look like dogshit
 
why would debug output need to look nice?
i mean you are obviously wrong, dont you see that?
 
Don't be an ass to people who are trying to help you
 
you are talking about "visualize realtime data" first and now debug output.
 
Does anyone of you have an idea of how to enable service worker on test/production but disable it locally/dev using Ionic/Angular?
 
Just use Gnuplot lmao
 
12:25 PM
ha
 
You're worried about the protocol introducing errors. I'm not sure why you'd be worried about that, unless you're working for Nasa and your node server runs on Saturn.
 
he left the room anyways ¯\_(ツ)_/¯
 
"left"
 
do you mean the word that starts with that character after before the first character of that word?
 
wut
 
12:27 PM
oh lol. it is before
 
please do not ask me to explain it :|
 
please explain it >:)
 
@KarelG would you kindly explain that to us?
 
The character before the first character of a word? A space?
The space.
You're so smart, Karel.
 
12:30 PM
!!space
 
@Neoares That didn't make much sense. Maybe you meant: sscce, spec
 
!!giphy space
just no
 
inb4 epilepsy
 
"left"
first character of that word -> l
that character before -> k
the word that starts with -> k...
:
 
karel?
 
12:31 PM
Karel?
 
!!undo
ugh
 
@KarelG illuminati confirmed
 
there is an eye in one of those images
 
why
why you delete a comment and then say the same?
 
Explain it
 
12:33 PM
idk. chat was acting up
 
you're being unwelcoming by not explaining that
 
go open a meta about that. That would be so ... meta.
 
i have a string of XML. any suggestions on how i can display this formatted including indentation in HTML? just throwing an XML string into a <pre> tag doesn't do the indenting.
 
 <div class="alcohol">
       <img src="~/img/Interaction/alcohol.png" title="Alcohol" />
       <span>{{product.interaction}}</span>
  </div>
IF {{product.interaction}} == 'CAUTION' (Span color is red ) any idea??
 
1:16 PM
um
is something set up to balance Vue and React GH stars?
they seem to have exactly the same amount right now
 
@im1dermike You can format it yourself on the server then put it in a pre tag
While i'm sure you could parse xml client-side, I wouldn't attempt it
 
@BartekBanachewicz AFAIK react had 4 or 5 less stars than vue
 
@KarelG right now it seems to go perfectly hand in hand
 
not difficult to make a joke from this and star react to that same number
yeah just checked
 
well ok vue seems to have 3 stars more now
but still that's like 0.003% difference?
 
1:26 PM
meh the "competition" is silly because by design, both are different
 
1:37 PM
@BartekBanachewicz it's been flipping for the last 3 days
 
01:00 - 14:0014:00 - 00:00

« first day (2802 days earlier)      last day (2145 days later) »