Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
jeffrey won't put the site's tagline back, but it was one of like 3 absolutely true things lowtax said

Adbot
ADBOT LOVES YOU

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



bob dobbs is dead posted:

jeffrey won't put the site's tagline back, but it was one of like 3 absolutely true things lowtax said

lines two and three: ~*fartz*~ and "hello, there!"

ElehemEare
May 20, 2001
I am an omnipotent penguin.

Subjunctive posted:

you used a very confident tone for someone coming from a place of inexperience!

Carthag Tuek posted:

hell yeah, promotion comin up

Hed
Mar 31, 2004

Fun Shoe

bob dobbs is dead posted:

jeffrey won't put the site's tagline back, but it was one of like 3 absolutely true things lowtax said

the internet makes you stupid is gone?

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Jabor posted:

the reason you have cors in web browsers is that without it, site a would get to make requests to site b with the user's site b credentials. that's not a problem with apps at all - the webview in an app doesn't share state with the standalone web browser or the webviews in any other app.

if you log in to a particular service within an app, the implication is that you're fine with that particular app sending requests to that service with your credentials. the alternative is that every app author would have to run a proxy service to funnel all the internet traffic from their app through (or more likely - use one from someone providing this service to many different apps), which is objectively worse for both security and privacy.

how dare you teach me something in THIS, the awfulest of threads

heresy

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

Hed posted:

the internet makes you stupid is gone?

can you find it? I can't find it anymore. its gone from where it was

RPATDO_LAMD
Mar 22, 2013

🐘🪠🍆
its on something called a "front page"

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

RPATDO_LAMD posted:

its on something called a "front page"

you know that ain't a thing anymore

RPATDO_LAMD
Mar 22, 2013

🐘🪠🍆
https://www.somethingawful.com/frontpage/

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
you know that it existing doesn't mean it's still a thing

Hed
Mar 31, 2004

Fun Shoe

bob dobbs is dead posted:

can you find it? I can't find it anymore. its gone from where it was

It's still there! Sorta...


HTML code:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      content="somethingawful, something awful, frontpage, news, comedy, games, movies, flash, video, forums"
      name="keywords"
    />
    <meta
      content="SomethingAwful.com offers daily internet news, reviews of horrible movies, games, and social networking, anime and adult parody, and one of the internet's largest forums covering games, movies, computers, sports, anime, cars, and more!"
      name="description"
    />

    <title>Something Awful: The Internet Makes You Stupid</title>

cool av
Mar 2, 2013

Jabor posted:

this is the only one that cors is supposed to protect against.

why then does it prevent requests being sent at all by default, rather than just excluding cookies by default?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

cool av posted:

why then does it prevent requests being sent at all by default, rather than just excluding cookies by default?

the client’s authentication could be a cookie, or an Authorization header token, or a client certificate for TLS, or simply being on an internal network for some cases

Share Bear
Apr 27, 2004

without resorting to java-level "one thing per file" organization, at what point do you figure you should put something in its own module? just keep code that deals with the same stuff together?

i'm refactoring two python projects and i really feel like i can better organize and label things than what i currently do, which is just by feel, where code that deals with the same sort of operations/apis or datatypes are in their own module

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
every act of modularity is a bet about correlation, a bet about the future changes you're making in the code. you can write down the bets but you're just making bets. there's no oracle that can tell where the roulette wheel lands, you're just guessing in the first place, but you can look at the history of things to see what the odds are, at least

abraham linksys
Sep 6, 2010

:darksouls:
every project should simply have a utils.[filetype] with 12,000 lines of code

tbh, a lot of modern code organization is defined by unit testing needs. this means there's a lot of advice about how to split things up by "layer": separate your routes, your logic ("service" sometimes), your data access into separate modules, so that you can unit test them individually. if you're not doing this (and in 2024 i am more inclined than ever to say "computers got loving fast and layer abstractoins have gotten more complicated to reason about, just integration test everything you can and use unit tests for weird poo poo"), then it really is kinda just up to you.

i think most web services wind up with "handler" (http routes/grpc stub/etc), "logic", and "data" layers, with the bulk of the code being under "logic." usually you have one module per "handler theme" (here's all the user profile endpoints) and one module per database access type (here's the DAO for getting user objects), and then "logic" just ends up being whatever is convenient. maybe you have a shared UserLogic module all your endpoints use some calls from, and then a UserProfileLogic module that just the profile endpoints use, that kinda thing.

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

bob dobbs is dead posted:

