« first day (4435 days earlier)      last day (499 days later) » 

12:09 AM
posted on December 06, 2022 by Matt

The Beta channel is being updated to 109.0.5414.29 (Platform version: 15236.27.0) for most ChromeOS devices. This build contains a number of bug fixes and security updates. If you find new issues, please let us know one of the following ways File a bugVisit our ChromeOS communitiesGeneral: Chromebook Help CommunityBeta Specific: ChromeOS Beta Help CommunityRep

 
 
2 hours later…
2:32 AM
check out my react project walkthrough, repo link in description youtube.com/watch?v=kCaA9jgec98&ab_channel=KumarAmresh
 
 
1 hour later…
3:33 AM
Hello, I am having an issue with my React app. Is it alright to ask here?
 
@Kastor438 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 setting my states of my functional component using useState(value). This is working for me, and it prints to my console when updating from using useEffect whenever my state changes. After my state changes and is printed, the next time I check the state it is reverted to it's original state. This actually happens to every single one of my states. They are set, useEffect does sees the change, and it does print the correct value. Then all of them reset to the original value. Any idea why?
 
 
2 hours later…
5:49 AM
@1.21gigawatts This is not reliable way to get all properties. It works but in the more simple cases. Consider an object with an optional property: { a: string; b?: string; c: string } if you examine it with for..in you might get a and c properties out of it or you might also get b. Depending on whether it's set or not. At runtime, you don't know what can be there by looking at what is there.
Also, an additional problem is that you cannot examine what are possible types for the same reason { a: string | number } cannot be detected at runtime. Similarly, literal types cannot either { state: "open" | "closed" } does not allow multiple different types but it shows up as "string" when it shouldn't have any string
With that said - TS can examine unannotated JS code and give you somewhat accurate type information. It's not wholly accurate, though as it can only guess what the types are (absent anything like JSDoc to describe it better). sum = (a, b) => a + b may be intended for numbers only but also can be used for strings.
TS won't be able to figure out the intention in many cases. If multiple types fit but you only need one, then it may not get that.
It still works fairly well, though.
Supplying a .d.ts file still helps even if your library can be analysed accurately for type info, since it can serve as additional documentation to explain what these are more thoroughly. Putting a name to some collection of properties and value types makes it easier to understand. You can also use generics or type hierarchy as a way to convey more information to future users.
 
 
7 hours later…
1:19 PM
hey there, anybody online?
 
Approximately everybody who has a device capable of connecting to the Internet and has at least one connected to the Internet is online.
 
Thats amazing
I had a lil beginner question
if I want to find out the number of an input with getElementById, is it enough if I would do ".value", or do I need to do something like Number(...value)?
like the number a user puts in
 
Number(document.getElementById("foo").value) would be the correct way to do it. Unless that's what you meant by ...value in which case "yes". However, there is an easier way if you have <input type="number" /> - use .valueAsNumber
 
hmm... AI is getting good
 
It's OK here. But mostly because this is a very old and very popular query.
Today I saw somebody generated an answer which advocated using a feature that does not exist. But they supplied a code sample and everything.
 
1:31 PM
yea, a colleague asked it to make a csv parser function... and obviously it didnt account for escape sequences
 
It must be an artefact of older training data. It's Object.observe which was a proposed feature but withdrawn. Back in 2015. So, the code sample was correct for 2014-ish.
 
generating production ready code is still pretty far away
but it might be useful for understanding things that you dont really know how to google
but even in 2014, the answer would only work on preview versions right?
because it was still a proposal
 
The problem is that it's very confident in the answer. Even when wrong. Something from earlier: "Is Germany landlocked?"
> Yes, Germany is a landlocked country. It is located in central Europe and is surrounded by a number of other countries, including Poland and the Czech Republic to the east, Austria and Switzerland to the south, France to the west, and Denmark to the north. Germany does not have a coastline or access to the sea. However, it has a long and rich history and has found ways to overcome the logistical challenges that come with being landlocked.
> For example, Germany has a well-developed network of rivers and canals that allows it to engage in inland trade and transportation.
@Wietlol Don't know if there were implementations in major environments. Maybe. But you can still write accurate code for a proposal. As long as it would be ever implemented...
 
