Comment On Internationalexemelization

There are some developers out there who believe that XML is the greatest "innovation" in computer science since electricity. Believing that, apparently, all data and communication are best represented as strings with angle-brackets, they'll go to great strides to ensure that this "technology" is applied liberally throughout systems they build. Undeterred by the inherent constraints of a data interchange format and its related transforms, they'll make sure that XML is not only the driving force behind their projects, but their raison d'être. [expand full text]
« PrevPage 1 | Page 2Next »

Re: Internationalexemelization

2005-11-28 14:47 • by AKrotkov
Bonus points for style?



:-D

Re: Internationalexemelization

2005-11-28 14:49 • by haveworld
Nice arrows you got there...

Re: Internationalexemelization

2005-11-28 14:53 • by lucha
wtf!



...but, if you scroll it down fast enough, it's kinda nice-looking.
Maybe he is a better ascii-art-composer then a programmer.....

Re: Internationalexemelization

2005-11-28 14:55 • by ComputerGuyCJ
Definitely worthy of "WTF"! I hope for the developer's sake he made a
custom tool to edit this crap out so he doesn't have to do it by hand!

Re: Internationalexemelization

2005-11-28 15:00 • by Robin H-P
51940 in reply to 51939
Yes, this is exactly why I think that for anything besides browser display, XSLT is the devil.

Re: Internationalexemelization

2005-11-28 15:01 • by whojoedaddy
When I see ucirc I alwasy think û so this makes perfect sense.

Re: Internationalexemelization

2005-11-28 15:03 • by marvin_rabbit
This is lovely! 



