- Feature Articles
- CodeSOD
-
Error'd
- Most Recent Articles
- Monkeys
- Killing Time
- Hypersensitive
- Infallabella
- Doubled Daniel
- It Figures
- Three Little Nyms
- Tangled Up In Blue
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Woohoo, failed... god dammit, i must stop posting links on these forums, i usually manage to get it right for most things but never for links
Admin
Please be joking. You're joking right? Shit, I just don't know. Man I hate JavaBeans.
Admin
You know, you could at least try to make your goals plausible.
Admin
Right! And another server to process and cache CountryCode beans.
Admin
Right..... And another server to process and cache CountryCode beans.
Admin
What you don't understand is that the 'countryString' is not holding one country. It is holding ALL of the countries. The String being passed into this method is only there to have the passed in country selected. Every country in the list gets appended to 'countryString'. The if/else blocks are only there to pick the right one as selected.
This method is getting the country dropdown for a web page, so this method is a small part of an html page being built as a large String with what looks like Java.
I actually think the buffer will get maxed out, but that won't be a problem as it will simply increase it's capacity.
The goggles they do nothing.
My eyes are bleeding.
It hurts, It burnsssss usss.
Wow.
Admin
The problem is not that it is a WTF (who cares?), the problem is that it is full of bugs. Or maybe it was uncorrectly pasted. Or more probably retyped...
Admin
Zounds! Excellent suggestion--I've been itching for a chance to implement a distributed second-level cache for Hibernate. Complexity makes for robustity! JBoss TreeCache, here I come!
Admin
Yikes! THAT is the biggest F in this WTF!!
Admin
IE spits chips if you don't explicilty set a value for each option.
<select><option value="US">US</option></select>
selectedIndex works but forget about .value, which sucks if ya looping all fields.
I'm wearing panties.
Admin
According to the standards, no it is not (well, maybe at the loosest doctype, but even then, you're just being dead brained writing it so sloppy with the attributes unquoted and no closing tags).
(HOW CUTE!!! When I quoted the post, it gave me a select box. This forum software is the most niftiest wtf I have seen. )
[image][image][image][image][image][image]
Admin
I was as surprised as you.
Admin
It's a twofer!
Grammar rule for the new millenium: AN APOSTROPHE DOES NOT MEAN "LOOK OUT! HERE COMES AN S!''
[pi]
Admin
You forgot JavaScript.
Admin
It would probably cause it to get, like, three feet of air.
Admin
At last! An explanation!
Admin
Do you mean the entire population, or just the heads of state?
Not that it makes much of a difference on Bouvet Island. :-D
I would preview, and there's probably O(ln N) typos after the Polish porter I had, but what with the forum software and all...
Admin
Here comes Pippi Longstocking.
XHTML is not valid HTML, if I remember correctly. And in HTML there are some amazing workarounds to make things work alright (closing the li tags for example). So don't try to find THE solution. There's no solution.
I'm surprised though. Nobody (or maybe I'm just too tired today to see it through two pages of comments) pointed out the fact that every second item in the list of countries is SELECTED. That's almost all of them going into the "too much" section.
Admin
Not true. For example, if isTrue(countryCode.equals("AJ")), part of the output would look like this:
As always, the real wtf is the -insert fav wtf here-...
Admin
I wonder why the developer did............... never mind.
I guess it's a good thing that he at least managed not to........... never mind.
sigh
Something's forcing me to comment on this, yet I am speechless.
Admin
I think the same guy who wrote this worked for me at one time :S
He used to brag about his "brute force" approach to program design.
Admin
Admin
(comments about forum software omitted)
Well, you'd better learn some.
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.
My way:
int p = preparedCountryList.indexOf("<option val="+db_countryCode+ ">");
if (p == -1) /* unthinkable mayhem */;
return preparedCountryList.insert(" selected", p + 7) /* don't remember if Java have insert function or how it's called */;
Admin
JavaBeans is a condition arising from the consumption of far too much coffee.
Admin
I actually liked the "robust" solution; but, shouldn't there be Factory and Validator beans in there somewhere?
Of course, in addition to using EJBs, the need to work in some XML so that we can do an XSLT transform is obvious... after all, no matter the result of the transform, our resumes can always use the extra acronyms.
The </OPTION> tags can always be added after the fact by implementing a DHTML solution.
Admin
You use the strategy design pattern.
In Java:
interface CountryCodeable
{
String getCountry(String getCountryCode) throws NullPointerException; // or enumerate the country codes
}
...then back the implementation using a java.util.Map with O(1) lookup, and potentially loading the strategy dynamically - in constrast to hard-coding it with O(n) lookup as it currently stands. I say java.util.Map with a foul taste in the back of my mouth - I much prefer properly designed collection types, which rules out java.util.*
net.tmorris.adt.map.Map http://contractualj.com/api/net/tmorris/adt/map/Map.html
Admin
Is it me, or is this an MVC/Model 2 violation? WTF?
Admin
Way to throw a shout out to every country, I mean I don't think people spend enough time making sure to cover all of the bases. Who cares that the page is going to be heavy. What's a few seconds shaved off some poor chumps life every time this page loads as long as you never get that call about uzbekistan not being in the drop down list.
Admin
I'm sick and tired of reading such claims again and again. From the XML specification:
"XML is designed to be a subset of SGML, in that every XML document should also be a conforming SGML document."
Cf: http://www.w3.org/TR/2004/REC-xml-20040204/#sec-xml-and-sgml, Appendix C (non-normative)
HTML is a SGML application. XHTML is an XML application. Do I need to draw a picture?
Felix
Admin
XHTML is roughly a subset of HTML with much stricter rules (being XML and all) such as being case-sensitive, disallowing attribute minimization (e.g. writing <option selected> instead of <option selected="selected">), forcing the quoting of attributes in every situations, requiring closing tags for every element, forbidding implied elements (e.g. writing only the <body> par of an HTML document is allowed, the browser has to generate the <html> root, <head> and <title> parts on his own, you can't do that in XHTML) ...
This means that an XHTML (1.0 at least) document IS backwards-compatible with an HTML document, and is actually parsed as an HTML document in just about every browser now (sending your XHTML document with a "text/html" MIME type will always get it parsed as HTML no matter what you do, you're supposed to use "application/xhtml+xml" or "application/xml" to have it parsed as actual XHTML, and IE doesn't understand these BTW)
HTML is an SGML dialect, meaning it has much looser constraints, therefore that the actual parsing and generation of the tree is much harder. See Ian Hickson's Crazy Tagsoup Parsing Adventures for some insight on how the current browsers fare at parsing HTML.
Admin
Yeah, this is really my only concern. We can't have deranged programmers running around sniping countries, but if I had to write out all the country names like that, I'd probably want to snipe something too...
Admin
No, it's not. You're assuming that xhtml is a subset of html - but it's not. There's no
tag in html. There is no <?xml ?> mark at the beginning of a document in html. There is no lang attribute for the html element. That's what I'm talking about. XHTML has common points with HTML, but is not its subset.
That's the biggest difference between xhtml 1.0 and 1.1. Sending xhtml 1.1 as text/html means you (the general you, not the personal you) don't understand what it is. People should'nt actually use xhtml 1.1 at all, at least not in public.
He's talking about html 5.0 and parsing a document with as many omitted tags as possible. No user agent renders it correctly? What a surprise.Admin
Scheisse forum Zoftwar!
One of the preceding paragraphs, take two:
No, it's not. You're assuming that xhtml is a subset of html - but it's not. There's no <br /> tag in html. There is no <?xml ?> mark at the beginning of a document in html. There is no lang attribute for the html element. That's what I'm talking about. XHTML has common points with HTML, but is not its subset.
Admin
Please, don't try to teach me how html and xhtml work...
That said
Notice the "roughly" at the beginning of the text?
I beg your pardon?
See above
Yeah right, please stop smoking, the root of an HTML element does have a lang attribute, what it doesn't have is an xml:lang attribute.
If you want to be picky about it, the precise definition of XHTML 1.0
The point is that if you follow the Compatibility Guidelines, XHTML 1.0 behaves, for all means and purposes, as a subset of HTML 4.01.
Yes and? Did I ever say anything different? Hell, did I EVER mention XHTML 1.1 in my post? Answer: no, I didn't, the only version mark I gave was 1.0
How about reading TFA in the first place? He's doing tests of the current state of the parsers on HTML documents, he's not using any feature of HTML5, and while his experiment is part of his writing on error handling in HTML5, what he's using here is good ol' html 4 (or 3, or you could probably get as low as HTML 1.0 and it'd still be more or less correct), the point is not the rendering but the parsing abilities and error recovery of HTML parsers.
Admin
Well, let's answer that too:
Guess what? The XML declaration is optional, even in fully conforming XML documents, and it certainly is not required in both XHTML 1.0 and in XHTML 1.1
Encouraged? yes. Required? no. No one therefore cares wether HTML documents have it or not
lang
attributehtml
element of an HTML 4.01 document does have alang
attribute.Admin
Gah, let's try it again.
Well, let's answer that too:
Guess what? The XML declaration is optional, even in fully conforming XML documents, and it certainly is not required in both XHTML 1.0 and in XHTML 1.1
Encouraged? yes. Required? no. No one therefore cares wether HTML documents have it or not
lang
attributehtml
element of an HTML 4.01 document does have alang
attribute.Admin
oooh, definition lists don't work at all... well at least i'll know it for the next try.
Let's try with some deflist emulation then, maybe the forum'll stop mangling it, third time's the charm or so they say
Well, let's answer that too:
<br> tag
<?xml ?>
lang
attributeAdmin
<FONT color=#0000ff>if</FONT>(countryCode.equals("WTF"))
countryString.append("<OPTION value=WTF selected>What the Fuck");
else
countryString.append("<OPTION value=WTF >What the Fuck");
Admin
And that's the very reason EJB 2.0 was a resounding failure. And why POJOs are recommended over entity beans. Now EJB 3.0 has learnt from the drawbacks of EJB 2.0. Obviously, the .NET Framework has made EJB run for its money.
I know of numerous organisations that had baulked at using EJB and instead opted for the .NET Framework. I know because I worked for one. They looked at EJB 2.0 and got feedback from the local EJB community, did their maths and found it not only prohibitively costly to port to EJB from an old Sun platform, they found most disconcerting the complexity in terms of creating and deploying these beans across the board.
Was way easier to use .NET Remoting Services and NHibernate to provide a robust solution with one-tenth the cost of going EJB 2.0.
Admin
Aaaaahhh! My EYES! The glasses! They do nothing! :'(
I'm BLIND!
Admin
You fail at using memes, the goggles do nothing, no glasses involved.
Proof:
<img src="http://masklinnscans.free.fr/4chan/Magic/goggles.gif" alt="The goggles, they do nothing>Admin
GeeWiz, just "SOAP" that sucker to the appropriate Geo-Political, Date-Time, Language-Babel, Travel-Guide, Global-Mapping, Gimme-Directions, Reverse-Finding, Census-Data, Atomic-Clocking, Currency-Converting, Stock-Quoting, Best-Fare, Shop-For-Me, Think-For-Me, Do-My-HomeWork, Find-My-Class-Mates, In-My-Opionion, Rumor-Mill, News-Line, Wiki-Bloggy, Trade-Anything, Try-For-Free, Industry-Trending, High-Tech, Base-Logic, New-Theory, Some-Day-In-History, Jokes-N-Quotes, Media-Clip, Book-Review, Ring-Tone-Library or You-Name-It-We-Found-It" webservice.
Surely the data is out there. No need to hard-code all that stuff.
Admin
I've been too busy to check in with TDWTF and when I finally get a few seconds of tranquility, this is the first post I'm greeted with.
Anonymous, you are an asshole. You are a complete waste of carbon. Would you please kindly die so that the rest of us may benefit by your absence?
And you're not much better. Thanks for the insightful and original contribution. Why even bother?
ahhhh. I feel so clean now...
Admin
Nitpick: if you implement it yourself, it's bean-managed, not container-managed persistence.
Otherwiese: ROTFL
Admin
maybe it's paid by line of code
Admin
Admin
Did you reaaly register just to say that?
Admin
You guys don't get it? It's optimized for sorting!
Admin
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.
Admin
There is one way to avoid if()*N, but its not faster and uses more memory.
Basically, write the whole string WITHOUT the select. Then go back into the string searching for the country code you need and insert the "select" text-- however, this causes the string to have to be reallocated since you're increasing it's size. 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) but its still not faster since you're a) moving chars and b) doing a string search. if()*N really is the fastest way.