|
biznatchio posted:Yeah maaaan if you're going to be helping spammers out, the least you could do is validate their email address list for RFC compliance for them first. Exactly. On another note, I just wrote this: code:
|
# ? Oct 8, 2009 11:34 |
|
|
# ? Apr 27, 2024 09:30 |
|
One of our clients uses vTiger as their CRM program, and I've been saddled with the task of adding things to it that they want.php:<? $rec_type = $_REQUEST["type"]; ... } elseif ($rec_type == "email_addy") { $email1 = $_REQUEST["email_addy"]; } $smarty->assign('TO_MAIL',trim($email1,",").","); ?> pre:&type=email_addy&email_addy="><script>myEvilCode();</script> code:
Actually just imagine I pasted the entire vTiger codebase here because god drat that program is the biggest pile of poo poo ever. Like when they do something like this: php:<? if($errormessage==2) { $msg =$mod_strings['LBL_MAXIMUM_LIMIT_ERROR']; $errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>"; } else if($errormessage==3) { $msg = $mod_strings['LBL_UPLOAD_ERROR']; $errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>"; } else if($errormessage=="image") { $msg = $mod_strings['LBL_IMAGE_ERROR']; $errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>"; } else if($errormessage =="invalid") { $msg = $mod_strings['LBL_INVALID_IMAGE']; $errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>"; } else { $errormessage=""; } ?> Or php:<? // This function doesn't seem to be used anywhere. Need to check and remove it. function get_contacts1($user_name,$email_address) { ... } function get_contacts($user_name,$from_index,$offset) { ?> megalodong fucked around with this message at 04:41 on Oct 9, 2009 |
# ? Oct 9, 2009 03:15 |
|
And to think all they had to do was:code:
|
# ? Oct 9, 2009 04:09 |
|
if(isBagInside==FALSE) bReady =TRUE ; else if(isBagInside==TRUE) bReady = FALSE;
|
# ? Oct 9, 2009 18:00 |
|
West4th posted:if(isBagInside==FALSE) Using an else-if in this situation is wise. You don't want to match FALSE and TRUE simultaneously. And you've gotta save that ending 'else' for the third option that's sure to come up later on in development.
|
# ? Oct 10, 2009 03:26 |
|
West4th posted:if(isBagInside==FALSE) I've seen a lot of this with ternary operators. Hypothetical: isValid = (checkForInvalid()) ? false : true. Usually in that order, so the "true" result actually returns false and vice versa.
|
# ? Oct 10, 2009 03:30 |
|
Seth Turtle posted:Using an else-if in this situation is wise. You don't want to match FALSE and TRUE simultaneously. And you've gotta save that ending 'else' for the third option that's sure to come up later on in development. It's been future proofed for quantum computing.
|
# ? Oct 10, 2009 05:27 |
|
Supervillin posted:I've seen a lot of this with ternary operators. Hypothetical: isValid = (checkForInvalid()) ? false : true. Usually in that order, so the "true" result actually returns false and vice versa.
|
# ? Oct 10, 2009 05:46 |
|
Mustach posted:!(There's not an operator that does this).
|
# ? Oct 10, 2009 12:30 |
|
gibbed posted:isValid = !checkForInvalid() ? true : false if (checkForInvalid().ToString().Length()==5) isValid=true;
|
# ? Oct 10, 2009 16:57 |
|
Ensign Expendable posted:if (checkForInvalid().ToString().Length()==5) isValid=true; inline conditionals reduce readability and make it more difficult to add other options in the future. it should be code:
|
# ? Oct 10, 2009 20:10 |
|
*trips over himself trying to come up with an even better coding horror, spills all of his golden manbabies* Noooooooooooo.....
|
# ? Oct 10, 2009 20:44 |
|
I believe we should be exploiting jump tables in a switch statement for maximum fastness code:
|
# ? Oct 10, 2009 22:00 |
|
Seth Turtle posted:Using an else-if in this situation is wise. You don't want to match FALSE and TRUE simultaneously. And you've gotta save that ending 'else' for the third option that's sure to come up later on in development.
|
# ? Oct 11, 2009 00:35 |
|
Incoherence posted:Clearly the third option is FileNotFound. I'm surprised it took this many posts to reach that.
|
# ? Oct 11, 2009 07:12 |
|
code:
|
# ? Oct 15, 2009 10:43 |
|
niteice posted:I'm surprised it took this many posts to reach that. I heard another set of values to booleans last night: True and Techcrunch
|
# ? Oct 15, 2009 10:50 |
|
An intern over the summer, trying to convert decimal into hex (I think, I don't really recall, but it was some inter-base conversion) in python:code:
|
# ? Oct 16, 2009 01:13 |
|
Tikki posted:
Dotdotdotalize is a hilarious word though.
|
# ? Oct 16, 2009 02:00 |
|
poopgiggle posted:An intern over the summer, trying to convert decimal into hex (I think, I don't really recall, but it was some inter-base conversion) in python: So is he getting a letter of recommendation?
|
# ? Oct 16, 2009 07:15 |
|
RussianManiac posted:So is he getting a letter of recommendation? He actually turned out to be pretty good at other stuff (he's double-majoring EE/CS and his EE skills are good) so probably. I wouldn't want him writing code though.
|
# ? Oct 16, 2009 19:26 |
|
Just got an email from my coworker about the new intern arguing with the senior developer:quote:INTERN is arguing with S.DEVELOPER right now.. Oh! The kicker... I was doing some internet detectiving on the intern's personal web site and there are plenty of XSS openings.
|
# ? Oct 17, 2009 00:13 |
|
Go ahead and hack it and report back, but don't let him know that was you. And send the hacked page to his senior developer.
|
# ? Oct 17, 2009 02:42 |
|
Not coding, but this craigslist ad came up in reddit and will probably disappear so I'll just paste it:Craigslist posted:We are looking for candidates with at least 2 years of experience to join our start up software company. We are looknig for developers to come on board part time ($10/hour) but there is a huge opportunity for advancement.
|
# ? Oct 17, 2009 07:54 |
|
JOrbisPlayer:code:
And I just realized that it's not an Applet, but a JApplet, so it's at minimum Java 1.2, which definitely has lastIndexOf().
|
# ? Oct 19, 2009 13:54 |
|
So while messing around in an old codebase I stumbled on this:code:
|
# ? Oct 19, 2009 15:07 |
|
Clearly GCC needs a warning about the upcoming dragons so it can put on its suit of armor. If you comment it out, GCC ignores it and the dragon gets it, causing it to crash.
|
# ? Oct 19, 2009 15:52 |
|
Seriously, I'm pretty sure the Dragon text devoted an entire chapter to fending off mythical beasts or something
|
# ? Oct 19, 2009 15:55 |
|
Broken Knees Club posted:So while messing around in an old codebase I stumbled on this: I... you have to figure out what the hell is going on here.
|
# ? Oct 19, 2009 20:41 |
|
I am adding that to every program I write, just in case.
|
# ? Oct 19, 2009 22:51 |
|
Or grep for it after running gcc -E and see if it's getting inserted into an unexpected place.
|
# ? Oct 20, 2009 01:17 |
|
Is it really a crash or is it just a compile error?
|
# ? Oct 20, 2009 02:08 |
|
I'd love it if you could track down what that bug was, because weird compiler bugs have always fascinated me. A few years ago I was the TA for one of our C++ courses, and when it came time to grade students' projects, I would compile and run their code and occasionally it would crash with "SIGILL: illegal instruction". Thinking they were doing something like blowing the stack, I pulled up gdb but it was actually g++ generating an incorrect CALL instruction. Instead of the correct destination address, it was basically generating "CALL (address of this instruction + 1)", which of course would never be correct. Sadly I was never able to figure out how to duplicate it reliably. Sometimes forcing -O0 would fix it, but then on another student's code it would be broken under -O0 but -O3 would work instead.
|
# ? Oct 20, 2009 02:42 |
|
Broken Knees Club posted:So while messing around in an old codebase I stumbled on this: I things like that Magic/More Magic switch in all manifestations. If you have nothing better to do, tinkering with them is an excellent way to waste time.
|
# ? Oct 20, 2009 03:39 |
|
Flobbster posted:I'd love it if you could track down what that bug was, because weird compiler bugs have always fascinated me. I would love for someone to explain to me (slowly) just why that happened and why the person who finally figured this out gave me the impression that this behavior wasn't a bug.
|
# ? Oct 20, 2009 04:45 |
|
Flobbster posted:Sadly I was never able to figure out how to duplicate it reliably. Sometimes forcing -O0 would fix it, but then on another student's code it would be broken under -O0 but -O3 would work instead. code:
I ended up having to declare somevar volatile to fool the optimizer.
|
# ? Oct 20, 2009 05:01 |
|
^^^ Regarding workarounds for bad compiler optimization... One of our CS professors was trying to write a delay into some code back in the day (apparently before the sleep call) and did something like this: code:
code:
The compiler took one look at the goto statement and was like, "gently caress it, I'm out." I don't recommend ever actually doing this but it's funny that it happened (and that it was perpetrated by one of the most brilliant people I've ever met). EDIT: Took out a really retarded infinite loop. Don't post while sleep-deprived, kids! poopgiggle fucked around with this message at 15:28 on Oct 20, 2009 |
# ? Oct 20, 2009 05:30 |
|
Presto posted:gcc is just bizarre like that. I was working with code similar to this: If somevar was being modified in a separate thread it is correct to optimize that way. However I suspect what was happening was the optimizer was modifying prev_somevar (or the register it had it in) early and then another part of the optimizer was seeing it as if you'd written: code:
|
# ? Oct 20, 2009 11:30 |
|
Incoherence posted:The only time I've ever seen a SIGILL was a situation where I managed to compile something whose dependencies included two classes with the same name, and somehow the linker got sufficiently confused that rather than, I don't know, complaining that there were two classes with the same name, or combining them sensibly, it decided to merge the two together into a single vtable that was missing several methods from each, so that when I called one of the missing methods the program of course crashed. It's pretty easy to reproduce this with objects with C linkage (e.g. everything in C): code:
|
# ? Oct 20, 2009 18:01 |
|
|
# ? Apr 27, 2024 09:30 |
|
Flobbster posted:I'd love it if you could track down what that bug was, because weird compiler bugs have always fascinated me. I used to work for a game company that was making software for the PS2. At one point I went and rigged up a new super-fast renderer for our automap, all written up in VU0 assembly code so it would run on what was essentially the PS2's vertex processor. Got it blazing fast and debugged, checked it in, forgot about it. About a week later someone made a build and got it to crash. I looked at it, couldn't figure out what was going on. Added some debug to it, rebuilt, and it worked. Removed debug, rebuilt, and it worked. Okay . . . cosmic ray? Buffer overflow? Well, it's working now, we'll just ignore it. A few days after that it melts again. I rebuild it. It works. I am worried, and go to ask my boss about it. He figures out the problem. The assembler for the PS2 was an optimizing assembler. It took my carefully-written assembly and munged it around to work better. Normally I'm okay with this. However, it didn't have a "optimization setting" or anything so mundane as that. No, it had a timeout. A realtime timeout. You'd say "optimize it for 5 seconds!" and boy howdy it would optimize that sucker for exactly 5 realtime seconds. Regardless of how much CPU it was actually getting during that time. And to make things worse, it was buggy. So, depending on how much CPU it got . . . well, it might just spit out invalid assembly once in a while. We told it to optimize for 24 hours, and discovered that it would actually reach a point where it considered itself "finished". That was the fix: put that in, and hope it didn't break for some other reason. Which, to the best of my knowledge, it never did. God the PS2 dev tools were crappy. I thought of one story, started writing that sentence, and before I'd finished I'd thought of two more. (incidentally I totally forgot I'd posted in this thread, but if anyone still wants answers to questions posed way back over here I can answer 'em)
|
# ? Nov 5, 2009 10:52 |