|
Mill Town posted:Data structure hell, just stuff all the strings into a hash set. 2) They're stricmps, not strcmps, so you'd still need to do some faffing to get the hashing (or sorting if you want to use a std::map) working properly. It's only done once per load, so it's not in a performance critical section, but it is annoying that it'll take longer than it should for want of a few extra keywords. It's sloppy rather than outright terrible.
|
# ? Jan 28, 2009 10:57 |
|
|
# ? May 14, 2024 13:06 |
|
Just so you know your compiler probably has <tr1/unordered_set> (not that it's necessary here)
|
# ? Jan 28, 2009 15:27 |
|
Ryouga Inverse posted:the real wtf is that it actually saves to the file (without asking) and then asks if you want to save the file, but really it's asking "do you not want to delete the file?" I do something similar when I'm supposed to write out an error log with an execution trace only if some error occurs. At the end, if it succeeded with no errors, I delete it. It's perfect because if it fails to delete for some reason or another, then I needed the log file because that's an error.
|
# ? Jan 28, 2009 15:59 |
|
TSDK posted:1) There is no standard library hash set in C++ (and this is an embedded system, so boost is not an option without butchering up a custom version).
|
# ? Jan 28, 2009 17:15 |
|
Avenging Dentist posted:Look upon your works, ye coder, and despair! The guy sitting next to me at work indents almost that badly, and he can't seem to decide between tabs or spaces.
|
# ? Jan 28, 2009 18:51 |
|
Found this the other day at work and thought it would liven things up a bit in here.php:<? /** * Loads the last group code assigned to each active high group. * This list should be updated periodically */ private function LoadHighGroups() { $this->aryHighGroups = array( "001" => "06", "002" => "06", "003" => "04", "004" => "08", "005" => "08", "006" => "08", "007" => "08", "008" => "92", "009" => "90", "010" => "90", "011" => "90", "012" => "90", "013" => "90", // 800 MORE LINES OF THIS ?>
|
# ? Jan 28, 2009 19:36 |
|
php:<? if(strpos($userid,".")>=0)$userid=-5; ?> Me, 1 hour later: gently caress! Now I'm searching our entire codebase for more cases of PHP programmers not understanding PHP. Obligatory: PHP is a coding horror
|
# ? Jan 28, 2009 23:38 |
|
What the hell was that code even supposed to do?
|
# ? Jan 28, 2009 23:43 |
|
Sartak posted:What the hell was that code even supposed to do? Possibly $userid -= 5?
|
# ? Jan 28, 2009 23:57 |
|
Even still, why would you subtract 5 from the userid if it contains a period?
|
# ? Jan 28, 2009 23:57 |
|
Sartak posted:Even still, why would you subtract 5 from the userid if it contains a period? I've seen worse things. Hell, I've written worse things (though I usually at least have the awareness to apologize for it in comments).
|
# ? Jan 28, 2009 23:59 |
|
Avenging Dentist posted:I've seen worse things. Hell, I've written worse things (though I usually at least have the awareness to apologize for it in comments). code:
|
# ? Jan 29, 2009 00:56 |
|
Sartak posted:Even still, why would you subtract 5 from the userid if it contains a period? The userid is supposed to be coming from a 3rd party authentication system and apparently there were periods getting in there somehow (and probably causing database errors) from someone at some point in the last 5 years. Rather than force people writing code upstream of the core authentication system to deal with it properly, someone decided it would be a great idea to hide a line in the system that will gently caress the userid right in the ear in this one specific case and then went and did it in a profoundly stupid way. I could post a bunch of our codebase in this thread but I'm extra pissed about this one because I read over this line 4 or 5 times before it occurred to me why it was wrong. It's supposed to set the userid to -5, by the way (it's = -5 not -= 5).
|
# ? Jan 29, 2009 15:56 |
|
shrughes posted:Codepadded into #cobol: I don't get it, what exactly am I looking at? Is it a for loop or a while loop?
|
# ? Jan 29, 2009 16:08 |
|
It's just a for-loop followed by a while-loop. It's hosed-up in other ways, but it's not a special syntax or anything like that.
|
# ? Jan 29, 2009 16:15 |
|
Triple Tech posted:I don't get it, what exactly am I looking at? Is it a for loop or a while loop? code:
|
# ? Jan 29, 2009 16:17 |
|
code:
|
# ? Jan 29, 2009 16:51 |
|
terminatusx posted:a very useful file, worthy of modularization, to be sure. Do not question the cult of modularization
|
# ? Jan 29, 2009 17:04 |
|
Explanation of what this is in a moment... Edit: So, here we have a "transformer". We get journal articles from publishers in all sorts of formats, mostly xml. Those that are in xml we transform to match our format. In java. Using org.w3c.dom.*. Each transformer, of which there are about 50, does something slightly differently than the next, and generally features a ~700 line processXML method, most of which is in a try/catch block. The catch block is, unsurprisingly, catch(Exception e). "Ok epswing, we're going to have you edit one of the transformers because a publisher has changed their format." "Ok sure..." http://paste.ifies.org/300 "Jesus. Christ." epswing fucked around with this message at 23:18 on Jan 29, 2009 |
# ? Jan 29, 2009 22:32 |
|
From http://www.jgc.org/blog/2009/01/single-line-assignment-filled-with-epic.html:code:
|
# ? Jan 29, 2009 22:34 |
|
mr_jim posted:There are so many kinds of bad right there. Yeah, especially the blog's title.
|
# ? Jan 29, 2009 23:18 |
|
mr_jim posted:
Little known fact, setting a file's permissions to 666 gives read and write access to everyone, and allows Satan to execute YOU. in hell. ...with a trident.
|
# ? Jan 29, 2009 23:29 |
|
terminatusx posted:Little known fact, setting a file's permissions to 666 gives read and write access to everyone, and allows Satan to execute YOU. in hell. Actually, I think the Satan thing comes up when you set a directory's permissions to 666 decimal instead of 0666 octal. With no user intervention. And then put in a misleading comment.
|
# ? Jan 29, 2009 23:56 |
|
whoops, my mistake.
|
# ? Jan 30, 2009 19:28 |
|
I haven't found the horror itself yet, but it's leaving markings everywhere:code:
code:
|
# ? Jan 31, 2009 08:56 |
|
No Safe Word posted:For one of our clients (in the healthcare business) they literally had at least five (and I think it may actually have been seven) options in the gender field. I forget them all, but it was at least: Male, Female, Unspecified and I think there was a "Neither" or "Both" in there somewhere. Obviously your healthcare has a few aliens under it's insurance policy
|
# ? Jan 31, 2009 09:32 |
|
Fenderbender Presents: Line 1208 $error = QuerySubs::insert_vital_record($GLOBAL_DATA_DB, $GLOBAL_DATA_HOST, $GLOBAL_DATA_ACCOUNT, $GLOBAL_DATA_PASS, [$mrn, $var{uniq}, $var{capture_date}, $var{capture_time}, $var{vitals_units}, $var{vitals_height_1}, $var{vitals_height_2}, $var{vitals_weight_1}, $var{vitals_weight_2}, $var{vitals_temperature}, $var{vitals_temperature_method}, $var{vitals_respiration}, $var{vitals_head_circ}, $var{vitals_waist_circ}, $var{vitals_bmi}, $var{vitals_bsa}, $var{vitals_lmp}, $var{bpp_sitting_systolic}, $var{bpp_sitting_diastolic}, $var{bpp_sitting_extremity}, $var{bpp_sitting_pulse}, $var{bpp_sitting_rhythm}, $var{bpp_standing_systolic}, $var{bpp_standing_diastolic}, $var{bpp_standing_extremity}, $var{bpp_standing_pulse}, $var{bpp_standing_rhythm}, $var{bpp_supine_systolic}, $var{bpp_supine_diastolic}, $var{bpp_supine_extremity}, $var{bpp_supine_pulse}, $var{bpp_supine_rhythm}, $var{pain_assessment_under_8}, $var{pain_assessment}, $var{pain_assessment_comments}, $var{pulse_oximetry_heart_rate}, $var{pulse_oximetry_o2_saturation}, $var{pulse_oximetry_delivery_method}, $var{pulse_oximetry_extremity}, $var{pulse_oximetry_fio2}, $var{pulse_oximetry_flow}, $e3::user, $var{clinic_intake_tobacco_usage}, $var{clinic_intake_tobacco_date}, $var{clinic_intake_tobacco_current_packs_per_day}, $var{clinic_intake_allergies}, $var{clinic_intake_allergies_comments}, $var{clinic_intake_medication_list_reviewed_with_patient}, $var{clinic_intake_prescription_needed}, $var{clinic_intake_prescription_needed_comments}, $var{clinic_intake_chief_complaint},$var{visit_details}, $var{capture_date}, $var{capture_time}, $var{vitals_units}, $var{vitals_height_1}, $var{vitals_height_2}, $var{vitals_weight_1}, $var{vitals_weight_2}, $var{vitals_temperature}, $var{vitals_temperature_method}, $var{vitals_respiration}, $var{vitals_head_circ}, $var{vitals_waist_circ}, $var{vitals_bmi}, $var{vitals_bsa}, $var{vitals_lmp}, $var{bpp_sitting_systolic}, $var{bpp_sitting_diastolic}, $var{bpp_sitting_extremity}, $var{bpp_sitting_pulse}, $var{bpp_sitting_rhythm}, $var{bpp_standing_systolic}, $var{bpp_standing_diastolic}, $var{bpp_standing_extremity}, $var{bpp_standing_pulse}, $var{bpp_standing_rhythm}, $var{bpp_supine_systolic}, $var{bpp_supine_diastolic}, $var{bpp_supine_extremity}, $var{bpp_supine_pulse}, $var{bpp_supine_rhythm}, $var{pain_assessment_under_8}, $var{pain_assessment}, $var{pain_assessment_comments}, $var{pulse_oximetry_heart_rate}, $var{pulse_oximetry_o2_saturation}, $var{pulse_oximetry_delivery_method}, $var{pulse_oximetry_extremity}, $var{pulse_oximetry_fio2}, $var{pulse_oximetry_flow}, $e3::user, $var{clinic_intake_tobacco_usage}, $var{clinic_intake_tobacco_date}, $var{clinic_intake_tobacco_current_packs_per_day}, $var{clinic_intake_allergies}, $var{clinic_intake_allergies_comments}, $var{clinic_intake_medication_list_reviewed_with_patient}, $var{clinic_intake_prescription_needed}, $var{clinic_intake_prescription_needed_comments}, $var{clinic_intake_chief_complaint}, $var{visit_details}]);
|
# ? Feb 4, 2009 21:50 |
|
More!php:<? $today = getdate(); $todayDate = sprintf("%04d%02d%02d_%02d%02d%02d", $today['year'], $today['mon'], $today['mday'], $today['hours'], $today['minutes'], $today['seconds']); $todayDate = $todayDate ^ "pippopippopippo"; $toret = $userid . "." . $todayDate; ?>
|
# ? Feb 4, 2009 22:03 |
|
Munkeymon posted:More! Apparently XOR is defined on strings in PHP. http://ca.php.net/manual/en/language.operators.bitwise.php
|
# ? Feb 4, 2009 22:07 |
|
Mill Town posted:Apparently XOR is defined on strings in PHP. HAHAHahah haha hah ha Even better: the manual says the only operators that work on strings are . and .= http://us.php.net/manual/en/language.operators.string.php
|
# ? Feb 4, 2009 23:13 |
|
Mill Town posted:Apparently XOR is defined on strings in PHP. How is that supposed to be useful?
|
# ? Feb 4, 2009 23:16 |
|
mr_jim posted:
XOR encoding leaps to mind... code:
|
# ? Feb 4, 2009 23:21 |
|
Otto Skorzeny posted:Just so you know your compiler probably has <tr1/unordered_set> (not that it's necessary here) As of gcc 4.3 unordered_set and friends are in the main include folder and under namespace std :themoreyouknow:
|
# ? Feb 5, 2009 00:01 |
|
mr_jim posted:
Why, so you can encrypt passwords with xor encryption!
|
# ? Feb 5, 2009 02:24 |
|
Another feather in PHP's security hat
|
# ? Feb 5, 2009 02:47 |
|
One time pads are bad how edit: Whoops, missed the "encrypt passwords" bit Zakalwe fucked around with this message at 03:52 on Feb 5, 2009 |
# ? Feb 5, 2009 03:48 |
|
shrughes posted:Why, so you can encrypt passwords with xor encryption! Encryption occurred to me after posting; I've been reading up on stream ciphers lately. I guess the context it was being used in threw me off. code:
|
# ? Feb 5, 2009 06:23 |
|
mr_jim posted:Encryption occurred to me after posting; I've been reading up on stream ciphers lately. I guess the context it was being used in threw me off. Seems to me all of that above could be written as: php:<? $toret=$userid.'.'.(date('Ymd_His')^'pippopippopippo'); ?>
|
# ? Feb 5, 2009 06:29 |
|
mr_jim posted:Encryption occurred to me after posting; I've been reading up on stream ciphers lately. I guess the context it was being used in threw me off. I wasn't sure either, so I stuffed it in a file and ran it (with $userid="test"): $ php test.php test.BY@I_BYE/_EYFD^ It does... something.
|
# ? Feb 5, 2009 11:07 |
|
|
# ? May 14, 2024 13:06 |
|
I'm pretty sure FeloniousDrunk is right about it generating session keys. That didn't occur to me because a) I'm not a web programmer, and b) "pippopippopippo" is odd enough that I thought it must have some significance beyond obfuscating the time stamp. I'm retarded.
|
# ? Feb 5, 2009 15:09 |