« first day (3659 days earlier)      last day (1272 days later) » 
00:00 - 19:0019:00 - 22:00

12:00 AM
Does anyone here know of any web pages that use lots of iframes in an experimental way?
Like a scatterplot of iframes, or massive grid that spells out a message or something wild like this?
 
posted on October 22, 2020 by Ben Mason

Hi everyone! We've just released Chrome Beta 87 (87.0.4280.27) for Android: it's now available on Google Play. You can see a partial list of the changes in the Git log. For details on new features, check out the Chromium blog, and for details on web platform updates, check here. If you find a new issue, please let us know by filing a bug. Ben Mason Google Chrome

 
12:38 AM
 
 
7 hours later…
ABC
7:57 AM
HI.
 
8:38 AM
Hello, I have this json array: hastebin.com/dequyagixu.json. Does anybody know, how to iterate over it. I already have parsed that json into a variable. The problem is, that this json file is dynamic, so the program doesn't know its content. This is the code I tried: hastebin.com/yubiqenida.js
 
9:05 AM
@Steven2105 in your sample spaces is an object, so you need to iterate over property names (keys) or entries which will give you f.e. key='coding' and obj[key]=['javascript',...];
then use another loop/forEach to iterate/visit the array elements of obj[key]
 
9:58 AM
@makadev Thank you
 
10:56 AM
Hi
 
Hi
Hi Ben
 
Could i ask for some help regarding vuejs?
 
@SatishBaghel 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.
 
Why does my vuejs app (local), when accessing url directly, works fine but when deployed in docker, I get 404 error?
should docker runs the same with local setup?
 
