« first day (3148 days earlier)      last day (1817 days later) » 

2:58 AM
More shameless plugging: SourceUndead-server and SourceUndead-client have now been converted to pure websocket and JWT :O
 
hi
 
@TheNewGuy 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.
 
 
3 hours later…
6:32 AM
@TheNewGuy hey, are you the new guy?
 
Good day
how can I put this <h1>asdfasdf</h1> inside the div? like markup?
 
@AppleCiderYummy you need to escape the characters if you want to show a literal <h1>asdfasdf</h1> on the page
 
But how?
 
on the page it would be like &lt;h1&gt;asdfasdf&lt;/h1&gt;
and it would show up correctly
 
because I have a sample text, <h1>asdfasdf</h1> and I want a div to convert it to h1"asdfasdf"
 
6:37 AM
ok, that's not a literal conversion then
what is the rule for converting <h1>asdfasdf</h1> to h1"asdfasdf"?
 
I mean, it must show asdfasdf as h1
Let's say, I have text. <strong>Hello world</strong>
I want my div to show it as Hello world (bold)
 
ok, so you want to add the html to the div
 
I tried this <div markdown="1"> doesn't work
Yes exactly
 
<div><h1>asdfasdf</h1></div> this should do it
it'll appear larger and bold as you'd expect
 
it only show <p><strong>kasjdkfajsdf</strong></p>
doesn't show the asdfasdf as bold
 
6:41 AM
can you make a jsfiddle showing me what you mean?
 
oh okay
 
I ask only because this isn't "typical" behavior
but I can't know the problem without seeing how you did it
 
It works fine using vanilla js
But in vue.js, it doensn't work
 
Rob
How are you setting it in vue?
 
ok, I can't help you then, but this should already tell you something
 
Rob
6:51 AM
vue is probably sanitizing the string for you
 
it has to do with vue
 
here's the result
from `<div>
{{item.row.description}}
</div>`
 
Rob
so.. <div v-html="item.row.description"> </div>
But uh..
 
Thank you so much @Rob it works perfectly fine
let me show you
 
Rob
It's very likely you don't want to do that. If that data is coming from user input
They can put in whatever they want, including javascript
 
6:56 AM
Thank yuou so much @Rob have a good day
 
Rob
Sure thing.. but did you see the above?
 
I understand but is there an option to not let the user do that?
 
Rob
Yes.. by escaping the html ;)
If you want them to be able to format text, you might want to look into supporting markdown syntax rather than plain HTML
 
Oh thanks for that info
 
7:38 AM
I am in Berlin for the OpenJS collaborator summit and JSConf - ping me if you're here and wanna hang.
2
 
 
2 hours later…
9:21 AM
This video is terrifying - youtube.com/watch?v=HRFzHiL-irY
 
9:43 AM
hello
i'm using bootstrap 4 i'm trying to change the photo in this class " bg-login-image"
 
10:00 AM
hello
@JRick what is the issue in that
use background or background-image to change image
.bg-login-image{background-image: 1.jpg}
 
@AtalShrivastava yea that worked , thank you !!
<div class="bg-login-image" style="background-image: url('url')"> that worked with me
 
Room question: How many of ya'll use API gateways at work, how do you authenticate with them? Ping me with responses!
(Can I Pin that?)
 
10:25 AM
can we encrypt a uploaded file before sending to server? i
 
is there is a way to make the image 100% width ( take the entire block ) , stay in the middle of the block , with relative hight ???
in bootstrap 4*
 
10:44 AM
how do i specify dates horizontally instead of numbers?
 
11:05 AM
Noooooo can't accept an answer to a question I had before I have to move for a day.
 
11:19 AM
Hey, does anyone know where I can get some actual help with v8? The lads over in the C++ lounge don't know
 
11:57 AM
@JacobSchneider what exactly do you mean with "help" ?
 
12:32 PM
@AtalShrivastava yea, use https
 
1:10 PM
@ShrekOverflow We use a bunch
most are oauth or just token headers
 
1:26 PM
Interesting 😀 thanks!
I pinned it -- feel free to remove :P
 
