this post was submitted on 13 Dec 2024
312 points (97.3% liked)

Greentext

4604 readers
338 users here now

This is a place to share greentexts and witness the confounding life of Anon. If you're new to the Greentext community, think of it as a sort of zoo with Anon as the main attraction.

Be warned:

If you find yourself getting angry (or god forbid, agreeing) with something Anon has said, you might be doing it wrong.

founded 1 year ago
MODERATORS
312
Anon is a math prodigy (sh.itjust.works)
submitted 1 week ago* (last edited 1 week ago) by [email protected] to c/[email protected]
 

top 26 comments
sorted by: hot top controversial new old
[–] [email protected] 63 points 1 week ago* (last edited 1 week ago) (4 children)

What programming language returns a 500 error because it fails?

A 500 error code is a critical server failure, It isn't something that can happen because a piece of JavaScript failed.

[–] [email protected] 13 points 1 week ago

Javascript also exists on the server, and an exception would cause a 500 error. Semicolons are optional in JavaScript, except for a handful of cases. One of those is in a for loop. I'm guessing the professor was running a nodejs app and did something like this (intentionally bad style because professor):

for (x = 0; x < 5 x++)
{} 
return x

Boom, syntax error, which would return a 500 air status in a nodejs web server framework.

[–] [email protected] 12 points 1 week ago (1 children)

Old IIS versions with PHP would do this when running in production mode. Talking about 2010-2012

[–] [email protected] 4 points 6 days ago

IIS. That brought back bad memories.

[–] [email protected] 37 points 1 week ago (1 children)

Maybe PHP? Since it runs as a server and returns computed results in a browser... Though I'm pretty sure it'd just return the compiler error text

[–] [email protected] 11 points 1 week ago

Php outputs HTML at the end of the process. If it didn't run because of a missing semicolon it would just output an error. It wouldn't crash

[–] [email protected] 17 points 1 week ago (1 children)

Any programming language that runs on the web server and doesn't gracefully handle its errors. There are many web servers implemented in Javascript, but it could also be Java, it could be Perl, it could even be C/C++ if someone is being masochistic.

[–] [email protected] 11 points 1 week ago

Couldn't be a compiled language, those wouldn't even get to the point where you send a request.

[–] [email protected] 28 points 1 week ago (1 children)

Intro to IT on some webform stuff is truly the darkest timeline.

Where have the good old times gone when peeps were tortured with plain C in some atrocious outdated IDE from the ancient times?!

[–] [email protected] 7 points 1 week ago

Ugh, I don't want to touch codeblocks again

[–] [email protected] 87 points 1 week ago (3 children)

how tf would a missing semicolon result in a http server error

[–] [email protected] 14 points 1 week ago (1 children)

If the web server is implemented in any of the languages that require semicolons.

[–] [email protected] 5 points 1 week ago (2 children)

why would you demo a for loop with a web server

[–] [email protected] 6 points 1 week ago

As one step of building a bigger project that demonstrates something web-ish.

[–] [email protected] 11 points 1 week ago

For the same reason our OS memory management class was in Java, a language without pointers, because some idiot decided all courses had to be standardized on the same language because the industry says they need people who know that language now.

[–] [email protected] 63 points 1 week ago (2 children)

In ASP.NET applications, specifically in ASP.NET Web Forms and ASP.NET MVC (pre-Core), the compilation process is dynamic and happens at runtime if source files like .cshtml, .aspx, and .cs files are present on the server.

ASP.NET uses just-in-time (JIT) compilation for views (.cshtml, .aspx, .ascx, etc.) and sometimes for code-behind files (.cs). When a request hits a page, ASP.NET dynamically compiles these files into temporary assemblies.

If there’s a syntax error, missing semicolon, incorrect type, or any other compilation issue, the process will fail and throw a 500 error.

[–] [email protected] 3 points 1 week ago

Yeah, what he said.

[–] [email protected] 12 points 1 week ago (1 children)

why would you use asp in an introductory course

even if you have like a student learning platform so they don't have to install anything, surely it would wrap the code that's submitted so it doesn't crash the application

[–] [email protected] 11 points 1 week ago

my guess is he had all the boilerplate written, and was using a single line or two of "working code" to show what the technology was capable of

but it's 4chan greentext so it could be fake and gay

[–] [email protected] 20 points 1 week ago (3 children)

File fails to compile, web server tries to run the file, error.

[–] [email protected] 2 points 1 week ago

Nodejs exists. Here's a JS snippet that would throw an exception:

for (x = 0; x < 5 x++)
{} 
[–] [email protected] -1 points 1 week ago (1 children)

If the file failed to compile the server wouldn't execute it because a file wouldn't be created. A compile error stops the process, It doesn't result in a corrupted output, since that would be really stupid.

[–] [email protected] 3 points 1 week ago

You must have never used the eclipse Java compiler.

[–] [email protected] 1 points 1 week ago (1 children)

if your server runs user-submitted code server side, that's a paddlin

[–] [email protected] 3 points 1 week ago

It never said user code.

This could as well be an intro to php and the server may be set to not show errors and instead just fail.

The lecturer then writes some code, forgets a semicolon and gets a 500.

[–] [email protected] 9 points 1 week ago

I do that too forotheer subjects