every act of modularity is a bet about correlation, a bet about the future changes you're making in the code. you can write down the bets but you're just making bets. there's no oracle that can tell where the roulette wheel lands, you're just guessing in the first place, but you can look at the history of things to see what the odds are, at least

the Oracle roulette wheel always lands on Oracle

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

abraham linksys posted:

every project should simply have a utils.[filetype] with 12,000 lines of code

tbh, a lot of modern code organization is defined by unit testing needs. this means there's a lot of advice about how to split things up by "layer": separate your routes, your logic ("service" sometimes), your data access into separate modules, so that you can unit test them individually. if you're not doing this (and in 2024 i am more inclined than ever to say "computers got loving fast and layer abstractoins have gotten more complicated to reason about, just integration test everything you can and use unit tests for weird poo poo"), then it really is kinda just up to you.

i think most web services wind up with "handler" (http routes/grpc stub/etc), "logic", and "data" layers, with the bulk of the code being under "logic." usually you have one module per "handler theme" (here's all the user profile endpoints) and one module per database access type (here's the DAO for getting user objects), and then "logic" just ends up being whatever is convenient. maybe you have a shared UserLogic module all your endpoints use some calls from, and then a UserProfileLogic module that just the profile endpoints use, that kinda thing.

utils.filetype always has 12000 sloc and is always like 11000 of sometimes-actually-tested pure functions and therefore is often the least poo poo code in the entire system

CPColin
Sep 9, 2003

Big ol' smile.
I couldn't figure out why my Spring controller that was trying to return just a String or just a byte[] kept wrapping everything in JSON, encoding as base64, etc. Then I found a bit of converter configuration code that was applying a certain date format and unintentionally unregistering all the other default converters. I commented that out and my stuff started working as expected.

Then I ran the tests and noticed that no tests failed. :thunk: So now I have to figure out what the hell actually needed this converter and why turning it off didn't break anything. Whee!

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
over the last decade i've deleted something like 20k lines of code from our utilities.hpp because it was stuff that got added to the standard library

ElehemEare
May 20, 2001
I am an omnipotent penguin.

Plorkyeran posted:

over the last decade i've deleted something like 20k lines of code from our utilities.hpp because it was stuff that got added to the standard library

negative loc contributors stay winning

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

bob dobbs is dead posted:

every act of modularity is a bet about correlation, a bet about the future changes you're making in the code

yeah, for me the guiding principle of software layout (module boundaries, repo layout, etc) is “things that often need to change together should live together”. you can make a lot of good architectural proposals just by looking at PR file correlation

it’s also a fun lens for looking at your engineering organization: what sorts of changes require multiple teams to coordinate? should the team boundaries be drawn differently? yes

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
d. l. parnas has 51 years on you, too (and me)

https://www.win.tue.nl/~wstomv/edu/2ip30/references/criteria_for_modularization.pdf

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



hrmmmmm tests fail on travis-ci because the app cant connect to the test db (php_network_getaddresses: getaddrinfo for mysql-tests failed: Name does not resolve)

so i run a debug build and do the travis actions manually, but works fine. no problems!

theres a sleep 45 between docker-compose up -d and docker-compose tests, which i even skipped when running manually

wtf gives

Soricidus
Oct 21, 2010
freedom-hating statist shill

Share Bear posted:

without resorting to java-level "one thing per file" organization, at what point do you figure you should put something in its own module? just keep code that deals with the same stuff together?

i'm refactoring two python projects and i really feel like i can better organize and label things than what i currently do, which is just by feel, where code that deals with the same sort of operations/apis or datatypes are in their own module

Java doesn’t enforce one thing per file, that’s a myth. it just enforces one public, top-level thing per file. you can have a bunch of public things if some of them are nested, or a bunch of top-level things if some of them are not public.

why yes, I have seen awful programmers abuse this to have an entire complex gui application in a single Java file … :negative:

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:
I am used to writing Python 3.1x code, but now I need to implement a few trivial things in an environment where I am locked into Javascript ES5 and limited to the stdlib and nothing else.

I need the equivalent of the Python set operation "a & b" and it looks like I need to write my own? This is like banging rocks together, but not in the kind of fun way that is ASM.

Osmosisch
Sep 9, 2007

I shall make everyone look like me! Then when they trick each other, they will say "oh that Coyote, he is the smartest one, he can even trick the great Coyote."



Grimey Drawer

Antigravitas posted:

I am used to writing Python 3.1x code, but now I need to implement a few trivial things in an environment where I am locked into Javascript ES5 and limited to the stdlib and nothing else.

