« first day (1503 days earlier)      last day (3445 days later) » 

3:01 PM
you're requesting a JSONp result.
if you omit the ?callback it fails due to CORS
so just use jsonp
 
and it has mimetype of a text file
 
@towc draw lines to the intersections, you know enough about the resulting triangles to calculate the area of the middle one and substract it from the section of the circles that contains it
 
C D
have tried this too
$.ajax({
dataType: "jsonp",
url: "http://www.football-data.org/soccerseasons/358/teams?callback=?",
success: function(data) {
console.log(data);
}
});
 
See, no callback in there. They don't support JSONP.
 
C D
oh
 
3:02 PM
@CD capture your errors
parsererror: Error: jQuery1710535615507280454_1417099195836 was not called
 
C D
didn't get that error at all? hmm
 
because jQuery swallows errors
 
@Mosho how would I know at which point of the base the intersections are? I'm not allowed to use a grafical approach
 
$.ajax({
dataType: "jsonp",
url: "http://www.football-data.org/soccerseasons/358/teams?callback=?",
success: function(data) {
console.log('here', data);
}, error: function() { console.log( arguments ) }
});
you need to capture the errors ^
 
C D
got it now
 
3:03 PM
@towc you have enough information to find all the data
 
C D
so that's not jsonp, got that, but how do I get rid of CORS restriction then?
 
@towc You have enough info to calculate the asymptote's length. Together with that length, and the length of the circle, you can calculate the angle of the inner triangle
 
@towc dat f
 
With that info, you can then calculate the area of the circle segment
 
@Mosho I know I do, but how?
 
3:05 PM
that is for you to discover, young grasshopper
(idk lol)
jk, it's pretty simple
I think
you have the other sides of the big triangle
and you know the lines you draw are of length L
and you have the angles of the big triangle
 
ohh Facepalm
 
then you should have all the lengths you need to calculate the area you need
 
@CD you know it isn't JSONP right?
so your only options if they don't offer a JSONp api is to proxy it on a server :/
unless someone else has figured out how to by pass CORS
 
@CD Not. The remote server has to respond with an "allowed" to allow your CORS request. Since they don't support JSONP, you have to do something else -- e.g. proxy the request, etc.
 
by an insane browser
 
3:09 PM
@RoelvanUden CORS is not related to JSONP...
 
C D
@rlemon @RoelvanUden got it now
 
what is the question, may I ask?
 
@FlorianMargaine no, but the issue is that 1) he thought it was JSONp, 2) not being JSONp there is CORS restrictions
 
@FlorianMargaine I didn't say that, and if you would just read the previous messages you wouldn't have made that comment at all :P
 
C D
the question - how to get the data out of a json feed - football-data.org/soccerseasons/358/teams
 
3:10 PM
proxy server
 
> The remote server has to respond with an "allowed" to allow your CORS request. Since they don't support JSONP, you have to do something else
I read it that way ^
ignore me then
 
@CD what is your server language/tech?
PHP? ASP? Node? Python?
 
C D
quick question before diving on so - how would I check whether a feed is json or jsonp? by just appending a ?callback=something?
 
@CD you don't
 
@CD well they should tell you what their API supports
but it is a good guess if callback=foo doesn't wrap it in foo(arr) then it's not JSONp
 
C D
3:12 PM
there's no info on that page; but how do you guys quickly figure out?
got it
 
now, depending on what you run on the server, you can proxy the JSON there in a number of different ways
 
@Mosho do I?
 
C D
@rlemon was just trying to append it to a div with jQuery
 
yes, but read up on CORS
 
C D
@rlemon will do right now, cheers guys
 
3:14 PM
the server otoh doesn't have the restriction, so you can download the JSON to your server and re-serve it to your site
 
have to tag this one as status-norepro. we're excessively dogfooding meta/sites/chat to our SE teams (a lot of people are remote), and we'd surely notice such behavior very quickly. — m0sa ♦ 3 hours ago
~~
 
@FlorianMargaine thanks for taking that to meta, I am really fed up of that thing.
 
@towc yes
 
@Mosho how?
 
angle + base + isosceles = you know everything
 
3:18 PM
btw, I'm not allowed to use trigonometry
 
hmm
 
@towc 54 deg each
 
@Mosho ok, I do know I can easily get the base angles easily, but then?
what I have to know is the angle of that inner triangle (?[°])
so base andles won't help me... this thing should apply to every triangle with a certain height/radius relation and a set minimum base length
I don't really care that the angle of the big triangle is 72°
by knowing ? I know everything I need to know, I agree, but how do I get to it?
I'd need to know where the intersections split the base, which by instinct I'd say that it divides it in 3/5, but how can I be sure?
 
did you try the math rooms?
 
@rlemon there are math rooms 0.o?
 
3:24 PM
@towc mathematics.se has a room
 

 Mathematics

Associated with Math.SE; for both general discussion & math qu...
 
sorry guys...
 
no worries.
 
lol
 
I'm just thinking you might have better luck figuring it out there
 
3:28 PM
@towc That shouldn't be too hard, once you figure out the height of the triangle
You know two sides and their opposite angles, so the sine law will quickly tell you the third side's length
 
