- Feature Articles
- CodeSOD
- Error'd
- 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
Sure, Java's a "most user friendly REAL PROGRAMMING language" compared to... say... Python?
Same code:
Admin
That would work if ResultSet had a size() method. Alas, it doesn't (assuming this is Java, as it appears to be), presumably because there's no guarantee that the underlying database has determined how many results there are before it can start providing some to you.
Stuffing the results into an ArrayList or similar would work pretty nicely.
Admin
Admin
Or in the .Net world, just use yield return (pretty cool because you can stream the items back to the caller while still reading from the reader). This assumes you don't CARE how many items there is in the collection, and often times, you don't...
Is there an equivalent in Java of the yield return?
Admin
Relax, it's probably his sock puppet... Which is funny because it's probably frits or boogs sock puppet, which makes it a sock puppet of a sock puppet.
Admin
what does yield do?
Admin
read this http://jimblackler.net/blog/?p=61
Admin
I like Python, but once a project gets above 3 members and ~7K lines, unless I've been able to very carefully select the other 2 programmers, I'd much rather the project be in Java (even if that does make it 12K lines instead).
The tooling is nicer, and although this can be mitigated by writing proper automated unit tests, it is much easier to debug problems in unfamiliar code.
Admin
Not surprised. The state of competence has more than 1 to 40 variance and examples of the lack of basic comprehension of the cause and effect relations in programs are common.
Reminds me of a bugfix, one programmer made. There was a function call missing from a piece of code, and that programmer was instructed to add the function call there. So that programmer copy-pasted the function call from the corresponding header file to the indicated place, compiled the code. As it compiled that programmer checked the code in and signed the fix done.
Only problem was, that the copy-pasted code remained a declaration (that was C code) so no actual function call, of course, took place.
Another programmer had learned to initialize C-strings like
instead of
in an university level programming course.
Admin
Admin
My mouth watering now. Time to go out and murder cow.
Admin
Agreed++
Admin
I think showing students the
version makes sense, as it makes it obvious exactly what is going on... but yeah I'd show them both at once and say use the quoted string one, but here's what's going on behind the scenes
Captcha: commoveo ... comb over in Italian?
Admin
What IM was that? Automatic detection and formatting of source code? I'd like that.
Admin
TRWTF is not using "Linq to Shortcut Guy"
Admin
mroot (10:03 AM): Got a problem for ya... mroot (10:03 AM): Any idea how I can parse a string of email addresses like this: [email protected]@[email protected]? mroot (10:04 AM): I need them separated in an array. I was thining of looking for .net, .com, etc. boog (10:05 AM): Sure, that might work. mroot (10:05 AM): Is there a web service to do that? boog (10:06 AM): There might be. See if you can find one, and let me know if you do. mroot (11:18 AM): Okay. What if there was a comma between the addresses? For example, [email protected],[email protected],[email protected]. mroot (11:19 AM): That should be easy to put in an array? boog (11:22 AM): Couldn't find a web service? Hmm... wait, where did those commas come from? mroot (11:24 AM): I just copy/pasted them from debug console. That's what my string has. boog (11:25 AM): Oh, I see, they make it easier to read. Good thinking! So if there's no web service already, you should write your own. It can start out by removing the commas, then search on .net, .com, etc.! Think you can pull it off? mroot (11:25 AM): Sure, no problem... boog: (11:25 AM): Excellent.
On the plus side, he'd never ask for my help again.
Admin
booger, That will never work. Mister Oot will simply ask you to write the webservice. <smiles>
Admin
Admin
Great... now no one will listen to my actually reasonable point, thanks Nagesh ;-) . And btw, that python segment isn't the "exact same code" ... it's closer to this
Yes, if I was writing a quick script to split strings, I'd choose python or ruby. Since they are often considered scripting languages they do have nicer string manipulation abilities, but let's look at what is actually doing the work here:
vs print "Real-how-to".split('-')
Yes longer, but not too unreasonable, and after a year or so of object oriented programming it shouldn't seem any more complicated
PS: elif python? really? saving three characters is so important that we need to use an abbreviation that should have died out in the 70's?
Admin
[sarcasm] Why wouldn't they just loop through each possible combination of the list, and send a test email to each one .. then just record which ones bounce, and viola ... you have your email list!! Easy ... [/sarcasm]
Admin
Admin
You mean conversations like that aren't normal? I have them everyday at work. Although I work for a small company (< 10 people) and I'm the only actual developer; my manager is actually a DBA trying to teach himself how to program in C#
I miss working with C and C++
Admin
Admin
I think you're all stupid LOL.
Admin
I think it's there to make the parser less complex, actually, although I could be wrong; it's been a while since I was elbow-deep into CPython's guts.
Admin
Really? People do that? Here?
Admin
I have split your email addresses. Pray I don't split them further.
Admin
Love the python fanboy whose hardest coding problem was probably scraping HTML off of a website.
re: TFA, I'm very suspicious of this. The if-statement means he'll only get the first result of the query each time the method is called, so it'd be impossible to get different email addresses without some manipulation of the database between calls.
Also, no call to rs.close()? Article is obviously BS.
Addendum:
You messed up your name in the last line of the instant message. The extra : ruined it.
Admin
Perhaps they were using a compiler hacked together by the course lecturer, which barfed on the "" syntax. After all, syntactic sugar is for wimps.
Admin
The person's job is programming. As in, understanding the basic structures of the language they are working with to make stuff that does other useful stuff and possibly occasionally solves problems, instead of introducing more.
The fact that they are using a loop to create a string out of individual email addresses, and cannot figure out how to parse individual emails out of their newly-created string, qualifies as a major WTF regardless of the language in question or anyone's individual level of patience.
Or do yu beleeve that an editer doesn't need to no grammer, speling, and vocabalery well, as qualifikations to doing there job and properly ern their paychek?
Seriously. Your comment is the real WTF.
Admin
I'm amazed...
Admin
Wow, I just skimmed over it assuming it must be a while... obviously I need another coffee today
Admin
Nothing better - or worse - than being the junior who's always correct. Been there, done that.
Yep, I noticed that too... faulty code sample makes me think made-up WTF.
Admin
Interestingly enough, Mozilla maintains a text file of TLDs here. There's even an atom feed of updates to it.
Admin
Oh wow, you've got OCD too?
Honestly, who the hell notices something like that, and furthermore, who the hell pays such close attention to boogs comments!? :)
Admin
Admin
Admin
Admin
Captcha: appellatio... The real reason Eve got kicked out of Eden.
Admin
Admin
Admin
Admin
Good god, please don't make that a meme...
Do a bert glanstron, or a paula bean, but for the love of all that is good, don't let that be a meme on this site...
Admin
I see what you did there. LOL
Admin
Seriously? Logging off fuming and needing to cool off after 30 seconds of questions from a newbie? That's the real WTF here.
Admin
Admin
Admin
That troll attempt has already been done... Please try and keep up.
Admin
The real WTF is reading comprehension or the lack thereof.
Admin
Yeah, well, adding the fact that it's the end of his world is completely unnecessary and should be left out unless you want to add the entire context every time. It detracts from the actual story, especially when the story isn't noteworthy to begin with.