1:36 PM
Hi, Our code uses React 15 but I need npm package slate to implement Rich Text Editor but it has dependency on React 16. I tried upgrading react which totally broke our code. What should I do?
 
fix your broken code
 
2:37 PM
but
 
Don't tell my mom, but I just started to microdose psilocybin as an antidepressant/anti-anxiety med, and it's probably the best thing I've ever done. I started to get really curious about it a while back, and I've seen some studies come out that talk about its profound effects, and the Denver decriminalized it, and so I decided to try it out (as a microdosed medication, not recreational)
Similar, but less side effects compared to an SSRI
more effective in its actual goal
 
@ndugger I've heard good things about it also
 
It's only been a few days in, though
 
My advise would be to not tell your mom if you think that would upset her
no reason to imho
 
lol, I talk to my mom about drugs all the time, and she still doesn't know
She's a nurse, though. We like to talk about the medical aspects of them
 
2:45 PM
hi, is it logical for a user on a editing form to click submit without editing and tell him that the edit was successfull?
 
logical?
 
it's more work to detect no change and make no action and/or notify the user
just save over the old data and move on
 
3:34 PM
Question about design choice: For the chat bot I am creating, should each room instance have its own node process or should they all be in one process?
 
How do you guys maintain good posture sitting at a desk all day? I notice myself slouch and try to mentally remind myself, but it takes away from me being able to concentrate. Anything you guys do to keep that posture upright?
Wouldnt the chatbot be easier to maintain if each room instance had its own node?
 
@faceless Not necessarily. I can design it so it would just be const room17 = new Bot(17); const room1 = new Bot(1);
 
@JBis Have you had a look at the architecture?
Events are fired across all rooms the bot is in
 
Yes, I know. But there are certain customizing options for each room. For example a different welcome message or different commands.
My real question is whether to convert the bot to a class:
@BenFortune hmmm. that actually gives me an interesting idea.
If I create a shared client and just pass it to each bot instance
 
Why are you using puppeteer?
 
3:45 PM
I plan to get rid of it in the future, its just easier to keep track of all the data (cookies, etc.) for now.
 
Because it's an extremely heavy dependency and you don't need it?
Most request libraries have cookie jars
 
Yes. That is true. I will be getting rid of it soon.
 
4:08 PM
@BenFortune Side note, if you would like to, feel free to contribute and/or correct any issues to this documentation. Trying to create collaborative documentation for the SO/SE Chat API. → github.com/jbis9051/SO-ChatBot/blob/master/docs/CHAT_API.md
 
5:05 PM
I realized I don't know as much about jquery as I thought. I'm using hilios.github.io/jQuery.countdown, and whenever I use the $('.clock1').countdown('pause');function as outlined in the documentation, I get an error Uncaught Error: Couldn't cast pause` to a date object.` on line 53 of their code. Does anyone have a minute that they could look at that code and see why it's not parsing the instructions it's supposed to?
 
what version are you using?
I see one open issue for a similar problem, and a closed issue with the same problem
 
2.2.0
 
do you start the timer before adding the element?
show me your code
 
Weird question, but this location seems to be the place that can answer it best: is there a beer keg emoji?
(in unicode)
 
not tmk
might be a barrel emoji
🛢️
there is an oil drum
 
5:13 PM
If it seems hacky, that's cause it is ;)
 
okay. so you have $('clock1').countdown('pause') but when building the countdowns you use .holderN
 
Yeah, I fixed that, and backed up over that, I'm still getting the same issues.
I've been banging my head against the wall for hours now trying to get it to stop. I'm essentially having it see that there is a viable end time and show how long the round was from start to end, but the clock keeps updating the countdown on the same container
 
can you make a demo showing the problem?
 
Give me a few minutes, I'm about to throw my computer
 
5:29 PM
Fucking IE dev tools
 
that's assault brother
 
ok, I just galaxy brained that and fixed it.
sometimes you just gotta look at your code and think "maybe we don't just hack together random things" and call yourself a dumbass.
 
That would be my dog, and she's currently asleep on the other side of the room.
Thanks for watching me be a dumbass
For clarity's sake, I kept forgetting to put in the line that checked to see if the timers had been started first.
I thought I had, but guess what
 
