« first day (2896 days earlier)      last day (2057 days later) » 

10:06 AM
hm
somehow
I'm reverse-engineering Google Calendar
 
no help or comment for me
i am getting a warning message
if i use .load
 
@geisterfurz007 VSCode
 
documentataions says it either i have to migrate jquery to greater than 3.x
 
they use a pretty peculiar API format
but I think I see what's going on there
 
or i have to use .on("load", ...)
any one comment?
 
10:09 AM
Cheers!
 
@CommonMan I finally stopped using jQuery for ajax and moved to fetch API
I only use jQ for DOM right now and that's only until I finally move to React
 
yep
I'm not saying that you're supposed to use it
I'm saying that I use it
 
my objective is to reload a content in a page after an ajax call.
 
there's like a million ways to do it
 
10:13 AM
where if i use .load i m getting an warning message in console which is not good
so what is that solution for me
 
why would I know
it's your code
 
for the script that i posted have
well it's my code but i am here because you all experts and help me learning.
 
refreshing the dom is always, in principle, gonna be something like this
1. Trigger the reload somehow - button, user action, periodic
2. Make the ajax call and register some handler
3. When the handler fires, update the content
jQuery's load is simply a shorthand for 2 and 3
and you can implement it manually or using fetch or whatever
 
is fetch doesn't requires a div reload?
 
fetch is just the #2 part
analogous to jQ's .get()
 
10:18 AM
can you suggest me a jquery API for reload
 
But I can link the docs
Read the note. Understand the difference between the two.
 
we got a terrible communication gap
 
because you're not trying to understand what you're doing
and instead are asking for copy&paste solutions
Welp I suppose this is how the next generation of software developers is gonna look like
spoiled with quick-start tutorials and hacking on existing examples
 
10:23 AM
well i knew that I am trying to do a reload thru a .load which was suggested in stackover flow...
 
@BartekBanachewicz you hurt my feelings. I'm going to my safe place now. :(
 
@CommonMan and did you read the documentation for load?
 
I got it worked well. which is the .load jquery... but the recent chrome browsers says it's deprecated.
yes... i do... before coming here
 
you probably should've pasted the warning you're getting btw
 
I am using an ajax call into the .ajax... will paste it here now
I am thinking if you understood that I am using PHP then I am not using PHP here to use .load as I am using a service call.. I never tried .load for a service call...
 
10:26 AM
a what
 
especially when it involves a post data to a service URL
 
an ajax request is just a page load without the actual page switch
Makes no difference to the backend how it's called
 
an ajax request is not a page load
 
jquery-3.3.1.min.js:2 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
send @ jquery-3.3.1.min.js:2
ajax @ jquery-3.3.1.min.js:2
w._evalUrl @ jquery-3.3.1.min.js:2
Re @ jquery-3.3.1.min.js:2
append @ jquery-3.3.1.min.js:2
(anonymous) @ jquery-3.3.1.min.js:2
z @ jquery-3.3.1.min.js:2
html @ jquery-3.3.1.min.js:2
(anonymous) @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
OOPS!
 
and there's a header appended if it's an ajax call so the backend can actually differentiate @Neil
 
10:28 AM
@BartekBanachewicz If you wanted to differentiate, sure
 
I am literally staring at my code right now with this:
    if not request.is_ajax():
        raise http.Http406("This endpoint can only be queried by AJAX.")
 
jquery-3.3.1.min.js:2 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check xhr.spec.whatwg.org.
this is the error i was getting when i use .load
 
and by page load, I mean requesting the server from an address ultimately
don't mince words
 
@CommonMan you shouldn't be getting this if you haven't passed async:false
unless
.load actually does that implicitly
 
32 mins ago, by Common Man
function refreshAjaxContent(divId){
	$(divId).on("load", function() {
		return;
	});
}