true, it would be very difficult for users to identify false positives
 
BTW, I then went and quizzed ChatGPT what the North Sea was, whether Germany bordered the North Sea, if a country that borders the North Sea can be landlocked, finally I repeated the question "Is Germany landlocked?" and it told be something to the effect of "As I told you before - no, it's not".
 
1:38 PM
XD
 
thank you guys
 
ChatGPT so far seems perfect for a politician. It's very confident about what it says, even if wrong or complete BS. It also adds a bunch of extra fluff to make it seem like what it says has more weight.
 
I am kind of interested in using gpt for Wietbot, but I only want it to parse the messages
for example, if I'd say "@Wietbot tell VLAZ welcome" I'd want the GPT stuff to tell me what the intent of the message is
but apparently, most AI stuff doesnt give you that option
I am not sure why...
 
I mean, it must be possible. I'm actually super hopeful about AI research. Just...this tool isn't great. But also it isn't really for providing answers. It says it's optimised for longer chats. As demonstrated above - it seems to work. Well, -ish. Seemed to realise two things 1. Germany isn't landlocked 2. I did ask before. Not sure which inference used for two - my previous question or maybe the "Can a country bordering the North Sea be landlocked?" + "Does Germany border the North Sea?".
I'd be impressed if it was the latter. And it might be that.
@Wietlol I mean, it's because it's super complex. From what I know (and not an expert here) it takes the input and tries to map it to meaning in confidence intervals. Then uses these confidence intervals to map to possible responses.
 
it might be super complex... but that is why I want GPT to do it for me instead of me writing it myself :D
 
1:44 PM
So maybe it can do something like spew { command: 0.78, request: 0.43, targetsUser: 0.65}
I mean I made up the categories and numbers. But that might be sort of the thing it works with. Then tries to find a match for an answer based on these.
@Wietlol I mean it's super complex to get "output". One which is meaningful to interact with programmatically, at least.
 
if I ask ChatGPT the following: what is the intent of "tell VLAZ welcome"
it responds with
> Without more context, it is difficult to say for sure what the intent of "tell VLAZ welcome" might be. It could be a command to a virtual assistant named VLAZ, instructing it to display or say "welcome" to the user. It could also be part of a script or dialogue in a larger piece of content, such as a video game or movie.
 
:D
welcome
 
so it does have a list of possibilities, but I want to know those in code rather than in my mind
 
For what it's worth, I did ask it once "What should I consider when choosing Ranger or Druid?" to see how it would respond without context. It told me that it was hard to understand without context, but if I meant in a roleplaying game, then <some generic advice>
 
in this case, the first result is exactly what I intended, but I want this in json format, allowing Wietbot to find an appropriate command and identify the target and then do whatever that command was supposed to do
 
1:48 PM
So, it identified the lack of context, but also chose a likely one.
 
Guys, with the Number() function it obviously worked, but only as long as I want to retrieve the value of an input that is 1 or higher. If the input value is empty or 0 for example, it does not work? Why tho? "if (valueblabla < 6)" should include the number 0, shouldnt it?
 
zero is less than six
 
And also, an empty input's number value is automatically 0
yes exactly, but inside the if condition, it only works for numbers between 1-5 instead of 0-5
0 is not included and thats weird
 
I do get a zero
Swapped the link. Also 0 < 6 is true
 
valueAsNumber wont give 0 for empty though
are you sure you use the Number() approach?
with .value instead of .valueAsNumber ?
 
2:00 PM
Can you help me ?
how to refactor code, in order to use useMemo instead of useState
 
@Wietlol yes fam, I used it that way:
let pwlength = document.getElementById('pwlength')
let pwlValue = Number(pwlength.value)
and then I use pwlValue for the rest of my code
 
jsbin.com/tunajoz/1/edit?html,js,console - cannot reproduce it still.
|| mcve
 
We have troubles to understand and/or reproduce your problem(s). Please create a Minimal, Reproducible example which allows us to understand it better.
 
Okay so here is the whole code for you guys. Its no responsive css lol I dont care about that yet, just a little UI so you can try:

if you generate a pw with a length between 1 - 5, the alert pops up. but, if the input is 0 or empty, the alert does not work.
 
2:15 PM
The problem is not the if - it's the loop. for(i = 0; i < pwlValue; i++) when pwlValue = 0 then i < 0 is false immediately, so the loop is never executed.
And the if is inside the loop.
||> for(i = 0; i < 3; i++) console.log("a")
 
@VLAZ undefined Logged: [ '"a"', '"a"', '"a"' ] Took: 0ms
 
||> for(i = 0; i < 1; i++) console.log("b")
 
@VLAZ undefined Logged: [ '"b"' ] Took: 0ms
 
||> for(i = 0; i < 0; i++) console.log("c")
 
@VLAZ undefined Logged: [ ] Took: 0ms
 
2:20 PM
Damn, totally right, it works now that I put the if condition above the for loop
However, even though the alert works (even when its 0), it still generates a password after the alert gets closed lol
obviously not with 0, but with higher numbers, it still creates a pw after the alarm is clsoed
 
the break wont work outside the loop
you would have to do something like an else after the if
 
ik, i deleted the break already
 
if (too short) {
    alert()
} else {
    loop
}
 
worked, thanks a lot guys!
sometimes, my thought process is way too complex for some simple things lol
<3
 
 
2 hours later…
4:01 PM
@1.21gigawatts an additional problem with that is that you put unnecessary strain on runtime, whereas TS types are completely ephemeral and are fully erased after compilation.
 
what if you use class instead of interface or type?
 
@Wietlol in which case?
 
just in any case
are classes also erased?
or can we configure them to be erased or not?
 
no, of course not. But the thing is that every class you declare has an interface bound to it under the hood
TypeScript doesn't erase anything that is runtime
an important thing to keep in mind for everyone using TS: types are fully and completely separated from the value plane
 
they are most useful in cases where the type can 100% be controlled
on the other hand, cases where the value comes from an untrusted source, or one that could potentially have a bug outside your environment,
you have to make sure your code can deal with that outside source providing you crap data
using types won't fix it
 
4:13 PM
@1.21gigawatts cont.: overall, what TypeScript does in not very different from DIY'ing it, it just does it a thousand times better than I or you can: first, Scanner tokenizes the source code, then Parser builds an AST, then Binder (builds up the type system), Checker (checks type system correctness), and Emitter (outputs JS if needed) come into play.
If you want to truly know TypeScript, I suggest an amazing project of basarat's: TypeScript Deep Dive. Covers everything up to compiler internals
@KevinB yup, everything that comes from an untrusted source should be checked at runtime, compile-time safety won't save anyone here. Although that's why we use runtime type guards in TS
 
@Wietlol Classes are runtime construct. If you set the target for ES5 or below, class gets transpiled into an equivalent construct. But ES6+ class Foo{} is just transpiled to class Foo{} without typings in it.
 
what is a common approach to runtime type guards?
 
@Wietlol (x: any): x is Whatever => { /* test x and return boolean */ }
Wait, you probably meant something different - that would ensure the type of x but mostly of use compiletime.
Is that what you need?
 
I dont even understand that syntax
 
It's a function.
It just returns a boolean and x is Whatever is the syntax to say that the boolean means x is actually the Whatever type.
 
4:21 PM
I mean, if I have a 3rd party service that gives me product information and I read it as this interface:
interface Product
{
	name: string
	price: number
}
what is the common way to ensure the name is a string and the price is a number?
 
E.g., (animal: Animal): animal is Cat => { return "meow" in animal; } will confirm you have a Cat. And the check is whether it has a "meow" property.
 
@Wietlol depends on how actually save you'd like to be. The strictest way possible?
 
what happens if it isnt a cat?
 
nothing, that's the beauty
 
ew
out of curiousity, what is the strictest way?
and what is a less strict way?
 
4:26 PM
 
@Wietlol something like what @VLAZ posted - and you can turn it up a notch
 
sounds like a lot of work
 
@Wietlol The strictest is to use an asserts x is Product. It's similar to a type guard but instead of boolean it must throw an error. So assertProduct(obj) will simply not continue if obj does not conform.
Therefore, you get guarantee that code after the call will only run if obj is Product.
But...that's too heavy handed.
Less strict is a type guard which returns true or false.
 
