New around here? Register your SA Forums Account here!

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
redleader
Aug 18, 2005

Engage according to operational parameters
low level langs are great for all the pearl-clutching about "ownership" they bring out. just let your gc take care of memory, and let finalizers take care of any other resources. ez and objectively, inarguably correct

Adbot
ADBOT LOVES YOU

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

redleader posted:

low level langs are great for all the pearl-clutching about "ownership" they bring out. just let your gc take care of memory, and let finalizers take care of any other resources. ez and objectively, inarguably correct

big big big disclaimer: don't forget to make your objs immutable, otherwise the ez correctness goes out of the window

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

https://medium.com/@PaulDJohnston/serverless-best-practices-b3c97d551535

i see 3 possibilities

a) this blag is awful
b) ~~~serverless~~~ is awful
c) both (a) and (b)

honestly can't figure out which tho

gonadic io
Feb 16, 2011

>>=

NihilCredo posted:

https://medium.com/@PaulDJohnston/serverless-best-practices-b3c97d551535

i see 3 possibilities

a) this blag is awful
b) ~~~serverless~~~ is awful
c) both (a) and (b)

honestly can't figure out which tho

That blog is pretty bad imo

gonadic io
Feb 16, 2011

>>=
To expand (imo) :
- Each function should do only one thing - correct

- Functions don’t call other functions - correct

- Use as few libraries in your functions as possible (preferably zero) - lmao what
He talks about container cold start time but in the non-p-lang world importing a function from a library does not increase initialisation time. Maybe just a confused js dev here used to having comments slow down loops

- Avoid using connection based services e.g. RDBMS - debatable
I mean I kind of see where he's coming from in that it does limit scability to have your functions block on a single sql dB but also unless you're real real big they're nice to have for stuff that does need acid and you can't afford eventual consistency

- One function per route (if using HTTP) - sure whatever
It feels like this contradicts point one but sure code separation is nice

- Learn to use messages and queues (async FTW) - I mean yeah this is literally the entire point

- Data flows, not data lakes - see above

- Just coding for scale is a mistake, you have to consider how it scales -??? Like I understand each word but this sentence is just meaningless and the paragraph afterwards doesn't help either


Conclusion: reads like a "I just understood monads let me write a blog post comparing them to burritos" blog post. Points are either trivial (try to avoid depending on a single server connection when doing serverless!) or wrong.

Xarn
Jun 26, 2015

redleader posted:

low level langs are great for all the pearl-clutching about "ownership" they bring out. just let your gc take care of memory, and let finalizers take care of any other resources. ez and objectively, inarguably correct

I found them, the one person dumb enough to use finalizers that always fucks up everything.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
low level programming is good because you get to spend more time on irrelevant and fun bullshit and less time working on features. right?

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme
all programming is bad

but yeah low level is less bad b/c you get less done

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i've been thinking a lot about how helpful the forums have been to me over my career and how sad it will be when i have to get my programming tips and discussion from hackernews and reddit. i think this place is swell.

so, i finally got my poo poo together and created a real terrible programmers offsite.

check it out:

https://gophersland.com/

Corla Plankun
May 8, 2007

improve the lives of everyone

DONT THREAD ON ME posted:

i've been thinking a lot about how helpful the forums have been to me over my career and how sad it will be when i have to get my programming tips and discussion from hackernews and reddit. i think this place is swell.

so, i finally got my poo poo together and created a real terrible programmers offsite.

check it out:

https://gophersland.com/

lmao

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

DONT THREAD ON ME posted:

i've been thinking a lot about how helpful the forums have been to me over my career and how sad it will be when i have to get my programming tips and discussion from hackernews and reddit. i think this place is swell.

so, i finally got my poo poo together and created a real terrible programmers offsite.

check it out:

https://gophersland.com/

:mrwhite:

comedyblissoption
Mar 15, 2006

A guhh? A bwuhh? A lubba wubba WHAAAA???