@JBis Really well documented, nice
 
5:46 PM
hey... how do you replace an html element with another element in javascript again?
specifically an image
nvm
lol
 
I am trying to trap a space followed by a number in regex /([ 0-9]+)/
 
look up what [] does
 
ok
33
Q: What's the difference between () and [] in regular expression patterns?

KatieKWhat is the difference between encasing part of a regular expression in () (parentheses) and doing it in [] (square brackets)? How does this: [a-z0-9] differ from this: (a-z0-9) ?

Thanks. ( +[0-9])
 
lol
 
6:33 PM
-1
Q: Why jQuery puts equals in whitespaces when I try to append some String

David DominguezI have this string: var strAppend ="<button id='btnUEN' class='k-primary' onclick='getCategoryByUEN(" + stronClick + ")'>"+ name +" </button>" $("#nav_clacom_1474").append(strAppend); I did put a console.log to strAppend and I have this value: <button id='btnUEN' class='k-primary' onclick='g...

 
oof
> strAppend
10/10 variable naming
almost as bad as when I see
> retVal
for the return value
 
@BenFortune Thanks!
 
@ndugger I have 0 problem with that.
it's at least trying to be descriptive
const r = await query(..);
better than that
 
bah meant to do incognito
 
lol
 
7:16 PM
!!refresh
!!magic
 
(∩ ͡° ͜ʖ ͡°)⊃━☆゚. * ・ 。 ᵀᴴᴱ ᴳᴬᴹᴱ
 
nothing to see here
 
bruh
 
stop moving messages nick
 
7:24 PM
!!ndugger
 
@KevinB That didn't make much sense. Use the !!/help command to learn more.
 
7:35 PM
is there a way to log frontend javascript errors on log files on my server?
 
But it iSN't frIdaY yet
 
!!the
 
game
 
7:51 PM
@TylerH i think the second link helps more, i have to write my own backend service for that, then.. doesn't seem there is a library to use out of the box..
 
i mean, if you want it stored on the backend
there's gotta be a backend for the client to talk to
 
can someone do me some google-fu and see if this is still true
41
A: PostgreSQL - set a default cell value according to another cell value

Erwin BrandstetterThis is not possible with a simple DEFAULT value, as the manual clearly states: The value is any variable-free expression (subqueries and cross-references to other columns in the current table are not allowed). You could use a trigger instead: CREATE OR REPLACE FUNCTION trg_foo_b_default...

6 year old answer
and this is the newest answer I can find
:/
 
can't you put a select statement in as the default value? I'm terrible with databases, but I thought that's how you would do that
 
The documenation still says the same
> The DEFAULT clause assigns a default data value for the column whose column definition it appears within. The value is any variable-free expression (subqueries and cross-references to other columns in the current table are not allowed). The data type of the default expression must match the data type of the column.
 
ahh. I somehow didn't see that
danke
 
8:01 PM
dank
 
After how long of inactivity do you leave a room?
 
7
 
define inactivity
 
I don't know. I am removing puppeteer from my bot, but I don't want to not receive events in the web socket cause I don't have an open tab in a browser. Do I need to send message to each room every so often or what?
 
there are users here right now that haven't talked in a month and a half
 
8:08 PM
@ndugger hours? days?
 
lightyears
 
So then what causes you to leave a room other than clicking the leave button or logging out?
or nothing
 
well, you can close the tab without leaving the room
 
But many times when I reopen JS chat after a night my icon drops in. I never clicked leave or logged out.
like forresthopkinsa's icon just dropped in
 
it depends on when your browser drops session cookies
historically it was on the process termination
 
8:12 PM
i'm testing it on the meta tavern now
closed tavern here, sitting there anonymously on an incognito, i'm still there
 
Yes. I figured its a timeout after the window is closed.
@rlemon So doesn't closing tab and still being here contradict that idea?
 
no
I said it depends on when that happens. then told you what used to happen like 8 years ago
if you're inferring that should be true now.. that's not what I said
 
> depends on when your browser drops session cookies
how does SO know when your browser drops session cookies if you aren't actively on the page...?
 
@JBis I think I woke my computer up right then
 