I need the equivalent of the Python set operation "a & b" and it looks like I need to write my own? This is like banging rocks together, but not in the kind of fun way that is ASM.

Are you looking for this? Or isn't it really ES5? Or are you using sets of non-reference-equalable items?

e: I may have my JS versions mixed up

e2: Yep, I was thinking of ES6, rip op.

Osmosisch fucked around with this message at 10:12 on May 21, 2024

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

what do you mean by “limited to the stdlib and nothing else”? libraries aren’t specially constructed language forms, they’re just code in a different file. why can’t you copy one of the many Set polyfills, or just drop core-js’s minified 1.2KB file into your project?

my homie dhall
Dec 9, 2010

honey, oh please, it's just a machine

Antigravitas posted:

I am used to writing Python 3.1x code, but now I need to implement a few trivial things in an environment where I am locked into Javascript ES5 and limited to the stdlib and nothing else.

I need the equivalent of the Python set operation "a & b" and it looks like I need to write my own? This is like banging rocks together, but not in the kind of fun way that is ASM.

what’s crazy is this is true for the latest release of golang too in tyool 2024

Soricidus
Oct 21, 2010
freedom-hating statist shill
python sets are substandard too tho. why does set.add not return a bool indicating whether or not the value was already in the set?

my homie dhall
Dec 9, 2010

honey, oh please, it's just a machine
cmon dog, how you gonna bring that up? pretty big gulf between sets — the most basic collection — having an obscure api issue and not existing at all

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:

Subjunctive posted:

what do you mean by “limited to the stdlib and nothing else”? libraries aren’t specially constructed language forms, they’re just code in a different file. why can’t you copy one of the many Set polyfills, or just drop core-js’s minified 1.2KB file into your project?

You are thinking far too big. It's a single file, 16 lines of code, 9 lines of comment. I'm not inlining 1.2KB of minified javascript to get the intersection of two arrays.

Comedy option: I could spawn a helper script that uses Python. I have Python 3.12 available to me.

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

Antigravitas posted:

You are thinking far too big. It's a single file, 16 lines of code, 9 lines of comment. I'm not inlining 1.2KB of minified javascript to get the intersection of two arrays.

Comedy option: I could spawn a helper script that uses Python. I have Python 3.12 available to me.

that's not how javascript peeps roll, to make a vast understatement

but that's an argument in your favor, lol

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Antigravitas posted:

You are thinking far too big. It's a single file, 16 lines of code, 9 lines of comment. I'm not inlining 1.2KB of minified javascript to get the intersection of two arrays.

Comedy option: I could spawn a helper script that uses Python. I have Python 3.12 available to me.

code:
var intersection = first.filter(function (v) { return second.indexOf(v) != -1 });
? man ES5 was so long ago, I don’t think it had .includes

mystes
May 31, 2006

If you're limited to ES5 It's a bit unreasonable to blame javascript in general imo. Like I guess in terms of how old it is it's not technically as bad as saying something like "I'm stuck on python 1.5 and wow python sucks" but javascript changed a ton after ES5 so it's kind of similar.

mystes fucked around with this message at 13:27 on May 21, 2024

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:

Subjunctive posted:

code:
var intersection = first.filter(function (v) { return second.indexOf(v) != -1 });
? man ES5 was so long ago, I don’t think it had .includes

I did something similar.

This thing doesn't even have "let" yet.

I resent polkit quite a lot tbh.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

you could probably transpile down to it, but yeah, 17 lines of code, probably not worth it

redleader
Aug 18, 2005

Engage according to operational parameters

my homie dhall posted:

cmon dog, how you gonna bring that up? pretty big gulf between sets — the most basic collection — having an obscure api issue and not existing at all

the most basic collection is unarguably the array

unless you're some flang nerd, in which case it's probably some sort of immutable copy-on-write freakshow implemented using two trees, a deque, and a bloom filter

my homie dhall
Dec 9, 2010

honey, oh please, it's just a machine
what is an array but a set with the added complexity of ordering? :smuggo:

Adbot
ADBOT LOVES YOU

Osmosisch
Sep 9, 2007

I shall make everyone look like me! Then when they trick each other, they will say "oh that Coyote, he is the smartest one, he can even trick the great Coyote."



Grimey Drawer

my homie dhall posted:

what is an array but a set with the added complexity of ordering? :smuggo:

A miserable block of memory.

But enough premature optimization, have at you!

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply