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
Zombywuf
Mar 29, 2008

Janin posted:

Entities in general are just silly. I can't think of any reason to use them that isn't better handled by a different concept.
It's an ok way to escape control and out-of-charset characters.

quote:

I think that's natural; XML is a markup language, and non-trivial validation requires a Turing-complete language.
I'm guessing you are unaware of RNG compact and the fact that XSLT is Turing complete.

quote:

No, no, no. XSLT is not OK for anything. It's easily one of the worst ideas to come out of the "enterprise ecosystem".
Why is it bad when used as a templating language? I know it is abused horribly, see above.

Adbot
ADBOT LOVES YOU

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

It's an ok way to escape control and out-of-charset characters.
Character references are better than entities, since they don't require a validating parser.

Zombywuf posted:

I'm guessing you are unaware of RNG compact and the fact that XSLT is Turing complete.
I am aware of both. Re-read my post; non-trivial validation (eg, more than "this attribute is a number") requires a a Turing-complete language. I'm pretty sure you can't encode requirements like "if parent attribute 'framing' is 'STAGGERED', any child elements must have a 'check' element containing '16' or '32' " in RELAXNG.

Zombywuf posted:

Why is it bad when used as a templating language? I know it is abused horribly, see above.
You were in gfdev too, right? Go look at the killboard some time.

Zombywuf
Mar 29, 2008

Janin posted:

I am aware of both. Re-read my post; non-trivial validation (eg, more than "this attribute is a number") requires a a Turing-complete language. I'm pretty sure you can't encode requirements like "if parent attribute 'framing' is 'STAGGERED', any child elements must have a 'check' element containing '16' or '32' " in RELAXNG.

Well, it sounds like someone forgot to design the schema and just slapped a bunch of elements together. But yes, RelaxNG cannot be used to validate schemas that have been incompletely specified. I think you're confusing validation with functional testing.

quote:

You were in gfdev too, right? Go look at the killboard some time.

I have no idea what you are talking about.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

I have no idea what you are talking about.
I thought you were in the developer group for SA's eve online alliance. If not, count yourself lucky; their internal websites are entirely XSLT-based for "performance reasons".

NotShadowStar
Sep 20, 2000

Janin posted:

I thought you were in the developer group for SA's eve online alliance. If not, count yourself lucky; their internal websites are entirely XSLT-based for "performance reasons".

Yep

http://killboard.goonfleet.com

It serves an XML file and points to an XSLT that transforms it into an HTML file. I have no idea what the hell.

Zombywuf
Mar 29, 2008

Aaaaaand using XSLT as a templating language is bad why?

EDIT: They'd get better perf out of their solution if they set Expires headers and used renaming if they needed to flush the cache, but the client side template approach keeps the page size down.

Zombywuf fucked around with this message at 23:02 on Apr 4, 2011

Lonely Wolf
Jan 20, 2003

Will hawk false idols for heaps and heaps of dough.
I use troff macros for my all data interchange and templating.

tef
May 30, 2004

-> some l-system crap ->
xslt gives me flashbacks

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

Aaaaaand using XSLT as a templating language is bad why?
Because it's slower, more complex, and less maintainable than every other alternative, including plain string concatenation.

Zombywuf posted:

EDIT: They'd get better perf out of their solution if they set Expires headers and used renaming if they needed to flush the cache, but the client side template approach keeps the page size down.
They'd get better perf if they moved expensive processing off PHP, but instead Solo worries about simlinks in htdocs/ because serving linked scripts requires an extra stat()

Zombywuf
Mar 29, 2008

Janin posted:

They'd get better perf if they moved expensive processing off PHP, but instead Solo worries about simlinks in htdocs/ because serving linked scripts requires an extra stat()

Heh, I doubt either of those would shave 1.8 seconds off the 2.7 it took the page to load for me. Expires headers would.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

Heh, I doubt either of those would shave 1.8 seconds off the 2.7 it took the page to load for me. Expires headers would.
Despite the space theme, Goonswarm members are not actually browsing from the moon. Two seconds of latency to serve four 304 responses means there is something very wrong with your internet connection.

Zombywuf
Mar 29, 2008

If you're going to say things like that could you at least check the number of 304's that are served and the dependencies between them.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

If you're going to say things like that could you at least check the number of 304's that are served and the dependencies between them.
Firebug is reporting four 304 responses:

code:
GET /                          200  30.04 KB
GET /templates/frontPage.xsl   304  16.8  KB
GET /templates/menu.xsl        304   1.8  KB
GET /templates/km.xsl          304  12.7  KB
GET /templates/screen.css      304   9.7  KB

Zombywuf
Mar 29, 2008

Janin posted:

Firebug is reporting four 304 responses:

code:
GET /                          200  30.04 KB
GET /templates/frontPage.xsl   304  16.8  KB
GET /templates/menu.xsl        304   1.8  KB
GET /templates/km.xsl          304  12.7  KB
GET /templates/screen.css      304   9.7  KB

I think you might have left a filter on there:

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

That's great. Nearly 1:1 between Waiting and actual Receiving.

tef
May 30, 2004

-> some l-system crap ->

BonzoESC posted:

The best part was the simple XSLT used to rename a variable, and Tim Bray crying from laughter in the audience.

watching this now, the whole 'bad ideas -> software in search of a problem -> creates more problems -> more bad ideas -> in some terrible spiral' rings true especially.

it's the sort of sunk cost thing where instead of fixing the original problem, they spend all the times fixing problems with the solution.

Opinion Haver
Apr 9, 2007

code:
$node = "(?<node>\([A-Z]+[[:blank:]]+([^()]+|((?&node)[[:blank:]]*)+)[[:blank:]]*\)[[:blank:]]*)"
I love PCREs so much.

zeekner
Jul 14, 2007

yaoi prophet posted:

code:
$node = "(?<node>\([A-Z]+[[:blank:]]+([^()]+|((?&node)[[:blank:]]*)+)[[:blank:]]*\)[[:blank:]]*)"
I love PCREs so much.

I thought I knew a fair bit about perl regex, but I can't read this drat thing.

What's it supposed to parse?

Edit: What are those named capture buffers even doing? Read it wrong.

zeekner fucked around with this message at 23:33 on Apr 7, 2011

Opinion Haver
Apr 9, 2007

Geekner posted:

I thought I knew a fair bit about perl regex, but I can't read this drat thing.

What's it supposed to parse?

poo poo that looks like "(PP (IN in) (NP (JJ full) (NN swing)))". The (?<node>) syntax means 'this pattern is called 'node'' and (?&node) means 'the pattern 'node'. So basically you can recurse back into the pattern from itself.

zeekner
Jul 14, 2007

yaoi prophet posted:

poo poo that looks like "(PP (IN in) (NP (JJ full) (NN swing)))". The (?<node>) syntax means 'this pattern is called 'node'' and (?&node) means 'the pattern 'node'. So basically you can recurse back into the pattern from itself.

Amazing. No, wait, the other thing: Tedious.

Are there any practical limitations on how far that kind of regex can recurse?

zeekner fucked around with this message at 23:38 on Apr 7, 2011

Opinion Haver
Apr 9, 2007

Geekner posted:

Amazing. No, wait, the other thing: Tedious.

Are there any practical limitations on how far that kind of regex can recurse?

No drat clue, but it works fine enough for our purposes since we're probably only ever going to recurse maybe 6-7 deep.

NotShadowStar
Sep 20, 2000

yaoi prophet posted:



I love PCREs so much.

Every time I see this poo poo I feel it's my duty to lock the author up with nothing but Ragel and gcc until they come out with a beard and a new enlightenment.

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

yaoi prophet posted:

code:
$node = "(?<node>\([A-Z]+[[:blank:]]+([^()]+|((?&node)[[:blank:]]*)+)[[:blank:]]*\)[[:blank:]]*)"
I love PCREs so much.

Interesting mixture of POSIX and Perl syntax, I honestly forgot PCRE/Perl supported that

welcome to hell
Jun 9, 2006
PCRE != Perl regex

Most of the basic stuff is the same, but that regex wouldn't work in Perl.

(Perl's syntax isn't any prettier)

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

Haarg posted:

PCRE != Perl regex

Most of the basic stuff is the same, but that regex wouldn't work in Perl.

(Perl's syntax isn't any prettier)

:what:

According to perlre, the posix character classes and some gnu extensions (like [[:blank:]]) are supported, and of course named captures have been around since 5.10, I don't see what would blow up

Also if Perl-Compatible Regular Expressions were anything but a subset of the regexes that Perl supports, something is horribly wrong

Blotto Skorzany fucked around with this message at 06:16 on Apr 8, 2011

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

