« first day (3804 days earlier)      last day (1369 days later) » 

user13780186
01:35
Hi All, I would like to ask how to fix this >  Room [object Object]

here's the code

{
 label: `Room ${<IconButton icon={<Icon icon="plus" />}`
}
ohhi
!!choose mun-outpost or minmus-outpost
"SyntaxError: Unexpected identifier" Logged: `` Took: 1ms
minmus-outpost
Lol at error
cc@JBis
lol. I'm testing out an autocomplete feature when a command not found and I guess it thought you were trying to execute code cause of the "-" in "mun-outpost"
would be cool if it'd detect "or"
01:40
good idea, i'll add
 
6 hours later…
08:05
1
Q: PWA service worker doesn't work in Firefox

LarakBellI have this code for add to home screen using service worker and PWA: function isFacebookApp() { var ua = navigator.userAgent || navigator.vendor || window.opera; return (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1); } if (window.location.protocol == "https:" && window.isSecureCo...

@LarakBell 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.
08:37
|| choose big task or stupid little tasks
@JBis Son, I am disappointed
|| choose big or medium or small
||choose big or medium or small
08:38
big
I hope it doesn't just choose the first thing
|| choose big or medium or small
medium
good
imagine that it replied with big again
it only captures a word, not when spaces are in between
|| info
I'm a bot. I am owned and operated by @JBis. I am open source. I am written in JavaScript.
08:49
^ should be TS
nice, it treats the text as multiple options
James is lying on the internet! Impossible!
actually if you check the source code its actually written in TS
@Moistbobo 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.
> big task or stupid little tasks
gives [big, task, stupid, little, tasks]
@Moistbobo *nicolas cage you don't say?*
|| choose big task or stupid little tasks
tasks
08:54
HUE HUE
oh i see what you mean now
english is hard
question about storing functions in variables and hoisting, why does functions stored in a variable are not hoisted ?
func()                                                                                                                              var func = function func() {
    console.log("dude");
}
@randomscientist for variables, the declaration is hoisted, not the assignment
for functions the declaration, initialisation, and assignment are hoisted
Admittedly, not much of an answer. I think I just restated what you were asking.
But that's really the basics of it.
09:06
|| choose work or coffee break
work
sadness
09:48
js could use a .zip function for arrays :x
10:02
dunno.. zip is one of the hipster functional functions no one realy uses except people who want to be functional hipsters or haskell/prolog users who are used to using zip because there is often no other way to handle multiple lists
it's rare that someone mentions PROLOG
It's the one logic language I learned at university, and next to haskell probably the last language I used zip too. ;)
We had a course called "Concepts of Programming", something like that.. it covered a lot.. from classics like COBOL as table driven language, ADA for it's ridicoulus typing, FORTRAN afair for it's number system up to Haskell as functional representative and PROLOG as a logic one.
I also learned VHDL.. but that's another story.. uhm.. anyway.. back to work :3
11:01
How much of a noob does it mean I am if I just discovered flexbox? :)
count yourself to 5% of the population
11:53
@KarelG Lodash
But I agree in general.
12:23
eh Musk is amusing me again, he has received a new title at Tesla; TechnoKing
SupremeTechnoOverlord
I have used lodash eventually, as it is a part of my project. But merge and zip are useful in various situations imo
hence I want that in js
@KarelG I'd fully support that
Anyway, according to somebody I know, at his place people could pick their titles, so you had people signing off emails with stuff like "Absolute Software Architect" or "Peerless Tech Lead" and so on.
really?
that would be fun... and confusing
Yeah, he claims it got old really fast.
12:34
I have a specific title as well, so when people asks for my profession, I say "IT admin" whereas my actual title is "<CRM name> infrastructure admin"
combining both infrastructure management and CRM
13:12
@KarelG use quotes
|| choose "big task" or "stupid little tasks"
stupid little tasks
Too lazy for that
After trying a couple langs, error handling is probably the most pain the ass thing to do properly
there is no means to do that properly
if (error) { curse(); goto start;}
13:15
a goto D:
there is two types of errors as i see it
and what if that goto leads to nowhere? you get another exception. 😁
@KarelG goto if (error)
1. Expected errors (e.g User input, resource doesn't exist, etc.)
2. Unexpected errors (e.g. Network failure, etc.)
I think VB has some appalling error handling mode where you could catch any error ever in the program and basically goto another place. Like rewind 10 lines before the error happened or something. Which you can imagine is horrible way to have happen on every error ever.
@JBis Yeah, that's a valid way to break them down. You can classify them in other ways, too. Java separates them into basically "checked" and "unchecked". The former are things you know can go wrong like trying to parse a string an it's malformed. Java requires you to handle them or pass responsibility up the chain. Unchecked exceptions don't require to be handled.
13:20
It's also hard to distinguish what error data should be sent to the user
Honestly, after I discovered Optional, I don't see the reason to have "expected errors". It just smells of using exceptions for control flow.
> exceptions for control flow
I never really saw an issue with that
If you expect something to happen, it's not really an error. If you treat try/catch as if/else things get messy.
Optional is more to infer from nullability
@VLAZ idk about that
if a user supplies a username and password, is it expected that the credentials maybe invalid?
13:24
@KarelG Well, it's the most well-known way to handle it. But you're right. The real way to handle those is Either. It's basically Optional's big brother but it's a bit obscure.
I love the monoid approach in haskell : you can have either a result or an error in a type
throw new AuthenticationError()
or
function isAuthenticated(){
  // whatever
  return false;
}
Yep, credentials not matching are not an error condition. No need to (figuratively) sound the alarm bells and pull the emergency breaks.
I disagree
And most API's treat it as a true error
Counterpoint: Most APIs have no actual way to encapsulate a "login successful" or "login denied" because looking at other APIs that's not done. It's a self-reinforcing pattern.
13:27
?
Yet, half your logins might be invalid.
It's not an exceptional situation.
I don't throw an error if an user isn't authenticated
how are you going to differentiate that from unexpected errors?
it is best to respond with a simple check (which is in use when throwing that exception anyways) and handle accordingly
like in my CRM, you get redirected to a "not-authorized" static page
So what does your API respond with if there is an authentication error? (Content, not status code)
HTTP 401 + message "not authorized"
I've an API at work that returns me an object (simplified):
{
  username: string,
  resultType: SUCCESS | FAILURE | ERROR,
  message: string
}
If you log in and the credentials don't match, you get a failure. If it fails because, say, Keycloak is down, you get an error.
13:32
{
   success: false,
   error: {
       status: 401,
       type: 'AuthenticationError',
       description: 'The username and password didn\'t match',
       details: null
   }
}
The message elaborates on what was wrong.
many APIs will respond with something like that
That's not an exception.
Why? How do you know?
Well, unless you have an API consumption library that treats 4xx as exceptions
It's a (usually) recoverable condition.
Well, "recoverable" in the sense that the user can do something.
13:33
I mean on the backend side
As opposed to "500: the server is on fire"
@VLAZ our front-end does not catch such errors specificiially. They only look at 200 and if the status is not 200, an error dialog is shown with status code and message
that helped a lot on troubleshooting, we only have to check for http codes and "near time" in our access logs
@KarelG uh yeah, the system that uses that API is a bit dumb and just assumes that the login was successful regardless of the actual resultType
But in theory, you'd display the error message.
shelving all of them into 200 is possible but not useful when troubleshooting
class AuthenticationError extends CustomError {
   constructor(){
      super(HTTPStatus.Unauthorized, "AuthenticationError", "The username or password was invalid")
   }
}
13:36
that what jbis has shown is different, but we use keycloak for auth
they have their own templates
My point is on the backend you'd throw an error
for that non auth? nah
you check that before accessing the resource
@KarelG wdym?
I usually implement my own auth system
lol
why use an auth service if you don't have to?
14:34
To get user emails for your useless newsletter
 
1 hour later…
15:53
posted on March 16, 2021 by Nicholas C. Zakas

If you’ve spent any time developing software professionally and then you are probably used to the spirited debates that take place between software engineers as well as between software engineers and management, design, and product. Software engineers are not known for being shy about their opinions on any particular subject, and especially when it comes...

16:10
🚽
Hey kevin
are u there
again me
16:47
almost done implementing this damn rfc
16:59
hmm can I make a button actually request a resource from the url without using ajax/xhdr requests?
So as to act like a simple "download" link?
I prefer to use a button since it's easier to construct the URL during the onClick event than elsewhere.
|| mdn download attribute
look at the download attribute
yeah but that requires me to provide the href on dom creation
just create one in memory, then .click()
17:01
What do you mean, create one in memory?
const x = document.createElement('a');
x.href = url;
x.download = "whatever";
x.click();
uhhh that's terrible!
Tings like screen readers will flip out on those
why?
Cause you manipulate the dom - where does the element "go" after downloading? What happens if multiple times are clicked? What is the aria label of that element?
17:26
My react app fetches "Air Force 1s" and renders it as a <h2> however on each space it creates a new line so it renders:
Air
Force
1s

Rather than just 'Air Force 1s' (on one line)
how do you render?
I guess it's each in a paragraph or separate div? - in that case you need a parent div which is a flexbox and has flax layout set to row.
I found the problem.. sorry (it was because i set the component="caption")
thanks though <3
@paul23 don't really get your question
i assume you are downloading on user action, right?
yeah, but dom manipulation is a big "no" since it's react and lots of things happen already based on dom manipulation.
It's not dom manipulation
You aren't actually rendering the element
17:30
document.createElement('a');
@paul23 this doesn't manipulate the rendered DOM
but you are modifying the document
that creates it in memory
and react will break on that
@paul23 no you aren't and no react won't break
17:31
yes - so you fight with the (virtual) dom that react is managing
|| mdn createElement
@paul23 no!
You are confused on what createElement does and how react works
createElement will create an element in memory, it does not render it. As such, react won't care. This is done all the time.
For react to actually care you'd have to append it to the body
:)
17:36
Still "memory leak" in that case?
no, js will gc it
Wait document.createChild doesn't create on document? - it's basically a static function?
Could've just as well be "window.createChild"?
dang factory methods
i don't think createChild is a method
|| mdn document.createChild
17:53
createElement, or whatever :P
need to use a metadata lookup for a form. So when a user opens it the Name/User field automatically fills that users name, & selects the next two fields for them based off of the metadata info. Any idea on what direction to look in for that?
18:20
I've been reading up on JavaScript lately and with regards to the this keyword, it is said that to understand what this refers to, observe the call-site rather than the declaration site. My question is that a lot of the code which we write these days are declarative rather than imperative. We define a function and the framework executes it. In such scenario, how do we reliably tell what this would refer to? Is that something the framework's documentation say?
@bit_junky 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.
@bit_junky most frameworks prevent using this liberally and allow for other tools. An example is to not use functions but rather lambdas as those directly bind this as expected.
Vue for example, states that we shouldn't be using arrow function, use this.
uh that seems to go against conventional knowledge, any source and reason?
There are obviously drawbacks: the main culprit when arrow functions don't work is when using inheritance and trying to overload the function. Normally polymorphism allows one to actually call the overloaded function on a child object - but that isn't possible since when using arrow function the functions are basically just values.
"Vue automatically binds the this value for methods so that it always refers to the component instance. This ensures that a method retains the correct this value if it's used as an event listener or callback. You should avoid using arrow functions when defining methods, as that prevents Vue from binding the appropriate this value."
18:38
Well then you have your answer? vue is actually using the lax this behaviour - so you should just use that

« first day (3804 days earlier)      last day (1369 days later) »