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
Abandon
Nov 23, 2006
:synpa:

Adbot
ADBOT LOVES YOU

Bloody
Mar 3, 2013

NOTinuyasha posted:

protobuf: if i add values to an existing enum will it break the protocol or will old versions just set the enum to default if an unknown value is encountered?

i would guess default but i havent encountered this (i designed my protocol correctly the first time :smuggo:)

leterip
Aug 25, 2004

NOTinuyasha posted:

protobuf: if i add values to an existing enum will it break the protocol or will old versions just set the enum to default if an unknown value is encountered?

I would expect it to just keep the numeric value of the enum and it just won't equal any symbolic name accessible in the old versions.

edit: confirmed this is what the Go protobuf stuff does. the enum wire type is just a varint anyway so

leterip fucked around with this message at 21:43 on Sep 13, 2013

THE PLATFORM MASTER
Jun 3, 2008

leterip posted:

I would expect it to just keep the numeric value of the enum and it just won't equal any symbolic name accessible in the old versions.

edit: confirmed this is what the Go protobuf stuff does. the enum wire type is just a varint anyway so

my understanding is that it goes to the default if your language can force things to an enum type, this is why you should always do

enum Butts {
UNKNOWN = 0;
BALLS = 1;
DICKS = 2;
}

so you always know when you have wacky data

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
gently caress the single-space-after-sentence police: http://www.heracliteanriver.com/?p=324

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
(we don't have a font thread no mo' :( )

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

NOTinuyasha posted:

protobuf: if i add values to an existing enum will it break the protocol or will old versions just set the enum to default if an unknown value is encountered?

according to the spec: "You can do this very simply by adding an enum to your message definition - a field with an enum type can only have one of a specified set of constants as its value (if you try to provide a different value, the parser will treat it like an unknown field)."

so it'll treat it like it's not present, therefore default value

Bloody posted:

(i designed my protocol correctly the first time :smuggo:)

congratulations on either designing dead software or underspecifying your protocol

Nomnom Cookie
Aug 30, 2009



Cocoa Crispies posted:

according to the spec: "You can do this very simply by adding an enum to your message definition - a field with an enum type can only have one of a specified set of constants as its value (if you try to provide a different value, the parser will treat it like an unknown field)."

so it'll treat it like it's not present, therefore default value


congratulations on either designing dead software or underspecifying your protocol

lolll do they not have conformance tests or something. might as well just roll your own lovely binary protocol

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Nomnom Cookie posted:

lolll do they not have conformance tests or something. might as well just roll your own lovely binary protocol

it's a construction kit for binary serializers that lets you add fields and not break outdated deserializers that don't know about them

having a default is part of that

Nomnom Cookie
Aug 30, 2009



and go's implementation doesn't handle it properly, therefore loll doesnt it have conformance tests

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Nomnom Cookie posted:

and go's implementation doesn't handle it properly, therefore loll doesnt it have conformance tests

lol so does beefcake in ruby
Ruby code:
ButtEnum.decode "\b\x03" #=> <ButtEnum repl: TRUE(3)>
ButtEnum.decode "\b\x04" #=> <ButtEnum repl: -NA-(4)>
ButtEnum.decode "\b\x09" #=> <ButtEnum repl: -NA-(9)>
and that's with a default of 0 set lol

*files bug*

Bloody
Mar 3, 2013

Cocoa Crispies posted:

congratulations on either designing dead software or underspecifying your protocol

nope it works wonderfully

Max Facetime
Apr 18, 2009

Otto Skorzeny posted:

gently caress the single-space-after-sentence police: http://www.heracliteanriver.com/?p=324

nice!  first typographers get duped by publishers wanting to cut costs.  they turn their backs on centuries of their own history and adopt the techinical limitations of the 60's to stay relevant.  in doing so they got owned by computers once.  now with ubiquitous computing capable of any any imaginable typesetting conventions they would get owned by computers again, if people actually cared that much about typesetting. what a profession

Bloody
Mar 3, 2013

Max Facetime posted:

nice!    first typographers get duped by publishers wanting to cut costs.    they turn their backs on centuries of their own history and adopt the techinical limitations of the 60's to stay relevant.    in doing so they got owned by computers once.    now with ubiquitous computing capable of any any imaginable typesetting conventions they would get owned by computers again, if people actually cared that much about typesetting.    what a profession

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Max Facetime posted:

nice!  first typographers get duped by publishers wanting to cut costs.  they turn their backs on centuries of their own history and adopt the techinical limitations of the 60's to stay relevant.  in doing so they got owned by computers once.  now with ubiquitous computing capable of any any imaginable typesetting conventions they would get owned by computers again, if people actually cared that much about typesetting. what a profession

owned, good ſir

Workaday Wizard
Oct 23, 2009

by Pragmatica
less presses > worthless ~~standards~~

who gives a poo poo about keyboard jockeys

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Shinku ABOOKEN posted:

less presses > worthless ~~standards~~

who gives a poo poo about keyboard jockeys

this.

it's a formatting issue. add some code or a stylesheet or whatever the gently caress if you want ". " to look like ". "

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Otto Skorzeny posted:

gently caress the single-space-after-sentence police: http://www.heracliteanriver.com/?p=324

two spaces after periods is a clear sign of advanced syphilis

Nomnom Cookie
Aug 30, 2009



as is indenting code with tabs

spongeh
Mar 22, 2009

BREADAGRAM OF PROTECTION
two spaces after periods just looks uglier and harder to read.

uG
Apr 23, 2003

by Ralp
it wouldn't be if you had robot eyes

uG
Apr 23, 2003

by Ralp
i imagine it would be slightly easier to parse english if 'end of sentence' token was the ever so slightly less ambiguous period double-space

Workaday Wizard
Oct 23, 2009

by Pragmatica

Nomnom Cookie posted:

as is indenting code with tabs

gently caress you+eat poo poo

tef
May 30, 2004

-> some l-system crap ->

Cocoa Crispies posted:

congratulations on either designing dead software or underspecifying your protocol

i dunno if you were using http you could use content-negociation to allow newer clients to get a new format while still supporting legacy ones

since i was using a website as an api, i just added more forms and links on it and old clients didn't break

Max Facetime
Apr 18, 2009

tef posted:

if you were using http you could use content-negociation

is this an actual thing that exists and not just one apache plugin zipping the server's response if there's an Accept-Encoding: gzip, deflate header?

because when a web application firewall can just plop down some tables and divs between html and head tags I'm having some doubts:

HTML code:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><div id="container"><table width="100%" xclass="notice-table" bgcolor="#f5f8fa" cellpadding="0"
 cellspacing="8" vspace="5"> <tbody> <tr> <td align="center"> <font size="4" face="Arial, Sans"
 color="red"><b> ModSecurity Alert Message:<br>CRS Anomaly Score Exceeded (score 4):
 <br>The application is not available<br>TX ID: UjWaL8Co8AoAADhnTWIAAAAb </b></font>
 </td> </tr> </tbody> </table> </div><head>
<title>503 Service Temporarily Unavailable</title>
</head><body>
<h1>Service Temporarily Unavailable</h1>
<p>The server is temporarily unable to service your
request due to maintenance downtime or capacity
problems. Please try again later.</p>
<hr>
<address>What-Chu-Talkin'-Bout-Willis?/Arnold Drummondv.1.0 Server at [url]www.modsecurity.org[/url] Port 80</address>
</body></html>

Meiwaku
Jan 10, 2011

Fun for the whole family!

uG posted:

i imagine it would be slightly easier to parse english if 'end of sentence' token was the ever so slightly less ambiguous period double-space

You don't know true pain until you have to tokenize CJKV.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

tef posted:

i dunno if you were using http you could use content-negociation to allow newer clients to get a new format while still supporting legacy ones

since i was using a website as an api, i just added more forms and links on it and old clients didn't break

protobuffs is optimized for size and backwards/forwards compat, and requiring users of it to implement negotiation goes against that

tef
May 30, 2004

-> some l-system crap ->

Meiwaku posted:

You don't know true pain until you have to tokenize CJKV.

chinese word segmentation makes a fun campfire horror story

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

tef posted:

chinese word segmentation makes a fun campfire horror story

Ill light the fire, you get the flashlight

Nomnom Cookie
Aug 30, 2009



tef posted:

chinese word segmentation makes a fun campfire horror story

seems like a good time for a consultant

Shaggar
Apr 26, 2006

tef posted:

i dunno if you were using http you could use content-negociation to allow newer clients to get a new format while still supporting legacy ones

since i was using a website as an api, i just added more forms and links on it and old clients didn't break

yes the normal way to change service message formats is to version them instead of replacing them to maintain backwards compatibility.

tef
May 30, 2004

-> some l-system crap ->
the version was in the header all along!

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

tef posted:

the version was in the header all along!

NOTinuyasha
Oct 17, 2006

 
The Great Twist

Cocoa Crispies posted:

according to the spec: "You can do this very simply by adding an enum to your message definition - a field with an enum type can only have one of a specified set of constants as its value (if you try to provide a different value, the parser will treat it like an unknown field)."

so it'll treat it like it's not present, therefore default value

thank you this is a good answer

Nomnom Cookie posted:

and go's implementation doesn't handle it properly, therefore loll doesnt it have conformance tests

Cocoa Crispies posted:

lol so does beefcake in ruby
Ruby code:
ButtEnum.decode "\b\x03" #=> <ButtEnum repl: TRUE(3)>
ButtEnum.decode "\b\x04" #=> <ButtEnum repl: -NA-(4)>
ButtEnum.decode "\b\x09" #=> <ButtEnum repl: -NA-(9)>
and that's with a default of 0 set lol

*files bug*

oh god i have to test it beforehand anyway :(

spongeh
Mar 22, 2009

BREADAGRAM OF PROTECTION
http://aem1k.com/world/

christ

Shaggar
Apr 26, 2006

tef posted:

the version was in the header all along!

yes you and the client can decide on a custom header to use for version information

Shaggar
Apr 26, 2006
altho usually just using a different base url is easier

Shaggar
Apr 26, 2006
or you can even put it in the message itself! no need for any reconfiguration from the client's view

tef
May 30, 2004

-> some l-system crap ->
Accept: application/vnd.shaggar; version=2

Content-Type: application/vnd.shaggar; version=3

or something :3:

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006
well yes I suppose you could abuse an existing field

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