but isnt the type information erased?
 
@Wietlol It is. However, the compiler is satisfied that if the function is successful, then the type is correct. However, it cannot verify the function is implemented correctly. That's up to the programmer.
 
4:30 PM
ah, x is Product is not a validation but feedback information
 
E.g., you can say x is Product but the check you do is just "name" in x and that's it. The compiler will not raise an error because you've not checked the existence of price
 
and yes, it's a lot of work, but it depends on your application requirements
 
@OlegValteriswithUkraine Yes, that's probably better. It covers all the requirements.
However, you may not need to verify everything. With the Animal and Cat example of type guard, you know that the item you receive is something that conforms to Animal, so it must be an non-null object. You just need to check cat-specific things.
 
@VLAZ yeah, I just tried to imagine the strictest way possible. Also runtime-heaviest
 
It's a good example of how to do it exhaustively.
It might also be even more complex if you have optional properties or ones containing unions. E.g., { prop?: string | number } has to account for all variations.
 
4:35 PM
@VLAZ yeah, the beauty of duck-typing. As long as it quacks, I don't need to care if it's actually a duck or a man in a duck's suit [don't try to apply that IRL]
 
@OlegValteriswithUkraine coming from statically typed languages, this sounds a bit weird to me. why would type validity depend on the application requirements?
 
because it's the only thing where it really matters?
who cares if you got an instance of Cat or SomethingThatMeows as long as it can call meow?
 
With that said, it's somewhat rare you'd really need to do an exhaustive check. Usually at entry points in the system, e.g., network call that might give you random data.
 
yup, quite a rare need
 
@OlegValteriswithUkraine that is irrelevant, that is just different type systems
 
4:38 PM
I know, I just never got the reasoning behind nominal type systems. To me, they are all unnecessary restictive
 
I would just assume that Typescript would just have a built-in validator that you would use to cast whatever type to another
either by value or by hierarchy
building the type validators yourself just sounds... weird
 
why would it have it if types simply don't exist at runtime?
 
it can automatically generate these guard functions
 
validators are built-in into ECMAScript 2 operators: typeof x === 'type name', x instanceOf y
auto-generated guards... I dunno, it's way too much strain on the compiler for a task that's not its job anyway
but runtime static type checkers exist for [JT]S
that do basically what you described
 
@OlegValteriswithUkraine but those only work for classes, I assume
 
4:43 PM
first one works for standard data types, the second one for any instance of a constructor function
the rest is on the programmer or an external tool
TypeBox, for example, is one such tool that allows to create types with runtime safety (although it's JSON schema-geared). I think there were other tools like that
 
5:38 PM
@Wietlol There are libraries that do that. I don't know how well they work but I know it's possible to generate a validator from a type.
@Wietlol typeof detects basic types - number, string, object, boolean. It can work to narrow a union, e.g., x: string | number | null can be narrowed withif (typeof x === "string") or even if (typeof x !== "string") The latter gives you number | null as the type inside the if - it subtracts the string from it. Other than that - yes, instanceofonly works with real classes. It will not account for structural equality which TS otherwise does.
 
posted on December 07, 2022 by Srinivas Sista

The Stable channel has been updated to 108.0.5359.98 for Mac and Linux and 108.0.5359.98/.99 for Windows, which will roll out over the coming days/weeks. A full list of changes in this build is available in the log. The Extended Stable channel has been updated to 108.0.5359.99 for Windows and 108.0.5359.98 for Mac which will roll out over the coming days/weeks. Intereste

 
 
1 hour later…
6:57 PM
any faking way to inspect element on android phone ?
not source code , but inspect element
 
7:10 PM
 
 
2 hours later…
8:58 PM
@MileMijatović yes, use remote debugging. Nothing f***ing magical
 
 
1 hour later…
10:20 PM
!!vaulthunters or poe
 
poe
 
10:56 PM
what is the minimum path needed to have a dynamic circle progress svg?
ive not had fun trying stuff with d="M 50 50 A .....
 

« first day (4435 days earlier)      last day (499 days later) »