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
Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Compared to something like JSON, protobuf is an absolute delight. Where it runs into problems is mostly that it doesn't go far enough in what it does. If you like strong typing, you'll be frustrated by the shortcomings of its type system. If you're using it because you need something faster than json, you'll inevitably start looking jealously at capn proto's even better performance.

Adbot
ADBOT LOVES YOU

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Using it a few years ago, protobuf's Python library was 10x slower than json.loads, and types used about 4x as much memory. This is probably just the official Python protobuf library being absolute poo poo, but it didn't inspire confidence in the rest of the stack

Volguus
Mar 3, 2009
Good or bad, Protobuf is here to stay and Google do their best to push it absolutely everywhere. One example of this is tensorflow, setting a session's configuration parameters. If you're working with tensorflow from Python (as most scientists do) , it looks reasonable enough, nothing to worry about :
code:
config = tf.ConfigProto()
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.5)
config = tf.ConfigProto(gpu_options=gpu_options)
sess = tf.Session(config=config)
If the name didn't give it away, ConfigProto is a Protobuf object, and that's what the Session expects. Wanna do the same thing in C? First you have to serialize that ConfigProto object to a byte array in Python:
code:
>>> import tensorflow as tf
>>> gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.5)
>>> config = tf.ConfigProto(gpu_options=gpu_options)
>>> serialized = config.SerializeToString()
>>> list(map(hex, serialized))
['0x32', '0x9', '0x9', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0xe0', '0x3f']
Then, with this data, you go to C:

code:
TF_SessionOptions* options = TF_NewSessionOptions();
uint8_t config[11] = {0x32, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f};
TF_SetConfig(options, (void*)config, 11, status);
Now, to be fair, in c_api_experimental.h they do provide a way to create a config object with some, pre-chosen parameters. If you want more either do this song and dance or go to the tensorflow core library where they have all the C++ protobuf objects generated for you.

xtal
Jan 9, 2011

by Fluffdaddy
I used ProtoBuf for a video game once, it was great.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


i can't complain about protobufs when i also have to deal with graphql

xtal
Jan 9, 2011

by Fluffdaddy
GraphQL is the gravest example of HTTP abuse

Carbon dioxide
Oct 9, 2012

I have no experience with protobuf but I have used avro and from what I heard they are similar in use?

Volguus
Mar 3, 2009

Carbon dioxide posted:

I have no experience with protobuf but I have used avro and from what I heard they are similar in use?

Not quite. From their website:

quote:

Comparison with other systems

Avro provides functionality similar to systems such as Thrift, Protocol Buffers, etc. Avro differs from these systems in the following fundamental aspects.

Dynamic typing: Avro does not require that code be generated. Data is always accompanied by a schema that permits full processing of that data without code generation, static datatypes, etc. This facilitates construction of generic data-processing systems and languages.
Untagged data: Since the schema is present when data is read, considerably less type information need be encoded with data, resulting in smaller serialization size.
No manually-assigned field IDs: When a schema changes, both the old and new schema are always present when processing data, so differences may be resolved symbolically, using field names.

moostaffa
Apr 2, 2008

People always ask me about Toad, It's fantastic. Let me tell you about Toad. I do very well with Toad. I love Toad. No one loves Toad more than me, BELIEVE ME. Toad loves me. I have the best Toad.
https://twitter.com/jtech63/status/1234600045787394048

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
That looks like a CORS issue, nothing to do with leap year.

Volte
Oct 4, 2004

woosh woosh
I think the site was just down.

NtotheTC
Dec 31, 2007


Isn't RobinHood that wallstreetbets app that is essentially gambling-but-we-pretend-to-know-what-were-doing?

In before "that's just normal gambling"

Also in before "that's just normal trading"

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I assume the tweet is about requesting March 3's data on March 2.

(No idea if that's in error in this particular context.)

OddObserver
Apr 3, 2009
I would be surprised if failure at CORS preflight time was that sensitive to the request URL.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

OddObserver posted:

I would be surprised if failure at CORS preflight time was that sensitive to the request URL.

It’s not, somebody misconfigured a server sometime this morning causing CORS errors, and for some reason twitter is blaming it on leap year.

Steve French
Sep 8, 2003

Jen heir rick posted:

It’s not, somebody misconfigured a server sometime this morning causing CORS errors, and for some reason twitter is blaming it on leap year.

You see that the responses are 503s, yeah? The CORS poo poo is a red herring because the 503 responses because their poo poo was down didn't happen to include the right headers.

https://status.robinhood.com/

https://techcrunch.com/2020/03/03/robinhood-will-offer-case-by-case-compensation-for-its-outage-on-the-day-markets-gained-1-1-trillion/

You're right that it's not because of time zones, but it ain't CORS either

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
Ok, good to know I’m half right. It just really bugged me that everyone on twitter was saying it’s cause of leap year.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

Jen heir rick posted:

Ok, good to know I’m half right. It just really bugged me that everyone on twitter was saying it’s cause of leap year.

Is everyone ignorantly misdiagnosing it as a leap year bug with no knowledge of the systems involved really that different to doing the same but with CORS? Programmers were a mistake.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
I think it is a little different to see a CORS error message and assume it’s a CORS error vs assuming it’s a leap year bug. But fair enough. I am the horror this time.

Dylan16807
May 12, 2010

NtotheTC posted:

Isn't RobinHood that wallstreetbets app that is essentially gambling-but-we-pretend-to-know-what-were-doing?

In before "that's just normal gambling"

Also in before "that's just normal trading"
So wallstreetbets definitely fits that description, and they seem to like Robinhood, but I'm pretty sure Robinhood itself is just a generic broker for normal trading. With the gimmick of not having fees.

Though Robinhood did have that wonderful coding horror recently where you could get infinite leverage.

Doom Mathematic
Sep 2, 2008

Soricidus posted:

What was that language that did arithmetic operator precedence based on whitespace rather than order-of-operations

It's an experimental feature of Nim.

code:
#! strongSpaces
if foo+4 * 4 == 8  and  b&c | 9  ++
    bar:
  echo ""
# is parsed as
if ((foo+4)*4 == 8) and (((b&c) | 9) ++ bar): echo ""
As an experiment, I love it, even though it is plainly doomed. Maybe because of that.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Doom Mathematic posted:

It's an experimental feature of Nim.

code:
#! strongSpaces
if foo+4 * 4 == 8  and  b&c | 9  ++
    bar:
  echo ""
# is parsed as
if ((foo+4)*4 == 8) and (((b&c) | 9) ++ bar): echo ""
As an experiment, I love it, even though it is plainly doomed. Maybe because of that.

What an incredible nightmare that would become.

rarbatrol
Apr 17, 2011

Hurt//maim//kill.
True, it doesn't even support tabs.

Absurd Alhazred
Mar 27, 2010

by Athanatos
Here's Jon Blow again with a problem that has never been properly solved in inferior programming languages: overhead-free lambdas. :rolleyes:

https://twitter.com/Jonathan_Blow/status/1235029372614012928

https://twitter.com/Jonathan_Blow/status/1235030416253284352

beuges
Jul 4, 2005
fluffy bunny butterfly broomstick
So he’s discovered either macros or inline functions and given them a new name?

Kilson
Jan 16, 2003

I EAT LITTLE CHILDREN FOR BREAKFAST !!11!!1!!!!111!
Well if he's calling them hygienic macros...

Wikipedia posted:

Hygienic macros are macros whose expansion is guaranteed not to cause the accidental capture of identifiers. They are a feature of programming languages such as Scheme,[1] Dylan[2], Rust, and Julia.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

even in coding horrors maybe just not even pay attention to jblow

omeg
Sep 3, 2012

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Is the horror that whoever drew that emoji thinks movie popcorn is sold in solid red boxes? Did they confuse it with the mcd fry?

Beef
Jul 26, 2004
To be fair, it is quite common practice among first year programmers, before they get shamed or beaten out of the habit.

omeg
Sep 3, 2012

Suspicious Dish posted:

Is the horror that whoever drew that emoji thinks movie popcorn is sold in solid red boxes? Did they confuse it with the mcd fry?

It's certainly a part, I needed to copy-paste google that emoji to see what it's supposed to be.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Suspicious Dish posted:

Is the horror that whoever drew that emoji thinks movie popcorn is sold in solid red boxes? Did they confuse it with the mcd fry?

What the gently caress is this post

I don't know or care what the popcorn containers look like at cinemas near me. Why do you have an opinion on something so inane? How does it even occur to you to pay attention to this?

Ola
Jul 19, 2004

Suspicious Dish posted:

Is the horror that whoever drew that emoji thinks movie popcorn is sold in solid red boxes? Did they confuse it with the mcd fry?

While fries doesn't capture the classic "watching piece of entertainment" as Cinema popcorn did, I think fries could work in a modern Netflix context.

Athas
Aug 6, 2007

fuck that joker

Hammerite posted:

What the gently caress is this post

I don't know or care what the popcorn containers look like at cinemas near me. Why do you have an opinion on something so inane? How does it even occur to you to pay attention to this?

Programmers are literally notorious for debating their precise preference of which invisible character is best.

Also, you don't need macros for that Joe Blow thing to work with zero overhead. I research language implementation and maintain a compiler, where we implement higher-order functions with defunctionalisation (a 70s technique) to get the same effect (and in contrast to most macro systems, it does not affect type checking).

Athas fucked around with this message at 11:54 on Mar 5, 2020

redleader
Aug 18, 2005

Engage according to operational parameters

Athas posted:

Programmers are literally notorious for debating their precise preference of which invisible character is best.

a wise poster once said:

Subjunctive posted:

there is no technical statement so anodyne and self-evident that it can’t be weaponized for lukewarm dunking on other forum participants

Beef
Jul 26, 2004
Coming from Scheme/Lisp, using a macro where a function will do is anathema.

What he shows also looks closer to the grand old compiler-optimization-defying fexpr, not the venerable macro that was designed to replace fexpr.

Or we're giving him too much credit and it's just preprocessor text substitution garbage

Volte
Oct 4, 2004

woosh woosh

Absurd Alhazred posted:

Here's Jon Blow again with a problem that has never been properly solved in inferior programming languages: overhead-free lambdas. :rolleyes:



I always thought he was hugely arrogant but this is the first truly moronic thing I've seen him say (note: I do not read the majority of things Jon Blow says)

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
My favourite thing about how bool x = (cond ? true : false); is more readable than bool x = cond; is that you can make it even more readable by writing it as bool x = ((cond ? true : false) ? true : false);

And you can make it even more readable again, by writing bool x = (((cond ? true : false) ? true : false) ? true : false);

There's probably a way to make it even more readable than that, but I'm still working on it

lobsterminator
Oct 16, 2012




Hammerite posted:

My favourite thing about how bool x = (cond ? true : false); is more readable than bool x = cond; is that you can make it even more readable by writing it as bool x = ((cond ? true : false) ? true : false);

And you can make it even more readable again, by writing bool x = (((cond ? true : false) ? true : false) ? true : false);

There's probably a way to make it even more readable than that, but I'm still working on it

Additional benefit is that it adds three layers of reliability and security, useful if you make financial solutions.

Adbot
ADBOT LOVES YOU

iospace
Jan 19, 2038


Jon blow reminds me of a friend, who works at Google, who is a huge Haskell fan. Like "EVERYONE SHOULD KNOW HASKELL" huge.

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