« first day (3274 days earlier)      last day (1667 days later) » 

12:09 AM
Is there a better way of doing:
.parallax.[someClass] {
    background-image: url("[some-url]");
}
I have many many images and I have to do that for each one
 
not sure that props can solve your problem though
 
12:33 AM
@forresthopkinsa Well someClass and some-url both change
I was thinking of using attr() function but it doesn't seem to be supported
 
12:44 AM
Maybe store it in a db and then generate it in the style attribute
hmm
 
yeah it's gonna have to be js
 
1:01 AM
I just found a rendering bug in chrome and safari and I am so confused
and firefox
it makes no sense
 
if it's in all three then it's unlikely to be a browser bug
 
yeah but I simply resize the browser or toggle on and off the same property it fixes it self
one sec...
@forresthopkinsa test.joshbrown.info/#my_info. Shrink width of browser till you get hamburger menu bar. Click the hamburger and then select "Portfolio" and the hamburger magically disappears.
none of the other buttons cause it
 
hmmm
could be a bad media query
 
Its so stupid its funny
 
yeah that's a tricky one
 
right I'm seeing that as well
your main div is getting shifted up
 
aha
thats odd
 
it is
in fact, your whole body is getting shifted up
oh gosh, the root html tag is doing it too
 
So its a browser bug....that somehow effects all engines
 
not a browser bug
something is wrong with your stylesheet I think
.main {
  position: fixed;
  width: 100%;
}
seems to work
that way it doesn't get scrolled up
 
1:21 AM
makes no sense to me but ok
thanks!
 
sure! make sure it only does that when doing the modal view though
not modal, uh, layer? not sure the term for 100%x100% menu
 
it really should be body element
 
well the problem seems to be that your menu is ending up getting scrolled off-screen
 
yeah its really badly designed so its a bunch of bandaids which have side effects...which require more bandaids
I'm in process of redesigning so eventually it will work properly
 
¯\_(ツ)_/¯ vanilla can be messy
 
1:26 AM
while you are here, what do you think of the animation on the portfolio page? Its between the current and just a simple fade in. You can see it by clicking on one of the small images on the left.
 
one sec
looks good
you definitely need to allow users to exit the modal by clicking outside it though
rather than just the X button
the only thing I would change about the transition is the background overlay
that part would look better faded in than sliding in
 
Yes, that is on the TODO. The original supported clicking outside the modal with jQuery but I am removing jQuery so I gotta rebuild.
 
makes sense
 
@forresthopkinsa yeah, I agree
thanks
 
np
you can probably do a super simple click-outside function by putting an onclick on both the body and the modal, and then use stopPropagation on the modal
 
1:35 AM
ooo smart
 
I haven't tried it that way but it seems like the simplest approach
 
oh wait, I'm stupid
 
Good night.
How to resolve these errors?
A cookie associated with a cross-site resource at google.com was set without the SameSite attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with SameSite=None and Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at chromestatus.com/feature/5088147346030592 and chromestatus.com/feature/5633521622188032.
 
the background covers everything, no need to use body can just use the wrapper
thanks for all the help @forresthopkinsa
night all \o
 
