|
geonetix posted:I'm not actually sure why, it's probably because I learned to computer that way. And I cannot live without "bindkey -v" to enable vi-like editing. If somebody has an actual valid pro/cons table of zsh vs bash vs (t)csh I'll be the first to read it. code:
Also I found csh considered harmful a while back, but never having used csh, I can't say how valid it is. Edison was a dick fucked around with this message at 23:15 on Jul 24, 2012 |
# ? Jul 24, 2012 23:09 |
|
|
# ? Apr 29, 2024 16:20 |
|
love this poo poo.
|
# ? Jul 24, 2012 23:43 |
|
This is what happens if you let a front-end guy write your Django app.Python code:
|
# ? Jul 25, 2012 00:40 |
|
theratking posted:
Github issues are pretty bad, but I wouldn't award them full-blown horror status
|
# ? Jul 25, 2012 00:57 |
|
Sinestro posted:This is what happens if you let a front-end guy write your Django app. I recently phone interviewed with a company who gave me access to their github, and their code was exactly like this. They had one model called DictionaryStruct which was exactly like the one you posted, which was used for everything. They offered me a very good salary, but I had to decline their offer.
|
# ? Jul 25, 2012 02:05 |
|
Sinestro posted:This is what happens if you let a front-end guy write your Django app. I combined them all into one class called GlobalVars and accessed the properties from there. Not really a horror to use global variables in this circumstance, since we were wrapping around another app, and the whole disaster ran for a few seconds to get some data and died. Aside: Bosscode has taken the "pay less, pay often" method of coding again, adding code to set the default timezone to every file instead of just setting the drat setting in php.ini once. Then again, this the same person who copy-pastes the same "header" (comprised of two function definitions that are the exact same, but with a number in the name of one of them), so...
|
# ? Jul 25, 2012 03:49 |
|
Doc Hawkins posted:Github issues are pretty bad, but I wouldn't award them full-blown horror status I'd say the horror is that my direct supervisor doesn't really fully understand the concept of an error or an error message. His response to "what's the 500 error" is "it's a 500 error."
|
# ? Jul 25, 2012 07:34 |
|
I don't even know what it's about, but some browsers try to be "smart" by replacing HTTP errors with their own "friendly" error messages. It's possible that 500 error is all that he sees and there are no specific details shown. edit: And by "some browsers" I mean "At least Internet Explorer 9", which gives me this on this HTTP error test page ymgve fucked around with this message at 08:01 on Jul 25, 2012 |
# ? Jul 25, 2012 07:57 |
|
<!-- IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddee ffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz1122 3344556677889900abacbcbdcdcededfefegfgfhghgihi hjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsu bcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwx hyz1i234j567k890laabmbccnddeoeffpgghqh iirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz 2z113223434455666777889890091abc2def3ghi4jkl5m no6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j 0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz 3aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4 jkj5lkl6kml7mln8mnm9ono -->
|
# ? Jul 25, 2012 08:02 |
|
Biowarfare posted:<!-- Funnily enough, I think chrome had the same thing. I think it was a 404 page I was trying to get working with a .htaccess on an Apache server, but it wasn't working. Turns out it had to be over a certain filesize for it to work, and just placing a single <img> wasn't big enough
|
# ? Jul 25, 2012 08:11 |
|
I thought he knew what he was doing because he was directly reading the response from chrome dev-tools.
|
# ? Jul 25, 2012 10:31 |
|
Doc Hawkins posted:Github issues are pretty bad, but I wouldn't award them full-blown horror status why are github issues bad. they do what they're supposed to pretty well i think
|
# ? Jul 25, 2012 10:46 |
|
Here's a nice, simple horror. From the source of a product thumbnail page, repeated for every single thumbnail present on the page (minimum 36): code:
|
# ? Jul 25, 2012 14:29 |
|
The most horrendous code I've ever seen, is some guy that thought he was coding motherfucking assembly code in PHP or something, check this out:code:
The entire loving CMS is a single clusterfuck of an index.php, which has mySQL queries, HTML, and basically everything in it. It's also 3000 lines long. ALL VARIABLE NAMES ARE TWO LETTERS LONG. It's madness. I mean, here I am, making a real effort to keep my team following best practices, coding in symfony2 neatly (you may or may not agree with the choice of symfony2, but it's still a very neat and modern MVC framework, I like it very much)... and there's still guys like THAT who are seemingly stuck in 1999 or something. What the flying gently caress. On the other hand, thanks to them it's really easy to get a good-paying job. Companies here are so disappointed with the rampant bad coders, they'll hire a semi-competent programmer faster than you can blink.
|
# ? Jul 25, 2012 16:54 |
|
Ithaqua posted:Here's a nice, simple horror. Webserver I use automatically strips non-[if IE] comments and minifies CSS and JS automatically
|
# ? Jul 25, 2012 17:29 |
|
Pochoclo posted:The most horrendous code I've ever seen, is some guy that thought he was coding motherfucking assembly code in PHP or something, check this out: I find the repeating nested program structure to be a much worse coding horror than the 2-letter variables.
|
# ? Jul 25, 2012 17:46 |
|
Beef posted:I find the repeating nested program structure to be a much worse coding horror than the 2-letter variables. Yeah, there's a reason I picked that specific part. Now imagine all the 3000 lines of it are just as terrible. It's like Boatmurdered, in PHP form.
|
# ? Jul 25, 2012 19:08 |
|
PHP, is_readable(), has a curiosity in its documentation.quote:bool is_readable ( string $filename ) Except... quote:Upon failure, an E_WARNING is emitted.
|
# ? Jul 25, 2012 20:35 |
|
Golbez posted:PHP, is_readable(), has a curiosity in its documentation. The bigger horror is that it exists at all. There is no way to provide that function without creating a race condition. What if someone deletes the file in between that call and your attempt to read it?
|
# ? Jul 25, 2012 20:48 |
|
leterip posted:The bigger horror is that it exists at all. There is no way to provide that function without creating a race condition. What if someone deletes the file in between that call and your attempt to read it? And if I try to run fopen() on a non-existent file, it throws a warning. Keep in mind that it also returns false. The documentation even helpfully suggests using @ to suppress the warning. Perhaps PHP functions should throw exceptions, because this seems like a reasonable place for that.
|
# ? Jul 25, 2012 21:03 |
|
Golbez posted:PHP, is_readable(), has a curiosity in its documentation. In theory, all the usual problems you'd have with a file name (too much symbolic link indirection, path name is too long, one of the directories in the path isn't, etc.), except PHP converts any error returned from access() to false and calls it a day.
|
# ? Jul 25, 2012 21:08 |
|
Golbez posted:And if I try to run fopen() on a non-existent file, it throws a warning. Keep in mind that it also returns false. The documentation even helpfully suggests using @ to suppress the warning. Perhaps PHP functions should throw exceptions, because this seems like a reasonable place for that. The point is that you have to assume that the fopen() call could raise a warning regardless of how much checking you do because by the time you get to actually opening the file the state of the filesystem could be different, so why bother doing the checking? It's a completely worthless function.
|
# ? Jul 25, 2012 21:38 |
|
leterip posted:The bigger horror is that it exists at all. There is no way to provide that function without creating a race condition. What if someone deletes the file in between that call and your attempt to read it? That isn't exactly a PHP problem, though. Tons of APIs have stuff like that.
|
# ? Jul 25, 2012 21:52 |
|
I've been lobbying to the PHP developers for years to change is_readable() to take source code as input instead of a file name.
|
# ? Jul 25, 2012 23:01 |
|
Gazpacho posted:I can assure you that the real problem is programmers just not knowing what memory is.
|
# ? Jul 26, 2012 02:48 |
|
Maybe doesn't belong in here, but...
|
# ? Jul 26, 2012 04:52 |
|
Strong Sauce posted:Maybe doesn't belong in here, but... I assume that the second line 27 is supposed to be a *?
|
# ? Jul 26, 2012 05:47 |
|
TextMate 2 is if not a coding horror at least a coding project horror. Is it possible to parlay years of widespread success into something more flaccid than TM2?
|
# ? Jul 26, 2012 07:11 |
|
I'm still using TextMate and those were two separate lines, not a wordwrapped line. Not sure what caused the problem.
|
# ? Jul 26, 2012 07:51 |
|
leterip posted:The point is that you have to assume that the fopen() call could raise a warning regardless of how much checking you do because by the time you get to actually opening the file the state of the filesystem could be different, so why bother doing the checking? It's a completely worthless function. There are other reasons to check if a file exists or is readable than to write (or read) from it. Sometimes you just want to know if the file exists and is readable.
|
# ? Jul 27, 2012 11:10 |
|
Steampunk Hitler posted:There are other reasons to check if a file exists or is readable than to write (or read) from it. Sometimes you just want to know if the file exists and is readable. Okay. But the information you receive from this function could be immediately out of date, no matter what you are going to use it for. It's a useless function.
|
# ? Jul 27, 2012 14:27 |
BP posted:Okay. But the information you receive from this function could be immediately out of date, no matter what you are going to use it for. It's a useless function. If all you want to know is if a process ran already today, you can just check to see if a file is there and readable. If someone for some godawful reason deletes it thereafter to try to have the process run again anyway, who the hell cares, you don't run again and it's their fault for being slow. (this is for the very popular "touch ALREADY_RAN_DATESTAMP" way of tracking this, of course)
|
|
# ? Jul 27, 2012 14:33 |
|
^^^ okay I suppose that worksBP posted:Okay. But the information you receive from this function could be immediately out of date, no matter what you are going to use it for. It's a useless function. What about Scenario 1: Have a script that runs for 10 minutes but only if it can read a file. So we check if the file is readable first, then run the 10 minutes, and at the end open the file and write to it. Scenario 2: Open the file first because handles are cheap and it doesn't matter if you fopen it or check if it's readable, but this keeps it locked for 10 minutes which really is that a bad thing? Yeah, you're right, I got nothing. So, then we have is_writable(), but also this nugget: file_exists(). quote:bool file_exists ( string $filename ) I am probably missing something here, but why the hell would this return "unexpected results" because of a large file? It can't see if that file exists if it's more than 2gb? What unexpected results would we have? Returning false if the file is actually there? Is this actually a thing that happens? Golbez fucked around with this message at 14:58 on Jul 27, 2012 |
# ? Jul 27, 2012 14:36 |
|
Golbez posted:I am probably missing something here, but why the hell would this return "unexpected results" because of a large file? It can't see if that file exists if it's more than 2gb? What unexpected results would we have? Returning false if the file is actually there? Is this actually a thing that happens? Then again it is PHP, so maybe checking for the existence of a file includes checking the size of the file for some reason.
|
# ? Jul 27, 2012 15:04 |
|
BP posted:Okay. But the information you receive from this function could be immediately out of date, no matter what you are going to use it for. It's a useless function. Well "this file existed when I started doing what I'm doing so I'm going to assume it still exists" and "this file has never existed within the scope of what I'm doing" are two quite different situations that usually call for different actions. Obviously you still have to write defensive code, but it's a bit of stretch to say that checking if a file exists is useless.
|
# ? Jul 27, 2012 16:06 |
|
Goat Bastard posted:Well "this file existed when I started doing what I'm doing so I'm going to assume it still exists" and "this file has never existed within the scope of what I'm doing" are two quite different situations that usually call for different actions. Obviously you still have to write defensive code, but it's a bit of stretch to say that checking if a file exists is useless. True. I guess you can use a file existence check as a way to short-circuit unnecessary code--ie skip doing processing that will eventually fail due to a missing file, rather than waiting until you actually need the file before failing. But you should always also check at time of open.
|
# ? Jul 27, 2012 17:23 |
|
silvergoose posted:If all you want to know is if a process ran already today, you can just check to see if a file is there and readable. If someone for some godawful reason deletes it thereafter to try to have the process run again anyway, who the hell cares, you don't run again and it's their fault for being slow. I use something like this for a cron job at work; it only runs every 5 minutes (or manually), and when it starts up it checks if a file exists (and tries to get the content if it does). If the file doesn't exist, it continues. If the file does exist, but the timestamp is more than five minutes old, it continues as well (but writes the latest timestamp to the file). At the end, the file is removed. It's not entirely worthless; I personally think that the obsession over race conditions is a little unwarranted if you have some control over what's going on and you aren't multithreaded, but everybody seems to throw a fit over them.
|
# ? Jul 27, 2012 17:34 |
|
Zamujasa posted:I use something like this for a cron job at work; it only runs every 5 minutes (or manually), and when it starts up it checks if a file exists (and tries to get the content if it does). If the file doesn't exist, it continues. If the file does exist, but the timestamp is more than five minutes old, it continues as well (but writes the latest timestamp to the file). At the end, the file is removed. A little caution is warranted even when today's environment doesn't call for it, because next year all kinds of other processes could have been introduced that interfere with your program's resources.
|
# ? Jul 27, 2012 18:15 |
|
We're losing sight of the big picture. The existence of is_readable is not the true horror. The true horror is that fopen() will always throw a warning if the file is not readable, unless you silence errors on the function call. It seems like they expect you to run is_readable first, and then run fopen, but in normal usage that could still result in fopen not opening the file. Most people would check to see if it returned false and move on, but now you have to manipulate the error reporting or simply ignore when your log gets a warning, both of which are poor options.
|
# ? Jul 27, 2012 18:17 |
|
|
# ? Apr 29, 2024 16:20 |
|
Eggnogium posted:A little caution is warranted even when today's environment doesn't call for it, because next year all kinds of other processes could have been introduced that interfere with your program's resources. I agree, I'm just saying that everyone seems to be acting as if race conditions are the newest goto. As for PHP, whatever happened to PHP 6? I seem to recall it existing at some point years and years ago, but then it got rolled back out of nowhere and seems to have been erased from existence. Is that just my imagination? Because it seems like a PHP 6 would be a great time to start working on cleaning up some of the larger horrors in PHP, like the lack of exceptions.
|
# ? Jul 27, 2012 18:20 |