• Kiss me, I'm Polish (unregistered) in reply to b1xml2
    b1xml2:
    XHTML is a subset of SGML.
    HTML is a subset of SGML, not SGML in itself.

    Apart from that, there's no formal relationship between HTML and XHTML.
    XHTML certainly is NOT a subset of HTML. Tell me in which formal documentation, which page and paragraph is it explicitly stated that XHTML is a subset of HTML.

    You should really have a good look at the real picture.

    felix:
    Thank you. I was starting to feel alone with all these people around telling me I'm wrong.
    The fact is nobody told us how would it be possible that perfectly valid XHTML doesn't validate as HTML, being its subset at the same time. Actually nobody proved me wrong (apart this xml:lang attribute, my bad). :D
  • (cs) in reply to b1xml2
    b1xml2:
    XHTML is a subset of SGML.
    HTML is a subset of SGML, not SGML in itself.

    Apart from that, there's no formal relationship between HTML and XHTML.
    XHTML certainly is NOT a subset of HTML. Tell me in which formal documentation, which page and paragraph is it explicitly stated that XHTML is a subset of HTML.

    You should really have a good look at the real picture.

    Ok, first, XHTML is not a subset of SGML it's an XML application (or an XML dialect), and HTML is an SGML dialect.

    XML is designed to be a subset of SGML, in that every XML document should also be a conforming SGML document as stated by the eXtended Markul Language 1.0 version 3 Recommandation, appendix C (that's a first formal even though indirect relation between HTML and XHTML here btw), and XHTML 1.0 [...] is a reformulation of the three HTML 4 document types as applications of XML 1.0 as stated by the XHTML 1.0 Recommandation, second edition. Considering that there is no new element in XHTML 1.0 compared to HTML 4, one can, with a bit of logic, understand that reformulating HTML (an SGML dialect) in XML (a subset of SGML) will yield a subset of HTML.

  • maht (unregistered) in reply to s0be
    s0be:
    Well, should be <OPTION value=US> should be <option value="US">, but at least he has the </OPTION>


    If it was XHTML then that would be true but plainly it isn't.

    In that case *YOU* should go read the HTML spec

    http://www.w3.org/TR/REC-html40/

    3.2.1 Elements

    Element names are always case-insensitive.

    Some HTML element types allow authors to omit end tags  (OPTION is one of these)

    In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend using quotation marks even when it is possible to eliminate them.



  • Tobias (unregistered) in reply to DiamondDave
        God forbid somebody passes a null string into this method....<br>
    

    It will throw a null pointer exception which is appropriate. Better than returning some random country.

  • (cs) in reply to Keless
    Keless:
    If you were writing in a proper language like C/C++ you could allocate the given size ahead of time and only have to take the time hit for moving the characters over (and not for re-allocating memory)


    That's exactly what you do with new StringBuffer(int) in Java. Also a good example of a premature optimization that will almost certainly have no noticeable effect.
  • (cs) in reply to Sean
    Sean:
    R.Flowers:

    Is this an example of the "loop unrolling" I've been hearing about?

    I'm looking forward to the whole mess of "it looks OK to me, obviously this code is machine generated, so that's not a WTF" posts ....

    Agreed. Is it added to the list yet?

    • The goggles...
    • The real WTF here is...
    • Damn *%!@^ forum software!
    • This code tastes like burning...
    • Brillant!
    • He should have used isTrue in there somewhere...
    • etc.


    If there's one thing the readers of this site are good at, it's beating the hell out of a joke.  Next goal: kiss an actual girl.


    I think that soon we are going to need to add, "it was done to solve a concurrency issue"
    It is amazing to me how much people complain about the forum software though.
    Just register, never use preview, proofread your post before you click the button and everything will be fine.
  • (cs) in reply to ferrengi
    ferrengi:
    Just register, never use preview, proofread your post before you click the button and everything will be fine.

    Nope, doing that works most of the time, but when you're toying with the HTML view to actually make something readable, the forum software will fuck it up one day.

  • Koen (unregistered)

    Thank god he used a stringbuffer...

  • (cs) in reply to JC
    Anonymous:
    Anonymous:
    > Well, should be , but at least he has the

    actually, no, he hasn't.. he has XXX YYY ......


    God, I HATE how wrong people can get writing something as html!!!

    Every day in my work I get to work with html that has no doctype ("Oh, doctypes aren't required, so no need to use it... just takes up bandwidth!"), has multiple sections ("I changed the title but it won't update, WHY!?"), and "hey, html needs no closing tags duz it?". :(

    As such, I would not be suprised at all these days to see:

    <select name="dumbName"><option>US </option><option>UK </option><option>ZA       **SNIP**</option></select>

    Anyway, the real wtf here is that he used html for the drop down list rather than a flash object or java applet.


    Dude the real WTF is that he never used a server side scripting language. Although I can appreciate why youd want to use an applet or some flash: Obviousley thats where your skills lie, and good on you ....
  • (cs) in reply to osp70
    osp70:

    StringBuffer countryString = new StringBuffer(5000);

    I love this, but would kill to see the country that will max out this buffer.

     



    Hahahaha, the country that will max this buffer........ Dude, he sort of uses the StringBuffer for all the countries and the html combined, I recon that could hit 5000 characters, but thats just a guess.
  • spob (unregistered) in reply to Sean

    readers! i'd like you to change that to posters please. Now look what you've made me do, i'm now a poster too.

  • spob (unregistered) in reply to Sean
    Sean:

    If there's one thing the readers of this site are good at, it's beating the hell out of a joke.  Next goal: kiss an actual girl.

    sorry forgot quote!
  • Otherside (unregistered)

    At first I thought my country (Belgium) wasn't in the list, apperently it's only available if it's selected, otherwise it's turned into belarus

    if(countryCode.equals("BE"))
    countryString.append("<OPTION value=BE selected>Belgium");
    else
    countryString.append("<OPTION value=BO >Belarus");

  • (cs) in reply to Otherside
    Anonymous:
    At first I thought my country (Belgium) wasn't in the list, apperently it's only available if it's selected, otherwise it's turned into belarus
    if(countryCode.equals("BE"))
        countryString.append("Belgium");
      else
        countryString.append("Belarus");


    It's a Catch-22 of countries.

    You want to select Belarus.

    Yet, upon selecting, Belarus is wrenched from grasp and turned into Belgium, which cannot be selected because it is onyl available when selected.

    Accomplished: nothing.

    THIS CODE IS FANTASTIC.
  • (cs) in reply to osp70
    osp70:

    StringBuffer countryString = new StringBuffer(5000);

    I love this, but would kill to see the country that will max out this buffer.

     

     

    She is not using countryString to store a country's name, but the whole <SELECT> sentence

     

    Sincerely,

    not Gene Wirchenko

  • (cs) in reply to R.Flowers

    The bigger WTF (if I am reading the code correctly) is that the pulldown will have ONLY ONE OPTION.

    Based on the series of IF statements, only that single country code will be available as an option (obviously in an HTML SELECT).

    So WTF is the point of the pulldown?

  • (cs) in reply to ParkinT
    ParkinT:
    The bigger WTF (if I am reading the code correctly) is that the pulldown will have ONLY ONE OPTION.


    You're reading  the code incorrectly then :)


  • (cs) in reply to ParkinT
    ParkinT:

    The bigger WTF (if I am reading the code correctly)

     

    Yea, you're not.  The If/Elses are independent.  One statement from each If/Else will be executed.  This is not a giant if/else-if/else-if structure (which would behave like a switch statement and would append only one thing to the stringbuffer).  It took me a few minutes of looking at the code to figure that out when I first saw it myself since I'm so used to seeing curly braces around the body of an if or else even if it is only one line. 

  • (cs) in reply to mrsticks1982
    mrsticks1982:
    mrsticks1982:

    whitey:
    curious, how would you solve this?

    SELECT all country codes from DB
    LOOP through them and say
        PRINT "

    can't see an efficient way to avoid the if statement num(countries_in_db) times.

    **EDITED**

    Why is there someone who has to try an solve these WTF's. Come on, all WTF's have a better solution. Just have a good laugh and enjoy the opportunity to take a few minutes to sigh and know that you are smarter than them.

    *sigh* - Thanks to the programmer who made me feel better about myself today!!

     

    sweet I love when I have typo's!!!!



    you also said "try an solve"...
  • (cs) in reply to masklinn
    masklinn:
    XML is designed to be a subset of SGML, in that every XML document should also be a conforming SGML document as stated by the eXtended Markul Language 1.0 version 3 Recommandation, appendix C (that's a first formal even though indirect relation between HTML and XHTML here btw), and XHTML 1.0 [...] is a reformulation of the three HTML 4 document types as applications of XML 1.0 as stated by the XHTML 1.0 Recommandation, second edition. Considering that there is no new element in XHTML 1.0 compared to HTML 4, one can, with a bit of logic, understand that reformulating HTML (an SGML dialect) in XML (a subset of SGML) will yield a subset of HTML.


    Your logic is invalid.

    Disregarding whether or not it is true for this specific case that XHTML is a subset of HTML (I haven't bothered verifying who's right), you have not demonstrated it with the above.

    Let's look at your statements, and assume they are facts:

    1. XML is a subset of SGML
    2. XHTML is an XML application
    3. XHTML's tags is a subset of HTML 4's tags
    4. HTML is an SGML dialect

    From that you are trying to assert that if 1,2,3,4, then the following statement is true:
    "XHTML is a subset of HTML"

    The problem with that, is that given the set A, if you take two subsets B and C, you do not know if B is a subset of C, C is a subset of B or if they even intersect.

    In this case, (3) above means we know there is some overlap between XHTML and HTML, and the syntax is obviously similar. But none of your statements support the claim you made, because none of them exclude the possibility of XML making use of a subset of SGML that is not supported by HTML (that is the sets we get from taking the XML subset of SGML features and the HTML subset of SGML features could very well only partially intersect)

    To logically arrive at your conclusion, you need to also either assert tfor instance that XML does not support any SGML features not supported by HTML, that HTML supports all of SGML, or that XHTML specifically disallows the use of any such XML features. (I'm giving examples, not asserting any of them)

    Yes, I am being pedantic, but you did try to answer a request for explicit documentation of the claim that XHTML is a subset of HTML, and you haven't provided it.

    V

  • (cs) in reply to vhokstad

    vhokstad:
    masklinn:
    XML is designed to be a subset of SGML, in that every XML document should also be a conforming SGML document as stated by the eXtended Markul Language 1.0 version 3 Recommandation, appendix C (that's a first formal even though indirect relation between HTML and XHTML here btw), and XHTML 1.0 [...] is a reformulation of the three HTML 4 document types as applications of XML 1.0 as stated by the XHTML 1.0 Recommandation, second edition. Considering that there is no new element in XHTML 1.0 compared to HTML 4, one can, with a bit of logic, understand that reformulating HTML (an SGML dialect) in XML (a subset of SGML) will yield a subset of HTML.


    Your logic is invalid.

    Disregarding whether or not it is true for this specific case that XHTML is a subset of HTML (I haven't bothered verifying who's right), you have not demonstrated it with the above.

    Let's look at your statements, and assume they are facts:

    1. XML is a subset of SGML
    2. XHTML is an XML application
    3. XHTML's tags is a subset of HTML 4's tags
    4. HTML is an SGML dialect

    From that you are trying to assert that if 1,2,3,4, then the following statement is true:
    "XHTML is a subset of HTML"

    The problem with that, is that given the set A, if you take two subsets B and C, you do not know if B is a subset of C, C is a subset of B or if they even intersect.

    In this case, (3) above means we know there is some overlap between XHTML and HTML, and the syntax is obviously similar. But none of your statements support the claim you made, because none of them exclude the possibility of XML making use of a subset of SGML that is not supported by HTML (that is the sets we get from taking the XML subset of SGML features and the HTML subset of SGML features could very well only partially intersect)

    To logically arrive at your conclusion, you need to also either assert tfor instance that XML does not support any SGML features not supported by HTML, that HTML supports all of SGML, or that XHTML specifically disallows the use of any such XML features. (I'm giving examples, not asserting any of them)

    Yes, I am being pedantic, but you did try to answer a request for explicit documentation of the claim that XHTML is a subset of HTML, and you haven't provided it.

    V

     

    ...I like pie.

  • (cs) in reply to Kiss me, I'm Polish

    Anonymous:
    b1xml2:
    XHTML is a subset of SGML.
    HTML is a subset of SGML, not SGML in itself.

    Apart from that, there's no formal relationship between HTML and XHTML.
    XHTML certainly is NOT a subset of HTML. Tell me in which formal documentation, which page and paragraph is it explicitly stated that XHTML is a subset of HTML.

    You should really have a good look at the real picture.

    felix:
    Thank you. I was starting to feel alone with all these people around telling me I'm wrong.
    The fact is nobody told us how would it be possible that perfectly valid XHTML doesn't validate as HTML, being its subset at the same time. Actually nobody proved me wrong (apart this xml:lang attribute, my bad). :D

    http://www.w3.org/TR/REC-html40/struct/global.html#edef-META

    Notice in HTML the end tag is forbidden (there are a few  of HTML tags with a forbidden end tag). In XML and therefore XHTML, all end tags are required. Therefore, XHTML is not a subset of HTML (unless you are going to stop using meta tags and the like).

    Or should I say, invert_bool(XHTML is HTML).

  • (cs) in reply to masklinn
    masklinn:
    ferrengi:
    Just register, never use preview, proofread your post before you click the button and everything will be fine.

    Nope, doing that works most of the time, but when you're toying with the HTML view to actually make something readable, the forum software will fuck it up one day.



    Haven't tried using HTML so I really don't know.

    I'll take your word for it and just not use HTML.

    I can use the bold, italic and other stuff from the toolbar and that has worked for me before.

  • Moobar (unregistered) in reply to John Bigboote
    John Bigboote:
    osp70:

    StringBuffer countryString = new StringBuffer(5000);

    I love this, but would kill to see the country that will max out this buffer.

     



    Nullpointeristan?


    StringBuffer is a dynamic storage class.  WTF are people complaining about other people's code when they themselves don't know what they are talking about.
  • Moobar (unregistered) in reply to maratcolumn1
    maratcolumn1:
    (comments about forum software omitted)
    whitey:
    .....
    can't see an efficient way to avoid the if statement num(countries_in_db) times.


    Well, you'd better learn some.

    1. Proper way: You can add all countries before selected one, then selected one, then all countries after selected one. Since your list is sorted, you can use binary search, or 26*26 elements lookup table.

    2. My way:

    int p = preparedCountryList.indexOf("");

    if (p == -1) /* unthinkable mayhem */;

    return preparedCountryList.insert(" selected", p + 7) /* don't remember if Java have insert function or how it's called */;



    I don't see how your method is any better that the previous poster's proposal.  Your way still requires the an 'if' check for every country to see if it's the selected one.   In fact, your method would be slower since it first requires sorting the unselected countries before you insert them into the list.  There's no reason to sort out the unselected ones if you are always going to be inserting them in the same order, you just waste time.

  • (cs) in reply to Moobar
    Anonymous:
    maratcolumn1:
    (comments about forum software omitted)
    whitey:
    .....
    can't see an efficient way to avoid the if statement num(countries_in_db) times.


    Well, you'd better learn some.

    1. Proper way: You can add all countries before selected one, then selected one, then all countries after selected one. Since your list is sorted, you can use binary search, or 26*26 elements lookup table.

    2. My way:

    int p = preparedCountryList.indexOf("");

    if (p == -1) /* unthinkable mayhem */;

    return preparedCountryList.insert(" selected", p + 7) /* don't remember if Java have insert function or how it's called */;



    I don't see how your method is any better that the previous poster's proposal.  Your way still requires the an 'if' check for every country to see if it's the selected one.   In fact, your method would be slower since it first requires sorting the unselected countries before you insert them into the list.  There's no reason to sort out the unselected ones if you are always going to be inserting them in the same order, you just waste time.

    What is really funny on this site is posters sometimes are not too far from wtf code authors. And how often do you think I'll have to perform sort? I'm too lazy to post code for item 1, but believe me there would be no if's there at all. There can even be no loops there.

  • (cs) in reply to R.Flowers
    R.Flowers:

    Is this an example of the "loop unrolling" I've been hearing about?

    I'm looking forward to the whole mess of "it looks OK to me, obviously this code is machine generated, so that's not a WTF" posts ....

    Agreed. Is it added to the list yet?

    • The goggles...
    • The real WTF here is...
    • Damn *%!@^ forum software!
    • This code tastes like burning...
    • Brillant!
    • He should have used isTrue in there somewhere...
    • etc.


    Maybe AP could just boilerplate all the above into an automatic first post. 
  • (cs) in reply to whitey
    SELECT all country codes from DB LOOP through them and say PRINT "<option val="+db_countryCode+(countryCode == db_countryCode ? " selected") + ">"+db_countryName+"</option>

    can't see an efficient way to avoid the if statement num(countries_in_db) times.

    I let the query engine do the work. Here's one way (pardon the MS Access SQL):

    "SELECT country_code, country_name, IIf( (country_code LIKE '" & my_country_code & "'),'','selected') AS selected FROM country_code_table"

    Then you can just output something like this:

    "<option value=\"" + country_code + "\" " + selected + ">" + country_name + "</option>"
  • (cs)
      if(countryCode.equals("AS"))
        countryString.append("<OPTION value=AS selected>Australia");
      else
        countryString.append("<OPTION value=AS >Australia");
      if(countryCode.equals("AU"))
        countryString.append("<OPTION value=AU selected>Austria");
      else
        countryString.append("<OPTION value=AU >Austria");
      
    <FONT face=Arial color=#000000>Another Bug for this amazing system is the incorrect ISO code for Austr<FONT color=#ff0000>al</FONT>ia and Austria </FONT><FONT face=Arial color=#000000>(yes America we are different Countries - on different sides of the world)</FONT>
    <FONT face=Arial>Austr<FONT color=#ff0000>al</FONT>ia's code is "AU", i'm assuming Austria is "AS" :P</FONT>
  • (cs) in reply to bemo56

    It may be the cool thing to bash Americans these days, but it's still gauche to generalize. For example, this American remembered that over eight months ago this point was already mentioned. Also, the description says "the business would switch to ISO-3166 country codes" (emphasis added). Seeing as how this section was pre-switch, they were likely using FIPS, or possibly NATO, which would be correct for these two countries. Reference the page linked in that previous post: http://en.wikipedia.org/wiki/Country_codes:_A#Australia

    So we have several poor assumptions here. 1. that Austria's ISO 3166-1 Alpha-2 code is "AS" (it's "AT"), 2. that this list was ISO 3166-1 Alpha-2 codes anyway, and 3. that Americans wouldn't know the difference between Salzburg and Sydney.

  • |=00|3@|2 (unregistered) in reply to Gene Wirchenko

    That's not the case at all, the infinite loop incident was merely part of the introduction to the wtf, it wasn't the WTF itself.  Pay better attention before posting..

  • Smithg30 (unregistered) in reply to masklinn

    Howdy! Would you mind if I share your blog with my twitter group? Theres lots of people that I believe would really enjoy your content. Please let me know. Thanks fcdgebkkkbdecaec

Leave a comment on “It's a Small World Afterall”

Log In or post as a guest

Replying to comment #:

« Return to Article