« first day (3831 days earlier)      last day (1100 days later) » 

12:18 AM
hi
 
@TheHowtoBrainiac 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.
 
 
10 hours later…
10:11 AM
 
 
2 hours later…
11:43 AM
Yall seen ECMA 2021?
Theyre screwin around with numbers again
If I start seeing numbers in JS looking like this:
var num = 1_000_000_000;
Ima lose my mind
I mean I get the idea, and I like it, but it just looks so silly...
The only time it looks useful is for readability with Hex, Octal or Binary:
// Support with binary, octals and hex
0b0000_0000_0101_1011;
0o0001_3520_0237_1327;
0xFFFF_FFFF_FFFF_FFFE;
idk, it just looks unusual
 
morn o/
 
Though, there is something neat in ECMA 2021 Im looking forward to...
const zipcode = person?.address?.zipcode
morning jbis
 
11:59 AM
@MisterSirCode Well if it is only for clarity, I am fine with it. If you have to create integers that looks like that, I would loose my mind hahaha
 
@SimenL 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.
 
Yeah its pretty horrific
The only time I can see someone using it with integers, is if they have some kind of sight disability or something
 
I hope they fix transparency in rgba and globalAlpha tho
 
or just cant read numbers with lots of integers or zeroes
 
Or perhaps it is limited to browsers...
 
12:00 PM
@SimenL whats wrong with it?
 
values below 0.002 turns transparent
Yeee
Asked a question regarding alpha limitations and people were arguing in the comments lol
But turns out 0-1 alpha is calculated to 0-255
 
and?
whats wrong with that
@SimenL well, it should, I dont think it would be percievable
 
Yeah I guess
 
||> 255 * 0.002
 
@MisterSirCode 0.51 Logged: `` Took: 0ms
 
12:03 PM
when it comes to canvas pixel manipulation/simulation, I find it a bit troublesome
 
0.51 / 255 alpha
thats literally transparent
 
I was hoping that some magic formulas would increase the 255 value
rgb is 8-bit right?
 
@SimenL Well, your application should be using 255 for the alpha scale, since there are only 255 valid alpha levels... theres no 254.5
and ive never experienced an issue beyond that
to me, it sounds like the specification is fine, but theres an issue with your code
 
These chat rooms are pretty cool tho
Hmm
 
@SimenL I believe so
||> 2 ** 8 - 1
 
12:05 PM
@MisterSirCode 256 Logged: `` Took: 0ms
@MisterSirCode 255 Logged: `` Took: 0ms
 
yes
its 8b bit
 
hahaha
I am trying to replicate the flow property in Photoshop but in the browser, but I suppose I am limited to the 8-bit alpha
I just have to reduce the stepping (which makes it a bit choppy) when I draw across the screen. Or do some jujutsu pixel manipulation on each pixel within the radius
So what are you doing in the chat? Just chilling?
Been here before?
 
@SimenL You could create your own color system
and just convert it to 8bit while drawing
||> console.log(2 ** 16, 2 ** 32)
 
@MisterSirCode undefined Logged: 65536, 4294967296 Took: 0ms
 
So you could have way more colors
32bit is unrealistic
but 16bit is definitely doable
 
12:11 PM
Hardware and software compatibility issues would appear I assume if I increaset the bit
16 could be alright I suppose
 
Just store the data in a 2D array
draw the bitmap info and save as a png
it should theoretically save it as a 16bit image
no idea
 
Oh well
 
Yeah probably unrealistic
Theres a limit to what the web can do
 
For now yeah
 
If we could use true color images or something
 
12:15 PM
Perhaps the standards will increase in the near future
 
itd be insanely unperformant
and websites would load much slower
true color is like... 24bit
||> 2 ** 24 - 1
 
@MisterSirCode 16777215 Logged: `` Took: 0ms
 
yeah, almost 17 million colors per grading
 
Phillips Hue advertisement phrase "17 million"
 
well, past 24bit is basically inpercievable
so no one really cares to go past it
but 32bit images exist
 
12:16 PM
So are you enrolled in any schools at the moment or are you employed somewhere?
 
@SimenL Bro I am straight up self tought. Sitting in a highschool classroom right now
 
Hahahah
shit
Well you are on a good way at least
I did not start coding until I was 18
So 5 years approx now
 
yeah, I hear a lot of people say the same thing
they find it unfair that I started when I was like 10
lol
 
Meh
Kinda dumb to say it is unfair
 
It does make the learning curve easier
starting younger, jumping right into the cesspool of madness called programming
but honestly, Im probably better at art than I am at programming anyways artstation.com/sircode
The people here could probably confirm Im a cringe javascripter
2
I do a lot of sketchy stuff for no reason
 
12:20 PM
Growing up with technological gadgets can be similar as you know how to interact with these gadgets
Like coding, you get used to how things function
Not bad stuff you got there!
 
Yeah I do a lot of 3D rendering
I draw sometimes aswell for fun
 
Ooo
Hang on
Seen this guy?
 
I thought of him when I saw your art
 
The sites blocked, but yeah, Ive seen him
beeple does more like abstract stuff all the time
every day
I just do my 1 or 2 pieces of art per week or every few weeks
Hes a lot more skilled than I am
 
But I probably know more about fractals and 3D volumes then him :3
 
Yeah well he has been going on about it for more than 12 years haha
 
I think hes more interested in the art side
I just like the lighting and technical stuff
and I can use math to make some crazy shit
 
I need to continue on my project, but it was nice talking to you
 
alright
cya
 
12:27 PM
Good luck with your art and coding! You seem like the guy who have the potential to work on games almost by yourself (except sounds and stuff)
 
1:19 PM
sleepy js chat today eh?
 
1:47 PM
ye
 
whats the general feeling on svelte nowadays?
 
No clue actually.. I remember svelte being the fresh new hipster shi.. uhm.. stuff some time ago. Now I see it here and there, but thats it. Might be a bit more visible than Polymeer, but less than the main 3 vue/react/angular.
But thats my perception.. I'm in a ReactJS bubble anyway.
 
2:43 PM
I really love svelte
Not sure it will live up to the hype or become a main player but it gets a lot of things right imo
 
can anyone help me , i got a small interface related problem in typescript
 
@EquanUrRehman 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.
 
user1986815
I want to reduce the traffic on a site by loading the pictures in the localstorage and use them from there. practically the script should look into the localstorage, if there is a variable called "logo" and if it is not it should load that file from the server and place it in the localstorage, and if it is it should append it to a id so the html can use it
 
@MaxMuster 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.
 
user1986815
hi James
 
2:44 PM
@MaxMuster I'm like, 86% convinced that's the wrong solution for caching images
 
