« first day (3819 days earlier)      last day (1351 days later) » 
05:00 - 11:0011:00 - 21:00

05:56
[Kid25] How do you deal with the fact of a colleague leaving and never to be seen again?
06:36
Good morning
@Botler If it's just a colleague? Whatevs.
07:09
Yo how do I tell regex "there has to be a space either in front or behind this word", or am I on the border of what regex can do?
[ntohl (MR.TaNk)] <whole regex>|<whole regex> <- one side of pipe the space before the <whole regex> other side after
Ah nice, thanks
[ntohl (MR.TaNk)] \b for word boundary
@Squirrelkiller
hI
How many cookies can I create?
Is there a limit?
Just need enough dough
So technically there is a limit
07:21
hehe
I meant in my webapp
I don't think you'll top microsoft
mr5
mr5
how does tangent work, as seen from this animation?
[Squirrel in Training] GoOoOoOoOoOoOoOoOoOoOoOd Mornin' pleberinos!
tan is very strange in this animation
07:23
cool
mr5
mr5
0 goes to 3 then jump to somewhere 57+ value
lemme draw a tan like I learned it real quick
mr5
mr5
I didn't learn sin,cos,tan at school
I only learn sin,cos out of school and trying to learn tan now.
I hope this is understandable
So when you have 0°, the line goes straight to the right and tan is 0
But if you have 90°, the line will go straight up, so it can never actually cross that edge, so tan is infinite
mr5
mr5
oh thank you. I am expecting the drawing from MSPaint :D
07:31
Oh when I need straight lines draw.io is always my go to :D
mr5
mr5
in the animation, I think it is showing the values of cos and sin in radian. Why is tan on degrees though?
and what is the range of its value?
518
Q: Detect when browser receives file download

JW.I have a page that allows the user to download a dynamically-generated file. It takes a long time to generate, so I'd like to show a "waiting" indicator. The problem is, I can't figure out how to detect when the browser has received the file so that I can hide the indicator. I'm requesting a hidd...

I want to do this but with c# and Js
mr5
mr5
oh I think I get tan now
the value is relevant to the values of sin and cos
sin/cos/tan don't have degrees - their input is either degree or rad but the value is absolute
sin(0°) = 0
If my circle has 1m radius, sin(90°) = 1m
@mr5 They are related, tan = sin/cos
@Shad That is JS, isn't it?
07:45
yeah
and backend in the example is php
07:55
@Shad Oh, it's super simple. Use JS to send an async request to a C# end-point that generates the file and stores it temporarily. While the async request is not done, you can show the spinner. Once it's done, JS-side can receives the temporary id of the file, and can then request it.
yeah thanks
but I am using IFrame
so need to use cookie way only, don't want to change code
Eh? You're a programmer, you're supposed to change code.
xD
I will need to change at a lot of places
adding a cookie check seems like a cheaper option
07:56
Using a cookie for a download is quite dumb tbh.
The JS side is literally nothing more than this:
showSpinner();
fetch('/api/generateFile')
  .then(x => x.json())
  .then(x => {
    hideSpinner();
    location.href = '/api/downloadFile/' + x.id;
  });