1:55 AM
?
 
 
2 hours later…
4:12 AM
@Tiago Use some other way to integrate google's service. Such as through their api (which almost always requires a key so that they can monitor and control you).
 
 
2 hours later…
5:50 AM
hi, i have a big audio file but i want the html file to load all of it before working on it with some javascript ( no streaming, just old plain load file is there a way to do this
 
6:24 AM
@narasimhasriharshaKanduri you can use an audio tag with preload="auto"
the browser is suggested to attempt to download all of it right away
Then you listen to the canplaythrough event
when that triggers, it has downloaded everything
 
 
2 hours later…
ABC
8:17 AM
Hello?
 
hi ABC
 
8:42 AM
hello
is it good to create a timer that counts every second in your web app?
 
for what purpose?
if you need to know the current second, do a difference between start timestamp and current timestamp
 
just to show the customer about the current time
but I tried to put the second in console log and this appears
and it bothers me about memory leakage
 
not a big deal to count up on your web page
but don't count up in the backend
when you need to know the current second, you can always calculate it
 
my timer works, but I'm worried what if it reaches hundred thousands
 
this is why you don't use a counter
it creates needless work
 
8:46 AM
here's my code
startTime(previous) {
      var today = new Date()

      console.log(this.second)

      this.day = today.getDate()
      this.month = today.getMonth() + 1
      this.year = today.getFullYear()
      this.hour = today.getHours()
      this.minute = today.getMinutes()
      this.second = today.getSeconds()

      setTimeout(this.startTime.bind(this, today), 500)
    },
I call that method whenever the this.second changes
 
nooooooooo!
you're creating a new timer every time that is called
 
yes sir
 
use setInterval and just output it.
Your lowest denominator is seconds, so why are you running every 500ms?
 
Oh I already changed it to 1000
    startTime(previous) {
      var today = new Date()

      console.log(this.second)

      this.day = today.getDate()
      this.month = today.getMonth() + 1
      this.year = today.getFullYear()
      this.hour = today.getHours()
      this.minute = today.getMinutes()
      this.second = today.getSeconds()

      setTimeout(this.startTime.bind(this, today), 1000)
    },
 
setInterval(() => document.getElementById("seconds").value = new Date().getSeconds(), 1000)
changes a value on the page once every second
done. No need to do anything more fancy
 
8:50 AM
this is why you use react, for reactive pages
 
I'm using vue.js
watch: {
    second() {
      this.startTime(new Date())
    }
  },
 
🤢
 
so we have this watch method
 
If all you need to do is update a second counter once a second, this is all you need
you don't need to put it in watch
 
Oh so all I need is call that method once right? @Neil
 
9:00 AM
@AppleCiderYummy yes, if this is all you need to do
 
startTime() {
      var today = new Date()

      console.log(this.second)

      this.day = today.getDate()
      this.month = today.getMonth() + 1
      this.year = today.getFullYear()
      this.hour = today.getHours()
      this.minute = today.getMinutes()
      this.second = today.getSeconds()

      setInterval(() => (this.second = new Date().getSeconds()), 1000)
    },
and I put the startTime() in my created
created() {
    this.startTime()
  },
are this all good now sir? without memory leakage issue?
 
well are you using only the seconds or also the minutes?
 
the other as well
how about this @Neil
startTime() {
      setInterval(() => {
        var today = new Date()
        this.day = today.getDate()
        this.month = today.getMonth() + 1
        this.year = today.getFullYear()
        this.hour = today.getHours()
        this.minute = today.getMinutes()
        this.second = today.getSeconds()
      }, 1000)
    },
 
be sure to check what this means in JavaScript
and if you intend it to display it, use a different approach
I believe that you are writing a stopwatch feature
so with start/pause/reset ?
 
just a timer sir
like a normal clock
 
9:07 AM
by assigning this.second = today.getSeconds(), it updates it on the page?
if so, then just ensure that gets run exactly once and you should be good
 
yes sir it updates the page now
Thank you sir
 
startTime() {
      setInterval(() => {
          displayTime(new Date());
      }, 1000);
}
and in displayTime do that this.day and ect and change its html
 
 
1 hour later…
10:27 AM
hi
I'm following this example to attempt long polling in an effect with NgRx - bbonczek.github.io/jekyll/update/2018/03/01/…
gist above of my effect based on this ^
what I'm seeing is the continuePolling effect only runs once and doesn't poll as expected every 5 seconds
any gotchas here in regards to the way I've polled the http resource?
 
 
1 hour later…
11:42 AM
is there a way with regex to get the characters after a split that are before a space?
so that I can split 'rnd##### #####'
and only have 'rnd#####' '#####'
its for a calculator
 
Is there any performant way to draw svg onto canvas?
Im drawing an svg to the canvas and increase the dimension everytime inside the drawImage() method, making it appear to become closer.
Performance is really bad on firefox and edge though
 
well keep in mind your redrawing a full svg like every couple miliseconds
use pngs or small images
or draw lines and shapes using the canvas
 
@TaylorSpark .split accepts a regex
!!> 'rnd##### #####'.split(/\s/)
cap?
 
12:12 PM
nyet
She's not coming back
 
12:37 PM
hi
 
O captain, my captain?
Sadness.
@TaylorSpark you can't do pattern matching with split unfortunately
you'll need a second regex for that
 
o.o Neil?
 
has anyone had success with grabbing the LastModified header from a http request with angular http/common?
I did try observer but its missing the LastModified header
 
@KarelG Yes?
 
I don't understand what you said
.split accepts regex, so?
bit confused
 
12:48 PM
@KarelG He wanted to know if you could capture characters near the split location
at least that's what I had understood
 
hmm could be that I misunderstood him while you did not
 
I need a bit of advise guys. Working on a chatsystem that includes most browser emoticons. Like :joy: is replaced by said emoticon.
Obviously I can do that for each short code with regex and it'll work fine. But there are around 3000 browser emoticons and doing all of that with regex will surely impact client side performance. So does any of you know of a better approach?
 
@icecub don't search for :joy:, search for :[^:]+:
if the middle part doesn't match any emoticon, then you simply ignore it
this way you only perform a lookup if it resembles a possible emoticon
 
Hmm but how would it know which emoticon image it resembles? Unless I rename all the images to match the pattern I guess
 
have a map with name -> image
 
12:53 PM
Ah yes, ofc. Thx guys :)
 