@MaxMuster don't. The browser already does that through it's own caching mechanism.
And if you really need to (which you don't), use IndexDB not localstorage.
 
user1986815
IndexBD ? never heard about it
 
That's the second-most important thing to get away from the comments ;)
 
what is your usecase
 
user1986815
the browser doesn't do it ... he loads them every time .. I checked the logs
 
2:48 PM
that's a server problem
 
@MaxMuster the browser will cache images unless you (the server or the user) tells it not to
 
user1986815
I can not change the server , it is a hosted site.
 
you can't fix it on the client
 
|| mdn image caching
 
2:51 PM
lol
 
@MaxMuster the logs... on the server? in the inspector in the browser?
 
user1986815
I made a simple img tag with a picture and reloaded the site and on the apache log I can see how he loads it each time I press refresh .. so cashing is NADA!!!
 
huh
so you can access apache logs but you can't change how the server serves images?
 
user1986815
also on the firefox inspector I can si in the network tab that the image is downloaded each time.
 
I mean, I have made horrible things in the past like serving the content of images manually (read the image and stream the bytes along with the correct mime-type) and that would allow one to control the cache headers
 
user1986815
2:57 PM
Kevin, right, I can access logs but I can not reconfigure the web server because the server is not my daddies server. It belongs to Bill Gates and he is not letting me change setting
 
can you execute code on the server? what is it that you do have writing permission on?
 
user1986815
only webspace so including .htaccess and TEMP directory
 
right, so you put static files in that space and the apache server exposes them.
 
user1986815
I can not change /etc ... is is root:root ... I am just user
 
is the server able to execute php files? serving images and caching them yourself is an achievable goal in that regard
 
user1986815
3:01 PM
yes php ajax python but just with user rights
 
@MaxMuster Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
ok well, you could 1. redirect all requests to /img to a php file 2. check what image is being requested 3. if it exists echo the content while setting mime-type and cache headers
 
1 message moved to Trash can
 
@MaxMuster It's more that it's less optimal than simply a bad idea. Here, the concern is caching. Solving it by trying to reimplement caching is sub-optimal.
 
user1986815
I thought about this :
```
      if (localStorage.getItem("logo") === null)
      {
            // fetch the "png" file and put it in the localstorage
            // append it to a ID
      }else{
            // take it from the localstorage
            // and append it to a ID
      }
```

Why is this not a good idea ?
 
3:07 PM
because caching isn't that simple. What if you want to change the logo?
now you need to rewrite your js to do that or it's gonna serve the wrong logo to some clients and not others?
the browser already does it pretty well, leave it to them
 
if you use JS to do it, you effectively need to recreate in js all the things the browser does to handle caching
 
well, you are being sent a lot of information suddenly but if I could offer one last piece of advice: at this point, were I in what I can understand of your situation, I would ask myself how worthy an use of my time it was to solve this now.
 
user1986815
okay Felix
 
it seems you're looking at non-trivial solutions, whereas maybe the problem is not that huge of a problem, and while you have done good to validate that the caching is indeed faulty, there's always this possibility that we've missed something.
 
i would begin with attempting to get it fixed the normal way, by someone with more access to the server. Best bet would be researching what would be required to make that change, then presenting that to those who can. Only after that being deemed impossible would i try to fix it with php/python etc
because, if you go the python/php route... now you need the same solution for other typically cached things
like js, css, etc
 
3:13 PM
read the mdn article and see if the headers that are being sent are wrong
 
user1986815
JBis I sent no headers I made a test file with just <img src="...."> to see what happends
 
user1986815
and I reloaded it
 
user1986815
and each time it downloads the image
 
When you have an image in your HTML, the browser will initially make a request to get that image. In the response there will be headers that tell the browser how to handle cache.
 
user1986815
According to what you tell me, this should not happen, the browser should recognize this and serve the image from the cache
 
3:17 PM
only if the proper headers are sent
 
user1986815
Yes but the MDN documentation says that the headers should only be negative so "no-cache".

I then wrote that in the .hataccess:

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/png A2592000
</IfModule>

It doesn't matter, the photos are downloaded every time
 
did you see said header in your dev console for the image?
 
sidenote: if you have the dev console open, cache maybe disabled
 
user1986815
yes I can see it in the network tab how he downloads the picture each time
 
we see an entry even when an image is loaded from cache
 
3:21 PM
right, but if you click on it, you can see response headers
 
user1986815
I did not checked the "disable cache"
 
Whats the URL of the image?
 
user1986815
I am very thankful that you insit on the best solution but I really came here to ask you some javascript questions.
Can I ask you this ?
 
@MaxMuster Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
1 message moved to Trash can
 
user1986815
Is this  here working for to fetch a pictureand attrib it to a variable ? And Can it run anytime in the script ?
        var logoImage= $("").attr('src', '<?=G::logo200118png;?>').load(function() {

          $("#logoId").append(logoImage);

        });

or do I need the `$(window).load(function() ` to load it ?
 
3:30 PM
oy
what are you trying to do?
 
... lol prevent the caching issue ^
 
@MaxMuster Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
1 message moved to Trash can
 
don't worry Max, you'll remember to hit ctrl+k before hitting enter eventually
 
user1986815
  $(window).load(function(){
        var logoImage= $("").attr('src', '<?=G::logo200118png;?>').load(function() {
              $("#logoId").append(logoImage);
        });
  });
 
there you go!
 
user1986815
3:34 PM
This loads the picture after the html has been loading
 
('src', '<?=G::logo200118png;?>') wait this is php templating.
<?=G::logo200118png;?> this is being replaced by php prior to serving the javascript file?
 
user1986815
right this code is in a php file
 
JavaScript.syntax.getSupport() === PHP.syntax.errors
 
user1986815
Exactly more or less this is my question, becauseI have the feeling this code is not executed
 
can you read the resulting javascript source code? is the G::logo200118png; properly replaced anyway?
like, if you were to paste that exact same code snippet, but as seen by the client
 
user1986815
3:39 PM
yes it is .. it is replaced well
 
@MaxMuster Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
user1986815
can somebody disable this bot ????
 
1 message moved to Trash can
 
@MaxMuster No, hes doing his job
 
user1986815
    then I go like tis to store the picture in the localstorage
    ```
    logoImage.addEventListener('load', function () {
            var imgCanvas = document.createElement("canvas"),
            imgContext = imgCanvas.getContext("2d");
            imgCanvas.width = logoImage.width;
            imgCanvas.height = logoImage.height;
            imgContext.drawImage(logoImage, 0, 0, logoImage.width, logoImage.height);
            var imgAsDataURL = imgCanvas.toDataURL("image/png");
            localStorage.setItem("logo", imgAsDataURL);
 
3:43 PM
I think Im ready to die
@MaxMuster Put a console.log("is this running"); or something similar inside of that event listener, and make sure its firing in the first place
if it fires, then log logoImage and make sure youre recieving an image object
after that, if you do log an image object, log imgAsDataURL and make sure youre getting a dataURL
just sift through it
find what exists and what doesnt
 
user1986815
okay brb let me try this
 
3:56 PM
hello ,
does anyone knows how to compares datatime like this one
`created_time_stamp: "Thu, 01 Apr 2021 14:38:09 GMT"`?
I have a nested json object with multiple created_time_stamp in it, I just want to find the most recent one
 
convert them all to timestamps
 
and then what ?
 
compare them
 
user1986815
In this line
`var logoImage = $("").attr('src', '<?=G::logo200118png;?>').load(function() { $("#logoId").append(logoImage); });`
I get this error: Uncaught TypeError: e.indexOf is not a function
 
that's... a rather weird line of code
 
user1986815
4:12 PM
 
user1986815
 
user1986815
If I click in the error it shows me line 6 ... the picture above
 
user1986815
What does Javascript want to tell me ?
 
what i mean is
$("") returns an empty collection
attr('src', '<?=G::logo200118png;?>') does nothing, because it's an empty collection
.load(function() { $("#logoId").append(logoImage); }); also does nothing, for the same reason, but is also completely out of place becaue nothing that has a src attribute should have content loaded into it.
unless you're using a very old version of jquery where .load can also be an event binding method
 
user1986815
okay so how do I brin the png file into the variable ?
 
4:18 PM
the file? or the address
 
user1986815
/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */
 
user1986815
Kevin the content of the file
 
err
what's the purpose of this
because, it's not going to result in the image being cached,
 
@KevinB empty collection?
 
yeah, a jquery collection with 0 elements
 
4:22 PM
oh wait nvm
wasn't really connecting the previous messages to that specific one, apologies
 
OK so I've converted the datetime to a time stamp, and It returned an int :

"Thu, 01 Apr 2021 14:38:09 GMT" ---> 1617287889

how do we compare the numbers to get the most recent one ?
 
just like any other number comparison
!!shrug
 
¯\_(ツ)_/¯
 
4:41 PM
so the bigger is the most recent one ?, is that is how it works ?
 
@LoopingDev yes
> Date objects contain a Number that represents milliseconds since 1 January 1970 UTC.
the greater the milliseconds the more time since 1 January 1970 UTC the more recent
 
Thank you!
 
user1986815
5:32 PM
Here again, is here really nobody able to tell me how to read a file in a variable ?
 
I think I ran into something like this few weeks back , let me check
how about Const file = await fetch("./db/file.json");
if it's a json file then u could probably use JSON.parse
 
user1986815
does it read the file in base64 format ?
 
this is bad advice
you can't fetch a local file
 
user1986815
it is a URl not a local file
 
and fetch returns a response not a file
 
user1986815
5:47 PM
 
|| mdn Response
James is broke
 
user1986815
I tried with XMLHttpRequest
 
user1986815
But I get the failure Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience.
 
|| mdn Response
 
so don't send a synchronous request
 
lol
 
6:11 PM
@MaxMuster I have no idea, I was lucky to get it to work.
 
Hi Y'all, While trying to refine an example that @VLAZ provided for me I tried the following but it didnt work and was wondering if anyone could provide any clues as to how I could accomplish this
function makeHeader(headings) {
			const headingCells = headings.map(function(value) {
				for (i = 0; i < headingCells.length; i++) {
					return $("<th/>").attr("id", "liveTimingColumn"[i]).attr("scope", "col").text(value);
				}
			});

			const header = makeRow(headingCells);
			return header;
		}
Mainly... Im trying to add an id to each table column
 
so... it is working, you just want to add an ID to each column..
find the iterator that creates table columns..... and add an ID attribute
you already have code there adding an ID
(Given, its crappy JQuery... but it works)
 
Im getting: Uncaught ReferenceError: Cannot access 'headingCells' before initialization
but removing the for loop and .attr("id", "liveTimingColumn"[i]) and it works
 
well
headingCells isn't a thing, until the map is done
map can't access itself like that
 
Mmmm
 
6:17 PM
headingCells.length doesn't make sense in that location
Should it be value.length or something similar?
should the for loop even exist?
 
I just thought of something... Lemme try removing the for loop here
I just thought of that too
brb
Oh No... Havent tried my thought yet but I dont see it working w/o for loop otherwise all id's will be the same
without iterator at end of "liveTimingColumn"
Mmmmm
lol
This is a tough one
 
well, i mean
"liveTimingColumn"[i] doesn't make sense as an id
 
sure it does
 
the id would be l, i, v, e, T, i, m, etc iterating by 1 each iteration
 
liveTimingColumn1, liveTimingColumn2, liveTimingColumn3
 
6:21 PM
right out of the gate that makes duplicate ID's, which is universally bad
 
Ohhhh
 
not to mention it's likely not intended
however
yeah i think the for loop isnt needd, just leave the return, and then concatenate the current index of the map's callback (second argument) to your id
i would argue the ID is unnecessary
yeah i think the for loop isnt needd, just leave the return, and then concatenate the current index of the map's callback (second argument) to your id
(those messages may be way out of order, my network is shit)
 
Hmmm
I need to learn more about map
Why do you say the id is unneccessary?
I need "something" to be able to access certain rows
 
if the id increments in the same direction and count as the elements, the index of the element should be just as usable for selecting the element as an ID would be
 
so I can hide certain rows (display: none;) for mobile devices
I was thinking that too but didnt know how to proceed
efficiently
Lemme look into map's 2nd arg. Great clue. Thanks
 
6:30 PM
all depends on what you're doing and how, on what criteria, etc
 
@min-width: hide columns
 
if you're hiding stuff with css via media queries, that's a different beast
 
Thats what I had in mind. Should be ez once I have an id ontop of each column
 
yeah i wouldn't reference things by id in one of those, i'd just use a mobile-hide class or something similar. using id's would be very hardcoded
 
Well I was wanting to initially add classes to a few columns but that is proving even more difficult
 
6:33 PM
if you used id's, then you'd have to change both the js and the css any time the number of columns changed
 
Wouldnt be too bad to add the same class to All columns
but that wouldnt be much use
 
posted on April 12, 2021 by Prudhvikumar Bommana

The Beta channel has been updated to 90.0.4430.70 for Windows Mac and Linux. A full list of changes in this build is available in the log. Interested in switching release channels?  Find out how here. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Prudhvikumar Bommana Goog

 
as then theyd all hide
I dont forsee col's ever changing
Famous last words Haha
 
6:53 PM
This wont work due to the pesky function as the 1st arg (Which is no surprise)
unction makeHeader(headings) {
			const headingCells = headings.map(function(value) {
				return $("<th/>").attr("id", "lTC" + index).attr("scope", "col").text(value);
			}, index);

			const header = makeRow(headingCells);
			return header;
		}
as index is now late for the party there but there's nowhere else to put it as a 2nd arg. Hmmmmmm
 
7:04 PM
err, wat
headings.map(function(value, index)
!!mdn array map
 
7:20 PM
Hoorah... It works and I was just looking at this but @KevinB 's answer / example helped immensely
as I was feeling overwhelmed with all the intricacies mentioned on MDN
Thats why I prefer... Dont say it.... W3Schools
I still dont "See It" with adding the index inside this functions parenthesis but it works so Im gonna leave it be
It'll come to me someday
Thanks again
2 more to go. Id like to access the XML file's root element attributes and make <table> not rewrite every run but those may prove more difficult
but nothing I cant crack
This is my version of a video game
A coding sudoku puzzle
 
 
1 hour later…
8:54 PM
Hello
Can you help me how to map and format an object?
I know that I can do the same with .map
but for Array
data: {lastName: "Admin", _id: "523badf0-63b7-4bd8-9cc5-024c49b7ec12", accountId: "quidelcorporation",…}
accountId: "quidelcorporation"
created: "2021-01-18T04:31:40.813Z"
email: "loga@test.me"
firstName: "test"
lastLogin: "2021-04-12T13:35:24.474Z"
lastName: "Admin"
lastTest: "2021-04-12T12:41:22.348Z"
role: null
tenantId: "quickvue"
tests: [{test: {vendorOrderId: null, userUUID: "523badf0-63b7-4bd8-9cc5-024c49b7ec12",…}, user: null,…},…]
0: {test: {vendorOrderId: null, userUUID: "523badf0-63b7-4bd8-9cc5-024c49b7ec12",…}, user: null,…}
How can I format created and isSelfAssessment ?
from this object
 
 
2 hours later…
10:36 PM
 
 
1 hour later…
user1986815
11:36 PM
I was able to read a picture in a variabe

now my variable looks like this "�PNG����IHDR�������v�������ܛ�"

how can I transform this in a base64 string ?
 

« first day (3831 days earlier)      last day (1100 days later) »