|
prisoner of waffles posted:More like the "very good programmers thread," amirite? there are no good programmers though. literally the entire point of programmig is to take shortcuts and be as lazy as possible to get comptuers to do work for us. also computers are so complex there's absolutely no way to actually understand what's going on unless you're writing in the rawest of assembly/most trivial peripheral bit twiddling so we just throw code out there and hope it looks like it works. i honestly love it.
|
# ? Oct 29, 2017 08:19 |
|
|
# ? Jun 8, 2024 17:57 |
|
fleshweasel posted:put/post matters because one of them implies you should only change values for keys which are specified while the other implies that keys omitted from the most recent request should be removed from the entity. I don’t remember which is which isn't the former PATCH and the second PUT? my mental model was like this: GET = select PUT = upsert DELETE = delete PATCH = update POST = generic "here's a command that should result in some (side) effects, let me know about them maybe"
|
# ? Oct 29, 2017 09:35 |
|
i tend to think of it as post = create, put = update, patch = partial update
|
# ? Oct 29, 2017 11:32 |
|
ok so serverless computing/functions-as-a-service: when and why would I actually want to use these? why are these cool + good and why/when would using these services be a better alternative to normal computering?
|
# ? Oct 29, 2017 11:36 |
|
terrible programmer q: is there any advantage to making my local variables small int sizes/uints if i know they won't have any representation problems? i'm asking about rust specifically but i guess the question applies to any lang that has i8/u8/i16/u16. i mean do they get aligned with wordsize anyway, so i might as well just use i/u size and call it a day? i'm getting pretty annoyed by the casting i need to do since all the library methods take usize/isize
|
# ? Oct 29, 2017 12:07 |
redleader posted:ok so serverless computing/functions-as-a-service: when and why would I actually want to use these? why are these cool + good and why/when would using these services be a better alternative to normal computering? when your it is bad or when the service provided is too complex for cost/benefit to make sense. my last job used providers like that since our it could take a year to develop and deploy a solution that is a sub-kloc case:switch statement
|
|
# ? Oct 29, 2017 14:06 |
|
gonadic io posted:terrible programmer q: is there any advantage to making my local variables small int sizes/uints if i know they won't have any representation problems? i'm asking about rust specifically but i guess the question applies to any lang that has i8/u8/i16/u16. mostly that it's tism soothing to not """""waste""""" all those bits but no not unless they're in a big array or something
|
# ? Oct 29, 2017 15:10 |
|
NihilCredo posted:isn't the former PATCH and the second PUT? yep, I just forgot about the existence of patch
|
# ? Oct 29, 2017 15:17 |
|
prisoner of waffles posted:More like the "very good programmers thread," amirite? don't worry I just POST
|
# ? Oct 29, 2017 15:25 |
|
Powerful Two-Hander posted:don't worry I just POST
|
# ? Oct 29, 2017 15:26 |
|
just use get and post
|
# ? Oct 29, 2017 15:49 |
|
get for everything unless you're a tryhard nerd
|
# ? Oct 29, 2017 16:08 |
|
that breaks misconfigured poo poo and you can pack more data in a post
|
# ? Oct 29, 2017 16:09 |
|
super super terrible programmer q: i have an array of 6 elements, (the neighbours of a tile) which contain a bool, and i'm writing a function that returns if any 3 consecutive neighbours are true. it also has to wrap around so the first element is next to the last one so [t, f, t, f, t, t] is true and [f,t,f,t,t,f] is false and [f,t,f,t,t,t] is true the only way i can think of is to loop from 0 to 5 (and then to 0 again) and increment a counter if true and reset the counter if false. then return (counter >= 3). e: poo poo but that doesn't work in the case of [t,t,t,f,f,f,f]. maybe early return if it's 3 or longer at any step? gonadic io fucked around with this message at 16:24 on Oct 29, 2017 |
# ? Oct 29, 2017 16:20 |
|
just count to 9 or whatever, then mod 6 for the index
|
# ? Oct 29, 2017 16:24 |
|
god this is awful:code:
|
# ? Oct 29, 2017 16:39 |
|
gonadic io posted:god this is awful:
|
# ? Oct 29, 2017 16:45 |
gonadic io posted:super super terrible programmer q: super terrible answer attempt: copy first 2 elements of array to the end, then while i <= length and true_counter < 3 do the increments on last match, starting with 1 and 2nd list element
|
|
# ? Oct 29, 2017 17:09 |
oh also copy last two elements to the start
|
|
# ? Oct 29, 2017 17:09 |
|
Fiedler posted:Agreed. Allman was right.
|
# ? Oct 29, 2017 17:26 |
|
CRIP EATIN BREAD posted:just count to 9 or whatever, then mod 6 for the index ya do this op code:
carry on then fucked around with this message at 17:35 on Oct 29, 2017 |
# ? Oct 29, 2017 17:31 |
|
Is there some reason that this shouldn't be generalized to sequences of an arbitrary length? Why is three special?
|
# ? Oct 29, 2017 17:36 |
|
Fiedler posted:Is there some reason that this shouldn't be generalized to sequences of an arbitrary length? Why is three special? it's a lovely little game i'm writing so there's no need to generalise unless it'd improve the code.
|
# ? Oct 29, 2017 17:47 |
|
I don't know about Rust, but I'd probably do this in Haskell. Maybe it can help you?code:
code:
|
# ? Oct 29, 2017 17:50 |
|
haskell has the built in group which groups by equality and i've never seen any use for until nowcode:
|
# ? Oct 29, 2017 17:57 |
|
redleader posted:ok so serverless computing/functions-as-a-service: when and why would I actually want to use these? why are these cool + good and why/when would using these services be a better alternative to normal computering? lots of things you put in a message queue also go fine in a serverless dealio which is good because message queues are founts of despair, especially doing ops for them
|
# ? Oct 29, 2017 20:17 |
|
tef posted:just use get and post code:
|
# ? Oct 29, 2017 20:28 |
|
akadajet posted:
I didn't realise that we worked together
|
# ? Oct 29, 2017 20:34 |
|
gonadic io posted:I didn't realise that we worked together
|
# ? Oct 29, 2017 20:46 |
|
I wish my coworkers designed apis that good
|
# ? Oct 29, 2017 20:59 |
|
Hello I'm a biostatistician and I don't know any "real" languages, just SAS and R. Am I confined to the #datascience thread or can I post in YOSPOS tyia
|
# ? Oct 29, 2017 21:03 |
|
lovely programmer solution with pattern matching: match([true, true, true, _, _, _]) -> true; match([_, true, true, true, _, _]) -> true; match([_, _, true, true, true, _]) -> true; match([_, _, _, true, true, true]) -> true; match([true, _, _, _, true, true]) -> true; match([true, true, _, _, _, true]) -> true.
|
# ? Oct 29, 2017 21:06 |
|
MononcQc posted:lovely programmer solution with pattern matching:
|
# ? Oct 29, 2017 21:08 |
|
code:
|
# ? Oct 29, 2017 21:14 |
|
code:
|
# ? Oct 29, 2017 21:20 |
|
instead of using an array of bools use an integer variable and bit masking to set/clear individual bits. then you can just test for a match to the six valuescode:
|
# ? Oct 29, 2017 21:32 |
|
Sweevo posted:instead of using an array of bools use an integer variable and bit masking to set/clear individual bits. then you can just test for a match to the six values
|
# ? Oct 29, 2017 21:55 |
|
Sweevo posted:instead of using an array of bools use an integer variable and bit masking to set/clear individual bits. then you can just test for a match to the six values code:
|
# ? Oct 29, 2017 22:03 |
|
code:
code:
gonadic io fucked around with this message at 22:14 on Oct 29, 2017 |
# ? Oct 29, 2017 22:09 |
|
|
# ? Jun 8, 2024 17:57 |
|
akadajet posted:
i don't see anything wrong with this
|
# ? Oct 29, 2017 22:10 |