@KendallFrey not allowed to use trigonometry... also: 20170000th message
 
Why no trig?
What are you allowed to use then?
 
@KendallFrey I have to find out the solution only using intuition and hand-made 2nd grade highschool calculations
and I can't figure out (yet XD) all of the possible configurations of sin/cos, sin^-1/cos^-1
 
"intuition" is poorly defined
My intuition told me to use the sine law
is pythagoras' theorem allowed?
 
@KendallFrey I can only use constants defined by the problem and can only use manually calculatable functions... and I don't know how to calculate sine by hand yet
@KendallFrey sure
 
3:33 PM
var x = document.getElementById("num1").value;
var y = document.getElementById("num2").value;

if (isNaN(x) || isNaN(y)){
window.alert("please check values");
}
else{
window.alert(x + y);
}
}
hi all...i am practicing some very basic javascript and trying to figure out how to add the sum of 2 input fields
it appends the two together instead of adding them
 
ok, I think pythagorean theorem might work
 
@KendallFrey show me your ways, master
 
if the equal sides are 1, and the base is L, then half of the triangle is a right triangle with hypotenuse 1 and leg L/2
 
if I instead replace x and y with numbers then it will add then
*them
 
then the height of the triangle will be sqrt(1 - (L/2)^2)
call that H
 
3:36 PM
anyone know what I am missing?
 
@ObadiahWilliams you're using strings, not numbers
Then the base of the smaller triangle will be sqrt(L^2 - H^2)
 
so i need to parse or convert the 2 input fields as integers
 
So you can get the area of the inner triangle using pythagorean
I'm assuming you know the length of the matching sides of the isosceles
 
!!> Number('1')
 
@rlemon 1
 
3:40 PM
@ObadiahWilliams does that hint help?
 
@KendallFrey MMiszy just proved me that the penthagon is perfectly inscribed in the circle -_-
so innertriangle = outertriangle actually
 
that sounds wrong
 
actually looking at the proof something really seems wrong... dropbox.com/sh/260nvjmjfjy1oqu/AADaJ9i5T6eSdW79RIGhCbGIa?dl=0
 
@rlemon @KendallFrey I have changed the input type of the inputs from text to numbers and it is still appending
 
because if the triangle fits perfectly inside the circle, then L(the circle's radius) must be equal to the other sides of the triangle
 
then the triangle would be equilateral
 
@ObadiahWilliams Well, they will still be strings. Look at the hint @rlemon gave you..
 
@ObadiahWilliams according to spec, .value on a form element will always result in a string
 
i didnt see the hint until now... I will try to implement it
 
the input type just limits what the user can physically input (and for validation)
 
3:45 PM
I think you're basically fucked without sin/cos/tan
 
@KendallFrey agree
 
var val = Number(input.value)
@ObadiahWilliams ^
 
@towc Actually wait a second, you might be able to fudge it
Let me work it out
 
@rlemon any reason for the huge overlap by calling the constructor instead of just prepending + ?
 
@jAndy Number constructor comes with little overhead and it is 100X easier to read and understand
 
3:49 PM
Clarity, perhaps. Implicit conversions are horrible.
 
unary + for casting a string to a number is great when golfing
not so great in real code
 
well its like 60% slower
 
so?
Number still does like 4 million op/s
 
function myfunction() {
var x = Number('num1'.value);
var y = Number('num2'.value);

if (isNaN(x) || isNaN(y)){
window.alert("please check values");
}
else{
window.alert(x + y);
}
}

The input box does not detect the number
 
because you still need to grab the elements from the DOM
'num1' is nothing
 
3:52 PM
@KendallFrey got it wrong, his proof said that it was just completely inside the circle, not that it was perfectly inscribed
 
should be Number(document.getElementById('num1').Value;)?
 
@towc oh yeah, fuck
 
solution is so easy now!
 
unless
 
I don't know about that.. I just.. hate to use unnecessary function calls like this, espcially for simple operations like that one. It would only make sense if you really give it the full blown.. explicit business then
 
3:54 PM
A(circle) - A(penthagon) = result
 
the angle is <60
 
like also never using var obj = { } but var obj = new Object(); etc.
 
Or is this specifically a pentagon?
 
still, how could I know the area of the penthagon without trigonometry or constants?
 
In which case, it would have been easier to say that from the beginning
 
3:54 PM
@KendallFrey it is... sorry, forgot to specify it
 
HAHA...Nice!
 
BTW "penthagon" isn't a thing
 
@rlemon, @KendallFrey

function myfunction() {
var x = Number(document.getElementById("num1").value);
var y = Number(document.getElementById("num2").value);

if (isNaN(x) || isNaN(y)){
window.alert("please check values");
}
else{
window.alert(x + y);
}
}
i did it!
 
Do you or do you not know the outside radius of the pentagon?
Because if you don't you might have to calculate that, and I'm not sure how to do that without trig
 
@ObadiahWilliams \o/
@ObadiahWilliams please start using console.log over alert
what browser do you use?
 
3:58 PM
@KendallFrey I do not
 

« first day (1503 days earlier)      last day (3445 days later) »