It actually reminds me of an old Apple ][ game where you had to use the
left and right arrows to maneuver a cursor between scrolling text
“walls”.  (Kinda simulating falling down a hole.)



Come to think of it, I believe it was the result of a “single line
program” contest.  The whole program was entered in on a single
Apple Basic line.  One line was limited to either 128 or 256
characters, don’t remember which.



It was pretty impressive for its compactness.  I would not have
wanted to try to maintain THAT either, but at least it did something
reasonable.



Re: Internationalexemelization

2005-11-28 15:03 • by A Wizard A True Star
51944 in reply to 51940

You know, I'm not a total newbie to XSL, but for the life of me I can't imagine why anyone would want to do this. I strongly suspect six days of work could be boiled down to this:


<xsl:value-of disable-output-escaping="yes" select="$input"/>


But without knowing the original requirements, that's just a shot in the dark.


 

Re: Internationalexemelization

2005-11-28 15:05 • by Jackal von ÖRF
The real WTF is that he did not include replacements for all unicode characters.



That code would not parse ????? (wa-te-fa-ku) correctly to &#12527;&#12486;&#12501;&#12449;&#12463;.

Re: Internationalexemelization

2005-11-28 15:06 • by Alex Papadomulis
51946 in reply to 51943
You should check the international C objuscation contest, they make better things in less lines and more unmaintanable.

Re: Internationalexemelization

2005-11-28 15:06 • by Melanie
51947 in reply to 51938
It is making me seasick. [+o(]

Re: Internationalexemelization

2005-11-28 15:19 • by mrsticks1982

six days, ha that guy was way underpaid


 


I bet i could have made it last at least two weeks, taken a day off and came back with a longer list. Oh an I would have used C#.NET to make a program that would do it all for me, allowing me to surf the web and buy "it" from ebay.

Re: Internationalexemelization

2005-11-28 15:19 • by Xepol

There is always someone out there who takes a good idea/good tool and then abuses it to the point of stupidity while thinking they are being clever.


Annoying, but hardly a wtf.  Stupidity neither confuses, nor surprises me when I see it (even outa myself on the occasion).

Re: Internationalexemelization

2005-11-28 15:26 • by Salta Mada
Indeed. Some... no, most uses of XML are truly repulsive. XML-RPC and SOAP, for example. (Worse than Tubgirl.) And XSL in general is high on the list. I can only hope, for the good of the Web, that XSL-FO (a new part of the XSL suite -- like CSS, except in XML) is not widely adopted. Seriously, what the hell is W3C thinking these days?

My theory is that people think that any technology with an acronym starting with an 'X' is cool by default. Since the letter X is completely useless anyway, I propose we eliminate it from the alphabet. That'll put the various data-ekschange formats on an equal playing field.

Re: Internationalexemelization

2005-11-28 15:28 • by Joost_
51951 in reply to 51944
A Wizard A True Star:

You know, I'm not a total newbie
to XSL, but for the life of me I can't imagine why anyone would want to
do this. I strongly suspect six days of work could be boiled down to
this:


<xsl:value-of disable-output-escaping="yes" select="$input"/>


But without knowing the original requirements, that's just a shot in the dark.





Cute, but that would leave him with invalid HTML, because the wëïrd
characters would get copied into the output without being transformed
to w&euml;&iuml;rd. The fun thing is that XSL doesn't provide
for this so everybody has to create their own solution; like having
&amp;euml; in the input and then doing the
'disable-output-escaping="yes"' thingy.


P.S. XML > S-expr


Re: Internationalexemelization

2005-11-28 15:29 • by MikeB

IsTrue(Idiot!) = True

Re: Internationalexemelization

2005-11-28 15:32 • by Csaboka
This thing...
Hurts my eyes...

Re: Internationalexemelization

2005-11-28 15:44 • by BlackTigerX
51956 in reply to 51954

why?


it looks good [:P] (if you scroll fast enough)

Re: Internationalexemelization

2005-11-28 15:52 • by Henryk Pl&#246;tz
Moin,



Somebody should have told him about the concept of character encodings.
There is absolutely _no_ reason to escape anything other than & and
< (and maybe > and ") in HTML. Simply select the right character
encoding and everything will be fine. (This especially goes to Joost_:
Of course "wëïrd" would not be invalid in HTML, so long as you declare what encoding you're using.)



--

Henryk Plötz

Grüße aus Berlin

Re: Internationalexemelization

2005-11-28 15:52 • by Eric the .5b
SIX STRAIGHT DAYS to cut and paste all that?  Eesh.

Re: Internationalexemelization

2005-11-28 15:56 • by Henryk Pl&#246;tz
51964 in reply to 51959
The dog ate my homework^W^W^W^W'forum' software ate my characters: What I said was of course:

There is absolutely _no_reason to escape anything other than & and < (and maybe >
and ") in HTML.

Re: Internationalexemelization

2005-11-28 16:00 • by Albatross
At least it's nicely tabbed...

Re: Internationalexemelization

2005-11-28 16:04 • by Brendan Kidwell

If you zoom out really far, you can see a dot and two right angle brackets.


Re: Internationalexemelization

2005-11-28 16:06 • by toxik
51967 in reply to 51951
I'm not intending to be a whipzor (don't ask, I mean pointdexter) but
the output would be UTF-8, so Unicode would be OK, see there's a
difference between escaping for ambigiouty and escaping for
readability/transport stuffies.





Re: Internationalexemelization

2005-11-28 16:08 • by nene
51968 in reply to 51964
He should be assigned to extend this code to cover the whole unicode range :) That would be a real opportunity to show all those great XSL skills :D

Re: Internationalexemelization

2005-11-28 16:17 • by ammoQ
So much stupid work, and it doesn't even contain the right translations for German umlauts.

äöü ÄÖÜ ß

auml ouml uuml Auml Ouml Uuml szlig

Re: Internationalexemelization

2005-11-28 16:18 • by PeonPower
He just copied the idea from the great pyramids of Div!

Re: Internationalexemelization

2005-11-28 16:23 • by Random Scotsman
51972 in reply to 51971
Did anyone else thing they were playing spyhunter when they scrolled down?

Re: Internationalexemelization

2005-11-28 16:24 • by Random Scotsman
51973 in reply to 51972
Anonymous:
Did anyone else thinK they were playing spyhunter when they scrolled down?

Re: Internationalexemelization

2005-11-28 16:42 • by ItsAllGeekToMe
51977 in reply to 51973

Reminds me of those old spams I used to get that said to hold the scroll down button, then a shit-ton of lines flew up, and "animated" characters cris crossed.....


 

Re: Internationalexemelization

2005-11-28 16:53 • by Boofus McGoofus
Anyone know why "&nbsp;" needs to be changed to " "?  Wasn't it
valid html to start with?  (Yeah, I read through it.  I'll go
be embarrassed now.)

Re: Internationalexemelization

2005-11-28 16:57 • by fregas

oh my god you stupid ass wipe.


I'll say this--the code is very pretty to watch when you scroll up and down.

Re: Internationalexemelization

2005-11-28 16:58 • by Gene Wirchenko
Alex Papadimoulis:
Joe works with one such a
developer, and presents us i18n.xsl, the end result of his colleague's
six straight days of work trying to get his fully-XSL solution to
properly display HTML characters.


And on the seventh day, he rested.  Unfortunately, he did not quit programming.


Sincerely,


Gene Wirchenko






Re: Internationalexemelization

2005-11-28 17:00 • by Gene Wirchenko
51985 in reply to 51972
Anonymous:
Did anyone else thing they were playing spyhunter when they scrolled down?




Cue the crash music.



Sincerely,



Gene Wirchenko



Re: Internationalexemelization

2005-11-28 17:04 • by Russ Gray
51986 in reply to 51966




My god, XSL code shaped like giant angle-brackets? You know you're in
the presence of a true artist when form and function are combined so
flawlessly.



Have you read Code Reading: An Open Source Perspective, by the way? Not many people out there that 'zoom out' of code...

Re: Internationalexemelization

2005-11-28 17:08 • by Otto

Could this not be solved by simply specifying the encoding in the XML document?

<?xml version="1.0" encoding="ISO-8859-1"?>

Simple as that, right? Just seems like he did lots and lots of work for absolutely no reason. I am a bit fond of XML myself, but this is just ludicrous.


 

Re: Internationalexemelization

2005-11-28 17:09 • by Spudley
*Sigh*

XML is designed to allow entities to be defined in the DTD. There's no need for a single line of that code.

But in general... why bother anyway? Numeric entities are much more convenient. What's the point in defining a bunch of entities when you only end up using most of them once or twice anyway.


But never mind.... I think it's fun that he's made the the thing look like a couple of angle-brackets.... sort of like fractal code -- it looks the same from a long way away as it does close up ;)

Re: Internationalexemelization

2005-11-28 17:14 • by Jackal von ÖRF
51989 in reply to 51982
Anonymous:
Anyone know why "&nbsp;" needs to be changed to " "?  Wasn't it
valid html to start with?


Replacing &nbsp; with the U+0020 character (space) would be
incorrect - the right character would be U+00A0 (no-break space). In
the code that Alex posted the U+0020 character is used, but that could
be a copy-paste error, so now we'll never know whether the original
code had a bug or not.



(This WTF'ed forum ate my first post. Can't you just fix/change it?)

Re: Internationalexemelization

2005-11-28 17:16 • by GneralTsao
51990 in reply to 51966
Powers of Ten, anyone? I bet at 10^26 this becomes the entire XMLiverse

http://en.wikipedia.org/wiki/Powers_of_Ten

Re: Internationalexemelization

2005-11-28 17:22 • by NoName
Please, please, would someone drag out this "programmer" and break his fingers. All of them. Or better yet, just shot him. He just needs killing.

Re: Internationalexemelization

2005-11-28 17:58 • by Appletosh
51992 in reply to 51943
I remember that game!  I would play it when I got tired of Lemonade Stand!

Re: Internationalexemelization

2005-11-28 17:58 • by LP
Ever heard this?



XML is like violence: if it doesn't work, use more.

Re: Internationalexemelization

2005-11-28 17:59 • by retnuh
Is nobody taught anymore that this crap takes real time to process!?
And unless I'm completly out of my mind, you want your web servers to
be able to handle more that 4 users, right?

------



Don't kill him, but make friday beat the idiot day.



DD

Re: Internationalexemelization

2005-11-28 18:00 • by Appletosh
51995 in reply to 51943

marvin_rabbit:
This is lovely! 

It actually reminds me of an old Apple ][ game where you had to use the left and right arrows to maneuver a cursor between scrolling text “walls”.  (Kinda simulating falling down a hole.)

Come to think of it, I believe it was the result of a “single line program” contest.  The whole program was entered in on a single Apple Basic line.  One line was limited to either 128 or 256 characters, don’t remember which.

It was pretty impressive for its compactness.  I would not have wanted to try to maintain THAT either, but at least it did something reasonable.


 


Forum software is hard!

Re: Internationalexemelization

2005-11-28 18:14 • by Dave Markle
"Night Driver" implemented completely in XML!  Brilliant!


Re: Internationalexemelization

2005-11-28 18:48 • by Joost_
51997 in reply to 51959
Sorry Mr. Pl&ouml;tz, I was under the impression that IE was just being too forgiving when putting weird characters in HTML documents.

Re: Internationalexemelization

2005-11-28 22:12 • by b1xml2
XSLT is a difficult
dialect to fully master. Leaving aside for the moment the core issue of
replacing textual content inside an XSLT document (which requires
recursion), the following is an example of a cleaner implementation:




POC.xml


<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>

<?xml-stylesheet href="poc.xsl" type="text/xsl"?>

<content>

Hello this is the letter <b>ê</b>   

</content>



POC.xsl


<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>

<xsl:stylesheet version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    xmlns:msxsl="urn:schemas-microsoft-com:xslt"

    exclude-result-prefixes="msxsl">



<xsl:output encoding="iso-8859-1" method="html"/>

<xsl:variable name="items">

<item text="ê" html="&amp;egrave;" />

<item text="à" html="&amp;agrave;" />

<item text="á" html="&amp;acute;" />

<!-- add more items to be replaced -->

</xsl:variable>



<xsl:variable name="count" select="count(msxsl:node-set($items)/item)" />



<xsl:template match="@* | *">

<
xsl:copy><xsl:apply-templates select="@* | node() "/></xsl:copy>

</
xsl:template>



<
xsl:template match="text()">

<
xsl:call-template name="replace">

<
xsl:with-param name="content" select="string(.)" />

</
xsl:call-template>

</
xsl:template>




<xsl:template name="replace">

<xsl:param name="content" />

<xsl:param name="counter" select="number(1)"/>

<xsl:variable name="node" select="msxsl:node-set($items)/item[$counter]" />

<xsl:choose>

<xsl:when test="contains($content,$node/@text)">

<xsl:call-template name="replace">

    <xsl:with-param name="content"

   
   
select="concat(substring-before($content,$node/@text),$node/@html,substring-after($content,$node/@text))"
/>


    <xsl:with-param name="counter" select="$counter" />

</xsl:call-template>

</xsl:when>

<xsl:when test="$counter &lt; $count">

<xsl:call-template name="replace">

    <xsl:with-param name="content" select="$content" />

    <xsl:with-param name="counter" select="$counter + 1" />

</xsl:call-template>

</xsl:when>

<xsl:otherwise><xsl:value-of select="$content" disable-output-escaping="yes"/></xsl:otherwise>

</xsl:choose>

</xsl:template>



</xsl:stylesheet>


Re: Internationalexemelization

2005-11-28 22:20 • by b1xml2
If it took six days to craft the XSLT, then either the developer does
not understand XSLT, or the document design is suspect or even worse,
there is a misapplication of XSLT to solve a certain problem domain.



In this WTF, it obviously is the last.



For one, textual recursions inside XSLT incur a heavy performance
penalty. If this was for a Microsoft platform and static HTML files are
generated, I'd use a custom class with an XmlReader to do the textial
replacements instead of resorting to XSLT which is a dirty way to get
it done (and incidentally is not quick when the size of the document
goes beyond a certain magic number)



XSLT is very handy to handle UI issues and apply presentation logic,
especially in AJAX applications. But it should not be used throughout
an application domain just because it seems cheap and easy to use.

Re: Internationalexemelization

2005-11-29 01:08 • by BlueEagle
What, you've never seen this kind of code before??

Am I the only one working with such morons on a regular basis? o.O

Re: Internationalexemelization

2005-11-29 01:08 • by Fubar
Anyone who's ever used XSLT to transform XML to get decent HTML layouts knows that XSLT is a WTF all on its own. 



For anything other than simple outputs it's one of the shittiest ways
to manipulate XML.  For anything requiring comlpex layouts you're
much better off using a standard C++ or Java DOM parser.  



« PrevPage 1 | Page 2Next »

Add Comment