function deleteAdminUser(adminUserName){
	var deleteAdminUserDetails = {};
	deleteAdminUserDetails.username = adminUserName;
	console.log(deleteAdminUserDetails);

	$.ajax({
		url: domainUrl+"something/here",
		type: 'post',
		data: JSON.stringify(deleteAdminUserDetails),
		dataType: 'json',
		contentType: "application/json; charset=utf-8",
		success: function(data) {
			refreshAjaxContent("#dashBoard_Data")
 
10:30 AM
in which case just replace .load with .get()
 
this is my code
 
yeah I know it's right above
 
so i haven't used aysnc; false... and let me try with .get as you suggested.
 
Here's the load impl and I'm not seeing that
 
check the doc before you just replace .load with .get please
otherwise while you're at it, replace foot with mouth
 
10:33 AM
I don't think it's about async
it's complaining that the handler took too much time
would it be enough to nextTick the handler?
I mean if it takes 200ms it will take 200ms eventually
it's just a matter of when, not sure why Chrome is complaining here
 
you got it @Neil.
 
1
A: jQuery has deprecated synchronous XMLHTTPRequest

runbackMy workabout: I use asynchronous requests dumping the code to a buffer. I have a loop checking the buffer every second. When the dump has arrived to the buffer I execute the code. I also use a timeout. For the end user the page works as if synchronous requests would be used.

 
the handler is .ajax method here... as there are no other event handler here... i m puzzled
 
It is strange that chrome should tell you that a jquery function is deprecated
 
load supplies its own handler, that's the main point of it
 
10:35 AM
I wouldn't exclude that possibility, but it strikes me as odd
 
@Neil it doesn't say that directly
Chrome just sees an XHR with a callback that took 200ms and complains
so my guess is that it'd like that callback to be pushed to an asynchronous computation
similar to fetch's .json(), which is a promise
eh let me do a quick test
 
then it's not an issue of being deprecated
it's complainng about latency
 
8 mins ago, by Common Man
jquery-3.3.1.min.js:2 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check xhr.spec.whatwg.org.
 
oh, how'd you manage to make it synchronous?
 
we use ajax for async
its why async is default true
 
10:40 AM
you don't have to set anything to be async
that's the default behavior
to make it work synchronously is another story
 
so i have to just ignore the warning?
 
the warning is right
I mean, somehow jQ is making synchronous requests
 
few docs suggest if i upgrade jq version to greater than 3.x.. it may niot appear
thank you all... besides soft criticism
 
there is no real reason to make the request synchronous
like ever
 
10:59 AM
how about readability and lowering complexity?
I don't understand you people
literally async/await, if you didn't have anything running in the background
 
@towc its not making the request synchronous, its making the code execute synchronously. Thats a big difference.
 
> if you didn't have anything running in the background
I agree synchronous requests are generally bad, but I disagree with how neil just throws them out
 
so you are going to synchronize requests just because you can?
thats... terrible approach
 
in python you have synchronous requests, which are used
in many js snippets, it would be easier if the requests were synchronous
maybe synchronous within another thread
top-level await is becoming a thing, which shows that this is slightly useful
I don't think sync requests are inherently bad, everywhere
also @KamilSolecki you still haven't answered: did you submit the game?
I haven't had time to look through the entries
 
I did, but am not proud of it. I mean all mechanics are there, but I didn't have time to make a level gen nor design enough levels
 
11:10 AM
link?
 
Am not on pc, Ctrl f for misconnected
 
@towc they usually are on the frontend though because they halt the thread until the request is completed
which you basically never want in a frontend setting, and it can have some bad side-effects
 
@KamilSolecki neat. You kinda get stuck sometimes, and can't put the cable down
 
ik
I submitted it about 30 seconds (literally) before deadline
If I did not have exams
it would go differently
 
but what if I really want a bugfree game?
 
11:16 AM
then you need to add another condition under spacebar handler
 
@GNi33 it would make frontend more accessible to some people though. It's not like advanced teams use many bad practices, but I would have had a harder time getting into dom manipulation if I didn't use jQuery
 
for pickup point
 
@KamilSolecki oh. The first time I submitted it, there were a bunch of bugs, and I emailed Mazur asking if he can apply some patches I sent him, over the next few days, after the deadline
you might still be able to do the same, if the patches aren't game changers
 
@towc yeah, I disagree
 
javascript is accessible because it doesn't throw mysterious typing errors in your face at the slightest mismatch
same for python
 
11:19 AM
if I don't want to put in the work to understand simple concepts as asynchronous requests and code execution, I may want to do something else
 
^
Again, async isn't magic
 
another thing that python got well is that people don't want to learn about async when they just want to get started with programming
 
its actually very simple, with a little bit of caveats
 
I wouldn't have written almost any webgl if there wasn't the simple canvas in between
 
yeah, I get it
and you can use sync requests, nobody's stopping you from using them
 
11:21 AM
someone who is very proficient with webgl might say that you don't really need canvas, and that if you're not willing to put in the effort to learn about shaders and buffers, then you might want to do something else
and for advanced stuff, sure
 
but don't be surprised if there are "DO NOT DO THIS IN PRODUCTION" stickers slapped all over the tutorial you're reading
 
yeah, that's fair
 
@towc slightly different scenario, but sure
 
@GNi33 see, that is another problem. Most do not realize that it might not be feasible for given scenarios and spreading the knowledge
 
@GNi33 is it?
 
11:22 AM
yes
 
although I am not saying a language should be foolproof
since thats impossible
 
@GNi33 how?
 
Im just saying that leading the world through sync without showing them the problems happens too often and leads to very miserable results
 
@towc I can't really do anything without those in webgl, can I?
 
@KamilSolecki yet you're an advocate for async/await? What are your thoughts for top-level await?
 
11:24 AM
disclaimer, my openGL days are long gone and I was never that proficient
 
@GNi33 but you can use the 2d canvas
 
sure, when it uses a webgl renderer by default in the background I couldn't care less
 
it's much much slower than webgl, it's easy to have bad practices with, yet makes graphics very accessible
 
and I would say that I might want to do something else if I do not want to put the work in to learn good practices
main culprit here might be that I simply do not see async requests as a big gatekeeper
 
good luck teaching graphics to someone by getting them straight into webgl
 
11:26 AM
and yet, sync requests are there, you're free to use them
now where did I say this?
 
my only point was that sync requests aren't inherently bad
 
@towc @towc its an absolutely terrible idea
 
they're just usually bad
 
fine
 
@KamilSolecki they're in stage 2: github.com/tc39/proposal-top-level-await
I don't think they'll be used much by important codebases, nor should they, in most cases
but for demos and learning, this is a huge plus
or short scripts
 
11:30 AM
with top level await, what is going to happen is, that you loading module x dependent on module y dependent on ... etc. will cause an eternal chain of dependency loading while preventing you from doing any freaking work.

What is more, it is actually slower.
With top level await, you might end up creating deeper dependency graphs
 
and sometimes that's fine
again, not for huge codebases, but for demos and learning
 
and on top of that
code becomes weird and much less readable
 
it's like canvas 2d vs webgl
@KamilSolecki on the contrary
 
@towc no, its like introducing bad, pretty much never to be used functionality that will confuse people and cause just trouble
its not simplifying things
its complicating them
 
why do you think it will confuse people?
or cause trouble?
or complicating things?
 
11:33 AM
..for the points I said above?
anyways !!afk work
 
you've made a single point, which is that dependency loading might be blocked (which is actually up for debate, in the proposal)
and even if it did, I already mentioned it's fine
your second point was that it becomes weird and less readable, which I disagree with. You haven't backed that statement with anything
 
sync requests are inherently bad
there's no arguing to have about that
blocking the main UI thread is bad, no sane mind would argue with that
now.
sync requests API is certainly better than async/await, promises, or what have you.
nobody can argue about that either.
@towc could you figure out a way to get the best of both worlds?
a completely synchronous API that is actually asynchronous behind the scenes?
 
11:49 AM
@FlorianMargaine That is technically async/await
At least, as close as it gets with the modern languages I know
 
@MadaraUchiha no.
@MadaraUchiha then you don't know enough languages :)
 
inb4 common lisp magic
 
Golang.
 
What, go routines?
How is that a sync API that's actually async?
 
in golang, a req := http.Client().Get() has a sync API which is actually asynchronous.
 
11:52 AM
There's no discernible difference for me between that and await fetch();
 
the .Get() will yield the current goroutine, and resume when it's done.
 
Especially since await can be used on synchronous values as well.
 
@MadaraUchiha I don't need to prepend async to func Get()
I don't need to even think about async/await
 
@FlorianMargaine Me neither, I just need it to return a Promise.
 
@MadaraUchiha lul
func foo() {
    req := http.Client().Get()
    return req.Body
}
then you call it with bar := foo()
that's literally all there is to it
you have to be really into Stockholm's syndrome to say async/await has "no discernible difference"
 
11:53 AM
Right, and the only reason you have async before an async function, because await is a valid identifier and not a reserved keyword
Same reason we have function* and yield
 
posted on September 20, 2018 by Michaël Zasso

Notable Changes fs Fixed fsPromises.readdir withFileTypes. #22832 http2 Added http2stream.endAfterHeaders property. #22843 util Added util.types.isBoxedPrimitive(value). #22620 Added new collaborators: boneskull - Christopher Hiller The Technical Steering Committee has new members: apapirovski - Anatoli Papirovski gabrielschulhof - Gabriel Schulhof Commits [add1fcd301] - assert: ad

 
how is any of this simpler than not doing it at all and use normally-looking code
 
If it weren't for the legacy, you'd have no syntactic difference
 
even just using const foo = await bar(); is bad
 
I disagree.
You do bar().Get() and I do await bar(), what's the big difference?
That you can hide your .Get() away inside of bar()?
 
11:55 AM
what?
 
Good on you?
 
no, golang just does bar()
 
You'll need to put the yield somewhere
Your yield is global to the routine scope, and mine is local to the function
 
no
that's the whole point I'm saying
yield are implicit
you don't need to care about yielding, ever
 
Maybe for userland code
But you still have that yield
That .Get() is your yield
And it doesn't matter where you put it
 
11:57 AM
no
ignore the .Get()
func foo() {
    req := http.Client()
    return req.Body
}
 
Would you have had the yield if you didn't use .Get()?
 
that's just as valid ^
no, you don't
 
What's the purpose of the .Get() then?
 
it's just part of golang's http API, http is the namespace, Client is the class, and Get is the method
req := http.Client().Post() would make more sense I guess
 
Something needs to tell the engine where to yield control, and it doesn't really matter if you're the one specifying it (via await) or if the language infers it (i.e. async functions that are implicitly so, like your .Post() and .Get())
 
11:59 AM
no, that's the whole point
the engine itself is yielding appropriately
 
In your example, .Post() is either marked as async, returns a Yieldble, or the engine does dark magic to make it work.
 
just the latter
 

« first day (2896 days earlier)      last day (2057 days later) »