hmm
return File(ms, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
I am return this from my action method
I return json now?
mr5
mr5
@Squirrelkiller ayt that make sense
yeeah
4 days no work here
it's time to make progress with my personal project <3
[Captain Obvious] Show spinner, Fire off a request for the file, (wait), on request completion: hide the spinner, then request the completed file linked in the response
[Captain Obvious] That's how loads of things work
mr5
mr5
ShowSpinner()
var model = await FetchJson<Model>("/api/generateFile")
// browser thingy
HideSpinner()
08:09
@Deathspike even the return types of the methods is memory stream instead of dataset
will be too many changes
mr5
mr5
What JSON library are you using?
NewtonSoft and System.Text.Json supports conversion from Stream to concrete model.
wait I am trying
[Captain Obvious] There's lots of changes because it was made badly in the first place
@Shad Then use .blob
showSpinner();
fetch('/api/generateFile')
  .then(x => x.blob())
  .then(x => {
    hideSpinner();
    downloadBlob(x, 'myfile.png');
  });
[Captain Obvious] Seems reasonable
08:17
@Shad See blog.logrocket.com/… "Downloading generated content" for examples on downloadBlob
thanks!
I am using jquery ajax instead of js fetch
Well, don't.
There's no point to jQuery in this day and age, unless you support IE9 or something.
And even that page is outdated AF
lol
alreay fetch it is then :D
and a fetch polyfill for old browsers github.com/github/fetch
(if needed)
Does the fetch api support other http verbs?
08:33
Yep. fetch('http://...', {method: 'POST'})
Or like fetch('http://...', {method: 'POST', body: 'Hewwow wurwd'})
I don't understand blob
:(
I don't want any anchor etc just download it when it reaches Js
@Deathspike
Sure, you can do that programmatically, which is exactly what I showed.
You should learn these concepts.
08:49
it says x is not defined
Go fix and debug.
doing that :)
@Deathspike I will
@Deathspike
sorry to be pinging
It literally says the blob was already requested when you entered that snippet there. You can't read the same stream twice.
so?
what should I do?
I have no idea what I am doing. xD
oh okay
makes sense
but in the next .then it says x is undefined
Works on my machine. You're probably doing something wrong.
09:00
return File(ms, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
my action returning this ^
and currently in js
 fetch(url)
 .then(x => { x.blob(); console.log(x); })
 .then(x => {
  console.log(x); //x is undefined
  downloadBlob(x, 'myfile.xlsx');
  });
Yeah... that's not what I sent ya. Please dive into how promises work.
x(
@Deathspike I don't see much difference
There sure is. Look again.
nope sorry I give up
apart from my additions it is the same 3 loc
Then that suggests that your additions are the problem.
09:11
alright issue was the missing return
you are awesome deathspike
@Shad That's what you get for using javascript lol
mr5
mr5
@Shad hmm. Do you have postman? Shouldn't you return plain byte array and the mime type should come from response headers
oh it's fix already
@Squirrelkiller no, no, no, that's what you get for misusing the language
JS is a wonderful language to work with, but you need to invest the time to understand it beyond the "I occasionally use jQuery and hate every minute of it". Of course you'd hate it if jQuery is all you know. Modern JavaScript is quite nice to work with.
I don't even know jQuery, and every time I hear about it I'm glad
function downloadBlob(blob, filename) {
                const url = URL.createObjectURL(blob);
                 URL.revokeObjectURL(url);
                };
is this much code okay to download the file? @Deathspike
it doesn't seem to download, in that example it returns an anchor element
09:28
Then just don't return the anchor, you don't have to, but that downloadFile (from the example) will download the file
what's wrong with my downloadBlob function?
It won't download anything.
I don't think it requires anything else
Well, try it, and see.
there is no downloadFile just downloadBlob in the example
x(
09:32
That's... what you're after. Try it.
10:01
@Deathspike I give up
mr5
mr5
Maybe try it on postman first
10:14
I don't have postman
All I see it is only possible on click of the anchor element
oh wait maybe I can call click myself in the code
@Shad that's what the example does..
read the exampleee
@Shad Swagger then?
// Programmatically trigger a click on the anchor element
// Useful if you want the download to happen automatically
// Without attaching the anchor element to the DOM
// Comment out this line if you don't want an automatic download of the blob content
a.click();
YES!
me blind
thanks <3
mr5
mr5
10:37
Is buying a domain on AWS a single payment thing?
I think "buying" a domain is never a single payment thing
You mean like, a domain name, right? Like mr5.io?
mr5
mr5
yep. it's per year for AWS
io is pricey
These names are never a one time payment, they are always rented from some registrar
mr5
mr5
My country is not enlisted on the list
I guess I'll be a foreigner then
"IT Nationality: Alien"
mr5
mr5
10:47
it's weird cuz my country is listed on other fields but not this one
oh fuck
it's all European countries
Is there maybe some other field you have to fill, like which internet agency (I forgot hte real name right now) you wanna register with or something?
I think there's like, one per continent
mr5
mr5
I can't see any
What if you click on the little info icon
OH wait I'm blind
Well good luck I guess?
Or like, use a different registrar
mr5
mr5
ohhhhhhhhhhh
It's based on the domain lol
I chose .it
mr5
mr5
10:52
So it's tied to that country which is italy
I thought I could chose whatever I want
Yeah some countries have restrictions on who can use their TLD
double-character domains are reserved for countries
but as far as I know, there is no logical explanation for it's availability based on your location
like... a person from America or Asia should still be able to buy a domain with an extension of a european country
05:00 - 11:0011:00 - 21:00

« first day (3819 days earlier)      last day (1351 days later) »