@JBis well then it's got to be a two part
 
8:16 PM
the longest inactive user i see in the tavern has a last seen of 13min
 
although might've returned focus to the chat window
 
horray, you just deduced something :D
 
now it's me at 7min, dunno where teh 13min went
 
maybe it's completely random
 
random doesn't exist
 
8:18 PM
maybe it's maybelline
 
i expect it to kick me out of the user list at 15min
 
I can't see the entire user list
cough #56 cough
 
click teh arrow thing
 
oh, haha
i adblocked the room info area
makes a lot more room for the stuff i care about
 
8:21 PM
you don't care about the chat, you just wanted to block something
 
I had made them all collapsible at one point.
but how the chat was building up the lists made it buggy as fuck
but that was a while ago
 
I can't use an adblocker cause it crashes stupid ass Safari (more than it crashes on its own). use chrome I want to switch over but Apple doesnt allow you to export passwords so its a pain the the ass </rant>
 
use a 3rd party password manager
 
I just don't use ad blockers </smug>
 
one that works across multiple browsers
 
8:22 PM
Exactly but how do I get them in there without going to 100+ sites and autofill + save
I have been just surfing and saving the ones I come across
eventually I will have all that I need
 
I keep my less-used passwords in a notebook locked in a desk drawer
 
ad blockers don't help grow a free and open internet
 
i don't care
 
i don't want to see ads, and i want all the stuff to be free
 
8:24 PM
if your payment model is ads, I'll adhere. if your ads are intrusive or your site is laggy because of it. I'll not revisit your site
 
:)
 
I wish that more sites let me pay to remove ads tho
 
@KevinB you have my vote
 
I'd gladly do that for my most used sites
 
I like the Medium model quite a bit
 
8:25 PM
i hate medium
 
I like how SO does ads. power users don't get banners.
 
Do you hate the content or the model
 
and the sidebar ads are not intrusive
 
A combination of both
 
@rlemon people will complain about them anyway
 
8:26 PM
!!s/about them//
 
@rlemon @rlemon people will complain anyway (source)
 
It has no way of presenting negative feedback
it's an echo chamber
 
@KevinB Authors choose which of their content goes behind the paywall, and the claps decide how much of your monthly membership cost goes to that story
 
@forresthopkinsa you'll always have people complaining. it's like a sport on the internet. who can bitch the loudest over irrelevant things.
 
yeah well I'll complain to that
/cheers
SO Meta is frustratingly negative
I'm gonna make a negative post on Meta about all the negativity
 
8:28 PM
lol.
-40 instantly.
 
Maybe if people didn't feel like they're being ignored
Ok, my meta tavern user has left the tavern
 
Your downvotes mean nothing to me, this is Meta. I have the power of Jeff and Joel on my side
 
wasn't paying attention, but it was probably after 15min
 
Was that @KevinB or an anymous user?
 
it was me
 
8:33 PM
hmm ok thanks
 
9:11 PM
I am wondering a bit about the Object.getOwnPropertyNames() method in JS
When you use it on an array i.e. `let arr = ['a', 'b', 'c'];`

`console.log(Object.getOwnPropertyNames(arr));`

It logs >[ '0', '1', '2', 'length' ]
What is "length" doing in that array?
It's not there when you use the method on an Object. i.e.

`let object = {a: 1, b: 2, c: 3};`

`console.log(Object.getOwnPropertyNames(object));` simply logs >[ 'a', 'b', 'c' ]
 
arrays have a property called length
 
so the properties of the array ['apples', 'oranges', 'peaches'] are still going to be >['0', '1,', '2', 'length'] ?
length is just always a property of an array be default?
 
Interesting.
 
Protip: Any code that enumerates the property names of an object is smelly and can probably be done nicer.
 
9:18 PM
Yeah seems like it's better to use this on an Object, since it actually returns the values of the properties of the object.
 
9:29 PM
Any chance someone could take a look at this?
https://stackoverflow.com/questions/56385796/how-to-store-a-variable-in-an-array-in-a-different-file
I want to store my variable in a seperate file as an array I've already created
 