11:28 AM
.match(/==|\/\/|\*\*|\*=|\/=|-=|\+=|<=|>=|\?=|>>|>>>|<<|\|\||&&|\d+\.\d+|\d+|\D|[(){}\[\]+\-\/*^%&=<>?]/g)
Uh
Is there a way to improve this? lmfao
In all seriousness, this is rather insane
but it DOES recognize and match an entire equation in milliseconds
 
What is the regex for?
 
@MisterSirCode there are alternatives for your formula thing
 
@Mr_Green It turns THIS
1^8(x+(9*y)/x)-55
9%82-4==4^3.1
1>>0|1<<0
8*2
9<=32
4{22**4(6))# This is a comment
Into THIS:
[
  '1 ^ 8 (x + (9 * y) / x) - 55',
  '9 % 82 - 4 == 4 ^ 3.1',
  '1 >> 0',
  '1 << 0',
  '8 * 2',
  '9 <= 32',
  '4 (22 ** 4 (6))'
]
Well obviously theres a few more methods used to clean things up
but thats essentially what it does
matches all the equation PARTS, joins everything with 1 space
clears out extra spaces before and after () and stuff
etc etc
@KarelG Well yes I know I could improve it, but how do you suggest I do so
what would be the best method
 
That's a very strange requirement and an interesting one
 
Well I dont know how else to match the uniques
the 2 character math symbols
even 3
I just found the easiest simplest method would be to match all operators literally plus any numbers
I still dont how Im going to handle negative numbers
 
11:43 AM
@MisterSirCode use a different approach, like both Ben and I have suggested.
 
Well thats where Im confused
Im asking if you guys can suggest a different approach
Cause right now I guess Im too slow to see an easier way of doing this?
 
write an LL parser
 
we did that already before
numerous times AFAIK.
 
start left to right until there's nothing left to tokenize
 
You guys keep telling me to use parsers for things, but I just dont really get the "shifting through and recognizing operators" thing
 
11:46 AM
there are various approaches on that, which require some self-study. These got covered by many scientists and engineers in the past. Use their knowledge, their findings, their conclusions, ...
 
@MisterSirCode why don't you ask that? If you do not comprehend something, you can ask about that?
 
this was just a multiline math formatter I was designing for my discord bot
 
you can use regex to help with that, but regular expression is not a parser in of itself
 
but even if I were trying to make a parser
I still dont get the shifting / recognizing part
 
11:48 AM
a parser is really quite straightforward, it just means something that converts a string into multiple strings (tokens) by some rules or metrics
 
hmm. perhaps you can use something else
there is an algorithm that can be used as well.
 
Like say, converting a;b;c to 'a', ';', 'b', ';', 'c' is an example of a simple parser
 
but I am unable to remember its name directly xD
 
@KarelG I mean, I guess I could, but Im always so sketch of making questions on SO because of how often they get downvoted / removed versus other sites on SE
@Neil Yes I know how that works, youre literally just splitting content into every single character
 
search around on Software Engineering SE? I don't believe nobody has asked that once.
 
11:49 AM
but I dont get the "shifting through and recognizing symbols" part
 
no, what if the example were john;fitzgerald;kennedy?
 
huning yard or something
 
I'd want 'john', ';', 'fitzgerald', ';', 'kennedy' as the result
 
nice, it even has a pseudo code
 
wouldnt that be as easy as .match(/\w|;/g)
 
11:50 AM
the algorithm is, using the first character, determine what token it is.. then grab the entirety of that token and remove it from the string and move onto the next
so first letter is a number.. that means it's a number token.. grab all numbers and points and lump it into a single token
 
Ok
Well thats a start
 
once you hit a character that doesn't fit the definition of a number token, you stop, and repeat, removing the number from the string
 
let me setup a simple html project, be right back
 
the validation of the token can be done inside the parser (in other words if you find a 0.1.2, then it's not a number token or anything valid)
the validation is important, otherwise maybe you'd just grab 0.1 then continue with the next "token"
 
So is it okay if I use a little regex just to match character types while shifting?
 
11:53 AM
yeah
 
sure
 
but really, use a function
eg isDigit(ch)
 
@KarelG that wouldn't work with negative numbers or decimal numbers
regex is fine to identify if the string starts with a number (negative or otherwise)
 
Well if Im really going to attempt to write a parser, I might as well try to recognize operators and words
not just math
 
if you do not have a regex that can match the first part of the string, then either one of your regular expressions is wrong or you have something which isn't a proper token in your language
if you also wanted to say, evaluate said tokens, then you'd do that in a second phase
 
11:56 AM
alright
 
generally, first pass is to tokenize. second pass is to organize tokens into a syntax tree. third pass is to execute given a syntax tree
if you're just formatting, then the first should suffice
IDEs generally perform the first two in order to be able to show if your syntax is wrong for instance
 
hmmm
Im trying to create something viable
 
you only hit the third pass if everything is proper
 
but now Im having trouble recognizing a symbol / operator or keyword / namespace
I dont even know what Im writing at this point
Im imagining it as: "if char is part of keyword, add it to a currentNamespace, then get next character, confirm its part of the same namespace, add it aswell, if currentNamespace doesnt match a keyword / namespace or an invalid character exists, throw error"
Buut I dont know how to implement it
 
ok, that line of reasoning isn't wrong, but it's a little too specific
what if the keyword isn't a keyword but a number or a string?
 
12:04 PM
Well that was just a general explanation
I could add checks for digits or operators
 
you need to be able to look at the first character and determine what token it is ideally
 
I just physically do not understand what to write in javascript to achieve this
Im imagining some kind of Backtracing for-loop to get characters and check if they are part of a namespace / keyword
 
think of it in this way, you have a string with the expression you want to parse, right?
You need to have a list of rules which can look at the first part of the string and determine if that rule applies
with a keyword rule, it's pretty straight forward.. to check if the string starts with "var", you do substring for the first three characters and if they're equal to "var", you've found it
I'll add a small caveat to that, which is that it can't be followed by an additional letter (if someone writes "variable", you don't want var rule to match it)
that's literally it
 
but thats why im also curious why you guys disapprove of using regex
I know you cant use regex to match things like parenthesis
 
I don't..
 
12:07 PM
oh
 
use regex to determine if it starts with var, that's fine
just make sure you also verify that there isn't a letter character after
 
well yeah I know that
 
this also means the literal string "var" should work as well, so end of string or not a letter
ok, well then I'm not sure what is unclear
 
Well perhaps Im just slow then
you guys make it sound easy, but something, I cant exactly pinpoint it, I dont understand
 
you have a list of regular expressions.. go through them one at a time and check the input string
each regular expression ONLY looks at the start of the string
if you find a match, you push it to the array, remove that from the string and do it all over again until string is empty
if you want, I'll give you a simple example
 
12:10 PM
I would appreciate it
Uh, by the way, is it fine if I use regex to split by Delimiters (like ; or newlines)
so its easier to parse single lines of equations / expressions at once?
 
hmm, that would be reasonable, but don't necessarily assume input will follow those rules
 
well, if you forget both a newline AND a delimiter in javascript
the equation will throw a TypeError
so... var x = value; var y = value; is okay, but var x = value var y = value will throw a typerror if you dont have a newline in between them.
So Im just replicating those same rules
or trying to...
 
12:44 PM
took me a second, it has been a while since I coded in javascript
note that it allows whitespace before the actual token, with the token being in the first capture group
so spaced or not, it should still work
It also splits them into lines, which is probably fine if you don't need to evaluate it, otherwise expressions can expand multiple lines, and you shouldn't
What determines if a new statement is being written should be handled in phase 2 at that point (which for most languages is just about finding the semicolon)
You're free to expand on the "rules" array by making them objects and including handlers or other things
the key point is once you know what token you're dealing with, you know how to handle it
 
I only see one ES2021 feature that I'd prob use, String.prototype.replaceAll
 
🤔
@JBis is that not already provided, by just using the g flag?
a right, it is useful for pure string replaces.
 
but you gotta use a regex for that meaning you need to escape things if you want to take user input
you can also use .split(str).join(' '), but now theres a handy method
also, private methods in js. Cool but why didn't they make it #methodName instead of just a private keyword?
 
that's an old discussion :P
gotcha tell that it's a facebook generation™ 😁
errr ... correction, twitter
 
1:03 PM
AFAIK there is a page that summarizes the whole discussion that led to the use of #
somewhere in that proposal
that social network ramble was a joke, because of the hashtag usage on both platforms
 
So...I installed a complexity analysis extension in VSCode. It didn't like some of the code.
The threshold to show red is 25, by the way.
 
> We can't just change how _ works for web compatibility reasons.
half the bullshit in js is cause of that
 
I still have a habit to write myArray.contains(something) 😕
 
@JBis that statement seems to contain include some anger.
 
@VLAZ we have set it to 15. Highest I've encountered was somewhere in 300.
that class file even became a inside joke of the office and nobody wants to refactor that. Even I don't
 
1:12 PM
@VLAZ it does, i think we should put a javascript version statement at the top and be done with it
#version es2018
 
"use strict"
"use non-bullshit parser"
 
but that would class with the private keyword!
 
@KarelG for fuck sake lmao
but if we just put a version deceleration we wouldn't need to worry about backwards compatibility
has that been proposed?
The last compatibility decision would be that if no version deceleration is made than the es2020 is used (or 2021 if version deceleration doesn't make it into that proposal).
 
1:43 PM
@Neil maybe somethings wrong with your example, or just repl, but it doesnt run lol
Ill try forking it and running it
oh I see
parse isnt called lol
 
well yeah, sorry. I wanted to be able to input anything
 
yeah it works perfectly
 
rule ordering is important, so keywords have priority over variable names since "var" would be a valid variable name
 
I mean for the purpose of that example, var isn't any different from a variable name, but again, you could add additional information if you wanted
 
1:46 PM
Ok, so this is a tokenizer, what would probably be the next steps to creating actions?
this I can understand
 
well for formatting, you're done
I even did it in the example
what else did you want to do?
 
Well mainly I just wanted to see how tokenizing worked, but now that Im seeing a functional example, I kinda wanna try actions
like... performing actions based on the formatted code
 
next step is putting it into a syntax tree
 
lexing..
right?
 
yes
you would do that in a similar fashion to tokenizing, except you're using the tokens to determine what kind of statement it is and how to deal with it
 
1:48 PM
And then create an array of object arrays that store the token type and keyword / value
 
yes, exactly
 
alright,
thats doable
so... Ive done something similar to this a long time ago
 
the "var" keyword is important to know that it is, say, an assignment statement
 
I made a "tokenizer" like this one like a year ago, and I barely remember much about it
 
so unless you have other statements that start with var, const, or let, then you can immediately know how to validate that
 
1:50 PM
but I remember once I got to the "lexing" stage, I was always confused about parenthesis
alright
 
the parentheses are just another token when you're parsing
the meaning is to put it at a lower level in the syntax tree
 
huh.... alright
 
so everything inside gets evaluated first
 
interesting
 
if you didn't have parentheses, then you give precedence based on the type of operator
 
1:51 PM
Order of Operations
 
multiplication is done before addition, for instance, so all the multiplication stuff would be at a lower level
right, you'll need an array of operations to know how to split up a bunch of expression tokens
if you see parentheses, you evaluate everything in between on its own lower level (recursively)
if not, you look for, say, multiplication symbol, and you recursively put the items on either side on its own lower level, etc.
 
well, I think itll be best just to evaluate something simple first
and then work up from there
 
go through the operations in order and assuming you tokenized correctly, you also shouldn't encounter unexpected tokens
the syntax tree is important to knowing in what order to handle everything
it's also important to validate the tokens, because I could write + 3 3 if I wanted
that would pass the tokenizer but not the lexer
first, you'd search for parentheses, find none, then move onto multiplication, division, etc... then you'd reach the plus
so you'd divide it in half.. send all tokens on left side (nothing) and all tokens on right side (3 3) to be recursively dealt with
you'd see 3 3, and do the same thing, find no operators, see that there's more than one number (if there were one, it'd be fine), and throw an error
that's how you'd know
you should always find an operator OR just a variable / number value
if you find anything else, you know the syntax was wrong
 
Thankyou
Ill play around with this and see what I can come up with
 
recursion makes this way easier
keep that in mind
you probably want to generalize making a syntax tree out of an expression, because it will come up in several places, like if conditions and such
 
user14475233
2:46 PM
How can I add collision to a rectangle (rect(100,100,100,100))to make sure my player (mover) does not go through it?
 
@LttntLrk you perform a check before you allow them to move in the direction that would put them inside the rectangle in their next tick
and to prevent it from being buggy, you also push player out in the off chance that they're inside
 
it depends of how accurate you want it to be
 
user14475233
3:24 PM
@Neil @Neil I am new to javascript(3 months) how can I do that?
 
user14475233
oops, it @tted twice
 
well it's part of your game logic for your player
your player presumably has a direction and position, right?
 
user14475233
yes
 
user14475233
this.pos.x, and this.pos.y
 
user14475233
but he is made up of shapes
 
3:26 PM
well add direction to position and you get player's new position
before you update player's position, check that it is inside the rectangle
which is to say, player's x is between the min and max x of the rectangle and the player's y is between the min and max y of the rectangle
 
user14475233
can i show you what my player looks like? and how he is made of shapes that i need all of them collision for?
 
ok
 
the way I'd do it, I'd imagine player's "space" as being a circle where his feet are
 
user14475233
okay
 
user14475233
3:29 PM
you see the circle at his feet?
 
yeah his shadow
that's an ellipse, but I'd start with a circle for simplification
 
user14475233
do i need to make an invisible circle around him, then add collision to everything else and the invisible circle
 
what I would do is find closest point to the rectangle, then subtract circle radius distance from that point to the player
 
user14475233
how can i do that exactly?
 
if you're using a canvas, then there's no automatic collision detection like what you're describing
 
user14475233
3:33 PM
i have to get rid of the canvas?
 
no, just that you have to deal with the collision yourself artificially
 
user14475233
hmm
 
user14475233
being new to JS, that sounds pretty hard
 
if player is against the wall, then you don't move the player if direction is towards the rectangle
well I don't recall the formula, but there's a means to find closest point on a line to another point
and a rectangle is just four of these put together
 
user14475233
yeah
 
3:34 PM
which works in your favor also if you wanted to have other shapes other than rectangle
 
user14475233
i COULD make a hitbox out of an ellipse with nofill and nostroke
 
user14475233
then just add collision to everything else
 
user14475233
i made the hitbox ellipse, now what
 
user14475233
wait
 
user14475233
i dont even need boundary collision
 
3:43 PM
not familiar with the whole hitbox thing on a canvas
 
user14475233
my game is controlled by mouse
 
but if that's a thing, then great
seems ideal
 
user14475233
i have a feeling this game (that i didnt expect i'd be working on for so long) is going to take a LONG time
 
heh, don't be intimidated
games are not easy, even simple ones
 
user14475233
yeah
 
3:49 PM
it's the kind of thing you get good at only by doing it
you just kinda have to work through every small thing one at a time in bit-sized pieces
 
user14475233
yep
 
user14475233
i have been
 
user14475233
1st, i got the movement down
 
user14475233
then the other things
 
user14475233
in small steps
 
3:52 PM
small steps is key
too much too quickly makes it buggy and difficult to develop
 
user14475233
yeah, thats what happened with my walking animation
 
needs to be built like a card house, which is to say, very carefully and only once you're sure it won't fall
 
user14475233
but for some reason, my walking animation gets buggy if the framerate is low
 
sounds like you're basing the animation on the frame rate and not on time passed between frames
 
user14475233
if i set the framerate to 60, it fixes itself
 
user14475233
3:54 PM
and the walking animation is a setInterval btw
 
don't use that, there's a much better function for animation
 
user14475233
there is?
 
requestAnimationFrame
 
user14475233
is it harder?
 
yes, it's meant to be used for animation
 
user14475233
3:55 PM
how do I use it
 
it's not harder, no
you pass a function you want to call when a new frame should be drawn
at the end of that function, you call requestAnimationFrame again
 
user14475233
Newframe?
 
user14475233
ok
 
so it will loop continually
 
user14475233
AHH Ok
 
3:56 PM
setInterval is designed to be punctual, but it doesn't take into consideration problems of draw time taking too long
 
user14475233
yeah
 
so you may end up with animation that's not consistent
 
user14475233
thats what happenes
 
user14475233
*happened
 
then I suggest you try that, it'll probably improve things quite a bit
 
user14475233
3:57 PM
ok
 
I think a time interval is passed to the function too, so you can use it to know how much time has passed since the last frame
 
user14475233
Idk what that means...
 
As in, what if you want to do something 60 times per second, but because it's slow, it only gets called 30 times per second instead
the time difference between frames will be twice what you expect it to be
if you didn't compensate for that, everything animates half as fast
 
user14475233
yeah
 
user14475233
i honestly dont know how to use the requestAnimationFrame
 
3:59 PM
fair enough, but you should learn
it's meant for animation unlike setInterval
 
user14475233
im going to look it up later, for now, i have 8th grade to do lol
 
4:25 PM
hello
 
user14475233
hello
 
5:42 PM
hi guys. can someone give me a descriptive answer for this question stackoverflow.com/questions/64460649/…
 
user14475233
5:59 PM
ill try lol, but im new to js
 
copy event.preventDefault();, and then paste it above the line mentioned in the comment
not quite sure how much more descriptive that can be
 
user14475233
Okay
 
@KevinB I did it. But I have some more requirements. To verify the password and all.
By moving that to the top, the form just does not get submitted.
Is there any better ways to do bootstreap form validation? Without Jquery please
Guys, can you please solve this? I have a text area with this html code!
<textarea required name="description" rows="5" class="form-control" aria-label="With textarea" placeholder="Enter the product description here" minlength="30" maxlength="100">
                            </textarea>
But it automatically adds whitespaces into the text area. I dont know why?
Ok. I solved it. It was an extra line break
Are there any solutions to form validation?
 
user14475233
6:31 PM
if anyones online, how can I add collision to a line in p5.js?
 
user14475233
scratch that
 
user14475233
i figured it out
 
user14475233
NEW QUESTION: how do I make a perfect, right facing half circle in p5.js?
 
user14475233
@KevinB ?
 
@LttntLrk I am not a pro in JS. I am just a beginner. I hope I can support you to find a solution. Can we solve this together
 
user14475233
6:41 PM
oh, i just need a perfect semicircle
 
?
 
ok. A perfect semicirlce in your html? What is P5.js?
 
user14475233
javascript
 
user14475233
its like processing bit for Javascript
 
user14475233
*but
 
6:43 PM
doesn't sound like something i'd want to help with
 
user14475233
i just need help making a semicircle that faces right in javascript...
 
@LttntLrk you mean the arc is in the left side of the page and the diamter is in the left?
Or vice versa?
 
user14475233
arc is on the left, the opening is facing right
 
user14475233
:50754782
 
user14475233
dont mind that last thing i sent
 
6:51 PM
did you try canvas arc?
 
user14475233
arc(700, 700,1000,1000, 1.5,PI+1.65);
 
user14475233
figured it out
 
ok. Awesome!!
 
user14475233
thanks
 
I did nothing bro. Congrats for your effort!
 
user14475233
6:52 PM
thnks lol
 
user14475233
im making an among us remake but in a different language
 
Fantastic! All the best
Hows the project going?
 
user14475233
i can send a link
 
Hey awesome bro. I never played among us but this seems of a whole new level. keep going and share us the completed project link
 
user14475233
6:56 PM
lol
 
user14475233
its going to take a while
 
user14475233
im working by myself, excpet on fridays, when i have help
 
Which language are you trying to develop?
 
user14475233
javascript
 
Oh. Then you didnt mean speaking langauge huh?😅
 
user14475233
6:58 PM
oh
 
user14475233
hahah
 
user14475233
different language as in javascript
 
Using only plain javascript?
 
user14475233
the actual game is in C++
 
user14475233
yeah
 
6:59 PM
wow
You are from?
 
user14475233
Las Vegas
 
user14475233
its in my bio
 
00:00 - 19:0019:00 - 22:00

« first day (3659 days earlier)      last day (1272 days later) »