necrotic posted:I had forgotten how utterly horrible PHP is. I don't understand where those 3 examples you quoted would come into play in the real world at all
|
|
# ? Jul 26, 2014 05:11 |
|
|
# ? Apr 28, 2024 13:16 |
|
Somebody tell me who it was that decided to make every variable in lua global by default. I want to find him and kill him.
|
# ? Jul 26, 2014 05:30 |
|
Nippashish posted:Somebody tell me who it was that decided to make every variable in lua global by default. I want to find him and kill him. IIRC their rationale was that it's easier to go with mutating an existing variable default (i.e. global by default) and force declarations for introducing new variables at that scope, rather than needing global and nonlocal and getting other associated scoping issues from introducing new variables by default (local as default) in python and ruby. Which is especially if you want to have true lexical scoping; you need a clean way to say "I want to assign to this variable an a higher scope", and differentiate between the true global scope or just a higher, but non global scope if you have local by default, where as if you do global by default, you just always indicate when you need a new variable. It sucks to read when people don't use local, but the semantics are a lot simpler, and more familiar; it's what's used in Javascript, C{,++,#}, Java, and so on (though C family languages require variable declaration while javascript and lua just do an implicit global). Look Around You fucked around with this message at 10:21 on Jul 26, 2014 |
# ? Jul 26, 2014 10:19 |
|
fletcher posted:I don't understand where those 3 examples you quoted would come into play in the real world at all strcmp returns 0 if its arguments are equal or NULL if at least one of its arguments is not a string (edit: only sometimes! I think it's only if the value doesn't 'naturally' coerce to a string, for example numbers and NULL as arguments do not cause strcmp to return NULL). Guess what can happen if you do if (strcmp($_GET["whatever"], "some string") == 0)! Hint: the parameters in $_GET are not always strings! (by the way, this behavior is not at all documented! http://php.net/manual/en/function.strcmp.php) Deus Rex fucked around with this message at 10:30 on Jul 26, 2014 |
# ? Jul 26, 2014 10:25 |
|
Deus Rex posted:strcmp returns 0 if its arguments are equal or NULL if at least one of its arguments is not a string (edit: only sometimes! I think it's only if the value doesn't 'naturally' coerce to a string, for example numbers and NULL as arguments do not cause strcmp to return NULL). Lmfao at the guy in the comments suggesting md5-hashing strings to make sure they're equal. And then someone replying to him cautioning about hash collisions (instead of pointing out how absurd it is to use a hash function to test for routine string equality).
|
# ? Jul 26, 2014 10:39 |
|
Look Around You posted:Lmfao at the guy in the comments suggesting md5-hashing strings to make sure they're equal. And then someone replying to him cautioning about hash collisions (instead of pointing out how absurd it is to use a hash function to test for routine string equality). That guy's comment is amazing. quote:Sometimes when you compare two strings that look "the same", you will find that they aren't. If you don't want to bother finding out why, then this is a simple solution: Skimming the documentation, it looks like that "$string = implode(str_split($string));" just gets back to the original string. Is it just the commenter being dumb or does that code do something for some reason? Qwertycoatl fucked around with this message at 10:47 on Jul 26, 2014 |
# ? Jul 26, 2014 10:45 |
|
Qwertycoatl posted:Skimming the documentation, it looks like that "$string = implode(str_split($string));" just gets back to the original string. Is it just the commenter being dumb or does that code do something for some reason? I think it's like a hosed up way to coerce to string. So if $string is a number (or array, etc), it'll become a string of that number (array etc) instead.
|
# ? Jul 26, 2014 12:43 |
|
Look Around You posted:IIRC their rationale was that it's easier to go with mutating an existing variable default (i.e. global by default) and force declarations for introducing new variables at that scope, rather than needing global and nonlocal and getting other associated scoping issues from introducing new variables by default (local as default) in python and ruby. Which is especially if you want to have true lexical scoping; you need a clean way to say "I want to assign to this variable an a higher scope", and differentiate between the true global scope or just a higher, but non global scope if you have local by default, where as if you do global by default, you just always indicate when you need a new variable. It sucks to read when people don't use local, but the semantics are a lot simpler, and more familiar; it's what's used in Javascript, C{,++,#}, Java, and so on (though C family languages require variable declaration while javascript and lua just do an implicit global). As JS goes things get... tricky in edge cases. Consider this: code:
name is a property of window and while it is overridable, in this case it won't be; name will be assigned as a property of A (as - document.getElementsByTagName("A")[0].name will be 5 and it will be a string; don't worry - window.f will also be a string, because lol), f will be assigned as a property of window While this example is silly, once this amounted for a couple hours of debugging on why are events not properly bound to objects (as event names are affected by this as well). And adding an additional JS horror, this: code:
var name = 8 is the same as writing window.name = 8 and window.name has immutable type. Here's a fiddle: http://jsbin.com/nofopuro/1/ I think scopes could have been done better in JS. edit: edited per comment below - my mistake, I'm dumb canis minor fucked around with this message at 15:22 on Jul 26, 2014 |
# ? Jul 26, 2014 12:45 |
|
eithedog posted:As JS goes things get... tricky in edge cases. Consider this: The name behaviour is due to the way DOM events are defined in terms of JS scopes, not because of how JS scopes themselves work. DOM0 is indeed a mess, but using event listeners or out-of-markup functions makes that particular weirdness go away (window.f is a number, by the way.) quote:While this example is silly, once this amounted for a couple hours of debugging on why are events not properly bound to objects (as event names are affected by this as well). Can you give an example for the event name case? I'm trying to think of one that has this clash. quote:var name = 8 is the same as writing this.name = 8, which in global scope this = window; and window.name has immutable type var name = 8 and this.name = 8 don't have the same meaning in JS. Ignoring that variable declaration and property assignment have somewhat different semantics, this is not usually the variables object. It's very easy to see by putting the code in a function. JS scopes are pretty reasonable (though the lack of implicit this-binding for closures is annoying). DOM0's weirdness runs pretty deep; DOM1+ less so.
|
# ? Jul 26, 2014 14:40 |
|
In fact the one thing 'this' can't be is a local variable scope. (It could be some weird magic scopes like the scope of exception variable in ES3, but that insanity got fixed in ES5)
|
# ? Jul 26, 2014 15:15 |
|
Subjunctive posted:The name behaviour is due to the way DOM events are defined in terms of JS scopes, not because of how JS scopes themselves work. DOM0 is indeed a mess, but using event listeners or out-of-markup functions makes that particular weirdness go away (window.f is a number, by the way.) I thought I've tested that and typeof window.f gave me string, but getting back at it you're indeed correct (I was suprised when I've gotten string, but attributed it to parsing of attribute). I agree - separating JS and assigning listeners via code:
removes the ambiguity for scoping. quote:Can you give an example for the event name case? I'm trying to think of one that has this clash. If I remember correctly it was something similar to this: http://jsfiddle.net/u8g83/2/ / http://jsfiddle.net/u8g83/1/ - can't give you specifics though as it was some time ago. I memorized though not to bind events this way as you can't be sure what will be accessed - the global or local variable / function. quote:var name = 8 and this.name = 8 don't have the same meaning in JS. Ignoring that variable declaration and property assignment have somewhat different semantics, this is not usually the variables object. It's very easy to see by putting the code in a function. In this particular example it is - I've oversimplified it; I can see why it is erroneous though and I don't know why I've written that, sorry. Reverted to less stupid. canis minor fucked around with this message at 15:50 on Jul 26, 2014 |
# ? Jul 26, 2014 15:20 |
|
On a related note, I once saw someone link to this "rebuttal" to that article: http://forums.devshed.com/php-development-5/php-fractal-bad-design-hardly-929746.html Except that they ignored the part where the author of the article himself ("Eevee") shows up and (very politely) shits all over his arguments. Fake edit: I forgot that the guy attempting the rebuttal also gave us such gems as "JavaScript is not a loosely typed language."
|
# ? Jul 27, 2014 01:45 |
|
Color Gray posted:On a related note, I once saw someone link to this "rebuttal" to that article: Eevee posted:For an anecdote about Wikipedia: a number of common templates are locked, because editing any of them would apparently cause so much load it would effectively take the site down. What's that about?
|
# ? Jul 27, 2014 02:34 |
|
Thermopyle posted:What's that about? Wikipedia claims it's more because those templates are used so frequently that even temporary vandalism would be catastrophic: http://en.m.wikipedia.org/wiki/Wikipedia:High-risk_templates
|
# ? Jul 27, 2014 02:40 |
|
code:
|
# ? Jul 27, 2014 20:19 |
|
Sweevo posted:
https://github.com/samplemaker/RS-423_oscilloscope_downloader/blob/master/main.c Looks like this was a clue to help visually relate the value of that field back to what was actually being sent to the hardware ("TRAN:FILE:RNAM" for example is a command it writes down the serial port). But still whatever happened to abstraction.
|
# ? Jul 27, 2014 20:37 |
|
A bit of code that builds some indexes for a medical records app I'm working on. Kudos to anyone who identifies the language.code:
|
# ? Jul 29, 2014 05:33 |
|
Medical records and gibberish? Gotta be MUMPS.
|
# ? Jul 29, 2014 05:42 |
|
You didn't get sucked into Epic did you?
|
# ? Jul 29, 2014 06:57 |
|
There's got to be a MUMPS Best Practices out there somewhere and it's just a single page which says "Don't abbreviate all your critical language constructs to a single character, you fool."
|
# ? Jul 29, 2014 11:26 |
|
leterip posted:Medical records and gibberish? Gotta be MUMPS. Bingo! ohgodwhat posted:You didn't get sucked into Epic did you? VistA, actually. FileMan > Chronicles.
|
# ? Jul 29, 2014 14:39 |
|
Has https://github.com/lismore/MathematicalInterfaceForLanguage been posted here yet?
|
# ? Jul 29, 2014 19:08 |
|
Munkeymon posted:Has https://github.com/lismore/MathematicalInterfaceForLanguage been posted here yet? "Effective communication depends upon the I.Q. level of both people involved in the exchange of information." Please, go on....
|
# ? Jul 29, 2014 19:19 |
|
That's a reference to this guy by the way.
|
# ? Jul 29, 2014 19:33 |
|
Munkeymon posted:Has https://github.com/lismore/MathematicalInterfaceForLanguage been posted here yet? That's not even just a programming horror, there's a huge linguistic horror in there too: English cannot be described with only 10 parts of speech. Unless "Legal English" is some proper subset of English that only requires 10. edit: oh I just saw the rationalwiki link. this isn't really even something worth responding to, is it? double edit: wow this guy is insane: "David is an adjective, Wynn is an adjective, Miller is a pronoun. Two adjectives are a condition of modification, opinion, presumption, which modifies the pronoun, pro means no on noun. So therefore, I'm not a fact. I'm a fiction." FoiledAgain fucked around with this message at 20:02 on Jul 29, 2014 |
# ? Jul 29, 2014 19:41 |
|
person before me left this bonus: he used a library named php.js
|
# ? Jul 31, 2014 17:53 |
|
My favorite JS snippetcode:
|
# ? Jul 31, 2014 18:40 |
|
btrfs is in good hands:quote:From: Nicholas Krause <xerofoify <at> gmail.com> quote:From: Josef Bacik <jbacik <at> fb.com> quote:From: Dave Airlie <airlied <at> gmail.com>
|
# ? Jul 31, 2014 21:32 |
|
lolquote:To: Linus Torvalds <torvalds@linux-foundation.org> Reach for the stars, dude
|
# ? Aug 1, 2014 01:04 |
|
This guy is brilliant. It is literally your worst patch contributor come true. Start here and keep clicking Next by Date: http://www.spinics.net/lists/linux-rdma/msg20450.html
|
# ? Aug 1, 2014 02:12 |
|
Strong Sauce posted:This guy is brilliant. It is literally your worst patch contributor come true. This is incredible! A dozen emails, a half-dozen patches and absolutely nothing accomplished.
|
# ? Aug 1, 2014 03:13 |
|
He's having a quasi-meltdown on the btrfs mailing list. He submitted a patch that enabled a few more FALLOC_FL system call modes in the btrfs interface, without any supporting infrastructure to do anything at all with those flags. Original thread: http://thread.gmane.org/gmane.linux.kernel/1760397 Hugo Mills patiently, helpfully says "please think through what the gently caress you're doing" quote:You've just enabled two options, but you haven't actually implemented the code behind it. I would tell you *NOT* to do anything else on this work until you can answer the question: What happens if you apply this patch, create a large file called "foo.txt", and then a userspace program executes the following code? Follow-up thread: http://thread.gmane.org/gmane.comp.file-systems.btrfs/37358/focus=37367 Synopsis: Nick says (all paraphrased) "I've been trying to read the ext4 code...", Hugo says "btrfs is completely different on-disk, and again, please address the issues I mentioned last time", to which Nick replies quote:I believed I answered your questions , seems I need to loving test my patches. And about the reply about data structures , thanks seems the other fallocate functions are there and I need to read these first , I sent out my patch by accident as I didn't realize I have removed the error return by mistake. (emphasis mine, in this last quote)
|
# ? Aug 1, 2014 03:56 |
|
This response from Hugo Mills was really good (emphasis mine): https://lkml.org/lkml/2014/7/31/194 Hugo Mills posted:Date Thu, 31 Jul 2014 11:11:16 +0100
|
# ? Aug 1, 2014 04:08 |
|
Googling his email address leads me to believe that all he does is go around and submit unwanted and bad patches without any sort of testing. I can't decide if it's an over enthusiastic ten year old or someone with a mental illness.
|
# ? Aug 1, 2014 04:45 |
|
Seems some bonehead is editing things in production: https://familysearch.org/search/collection/list click any of the "view images" links and check the console spit debug log crap, plus the images don't actually show up as they normally do.
|
# ? Aug 1, 2014 12:35 |
|
Lysidas posted:btrfs is in good hands: Nick Krause is clearly a dumbass. Yeah, google his email and you come up with one bad, untested patch after another. That said, page_cache_release seems like a dumb name for a method that doesn't actually release page cache. If it releases a reference to the page, why not name the method release_page_cache_reference instead?
|
# ? Aug 1, 2014 16:44 |
|
Because "release" is commonly used purely to decrement a reference count and free if zero. c.f. IUnknown, NSObject
|
# ? Aug 1, 2014 16:57 |
|
I'm pretty impressed with the patience on display on the lkml, I'd have expected worse after things I've heard. I guess he's just some kid who's missing the forest for the trees and literally doing cargo-cult open source: he only sees other people write C code and submit patches and it's not getting through to him that he's missing the vast majority of the actual work that makes that possible in the first place.
|
# ? Aug 1, 2014 17:13 |
|
I can't help myself. One more post. http://thread.gmane.org/gmane.linux.kernel/1760397 again ("Add support to check for FALLOC_FL_COLLAPSE_RANGE and FALLOC_FL_ZERO_RANGE crap modes"): Theodore Ts'o, primary developer of e2fsprogs, maintainer of ext4 posted:There are also the conceptual failures. Before you do anything else, you need to be able to answer the question, "what do you think the flags FALLOC_FL_COLLAPSE_RANGE and FALLOC_FL_ZERO_RANGE are supposed to do?" What are the possible appropriate things for btrfs to do if it sees these flags? (Hint: there is more than one correct answer, and its current choice is one of them. What is the other one?) Nick Krause posted:I miss send this patch, that's my there are issues.
|
# ? Aug 1, 2014 17:16 |
|
|
# ? Apr 28, 2024 13:16 |
|
Paul MaudDib posted:Nick Krause is clearly a dumbass. Yeah, google his email and you come up with one bad, untested patch after another. Its a reference counted object, you're releasing it in the same way you release a smart pointer.
|
# ? Aug 1, 2014 17:32 |