10:02 PM
Can someone help me with the request promise library I am getting inconsistent results
ignore
 
 
1 hour later…
11:29 PM
Ok, I still need help :(
async browserSetup() {
        this.cookieJar = request.jar(new FileCookieStore('./data/cookies.json'));
        return this;
    }
async mainSiteLogin() {
        const resp = await request({
            method: 'GET',
            uri: config.siteUrl + '/users/login',
            jar: this.cookieJar,
            resolveWithFullResponse: true
        });
        if (resp.statusCode === 302) {
            console.log("Already Logged in Yey!");
            return;
        }
        const $ = cheerio.load(resp.body);
        const fkey = $('input[name="fkey"]').val();
        const body = await request({
            method: 'POST',
Already Logged in Yey! never prints cause the cookies don't save/load properly
I'm not sure what I am doing wrong
 
If you had to use a word to refer to the concept of ".." in the directory navigation sense of the idea, what word would you use?
 
relative parent folder
.. is the parent folder relative to the current directory or .
 
Right, good point. I'm trying to figure out a word/phrase that is self-inclusive as well as exclusively refers to "..". So words/phrases like "relative parent folder" or "navigate to parent directory" don't actually mean ".." on their own - they're descriptions of what ".." does
 
We're back and better than ever :O
 
11:35 PM
I wanna find a word/phrase that when you see it, you think "ah, .."
 
@JBis took me hours to figure it out, but I just switched over to JWT instead of cookies. And it's not terrible
tbh probably easier outside of redux (but it is react)
 
@SterlingArcher ...what?
 
You're doing login and cookie stuff, just tossing out an alternative :P
 
Its not my server, I have to use cookies
 
11:39 PM
Its stack exchange....
> uri: 'https://stackoverflow.com/users/login',
not sure what you mean
 
even more ew. Didn't they move away from OAuth?
 
Well my question is about requests
 
It doesn't look like you're calling browserSetup
So in
const body = await request({
    method: 'POST',
    uri: 'https://stackoverflow.com/users/login',
    jar: this.cookieJar,
this.cookieJar is probably undefined?
 
I am calling it, I just didnt show the code that calls it
it is defined
 
ok, but you're still getting a 301 response?
302
 
11:45 PM
no, I want to get 302
302 means the cookies were retained after shutdown
 
> The HTTP response status code 302 Found is a common way of performing URL redirection.
 
200 means login
 
I don't think 302 is the right status code you're looking for
 
yes, yes it is
 
Is there an SE login doc that says it returns that code if you're already logged in?
 
11:47 PM
If the login is successful it will redirect you to the homepage
@SterlingArcher Yes, the one I created.
 
Where do you do that?
ah ok hang on
 
> If the site detects you are already logged in, it will redirect you to the home page
 
I'm not seeing an HTTP status code defined on that README
 
grrrr
look
see
302
redirects
 
Well I can't exactly see your console :P
 
11:51 PM
agrgafbhasjhdfbasd
I logged in on chrome and then went to url and checked the dev tools
if you don't believe me check yourself: stackoverflow.com/users/login
 
Easy cowboy, just trying to understand what's happening so I can help
 
sorry
the issue is not with that status code check
 
Ok, so you said the cookies aren't being stored properly?
 
it is either with request call or cookies jar
yes
 
Can you compare the cookies sent from the login, to the one you've stored?
Maybe they're different, or maybe something in your browserSetup puts them in a schema the jar isn't expecting?
 
11:54 PM
they are wrong
thats the problem
they are stored properly the first time but then when your restart the node process they are cleared
 
When dealing with the .hasOwnProperty() method, does it not really work for arrays?

I have

`let array1 = ["hello", "world"];

console.log(array1.hasOwnProperty("world"));`

And it logs out false.
 
@HappyHands31 use includes
 
!!> let arr = ['abc', 'def']; console.log(arr.abc)
 
!!> ["hello", "world"].includes("world")
 
@forresthopkinsa "SyntaxError: return not in function"
@JBis true
@forresthopkinsa "undefined" Logged: "undefined"
 
11:59 PM
array elements are not properties of the array
 
@forresthopkinsa the properties of an array are just the index values + "length", correct?
 

« first day (3148 days earlier)      last day (1817 days later) »