Ask me about TND

NihilCredo posted:

big big big disclaimer: don't forget to make your objs immutable, otherwise the ez correctness goes out of the window
oh yah that's another cool thing about rust's borrowing rules

rust shows that immutable vs mutable data structures for correctness vs performance is a false dichotomy

you can do both

just have mutable data structures and make them immutable/mutable in a scope

you don't need a separate StringBuilder class

tinaun
Jun 9, 2011

                  tell me...
i mean rust's str vs String is basically String vs StringBuilder in java :v:

comedyblissoption
Mar 15, 2006

A guhh? A bwuhh? A lubba wubba WHAAAA???

Ask me about TND
not really

str is a string slice and has no equivalent in java's std lib afaik

edit: i know you're joking but people can get easily confused about it and i don't want them to lol

Progressive JPEG
Feb 19, 2003

Jabor posted:

if the caller is going to be taking ownership, return a unique_ptr. if not then return a raw pointer or a reference.

if you don't know who's supposed to have ownership, and one might be cleaned up before the other one is finished with the large object you've returned, then

doesn't unique_ptr disallow copying, which the return would technically qualify as?

its been a while but i remember something like that being the case

Xarn
Jun 26, 2015
unique_ptr disallows copying, because it is, well, unique.

It doesn't disallow moving, because that means ownership transfer -> you can return it from a function just fine.

brand engager
Mar 23, 2011

I missed emulator chat, but heres my unfinished chip8 thing https://github.com/shameful/chip8plusplus
Got tired of it after several of the places I was using for documentation had conflicting info on some instructions, and each implementation would have broken programs expecting the other one.

akadajet
Sep 14, 2003

i always wondered how much it would cost to have something crawl this site and provide a search engine that actually worked and included archives. something built on elastic or a similar service. i remember a long time ago there was a 3rd party search that was decent.

akadajet
Sep 14, 2003

dassaas, that's what the old search engine was.

gonadic io
Feb 16, 2011

>>=
you can probably train neural nets on each poster. shaggar was the proof of concept

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

akadajet posted:

i always wondered how much it would cost to have something crawl this site and provide a search engine that actually worked and included archives. something built on elastic or a similar service. i remember a long time ago there was a 3rd party search that was decent.


If you don't care about archives, googling with "site:forumsomethingawful.com" is quite needs-suiting

Progressive JPEG
Feb 19, 2003

Xarn posted:

unique_ptr disallows copying, because it is, well, unique.

It doesn't disallow moving, because that means ownership transfer -> you can return it from a function just fine.

aha yeah thats what I'm missing

for whatever reason the code I worked on didn't have move semantics available yet

Luigi Thirty
Apr 30, 2006

Emergency confection port.

cool so my Glide lighting and texturing were broken because:

- I didn’t normalize normal vectors after transforming them
- I was placing (U / (1/W)) where (U/W) should go

now I have lambert shading and textured perspective-projected polygons

it only took me 3 days to figure that bug out

gonadic io
Feb 16, 2011

>>=
ctps: been getting carried away with metaprogramming in rust: https://github.com/djmcgill/atsamd21-rs/blob/master/hal/src/gpio.rs#L527

turns
code:
define_pins!(
    /// Maps the pins to their arduino names and the numbers printed on the board.
    /// Information from: <[url]https://github.com/arduino/ArduinoCore-samd/blob/master/variants/mkrzero/variant.cpp[/url]>
    #[derive(Debug)]
    struct Pins,
    target_device: atsamd21g18a,

    /// Digital 0: PWM, TC
    pin d0 = a22,

    /// LED built into the board
    pin led_builtin = b8,
);
into
code:
#[doc = r" Maps the pins to their arduino names and the numbers printed on the board."]
#[doc = r" Information from: <[url]https://github.com/arduino/ArduinoCore-samd/blob/master/variants/mkrzero/variant.cpp[/url]>"]
#[derive(Debug)]
pub struct Pins {
    #[doc = r" Opaque port reference"]
    pub port: Port,
    #[doc = r" Digital 0: PWM, TC"]
    pub d0: gpio::Pa22<Input<Floating>>,
    #[doc = r" LED built into the board"]
    pub led_builtin: gpio::Pb8<Input<Floating>>,
}
impl Pins {
    #[doc = r" Returns the pins for the device"]
    pub fn new(port: atsamd21g18a::PORT) -> Self {
        let pins = port.split();
        Pins{
             port: pins.port,
             d0: pins.pa22,
             led_builtin: pins.pb8,
        }
    }
}