Otto Skorzeny posted:

Also if Perl-Compatible Regular Expressions were anything but a subset of the regexes that Perl supports, something is horribly wrong
Apparently PCREs are a subset of Perl regexes, but Perl only supports a subset of PCRE settings.
why would you do that

pseudorandom name
May 6, 2007

Because you started out making a Perl compatible RE library, and then kept enhancing it to meet your users needs?

qntm
Jun 17, 2009

yaoi prophet posted:

code:
$node = "(?<node>\([A-Z]+[[:blank:]]+([^()]+|((?&node)[[:blank:]]*)+)[[:blank:]]*\)[[:blank:]]*)"
I love PCREs so much.

PCREs support whitespace and comments so I think this would work:

code:
$node = "
 (?x                      # ignore whitespace, allow comments
  (?<node>                # named subpattern, "node"
   \(                     # literal left parenthesis
   [A-Z]+                 # node name
   [[:blank:]]+           # gap
   ( [^()]+ | (?&node)+ ) # stuff, or another nested node (recursion)
   [[:blank:]]*
   \)                     # literal right parenthesis
   [[:blank:]]*
  )                       # end named subpattern
 )
"

Opinion Haver
Apr 9, 2007

Haarg posted:

PCRE != Perl regex

Most of the basic stuff is the same, but that regex wouldn't work in Perl.

(Perl's syntax isn't any prettier)

Considering I tested it in Perl I'd have to disagree.

e:
code:
$ cat node.pl
$re = qr{(?<node>\([A-Z]+[[:space:]]+([^()]+|((?&node)[[:space:]]*)+)[[:space:]]*\)[[:space:]]*)};
$sample = <<END;
(ROOT
  (S
    (VP (VB Get)
      (VP (VBN owned)
        (NP (NNP Haarg))))))
END
print ":smug:" if $sample =~ /^$re$/ms;
$ perl node.pl
:smug:

Opinion Haver fucked around with this message at 13:42 on Apr 8, 2011

welcome to hell
Jun 9, 2006
Yeah, I was wrong about that in this case. Was forgetting the named capture syntax.

PCRE supported named captures before Perl did, but using a different syntax. they have since adjusted it to be compatible with Perl.

NotShadowStar
Sep 20, 2000

Haarg posted:

Yeah, I was wrong about that in this case. Was forgetting the named capture syntax.

PCRE supported named captures before Perl did, but using a different syntax. they have since adjusted it to be compatible with Perl.

Well that's not very Perl Compatible Regular Expression then!

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
code:
loop0:  for (;;) {
      switch(state){  
      case c0_top:
        dindex =  (((((int) ((0x21) * ((((((((int)((in[ip+1+2+1] & 0xff) << (6)) ^ (in[ip+1+1+1] & 0xff) << (5)) ^ (in[ip+1+0] & 0xff) << (5)) ^ (in[ip+0] & 0xff))))) >> 5) & (((1 << (14)) - 1) >> (0))) << (0)))));
it is vitally important that this be one line!!!!

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Aleksei Vasiliev posted:


it is vitally important that this be one line!!!!

I got a good laugh out of that.

Needlessly constructing one liners at the sake of readability is AWESOME.

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
in[ip+1+1+1]

What the gently caress is this poo poo.

Volte
Oct 4, 2004

woosh woosh
That looks like generated code to me.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

Volte posted:

That looks like generated code to me.
https://code.google.com/p/java-compress/source/browse/src/org/jvcompress/lzo/MiniLZO.java#137

It's not generated code, it's a partial port of MiniLZO from C.

pseudorandom name
May 6, 2007

I bet the C implementation had a macro there, and the Java version is a copy & paste of the preprocessor output.

Nippashish
Nov 2, 2005

Let me see you dance!

code:
if (in[m_pos+3] != in[ip++] || in[m_pos+4] != in[ip++] || in[m_pos+5] != in[ip++] ||
    in[m_pos+6] != in[ip++] || in[m_pos+7] != in[ip++] || in[m_pos+8] != in[ip++] ) {
     --ip;
    ...

Volte
Oct 4, 2004

woosh woosh

That doesn't mean it isn't generated, I write code generating scripts all the time.

Adbot
ADBOT LOVES YOU

pseudorandom name
May 6, 2007

The original C source line is DINDEX1(dindex,ip), in case you were wondering.

#define DINDEX1 D_INDEX1
#define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5)

etc.

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