|
bitreaper posted:... Passport, , L2F, ... It's funny; I laughed at the error message, then noticed what I imagine is the error (quoted) one second later. Why can't I do that with my own code...
|
# ¿ Mar 23, 2008 21:08 |
|
|
# ¿ Apr 24, 2024 05:26 |
|
Found this in the PHP manual. It's like the guy knew he wanted some kind of conditional execution, but forgot about the "if" keyword.code:
|
# ¿ Mar 28, 2008 21:03 |
|
Surge Strip posted:
Woah, OK, this example here takes the cake. Let me see if I can list the problems here: 1. A function that does the intended effect already existed. 2. The function name is purposely misspelled. 3. I've never written Delphi before, so correct me if I'm wrong, but newstring is going to be the old string's ASCII characters shifted down 32. So this fantastic reimplementation doesn't even do anything right. (Your newline is now ASCII -22! Or maybe even 234! ) 4. This is a trivial function for someone a month into their first ever programming class with no prior experience. Yet someone got paid to write this. This simply cannot be topped. This is maximum . (Did I miss anything?)
|
# ¿ Apr 2, 2008 08:00 |
|
MrMoo posted:Return value seems to be undefined if string has length zero. It won't simply return the empty string?
|
# ¿ Apr 2, 2008 11:23 |
|
king_kilr posted:PHP? code:
code:
|
# ¿ Apr 4, 2008 11:28 |
|
noonches posted:
That is pretty sad, especially since it'll have duplicates of whatever value's thrown in. However, what's this "tiny piece of code" you'd use to add "selected"? It's as long as that if I recall correctly.
|
# ¿ Apr 8, 2008 05:27 |
|
G-Dub posted:Finally, when opening the site instead of just opening an HTML file you open an HTA file, which is apparently an HTML Application. Is this ever excusable? Maybe it's doing some really cool fuckery that you can't do with non-application HTML. I don't have a clue what such fuckery would look like, but who am I to say it doesn't exist.
|
# ¿ Aug 22, 2008 02:20 |
|
People seem to be arguing over fundamentally different definitions of "exception". If there was ever an overloaded term in the realm of coding, it's "exception". It means everything to everybody. Janin almost hit it: if you come into Python thinking "'exception' means non-Python definition x", it won't look right. Part of making your own language is deciding what "exception" means to you. Wikipedia's definition of exception handling is something that is "designed to handle the occurrence of a condition that changes the normal flow of execution". That definition seems general enough to include the case where a generator/iterator/etc. can't continue executing normally because there's nothing left to generate/iterate/etceterate. Beyond that, it's up to the language.
|
# ¿ Nov 8, 2008 07:32 |
|
ZorbaTHut posted:I spend a lot of time in a C++ help channel and, from my experiences there, I've concluded that many people's brains simply freeze up when they see an error message. They see "error" and they just panic and stop thinking. You know, that makes total sense. Lots of things only click when the context is changed. It seems that taking the information out of the context of "an error message" makes the problem much easier to solve. quote:I weep for humanity. Oh, you were just being a dick.
|
# ¿ Dec 1, 2008 19:54 |
|
ShoulderDaemon posted:You could've just said "some people don't read what they write" and saved yourself a lot of handwaving. I think you even tried to say that somewhere in the middle there.
|
# ¿ Mar 17, 2009 03:24 |
|
Beardless Woman posted:
Ah yes, that ancient coding blasphemy. Death to the not operator! All hail empty code blocks! Allah ackbar!
|
# ¿ Apr 9, 2009 16:09 |
|
ehnus posted:No, but "unless" certainly is. What's the difference? Isn't "unless(statement)" identical to "if (!(statement))"? e: Come to think of it, isn't "if" redundant if you have goto? And "else" is sure overrated hey? I just jump right there. Surely we don't need for loops if we have while loops. Why have a break statement when you can just use a flag? When does "arbitrary" cross into "quite helpful" for you? Especially if it boils down to the same instructions in the end. pokeyman fucked around with this message at 19:03 on Apr 12, 2009 |
# ¿ Apr 12, 2009 18:54 |
|
Gazpacho posted:I don't see the point of arguing whether Perl has redundant features. Larry Wall admits it and is proud of it. Wasn't arguing about Perl redundancy, more that being pedantic about redundancy in coding leaves you with a tiny set of nonredundant operations and most likely unreadable code. But I'm done. Regarding conditional goto: I meant to say branch, sorry. Branch/if and goto/break. Y'all got my point: higher-level constructs like if boil down to low-level constructs like branch, so they're redundant, but surely we find value in them, etc. etc. I don't think Beardless Woman found value in an empty code block, as he expected a not or an unless, so he posted it here. That's all.
|
# ¿ Apr 12, 2009 21:14 |
|
ehnus posted:Sorry to break it to you but "unless" is redundant as it does the same thing as using if with a negated condition but saves no typing and some (like myself) might even say it does nothing to improve code clarity or comprehension. code:
Calling something "redundant" doesn't imply it's a worthless feature; we've covered this. Stop using that as a crutch, and just explain your opinion. pokeyman fucked around with this message at 23:10 on Apr 12, 2009 |
# ¿ Apr 12, 2009 23:07 |
|
That Turkey Story posted:Both statements have undefined behavior unless those are overloaded operators. Post or pre-increment doesn't matter, assuming C or C++, that is. I get why post/pre doesn't matter, but why is the overall behaviour undefined? To my (admittedly untrained) eyes, assuming i and j are numbers, that line increments i by one then ensures it didn't just grow larger than j, wrapping around to 0 if so. Did I get that wrong?
|
# ¿ May 10, 2009 20:03 |
|
rjmccall posted:With a few exceptions, the order of execution of side-effects within expressions is not specified in C/C++, so it is permitted for the increment to logically happen after the assignment. The major exceptions are the comma operator (left before right), the ternary operator (condition before chosen expression), and call-like operations (function and arguments (in any order) before call). (n.b. this list is not guaranteed to be exhaustive) Thanks for the explanation. Vanadium posted:no this is not "who knows what the value of i is going to be afterwards", this is literally undefined behaviour Calm down champ, nobody's trying to stir up poo poo but you. "Literally undefined behaviour" and "not specified in C/C++" mean the same thing to me, and either way I got the point: the result of this expression is not defined, and thus a coding horror. I didn't know it was undefined in C/C++ so I didn't see why it was a horror. Following along? Great.
|
# ¿ May 11, 2009 00:03 |
|
tef posted:this for new cobol title
|
# ¿ Jun 9, 2009 10:00 |
|
Pooball posted:I don't see how this could be done any better. Factor out the isset check code:
|
# ¿ Jun 10, 2009 09:02 |
|
Zombywuf posted:Cue coding standard that require Much more fun.
|
# ¿ Aug 7, 2009 18:48 |
|
Sebbe posted:I think I'll start using roman numerals code:
|
# ¿ Aug 11, 2009 15:43 |
|
Any attempt to start the PHP derail should be bannable throughout CoC.
|
# ¿ Sep 9, 2009 06:58 |
|
What does what you said have anything to with what you quoted?
|
# ¿ Sep 30, 2009 04:46 |
|
yaoi prophet posted:What exactly does '3rd-level damage' mean? When the epidermis is lost with damage to the subcutaneous tissue?
|
# ¿ Oct 4, 2009 23:12 |
|
floWenoL posted:God forbid anyone point out coding horrors in the coding horror thread! He was pointing out a human horror, that goes in the other thread. The one on page twelve or whatever.
|
# ¿ Nov 9, 2009 22:47 |
|
Ryouga Inverse posted:this works until: I can't figure out a way to make yes take a line feed. Just strips slashes here on OS X.
|
# ¿ Nov 13, 2009 00:13 |
|
tef posted:yes newline Man I'm dumb. I'll file that away. It'll come in useful one day.
|
# ¿ Nov 15, 2009 00:43 |
|
ton1c posted:You know it's funny, a good number of people reading this thread and that reddit thread would probably be guilty of a number of things in this thread. Programming should be more like music, where you compete against yourself rather than bash those who suck, but then nothing would get done. And nobody should ever listen to each others music, we'll all just whittle our own instruments and play holed up in our rooms and never speak of it again. Most importantly, we'll never critique one another's music. This will guarantee all but one of us are stuck at the beginner level, and we'll all be happy.
|
# ¿ Nov 15, 2009 07:58 |
|
From the helpful comments department:code:
code:
pokeyman fucked around with this message at 00:25 on Nov 27, 2009 |
# ¿ Nov 26, 2009 22:32 |
|
A A 2 3 5 8 K posted:http://search.cpan.org/~bshade/Array-PAT-2.0.0/PAT.pm Array::PAT posted:Just as The Beatles say: Forgot about that humdinger. That's from the Yellow Submarine lyrics right?
|
# ¿ Dec 30, 2009 01:43 |
|
pseudorandom name posted:You see any MUMPS source. It's named after a goddamn disease. Or is the disease named after it...
|
# ¿ Jan 8, 2010 00:41 |
|
http://www.phpfreaks.com/forums/index.php/topic,240487.0.htmlguy with problem posted:In an attempt to automatically hide my email from spam bots, I have been working on a script that turns all email [addresses?] on a page into ASCII, however I am having trouble with one little bit of code. phpfreaks superstar posted:I like to give each user that can receive e-mail a unique id that pertains to the user e-mail address, then on the back end I run the mail algorythim. phpfreaks superstar posted:There is a built in option for mail to be sent as html, not other things. phpfreaks superstar posted:Are you talking about having a captcha that is required before sending the e-mail to someone, otherwise it runs a loop? I swear this guy's a bot running a rudimentary search engine.
|
# ¿ Mar 20, 2010 07:25 |
|
Perl-compatible regular expressions.
|
# ¿ Apr 5, 2010 22:22 |
|
What do objects and that switch statement have in common? Or why would that shut them up in that debate?
|
# ¿ Apr 12, 2010 01:21 |
|
Oh, ok. Carry on with the unmasking of the incompetent coworkers!
|
# ¿ Apr 12, 2010 03:06 |
|
From the Ask General Programming Questions thread:Nippashish posted:In Java | and & are the non-short-circuiting versions of || and &&. *is given counterexample of 1 && 2 and 1 & 2* Nippashish posted:They're also bitwise operators when the operands are integral types. Maybe you should try them with boolean operands.
|
# ¿ Apr 16, 2010 07:09 |
|
When I suggest making a new function to a certain non-programmer taking an intro CS course it's always met with groans. This despite agreeing later that the added function makes things clearer and easier. Maybe it's the mental context switch needed, and I just don't notice it after so much practice.
|
# ¿ Apr 16, 2010 08:00 |
|
Monkeyseesaw posted:This is largely moot anyway. He's not writing unit tests for a drat school assignment. If I'd known about unit tests it would've made some assignments sooooooo much easier...
|
# ¿ Apr 19, 2010 05:16 |
|
That's why there isn't a fight in Python: there's a style guide. Like all style guides, it provides rules that should be followed unless you have an excellent reason not to. Given this, why is "following a standard blindly" a horror? If you can't be bothered to think about whether you should break a rule, the least confusing thing to do is follow the rule.
|
# ¿ May 19, 2010 09:19 |
|
Rocko Bonaparte posted:I was trying to figure out what you had cooking with the acronym too. I remember in college they rammed something down our throats like that where we could only return right at the end of things. What I thought particular worse was they were also anal about breaking out of loops. So you'd have to throw your terminal conditions in the loop construct and often deal with signal variables of some kind. One of my profs went violently in the other direction, taking off style points unless every loop was an infinite loop where you break out of it somewhere (maybe multiple places) in the loop body. It was actually kinda useful because it can be more readable, and awesome because signal variables could be eliminated (their use was an even more egregious style violation).
|
# ¿ Aug 16, 2010 23:52 |
|
|
# ¿ Apr 24, 2024 05:26 |
|
Hammerite posted:I think this could be defensible, depending on what exactly it's being used to do. Similar to how while (true) {...} can be a useful control structure. You might've had a point with do { .. } while(0), but you missed your chance.
|
# ¿ Sep 27, 2010 18:18 |