gonadic io
Feb 16, 2011

>>=
im the spaces at the start of the doc comments

Workaday Wizard
Oct 23, 2009

by Pragmatica
someone made a macro diagram generator for rust and it’s fing awesome


https://lukaslueg.github.io/macro_railroad_wasm_demo/

tef
May 30, 2004

-> some l-system crap ->
i've got a gsm phone that runs micropython, heh

tef
May 30, 2004

-> some l-system crap ->
am i an embedded dev now

Skyl3lazer
Aug 27, 2007

[Dooting Stealthily]



gonadic io posted:


- Functions don’t call other functions - correct


Is this some serverless specific thing? This seems like an awful rule for most coding scenarios.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Skyl3lazer posted:

Is this some serverless specific thing? This seems like an awful rule for most coding scenarios.

yeah i think so

Bloody
Mar 3, 2013

what is serverless and why does it still require servers

Shaggar
Apr 26, 2006
its not a thing and also it requires servers. its like "non-blocking io" back when node js was a thing

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum
isn't "serverless" just when you get the client machine to do everything e.g. javascript

mystes
May 31, 2006

anthonypants posted:

isn't "serverless" just when you get the client machine to do everything e.g. javascript
No, serverless is CGI. Sorry, I mean Amazon Lambda.

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Bloody posted:

what is serverless and why does it still require servers

I don't think it's a real technical innovation; you upload your code and then the price model is more like pay-per-invocation (of e.g. API endpoints) than pay-per-(servers x time + bandwidth)

animist
Aug 28, 2018
"serverless" means "spin up a docker container in someone else's kubernetes deployment, run one (1) javascript function, and then terminate the container, every time I hit this REST endpoint"

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

quote:

With AWS Lambda, you pay only for what you use. You are charged based on the number of requests for your functions and the duration, the time it takes for your code to execute.

Lambda pricing details
Lambda counts a request each time it starts executing in response to an event notification or invoke call, including test invokes from the console. You are charged for the total number of requests across all your functions.

Duration is calculated from the time your code begins executing until it returns or otherwise terminates, rounded up to the nearest 100ms. The price depends on the amount of memory you allocate to your function.

The Lambda free tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month.

Free Tier
1M REQUESTS
per month
400,000 GB-SECONDS
of compute time per month.

The Lambda free tier does not automatically expire at the end of your 12 month AWS Free Tier term, but is available to both existing and new AWS customers indefinitely.


Requests
1M REQUESTS FREE
First 1M requests per month are free.
$0.20 PER 1M REQUESTS THEREAFTER
$0.0000002 per request.


Duration
400,000 GB-SECONDS PER MONTH FREE
First 400,000 GB-seconds per month, up to 3.2M seconds of compute time, are free.
$0.00001667 FOR EVERY GB-SECOND USED THEREAFTER
The price depends on the amount of memory you allocate to your function.

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.
So serverless really seems like a cloud cost model leading to a different programming model, which makes sense and is kinda neat.

not something to get excited about unless you really care about the cost of a cloud deployment

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
I care very much about the costs of my butt deployment

Adbot
ADBOT LOVES YOU

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
its useful when you have something that will get called very infrequently, or is some sort of special endpoint that you dont want integrated into your applications.

especially if it just does stuff like call AWS API endpoints

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