1:15 PM
Hi, I am this simple question. Function AP is defined here in script file, which is loaded using script tag
However, I can't access AP function from within HTML file
It's probably stupid question, I am not a javascript dev - so guess I am missing something here
 
@chhantyal If you attempt to access a function before the page is loaded, it may not exist
so it is a question of timing in that case
Otherwise, the only way this could happen is if you think the script is loaded but it isn't
 
@Neil I cannot access after even page is loaded. Like when I try to call this function from developer console
 
ok, well you should double check that the script has been loaded
check the network tab and ensure the script has been downloaded and the script is available in the Sources tab
 
Neil
 
yea this is source tab i.stack.imgur.com/kldKQ.png
 
1:22 PM
I didnt mean check for pound signs (###) I mean like a numbered wildcard
like look for 'rnd(RandomNumbersandDecimals)'
like it would accept any numbers or periods in that location, but also looking for rnd at the front..

basically Im trying to setup a custom round command that uses Math.round()
using it for my arithmetic calculator and also my console API
 
@TaylorSpark you can't do that with a single operation
Though you could attempt to match without splitting
 
Yeah, but im curious, is it possible?
 
you would just search for all matches, not just the first
 
like could I do something like `split("rnd" + regex)'
the only problem is that the regex would accept all the other numbers in the textbox too
 
you could, but that wouldn't do what you'd think
 
1:24 PM
thats where im confused
 
split means remove every match and return everything else in separate strings
 
hmm... im not sure how to do this then
yeah, i mean I know what it does
 
ok, so what's the problem?
 
Wes
Could you give me some advise on how to ask a question. I'm trying to style an angular material component background. I've a sample application where I tried to style the component that doesn't work generated by ng How would I go about formatting a question on it? would I need to paste the whole project somewhere?
 
hmm... is it possible you can use regex to search for rnd AND only the numbers after it, because I use spaces to seperate all my operations in the calulator.
so is there a regex that can search for all numbers and decimals between each rnd and space
regexr helps
but it didnt do what I needed to here
 
1:26 PM
make an example then
so I can see what you're trying to match
 
like say I wanted to run the command rnd4.5 which should output 5
rounding the .5 to a 1
but it also needs to ignore all the other operations
rnd4.5 + 3 * 3

for example
it should ignore the +3 * 3
 
Wes
@TaylorSpark something like /rnd([0-9]+[\.]{0,1}[0-9]+)/
 
im using Math.round to make this possible. and I originally thought making mobile functions like rnd(numbers) would work
but the evaluator just returns the number inside the functions
not what I put into Math.round()
 
@TaylorSpark ok, so you're writing a parser..
 
yeah
im trying to safeguard my eval() to make it possible, as Im not wiriting a mile long parser for letters
but Im still partially doing that
 
1:30 PM
this has been done to death, and generally the best approach is to transform a string into tokens
once you have tokens, you can attempt to make sense of them
 
codepen.io/SkylerSpark/pen/eYOwNaJ As you see here, I originally tried doing something like this:
function sin(n) {
 var a = Math.round(n);
 return a;
}
 
Wes
capture rnd followed by digits followed by 0 or 1 point followed by digits.
 
I then used an html button to pass that sin() function into eval
 
@TaylorSpark lookup AST and use it in your work.
 
oops i put math round in that, it should be Math.sin
that was the sine function facepalm
 
1:32 PM
yes make an AST
 
AST?
 
abstract syntax tree
 
!!g AST
oof forgot
im banned from cap
^_^
 
like rnd2.3 + 5 * 3 gives you a tree with [rnd2.3]--add--[ 5 * 3 ] which then is [rnd2.3]--add--[ [ 5 ]--mul--[ 3 ] ]
 
Well, I could make a parser for the add, mul, modulous, div, etc
 
1:33 PM
[rnd] -- [2.3] rather
 
and I originally did
it looked more like a box of 10 years worth of mixed up legos
but the legos being if statements and calculations
 
@Neil no [rnd2.3] is [rnd [2.3]]since it's a single operation
Trust me. I wrote meta-interpreters with PROLOG / Haskell / Racket (C-LISP variant)
 
@KarelG meh then it would be [mul [ 5 ] [ 3 ] ]
 
I was trying to make operations for Modulous, calculatory basics (+-/*) and sin, cosin, round, ciel, floor, exponential math, and other calculations
oof I cant type today
 
then study what AST is and use it
many current calculators you see are usually using it
 
1:36 PM
the ASTs Im seeing seem more like just implementations of javascript's source code
they dont seem like tools to use IN javascript
Could someone show some examples or newbie explanations on how to write or use something like an AST?
Ive never heard of this.. Im not quite grasping what it is per say
From my point of view, it looks like a deeper explanation of JS and other languages
 
Wes
@Wes is this enough context? Too much code? too little? stackoverflow.com/questions/58220432/…
 
@KarelG Did you saw Wes' question. Gotcha tell it to him or not, no?
 
@TaylorSpark One of those other languages would be the math syntax
 
Wes
@KarelG sorry was just trying to link back rather than spam.
 
was joking :P
 
1:46 PM
Sorry, have to bother you guys one last time. So I tried the following:
let regexp = /:[^:]+:/gi;
let str = 'test :sdf: test :d:';

let array = [...str.matchAll(regexp)];

console.log(array[0]);
Which should return all matches as far as I know. But it only returns the first?
 
@TaylorSpark A stupid example of an AST would be 1+2*3 = { op: "+", left: 1, right: { op: "*", left: 2, right: 3 } }
 
Oh wacit
 
Wes
@icecub eh you have told it to return only first item
 
Never mind
Ye just noticed it, ugh
 
Wes
try console.log(array)
 
1:54 PM
I have no idea how to write an AST
Maybe ill just write a manual parser XD
 
tokenisation
 
and im lost again... sorry.
most languages have a basic concept to go along with, but when it comes to outsider concepts and things that reach into other languages and even more concepts, it becomes hard to catch on
thats why I never got into SQL
 
Wes
off topic but I read rnd as random not as round.
 
yeah
I did to, I just usually shorten my variable names to 3 or 4 chars
I find it easier to read, rather than typing and reading large super explanation-based names
 
Wes
@TaylorSpark I can see Math.round(3.7) + 1 works there.
 
2:03 PM
Yeah, im using eval() as of right now because im having trouble getting my manual parser to work
I dont plan on keeping eval as its evil
it allows pure Math objects to be called
then again, eval can run basically Math.pow(5, 10) * 7 / 3 * Math.sin(34) and so on so fourth
would love to make the calculator based on eval, but with it being so exploitable, I dont find using it safe
or perhaps people calling it evil has just made me paranoid
 
@TaylorSpark if you took effort to do proper googling, you would have some useful references. Such as this article which talks about tokenizing math expressions. Better: with JavaScript. Please read it completely (so, don't be a copy-pasta-nitwit) and apply it in yours project. Then I may have some hope for you, being as a developer, in the future.
 
copy pasta... ugh now I may be a vampire, but tutorials that just give you code to copy are the worst
Ive searched several times for physics equation tutorials with unity in C#, and I find some chinese site with a mile long code box that has a button that says "Copy"

and not even an explanation
Thanks for the article though
 
how did you end on a chinese site?
google usually filters by language/geography and chinese sites is seriously at the bottom when fetching results for USA people
 
not sure
it was english when I clicked it
but all the content was in chinese, and the place with the "code" had no "article" like more sites do
it just had the top navigation bar, and a huge box of code to copy :L
 
2:41 PM
Anyone an idea why this keeps returning invalid regex group? \w*(?<!alt=)test Its working fine on regex101 so not sure if I'm missing something I need to escape
 
probably that negative lookbehind
 
try using regexr
they explain everything more in depth
 
@icecub just checked. It is not supported unless being on Chrome/Opera
 
@KarelG Ah that explains it. Thnx :)
 
Yeah, lookbehinds are very new
Works in node
 
 
5 hours later…
user11867329
7:26 PM
Hey!
 
💩
 
user11867329
Welcoming as always.
 
user11867329
So, I have 9000 scripts
 
only 9000?
 
user11867329
and need to do a backspace on the first character which cause line 8 & 9 to merge
 
user11867329
7:28 PM
on AWL of dem
 
user11867329
what's a smart way of doing so?
 
so you want to replace all the linebreaks between two specific lines in multiple files?
Are the two lines before and after identical in all the files?
 
user11867329
Lemme google linebreak to see about the term
 
user11867329
No they are not
 
user11867329
Line 8 = src=sdjhdajklhdajkldh
line 9 = ,'
 
7:29 PM
What is significant about them that they all need the same treatment?
 
user11867329
for some reason, my script that generate the scripts create a line break when it should be on same limne
 
user11867329
All the same line
 
TLDR you're gonna need a regexp search
line numbers aren't useful
 
user11867329
line 9
 
user11867329
needs to be backspaced 1 character at the start of the line
 
user11867329
7:30 PM
so it merges back to line 8 like so: src=ashkdhasdjkasdhjk,'
 
user11867329
instead of 9000 scripts that have invalid syntax
 
user11867329
So there's no vi command to batch insert with lines as arguments or something?
 
user11867329
vi or vim
 
user11867329
It's python scripts by the way, so I just need a bash way to do so.

Googling about regexp but are you sure you don't know of a short and sweet easy way?
 
8:25 PM
sed
 
user11867329
awk also
 
9:45 PM
Hey old members. Can anyone provide insight on what this is referring to:
> SE reacted with more decorum and decency when a moderator had actually been arrested for one of the ugliest crimes a human is capable of
@MadaraUchiha Sorry, to ping but I thought since you are a mod you may have some info.
 
hi devs
 
 
2 hours later…
11:32 PM
@JBis It's probably not entirely appropriate to discuss the crime here, but it was due to not putting semicolons at the end of every statement.
 

« first day (3274 days earlier)      last day (1667 days later) »