|
HappyHippo posted:"Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp." Norvig's corollary: “Any sufficiently complicated LISP program is going to contain a slow implementation of half of Prolog”
|
# ? May 9, 2012 21:38 |
|
|
# ? Apr 25, 2024 08:06 |
|
yaoi prophet posted:Look, I just want to know why we've been writing text using the same 26 letters for hundreds of years. Isn't it time we started using something more English 2.0? Good idea!
|
# ? May 10, 2012 00:49 |
|
pokeyman posted:How does anyone justify using PHP for a new project? -It's a popular enough solution to be something of a buzzword in the business domain, or at least it holds a mental association in the business domain for whenever "we have to build software to do X" comes up. -It's super cheap, at least the sticker price is, when you factor in skillset availability, salaries, expected time to market and so on. -It is involved in some appetizing success stories. Well, at least I'm sure there's an outsourced software success story out there. Maybe. I had to work jointly with a guy somewhere in the former USSR for a while and he knew his stuff and produced quality code, minus the times he'd randomly disappear for a month or two due to military service. Does that count? Combine the above and it (outsourcing OR php) is far and away an A-list superstar when it comes to meeting requirements that are held to "page loads, looks pretty, good enough for me" standards of QA/testing. I think that's half the problem: dev costs and time to market are such a big deal for 99% of all webdev projects that a lot of decision makers under those pressures will ignore or happily assume the risks of heavy long term maintenance costs, security vulnerabilities, low threshold for new bugs, and so on if it means they can get the core requirements and most basic use cases up and working asap and on a budget they'll feel like bragging about. Bhaal fucked around with this message at 01:26 on May 10, 2012 |
# ? May 10, 2012 01:21 |
|
shrughes posted:Diff tools do not need to know about ASTs because they work perfectly fine without them and much more predictably without them. Line based diffs using the classic O(ND) algorithm are unbearably awful and I don't understand how anyone who's had to look at non-trivial diffs could think otherwise.
|
# ? May 10, 2012 01:35 |
|
If I understand what this argument is about, if you have a diff tool based on the AST of the language in the source files, what if you make a change that is a syntax error in the language? Will the diff tool break down? Would the programmer have to keep two different diffing behaviors in their head for when the AST can't be created?
|
# ? May 10, 2012 02:11 |
|
Fren posted:If I understand what this argument is about, if you have a diff tool based on the AST of the language in the source files, what if you make a change that is a syntax error in the language? Will the diff tool break down? Would the programmer have to keep two different diffing behaviors in their head for when the AST can't be created? obviously the editor would just refuse to let you save the file
|
# ? May 10, 2012 02:13 |
|
yaoi prophet posted:Look, I just want to know why we've been writing text using the same 26 letters for hundreds of years. Isn't it time we started using something more English 2.0? there are more than 26 letters (in english) if you are pedantic and see carolingian minuscule and latin as different scripts
|
# ? May 10, 2012 02:17 |
|
Zhentar posted:Line based diffs using the classic O(ND) algorithm are unbearably awful and I don't understand how anyone who's had to look at non-trivial diffs could think otherwise. When merging you just burn through them. So many people complain about merging and then when I look at their merges they just have to loving do the merge, burn out your mind's swap space, and get it over with and in the worst case it takes a few minutes modulo maybe one or two compilation mishaps. And it becomes an all day thing for them. Maybe I'm just superhuman. Oh also some people for some reason don't enable 3-way diffs. They are wrong to not do so.
|
# ? May 10, 2012 02:20 |
|
shrughes posted:You end up never knowing what format your code is really in, and that has side effects like writing ad-hoc perl scripts to help with large renamings or refactorings much harder. That's not the only side effect, you surely get others because you decided to make things complicated instead of keeping them simple. I agree about not storing/editing ASTs but you are missing the point on this one. The compiler has the best knowledge about what each symbol in the code means. It knows the difference between a type named Foo and a local variable named Foo, something that is extremely difficult to get right with a regex. That's part of the reason MS is exposing the compiler as a service in the next version of VS - so you can write code that writes code, with full access to the compiler and intellisense. It's an extremely powerful concept once you wrap your brain around it. Bottom line: refactors should never be dumb text replacements... They should use the compilers knowledge of the code to make sure the factor is verifiably correct. Same for renames. Edit: as for diffs, why does it have to be one or the other? Why can't the diff tool use both textual analysis and compiler services to figure things out? I'm not aware of any such tool but I wish there was one. It is often immediately obvious that the diff tool has picked up a stray bit of code between two methods and made hash of the file, where if it had even rudimentary knowledge of the context it would know it was looking at two different methods. It could even trivially handle things like source code reorganization. Simulated fucked around with this message at 02:49 on May 10, 2012 |
# ? May 10, 2012 02:46 |
|
shrughes posted:When merging you just burn through them. So many people complain about merging and then when I look at their merges they just have to loving do the merge, burn out your mind's swap space, and get it over with and in the worst case it takes a few minutes modulo maybe one or two compilation mishaps. And it becomes an all day thing for them. Maybe I'm just superhuman. I don't have much trouble with merges, since we've got a huge, established code base people are rarely stepping on each others' toes. Except there was this one time where I made a bunch of changes to a file and another guy had the gall to move a bunch of code from near the top of the file to the bottom of it. It took me a couple hours to sort that one out, even with the 'just burn through it'. But when it comes to looking at code diffs (which I do a lot, since all of our development is required to go through two rounds of code review), I just couldn't handle going back to a plain jane diff tool.
|
# ? May 10, 2012 02:58 |
|
Bhaal posted:Similar reasons to why people still regularly outsource critical core-business software to the other side of the globe. What about -We already have PHP-skilled programmers and are actually good at our job and don't gently caress it up like 99% of PHP programmers do?
|
# ? May 10, 2012 03:16 |
|
Ender.uNF posted:That's part of the reason MS is exposing the compiler as a service in the next version of VS - so you can write code that writes code, with full access to the compiler and intellisense. That won't be in VS11/2012 (whatever they call it), unfortunately. It's pretty cool stuff, though. My favorite part of it is that it adds a REPL for C#.
|
# ? May 10, 2012 03:21 |
|
Fren posted:If I understand what this argument is about, if you have a diff tool based on the AST of the language in the source files, what if you make a change that is a syntax error in the language? Will the diff tool break down? Would the programmer have to keep two different diffing behaviors in their head for when the AST can't be created? I suppose it would be the same as some theoretical precommit hook in svn not allowing you to commit a file with a syntax error in it.
|
# ? May 10, 2012 04:47 |
|
Ender.uNF posted:The compiler has the best knowledge about what each symbol in the code means. It knows the difference between a type named Foo and a local variable named Foo, something that is extremely difficult to get right with a regex. That's part of the reason MS is exposing the compiler as a service in the next version of VS - so you can write code that writes code, with full access to the compiler and intellisense. It's an extremely powerful concept once you wrap your brain around it.
|
# ? May 10, 2012 05:15 |
|
Ender.uNF posted:Edit: as for diffs, why does it have to be one or the other? Why can't the diff tool use both textual analysis and compiler services to figure things out? I'm not aware of any such tool but I wish there was one. It is often immediately obvious that the diff tool has picked up a stray bit of code between two methods and made hash of the file, where if it had even rudimentary knowledge of the context it would know it was looking at two different methods. It could even trivially handle things like source code reorganization. I remember some sed-like tool for C that allowed you to do replacements based on templates (replace the names of local variables, etc.) I know I saw it once, but I cannot find it again for the life of me. EDIT: I believe it was Coccinelle. Blog post about it. Suspicious Dish fucked around with this message at 05:51 on May 10, 2012 |
# ? May 10, 2012 05:42 |
|
code:
|
# ? May 10, 2012 06:14 |
|
Ender.uNF posted:the difference between a type named Foo and a local variable named Foo, something that is extremely difficult to get right with a regex. The right tool for something like this is a kick in the balls.
|
# ? May 10, 2012 12:46 |
|
xf86enodev posted:The right tool for something like this is a kick in the balls. Giving a type and its constructor exactly the same name is standard practice in Haskell code:
|
# ? May 10, 2012 16:25 |
|
Not only that but it's valid code, so either you do "the right thing" with tooling or you go all Douglas Crockford.
|
# ? May 10, 2012 16:27 |
|
Golbez posted:What about Must be nice to work inside a unicorn. Do you guys have a mermaid tank in the lobby?
|
# ? May 10, 2012 16:47 |
|
Munkeymon posted:Must be nice to work inside a unicorn. Do you guys have a mermaid tank in the lobby? Funny thing is, I referred to us as a unicorn to my boss this very morning. We send out a rather simple PHP test. It has been passed 100% exactly twice since I've been here: Once by me, and once by the one guy we've hired since I've been here. Some of the responses we get from that... oy.
|
# ? May 10, 2012 16:59 |
|
question: "Is '==' a transitive operation?" response: "Yes?" correct answer: "No." question: "Is a string distinct from a number?" response: "Yes!" correct answer: "Not really except when it is."
|
# ? May 10, 2012 17:10 |
|
question: it's php 5.4 already and there is still an error in transliterated hebrew. what causes it?
|
# ? May 10, 2012 17:24 |
|
Biowarfare posted:question: it's php 5.4 already and there is still an error in transliterated hebrew. what causes it? in my defense we're still on PHP 5.1
|
# ? May 10, 2012 17:28 |
|
What is it with PHP and virtually every environment for it? It seems like PHP is almost always running disgustingly out of date versions, no "normal host off the street" (or anywhere else really) runs up to date/anywhere close to up to date versions/5.4?
|
# ? May 10, 2012 17:53 |
|
Biowarfare posted:What is it with PHP and virtually every environment for it? It seems like PHP is almost always running disgustingly out of date versions, no "normal host off the street" (or anywhere else really) runs up to date/anywhere close to up to date versions/5.4? In our case it was either RHEL5 only supporting up to PHP 5.1, or if they supported higher they didn't include the extensions we needed, or what not. I don't know, I've been bitching at the higherups for years about it, and they consider having support more important than bleeding edge. We're finally testing a new version of RHEL so we should be at 5.3 soon! As for normal webhosts... laziness? No clue. The worst is when someone's still running PHP4.
|
# ? May 10, 2012 17:59 |
|
SlightlyMadman posted:What about an svn hook that runs a whitespace formatter, and if it passed some threshold of changes, rejected the commit. In my experience, anyone who can't think straight enough to format their whitespace has other problems too. On one hand, it's a bit annoying when it won't accept some particular special-snowflake formatting that makes one function a bit easier to read. On the other, there are absolutely no files with mangled indentation, trailing whitespace, elided braces, or other such formatting horrors.
|
# ? May 10, 2012 18:12 |
|
Golbez posted:We send out a rather simple PHP test. It has been passed 100% exactly twice since I've been here: Once by me, and once by the one guy we've hired since I've been here. Some of the responses we get from that... oy. Care to share? A short-lived pastebin or whatever wouldn't show up on search results
|
# ? May 10, 2012 18:33 |
|
Munkeymon posted:Care to share? A short-lived pastebin or whatever wouldn't show up on search results It's basically: * Replace part of a string with something else. * Using regular expressions, remove everything that's not a letter or single space from a set of strings. ** Most people simply go for /[^A-Za-z ]/, without realizing the single space part of the instructions. * Add X days to a date, and if the new date falls on a weekend, push it to the following Monday ** This is where most people trip up. They usually add days to it by adding seconds to the time, so... strtotime($date1) + 60*60*24*x. Which fails because we cross daylight saving time in some of these, where you run into days that are not exactly 86400 seconds long. The main thing this tests is reading comprehension, if you can read and understand the instructions. About half fail on this alone. The other half fail on the adding days. Usually other things too, but no one's gotten the date addition right without acing the rest. The sad thing is, if they actually cared about getting the job like I did and verified their work by counting days for each example, they'd realize that they'd screwed up.
|
# ? May 10, 2012 18:54 |
|
Golbez posted:It's basically: quote:* Using regular expressions, remove everything that's not a letter or single space from a set of strings. quote:* Add X days to a date, and if the new date falls on a weekend, push it to the following Monday Granted, I can see how some people would trip up (it's easier to take the obvious mistake route) but provided the information that the easy solution fails, the alternate working solution is pretty easy to come up with. At least, I hope I got that right. (It'd also be a lot easier to pass if this was something you got to do on your own time or at least on a computer, instead of a written Javascript syntax exam that I had to take for this job. ) Zamujasa fucked around with this message at 19:16 on May 10, 2012 |
# ? May 10, 2012 19:13 |
|
Golbez posted:if the new date falls on a weekend, push it to the following Monday Zamujasa posted:adding a day if wday == 0 || wday == 6 Add two days if it's Saturday, one if it's Sunday.
|
# ? May 10, 2012 19:19 |
|
Zamujasa posted:Basically str_replace("a", "b", $str)... quote:What about using a two-pass search and replace, where you look for /[^A-Za-z]/ the first round then / {2,}/ the second? (I forget offhand if PHP accepts that length format, though. There's also probably an easier way to do it but work has me too preoccupied to put much thought into it) quote:This one is easy enough, using mktime(). Just provide the stuff getdate() gives you to it and run the returned timestamp through getdate() again, adding a day if wday == 0 || wday == 6. Since mktime allows days beyond the end of a month (which go into the next month) this is pretty simple even for a braindead solution I just came up with in 30 seconds. quote:Granted, I can see how some people would trip up (it's easier to take the obvious mistake route) but provided the information that the easy solution fails, the alternate working solution is pretty easy to come up with. Exactly, YOU think it's easy, and I think it's easy, but 99% of the people taking the test either don't think it's easy, or don't even notice they did it wrong. It's not like this is timed. They are choosing to hand in substandard and unchecked work. Edit: epswing posted:Add two days if it's Saturday, one if it's Sunday. strtotime('next Monday', $foo)
|
# ? May 10, 2012 19:20 |
|
Zamujasa posted:(It'd also be a lot easier to pass if this was something you got to do on your own time or at least on a computer, instead of a written Javascript syntax exam that I had to take for this job. ) Did it have questions on semicolon insertion? Q: What is the proper interpretation of: code:
|
# ? May 10, 2012 19:21 |
|
Golbez posted:It's basically: quote:This one is easy enough, using mktime(). Just provide the stuff getdate() gives you to it and run the returned timestamp through getdate() again, adding a day if wday == 0 || wday == 6. Since mktime allows days beyond the end of a month (which go into the next month) this is pretty simple even for a braindead solution I just came up with in 30 seconds. pigdog fucked around with this message at 19:26 on May 10, 2012 |
# ? May 10, 2012 19:22 |
|
Zamujasa posted:What about using a two-pass search and replace, where you look for /[^A-Za-z]/ the first round then / {2,}/ the second? (I forget offhand if PHP accepts that length format, though. There's also probably an easier way to do it but work has me too preoccupied to put much thought into it) Or one pass with positive lookahead: / (?= )|[^A-Za-z ]/ (edit: simpler regex) pokeyman fucked around with this message at 19:38 on May 10, 2012 |
# ? May 10, 2012 19:33 |
|
quote:Did the week start with Monday, or Sunday? Golbez posted:Other way around, wouldn't it? Otherwise the first one would get rid of all spaces. But yeah, that's basically it - condense multiple spaces into one, then remove all non-alphas and non-spaces. As for positive lookahead: I haven't delved into those because a lot of the playgrounds I mess with regexes on don't really support those. Good to know though, thanks -- I'll have to remember it. quote:There are multiple ways to do it, but most people appear to have been taught to always add time by using seconds so there's a lot of 86400s out there. The simplest way is simply strtotime('+x days', $foo), though using mktime() comes close, but requires you to remember or no or have an IDE that knows what order the arguments go in. Besides, I can't help but think that localization issues might cause problems, too. Does it always use "days"? (Then again, PHP in general seems to barf all over localization formatting.) quote:strtotime('next Monday', $foo) That would work as a second step, yes. As for the prior code, a niave solution would be to just keep running that in a loop until it didn't fall on a weekend any more, which was what I meant. Switching it would be better based on the number, of course, or strtotime if it worked reliably. And now my excuse for the above, I've been frying my brain trying to figure out why my boss seems to think this is "just seperate this poo poo into different files and call them as needed". I gave sample estimates for every part of the task (3 days, as every estimate prior has ran over due to discovery of horrors) and got a bunch of grief over it. And lo and behold, I find another horror: code:
Given how the last few times I've pointed out these horrors I've gotten in poo poo because suddenly I have to take time from my already-too-short estimates to fix, I might just keep this one buried until I can fix it later.
|
# ? May 10, 2012 19:35 |
|
Internet Janitor posted:question: "Is '==' a transitive operation?" php.net posted:Note that php comparison is not transitive:
|
# ? May 10, 2012 19:36 |
|
Golbez posted:What about It's certainly not unique to PHP either. It has just that right mixture of accessibility and productivity, and came along around the right time, to attract such a crowd. When I was in college it was VB that had a similar role, but to be fair, at least in the world of GUI apps, I remember my brain melting once or twice trying to navigate the MFC of circa 1999-2001 (6.0 I think?). That domain has come a long way since then, and I'm thinking when webdev and the toolset and paradigms used for it finally start to shift comprehensively instead of iteratively (I'm not sold on Nodejs or RoR or backbonejs or whatever else is trending on github these days as being the vanguard of that shift) we'll start to see PHP drop off and some other new framework/appstack start taking in all the fallout developers. Bhaal fucked around with this message at 20:09 on May 10, 2012 |
# ? May 10, 2012 20:06 |
|
Golbez posted:
|
# ? May 10, 2012 20:46 |
|
|
# ? Apr 25, 2024 08:06 |
|
Janin posted:I never get tired of posting this. It's stuff like this that made me religiously start using ===.
|
# ? May 10, 2012 20:57 |