« first day (3803 days earlier)      last day (1370 days later) » 

01:23
hey I'm trying to make a dynamic table using vanilla js.

it looks pretty good except that it keep saying undefined before the table, not sure why?

it's a simple html table that get inserted in innerHTML of the tbody of an existed table
           var tb = document.querySelector('#tbody1');
           var q;
           q+= '<tr>'
           q+='</tr>'

          tb.innerHTML = q;
it appears fine but i keep getting undefined<tr></tr>
01:41
nvm , it was because var q is undefined , fixed by changing it to var q = ''
 
3 hours later…
04:53
@LoopingDev You should start using let or const and avoid Var.
 
2 hours later…
07:17
moring. What is the goto (if any) logging framework for frontend js?
 
2 hours later…
09:19
console
Depends on your environment tho
ok, I want to be able to save the logs (like push them to a rest or as a message via websocket)
10:13
Can someone help me with uploading image files from express to react plz
well only problem i have right now is saving the correct file path to mongodb
You're not giving us much to go off of
so I have this multer function(s) to save uploaded images in my backend:

const fileFilter = (req, file, cb) => {
    if (file.mimetype === 'image/jpeg' || file.mimetype === 'image/jpeg' || file.mimetype === 'image/png'){
        // accept a file
        cb(null, true);
    } else {
        // reject a file
        cb(new Error('Incorrect file'), false);
    }
}
const storage = multer.diskStorage({
    destination: (req, file, cb) => {
        cb(null, 'uploads/');
    },
    filename: (req, file, cb) => {
It correctly saves the image to that directory and gives the correct filename
I am saving the filepath to mongodb using this line in my controller

productImage: product.productImage
It saves the following file path to my db:

uploads\\2021-03-15T10-28-01.739Zvans-2.jpg"
When i try to render that file path in react it doesn't work: shouldn't that file path look more like uploads/image1
Also i made a mistake in my multer filename function: its not cb(null, file.fieldname)

its: `cb(null, new Date().toISOString().replace(/:/g, '-') + file.originalname);`
Im saving the file path to the db like this: productImage: req.file.path
I get "Not allowed to load local resource: ...."
and the following filepath is pushed to my src attribute to the img element:

..\c lientpublicimages‡-03-15T10-36-32.238Zvans-2.jpg
omg nvmm i found the answerrrrrrrr. spent last 2 days on this woooooow
11:14
heh
Always good to have a rubber duck
12:02
hi
@AminDeraiya 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.
12:35
@BenFortune all hail our rubber lord
@BenFortune is that a British saying ?
TIL
In software engineering, rubber duck debugging is a method of debugging code. The name is a reference to a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck and debug their code by forcing themself to explain it, line-by-line, to the duck. Many other terms exist for this technique, often involving different (usually) inanimate objects, or pets such as a dog or a cat. "Desk check your code" is the original term for this technique. Many programmers have had the experience of explaining a problem to someone else, possibly even to someone who knows nothing...
I was just going to link this.
I have experienced that myself, explaining my problem and suddenly got a "bright lamp", why that occurred and how I could tackle it down.
so .. rubber duck'd ?
Do you accept the rubber duck as your lord and saviour?
(side-note - googling "giant rubber duck" lead to a ton of entertaining images with this thing. No idea where it was)
Last one, I swear. It just cracks me up:
The rubber duck is the best source of answers outside SO
And maybe even on SO, but I don't think we have stats on people that started writing questions ang got rubberducked.
12:47
The rubber duck doesn't judge. It accepts you with your failings.
@Cerbrus SO becomes a bad source for answers IMO
Depends on the question
there are a lot questions with answers that are from before 2015
it may help but the solutions are usually "old" or deprecated.
a minority of these gets updated with solutions using "recent" functionalities
hence when I have a solution I can use, I use that but continue my research, to see if there are no better alternatives
13:33
342
Q: Introducing Outdated Answers project

Anita TaylorIn our blog post last month on our Community & Public Platform strategy & roadmap for Q1 2021, we announced an initiative to address outdated answers on Stack Overflow. Today, I'll give you more information on our approach and how we will solicit your feedback. Why outdated answers? Why now? Find...

Hmm one of our services just became terribly slow last thursday/friday.With request times going up to 30 seconds for simple database calls. However now past the weekend it's running smoothly again, and there shouldn't have been any change (update backup etc) between now and then.
Shoudl I be worried?
13:54
It was probably tired. It's now feeling refreshed after the weekend. /s
OK, more seriously - maybe. Who knows - there are many things that might be happening. It could be a fluke. It could also be the first manifestation of a problem.
My advice would be that for now you don't do much - maybe enable more logging/monitoring but overall just keep an eye on the service. If it exhibits a similar behaviour, then start looking into what's causing it.
BTW, had a client complain that "the program is slow" (deployed on their premise and maintained by their infrastructure team). We tried using their copy and it was indeed very slow to search stuff. We had access to the database and trying a simple SELECT 1 took seconds to come back. Turns out their DB had some issues and the DB admins hadn't talked with infrastructure team, nor did the users go to the internal maintainers first.
Moral of the story - might not actually be you.
@paul23 you need to log that (if there is one)
I have an excel sheet here with performance logs, indicating [datetime, client, server, operation issued, comment]
14:09
If possible make add some automatic monitoring...thing. I've cobbled together some Bash scripts for network monitoring.
It just does a ping and drops writes the responses to a log, so it can be examined later, if needed. Something of this calibre can work - a simple script that gives you some data to go back to.
Doesn't have to be complex however, it can be challenging to make such a thing in some circumstances.
I have that as well, but the excel sheet is easier to look up and can be used by other people outside my team
for example support; when they get a ticket about perf problem, they can look in that sheet if it has occurred often. If so, they can elevate that to us. If not, they submit a form for small research and that's it
these entries are always being looked at as first job by someone the day after. That person gets cycled per day
Are Redis and redux are similar things? what is different about it?
no. Both tech have also a nice website explaining what it does
@VLAZ @VLAZ thanks for sharing that.
in one of the linked questions, I've found this
They're too soft on duplicates — random Aug 19 '11 at 0:52
2011!
14:21
So that would log each request to a database and give time etc?
Wouldn't that quickly collapse the whole structure because the amount of requests is too large?
have a thread purely for logging
put a queue
when threshold got reached or timeout, send it away (write to db)
@paul23 Yeah...refer to "it can be challenging to make such a thing in some circumstances."
Hmm that's actually properly complex: we have a server that spins like 6 independent (except for database queries) dockers for each "type" of request. Like login docker, a docker for action A & B, and another for C & D... I'd have to add a multitask structure in this docker?
Or add a (small) script to the routing nginx...
I'd advise not spending more than a day on this. Probably not more than a couple of hours.
If it's a problem, then you can invest more.
But if you spend a month engineering the best logging system that won't catch a problem, it's a bit of a wasted effort.
Dunno what the service is but you can have a script that makes a request and measures the response time. Then schedule to run it every hour or something.
That's a quick and dirty monitoring solution.
The service that was actually having trouble was just "getting translations for text on the website" - which took 30 seconds while normally taking 0.5-0.8 seconds.
14:29
hello
who is good in javascript here
no one
I just know c++, no js here.
!> just ask
is that a command? :P
14:32
|| just ask
Invalid command! Did you mean: test, list, wut? Try help for a list of available commands.
apparently, no
||welcome @KathrynBowner
@@KathrynBowner 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.
please who is good in javascript
Just ask your question ;P
Don't ask to ask
14:36
i am creating a project where by when i select from my dropdown let the seelcted option and amount to appear on a span on same page here is the jsfiddle of my work jsfiddle.net/kathrynbow/gk64Lcts/1
can anyone help me out it is really given me an issuehere
jquery... chickens out
i dont get u
@KathrynBowner jQuery is not a relevant technology anymore. There are barely useful use cases with it now. Actually there is only one; CSS manipulation
@KarelG basically that and legacy stuff. Including if you have something which depends on jQuery.
@KarelG for now that is what am dealing with
14:43
but you have to describe your problem a bit more accurately
@VLAZ yeah it is still ok as legacy code
i want the selected option from my dropdown to appear on a span inside my html onchange
on change, set text
 
1 hour later…
15:59
@KevinB i should change onchange to Text
wut
no
on change, set the text of the span
@KevinB have u checked the jsfiidle i sent to u jsfiddle.net/kathrynbow/gk64Lcts/4
i have not
please do check
i'd rather not
16:01
ok
then how would u know help me
if u cant see what am doing wrong in my code
you could provide a minimal example here
either your problem is far more complex than what you've described... or just changing the text of something on change should be more than enough explanation
dont worry i will find a way to solve the issue
16:19
why guys, i'm kinda noob yet on programming...i'm looking for a way to make my drag image slider work on mobile using events...until now i was not able...can you guys point me on the right path? or help me do that
dragging on mobile web sucks even when it works properly
wdym by image slider?
@JBis it is for the homepage slider...client whants to be able to swipe on mobile like on desktop -.-
wdym homepage slider? like scrollbar?
@JBis sorry, my bad, its a carousel
fullscreamsize carousel
on desktop i used a dum event like this
  function dragg (e) {
    document.addEventListener('mousemove', logMovement)
    function logMovement (event) {
      if (event.movementX < 0) {
        setCurIndex((curIndex - 1 + propsItems.length) % propsItems.length)
      } else if (event.movementX > 0) {
        setCurIndex((curIndex + 1) % propsItems.length)
      }
      document.removeEventListener('mousemove', logMovement, false)
    }
  }
dragging on desktop for carousel is horrible ux imo
|| mdn touchstart
take a look at that ^
ho mean...tha loks worst the the fist one
16:57
bahh..i cant make it work...
i have no movementX like before
pageX, clientX dont have the values i need
17:15
the one we used just... worked
touchstart, touchmove, touchend
18:04
Does anyone else have Firefox? Could you tell me how much memory is being used with no windows open on main process?
18:29
I created a helper library that works with the data viz library D3.JS (this isn't important but helps for clarity) When I link to the CDN of D3.JS and import my helper lib, it works. However, when I import D3.JS and my helper library, I get a D3 undefined error when attempting to use one of my helper library's methods. But when I write in native D3.JS, it works fine.
I am assuming the culprit is the order in which they are compiled, but I don't know how to address that
19:18
Hello people im new here and im tryng to make a deploy on digital ocean for my node js app and i have some issues is this the correct place for ask for help?
0
Q: troubles deploying with diigtal ocean node sequelize

Dario CoronelIm trying to make a deploy in Digital Ocean when i try to make a migration using sequelize cli but wehn i do it npx sequelize db:migrate its says a error in the terminal and says ERROR: Cannot find "/home/deploy/app/config/config.json". Have you run "sequelize init"? then i tri using npx seque...

it's probably the only chat room here remotely close to it
thanks realy thanks, here i expplain the problem in this ask
does the config file exist
yes its exists but even when make sure the config.json say the same
so there is a file at /home/deploy/app/config/config.json?
19:23
yes, there is
does the process trying to access it have the permissions to do so?
guess that'd be a different error anyway tho
yes i have the permision, but it like a issue in the path of the dir base idont know i gonna try something
@JBis 360 MB -.-
So why the hell is mine at 900MB
Mac or PC?
PC
That is what it is for me if I open Firefox then immediately check in processes under task manager
19:36
i have solved it using npx sequelize db:migrate WORKDIR /myapp/path
but now my app is runing
I thought 360 was rough that is extremely weird yours is almost using triple the memory
chrome is using 350 atm
I thought ff supposed to be more efficient
Chrome on startup is at 100 for me
With 10 tabs open, edge only using 500 MB for me
HI guys! , just a quick question please ,
i'm making an E-commerce web App using MERN stack , i need to use geolocation for Products , any recommendation on a library ? or should i just go ahead and use vanilla JS ?
many thakns
19:47
@HarvesterHaidar 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.
Yuh what's up
@joostdr_ 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.
20:06
@HarvesterHaidar you try to use reactleafleft?
sorry i mean lefalet
leaflet* its a javascript library thats use geolocations functions etc
Hi all! So, I am trying to use a JS regex to add bold formatting (<b> tags) to certain parts of the html.
@correctsyntax 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 am trying to get all instances of "1 somebook 5:6" to be formatted with <b> tags around them so they are bold.
The catch is that the numbers and "somebook" changes through the html
so my code I have so far is
```var pattern = '([0-9]\s|)([A-Za-z])\w+(\s)([0-9])+:([0-9])+|([0-9])+/gim';

const regexp = new RegExp(pattern, 'ig');

var result = string.replaceAll(regexp, "<b>$1</b>");

document.getElementById("new").innerHTML = result;

console.log(string);```
the string variable is a string with the original html content
the problem is that the $1 isn't working to re-add the content again to the string
ew
do you have to do it from already made html?
var string = "<blockquote><p>1 Acts 1:14 “And here he has authority from the chief priests to bind all who call on Your <strong>name</strong>.” 15 But the Master said to him, “Go, for he is a chosen vessel of Mine to bear My name before Gentiles, kings, and the children of Israel. 16 “For I will show him how many things he must suffer for My <strong>name’s</strong> sake.”</p></blockquote>";

var pattern = '([0-9]\s|)([A-Za-z])\w+(\s)([0-9])+:([0-9])+|([0-9])+/gim';

const regexp = new RegExp(pattern, 'ig');
this is a full example
well, the reason I need to do it with html already is because this is an after-page load thing
though, alternatives could be much better
according to regexr.com, the regex matches what I need (the numerals and book name
20:19
hello guys its me again, someone here know something about this Error? it using Nodejs in deployment its a Api here my problem
0
Q: (node:139123) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated NODEjs

Dario Coroneli have my app running in a server on digital ocean all its work, but when i try to make a Post with Insomnia like create a user its say the next error (node:139123) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallbac...

my api is running, but when i a make a post tryng to create a user with insomnia says "internal server error"
but in localhost in my pc its works fine
20:52
Hello, can you help on this question?
https://stackoverflow.com/questions/66645222/angular-cdk-drag-and-drop-ordering-issue
21:04
posted on March 15, 2021 by Cindy Bayless

The Beta channel has been updated to 90.0.4430.19 (Platform version: 13816.12.0) for most Chrome OS devices. This build contains a number of bug fixes, security updates and feature enhancements If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit feedback using ‘Report an issue...’

 
1 hour later…
22:06
1 small question, please. I'm storing the access token in the local storage of the browser. If I close the browser and open it again, the application still sends this access token from localStorage since it is there. But on mobile, whenever I close the browser and open the web app again, the token isn't sent in the request. Is the token being removed? How can I keep it even after closing the browser?
you can't control what privacy/content settings the client has
@ZahidSaeed localStorage should be persistent. Session storage is only for the current session (cleared on browser close). Neither should be sent in any request like cookies. They are only accessible through JS.
If they are being cleared for some reason on mobile, then what kevin said applies
@JBis Yes, correct. My code first checks if there is an access token in local storage, if yes then it sends it in the "Authorization" header
@KevinB Just for testing, is there any way i can check through my browser manually?
Just to see if this setting is enabled on my browser
I'm not asking how to disable it programmatically. Just confirming if it is really happening
output something from localstorage where you can read it
okay, I'll do an alert ( )
22:13
not neccessarily the token, but anything
yes
Understand
@ZahidSaeed alert will work but usually for testing it is prefered to use console statements, e.g console.log()
@JBis Yeah, I know but that will require me to connect the mobile device with the laptop
I have the angular app so I can just use the laptop IP
to show the message
An alert would be fine for it
fair point, there should be dev console on phones
Lol
but then they couldn't make it more convenient for us to buy their hardware/software
22:17
kinda funny how we have to pay to develop software for their platform, especially with ios apps
huh.
seems like chat is eating some of my messages
like the 3rd or 4th time today
helping with a mobile app that is unexplainably slow, but there's no profiler for it without paying for the expensive license
so.... all we can do is brute force it, or get approval for the license
pretty stupid
app working slow also looks bad on the platform i think
it interacts with hardware via midi, and i suspected the issue was throttling due to trying to send/receive too much at a time
but...
it's not that
because in demo mode, which doesn't talk to the hardware at all, it's just as slow
:shrug:
Okay, so I tested
I'm using ng2-cookies
So this small library basically stores the values in the "cookies" instead of the local storage
Once I log in and refresh the page, the access token stays there
but when I close it and open it again
The alert doesn't print the access token
are you setting an expiration?
|| mdn cookie expiration
I'm checking the expiry parameter of the library
I think that is the issue
I was missing the "expiry" in days parameter
@KevinB, @JBis Thank you for your help guys :)

« first day (3803 days earlier)      last day (1370 days later) »