|
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 |
|
|
# ¿ Apr 18, 2024 10:08 |
|
That or he doesn't know how to create an array of objects
|
# ¿ Feb 24, 2009 06:35 |
|
Why... why am I calling this private method...
|
# ¿ Mar 13, 2009 05:39 |
|
Mick posted:I think I like this one better. I promise this has been in (at least) the last two releases. This code.. is art.
|
# ¿ Mar 29, 2009 22:43 |
|
While we're still talking about timezones... https://www.eff.org/press/releases/eff-demands-withdrawal-bogus-time-zone-database-lawsuit Large Hardon Collider posted:I'm convinced these redirects are the web development version of the speed-up loop.
|
# ¿ Jan 13, 2012 01:47 |
|
Hammerite posted:It appears to pass the correct number of arguments to str_replace()? You're right I missed the nested str_replace in there. I knew it was doing extra redirects. While I could see why he would redirect a lat/long query to one that redirected to whatever zipcode it was, that became irrelevant when he just redirected the zipcode after saving it into a cookie or session. So essentially what you just said...
|
# ¿ Jan 13, 2012 06:28 |
|
Eliza posted:It should be noted that input() in its current form is abolished in Python 3.x though. While the name of the function still remains, what's behind it is essentially 2.x's raw_input(). Unless I am mistaken, that one always returns a string and will be recognised as such, so this particular horror is something belonging to an ending pathway. This whole discussion was started because of this difference...
|
# ¿ Jan 18, 2012 22:24 |
|
Internet Janitor posted:My best guess is that "variable variables" are a popular feature because it lets you add a layer of indirection to references in a program without disturbing the code that already exists. Once you think of it in terms of hacking new stuff into existing codebases with minimal effort it makes a terrifying kind of sense. I've never actually seen anyone use "variable variables" so I doubt that it is popular feature. However it does allow you to weed out bad programmers if they think that is the best method. PHP can do pretty dumb things, and it gets labeled as a "beginner's language" so I guess is a bad combination. If I do use PHP for a project, I only work using a framework to avoid a lot of the crappy things PHP can do.
|
# ¿ Feb 15, 2012 00:16 |
|
Optimus Prime Ribs posted:What version of PHP causes this? According to the thread: this "optimization" https://github.com/php/php-src/commit/0accb4b0094b8fdda905e0a374843f0c775f4537
|
# ¿ Feb 21, 2012 20:56 |
|
Janin posted:https://github.com/rails/rails/issues/5228 Note that there are two distinct portions of this. One was that he posted this as a rails issue and when it was closed because the main rails committers said it was up to developers to implement checks, he exploited the rails app on GitHub (one of the larger rails running apps) to prove a point. There has been tons of argument over what the default in rails should be, a lot of the main rail committers were opposed to the idea (I am not really sure the exact reason but it probably has something to do with having to be right all the time). This pretty much forced their hand in implementing a whitelist rather than the blacklist
|
# ¿ Mar 6, 2012 01:08 |
|
Optimus Prime Ribs posted:I want to believe that a person didn't willingly type that out. Do you think those programmers ever wonder, "drat I wish there was an easier way to do this. If only there were some sort of thingy that can hold all these similar items!" I had something similar when I worked at company a few years ago. My company was expanding and hired a guy without ever asking me if I wanted to talk to him Anyways, we don't interact much since his projects aren't the projects I'm working on for the site. But finally, I had to take over for one of his projects and as I'm browsing through the code, I see some code that outputs html like this. code:
code:
Needless to say, I ended up fighting constantly with him.
|
# ¿ Mar 23, 2012 20:23 |
|
yaoi prophet posted:I've never even touched PHP, what's the proper way to do this? The problem is that you want fields as an array, so there are two ways to accomplish this. Either have the inputs be named, "field[0], field[1], field[2], field[3]" or do it the easier way if you know that $arr[] = "blah" appends a new element to the end of the array you can do this: code:
And the second part is just part of the pain from the first part, but also what Optimus Prime Ribs said. I think PHP only returns a warning if an element you are referencing doesn't exist in an array so you can just surpress it but it's always good to actually check that an element actually exists using array_key_exists. Strong Sauce fucked around with this message at 21:59 on Mar 23, 2012 |
# ¿ Mar 23, 2012 21:45 |
|
I don't know if I'd care if that was the only thing 'wrong' with the code.
|
# ¿ Mar 24, 2012 09:34 |
|
McGlockenshire posted:Perl doesn't let you do one-line no-curly if statements... unless the statement precedes the if. Ruby allows this too.
|
# ¿ Mar 27, 2012 19:16 |
|
I do not get that style at all. More so when they say that function definitions should not indent curly braces. And then for switch/case statements a case doesn't get indented after the indentation form the curly brace. I'm all for following coding styles but it should just boil down to a few things. Don't make me remember complex indenting rules.
|
# ¿ Mar 28, 2012 20:32 |
|
Did they seriously hard code every special offer code they have?
|
# ¿ Mar 29, 2012 02:19 |
|
pigdog posted:I hope not to sound like a contrarian jerk... But aside from general badness and not putting start and expiry dates in the code it's not necessarily a bad idea to hard-code promotions like that, depending on circumstances. Making a nice administration UI for something like that an order of magnitude more work. If an offer is complex, then making it configurable is even more complex. If it's a small company, the number of offers and options are limited enough to have a grasp of, and it's easy to deploy new versions, then it may very well be easier to tell the VB programmer to update the code and redeploy. As opposed to spending a lot more resources, and dealing with a lot more integration, security and maintenance issues, to develop an interface for non-technical people who may end up needing the help of technical people regardless. At the very least they seem to have some code reuse going on, and have the offers separated into distinct methods/objects. Come to think of it, that code could look far worse. I agree with you, but there are tons of better ways than listing out every single discount. At the very least there should be a separate text file with a hash of all possible "coupon" names. Then in each hash is an object that has something like, "description, type, value, num_discount_times" as strings and maybe an array "list_of_items" that contains a list of items that can use this coupon. 'description' is just a description of the coupon, 'type' is some ENUM that contains what kind of discount it is maybe, [percent_off, price_off, free], 'value' is the value based off what type is. E.g. if type = percent_off and value = 10, then its a 10% off coupon. 'num_discount_times' is another ENUM that determines how many times you should apply this coupon to an order which maybe contains [per_item, only_once]. I mean I've probably accounted for a large portion of what most companies want in their coupon/discount config. So now that you have this hash, you have very simple if/then or switch statements in your actual controller code that can apply any type of discount written by the data in the hash, and if for example you need to handle expiration you can add a new property to the object and then rewrite code in the controller to handle expiration. I don't think there needs to be a front-end to the discounts but writing every single possible coupon out like that either means the previous developer was extremely lazy or just not a decent developer. Strong Sauce fucked around with this message at 09:02 on Mar 29, 2012 |
# ¿ Mar 29, 2012 08:59 |
|
The fact that it chugs on a x120e while seemingly not doing anything processor/graphic intensive is pretty frustrating. Wish they would clean the code up rather than add new things you have to worry about like hunger.
|
# ¿ Apr 8, 2012 07:44 |
|
Got to respect his ability I get his game into a playable state for release. I probably would have been stuck trying to make everything really efficient for no real benefit. But really notch, improve the game so a NetBook can play it. Stop putting in dumb things no one likes
|
# ¿ Apr 9, 2012 01:02 |
|
My kingdom for a new LOL PHP error.
|
# ¿ Apr 9, 2012 08:57 |
|
Not sure about 'hate'. That HN thread seems on pretty even keel with a lot of people saying good and bad things about PHP. And overall I don't really see much comments about how the article sucked unless you imply that people who comment defending PHP hated the article.
|
# ¿ Apr 10, 2012 11:03 |
|
https://bugs.php.net/bug.php?id=54547 With rasmus reply!
|
# ¿ Apr 12, 2012 20:20 |
|
Yeah not sure why you assumed PHP forced some kind of weird internal MySQL representation, but you can create tables with ints, varchars, text, dates just like normal, it just pulls them out as strings since the reasoning is you're just going to output them to HTML.
|
# ¿ Apr 13, 2012 08:35 |
|
Suspicious Dish posted:
The only coding horror is that he doesn't bother just using the short tags since he's already ruined it by having a "<?=" Why bother with "<?php" if you're already guaranteeing your script to fail when someone turns off short tag support. Edit: Ah apparently since 5.4 <?= is accessible regardless of whether short tags is on or off... Certainly not a coding (implementation?) horror. No siree bob. Strong Sauce fucked around with this message at 01:09 on Apr 20, 2012 |
# ¿ Apr 20, 2012 01:05 |
|
http://en.wikipedia.org/wiki/HTTP_referer
|
# ¿ Apr 20, 2012 23:25 |
|
Bhaal posted:So my company has an "ancient" website (been around since ~2005). Kind of an entrepreneurial first draft business website by the company's founders. It was made by some outside group that was gone before the CTO ever came aboard years ago; he counts himself lucky that he has full access to the hosting account that the server runs through. The site is very simple and "works", plus the company changed its focus years ago and that site only sees a trickle of clients and is all managed by one of the senior sales/account managers. Nobody in IT has had to ever go near it. I don't know what to tell you other than condolences, but it's probably best to not think that most developers write code like that (because they do). At the very least when I first heard about SQL injection I got real nervous and used addslashes at the very least, then eventually the mysql_escape_string function. Note: I always thought it was PHP's terrible decisions that led the current escape string function to be called, "mysql_real_escape_string" but apparently this is MySQL's doing as PHP is just copying the function name implemented in MySQL API
|
# ¿ Apr 25, 2012 20:09 |
|
ShadoX posted:And now the real answer: Parameterized queries. Suspicious Dish posted:All of which are the wrong solution, and can be bypassed in novel ways. Use prepared statements.
|
# ¿ Apr 26, 2012 00:58 |
|
Ender.uNF posted:
Well PHP did have mysql_real_escape_string which works just fine (and still does) in preventing SQL injections as long as you craft the SQL string properly, and there were libraries that emulated parameterized queries that essentially did some scrubbing of the input. Obviously with the new PDO libraries it looks much cleaner and makes it less-prone to developer laziness.
|
# ¿ Apr 26, 2012 01:12 |
|
Thermopyle posted:This is probably a coding horror in and of itself, but I can't stand XML and I can't really articulate any reason that an XML-defender couldn't give an answer of some sort to. It's ridiculous verbosity? The fact that people misuse it and just shove everything into XML? There are obviously some good use cases for XML, somewhere down the line someone thought to use XML for everything. See: Java
|
# ¿ Apr 27, 2012 22:56 |
|
I would say I'm pretty well seasoned in PHP, but 1) I never knew == was not transitive and 2) I never knew "php" == 0 is true, which is probably why I assumed == would be transitive. Man, that is truly horrible.
|
# ¿ May 10, 2012 22:28 |
|
ToxicFrog posted:Does it make me a bad person that I want to find out who it was and then buy them your avatar? If you're not American, ITT is essentially a degree mill with a focus on technology, although I remember them expanding into crime/law enforcement related fields.
|
# ¿ May 14, 2012 23:46 |
|
Zamujasa posted:*Don't know how to use arrays....* http://forums.somethingawful.com/showthread.php?threadid=2803713&pagenumber=281&perpage=40#post401853293
|
# ¿ May 18, 2012 01:56 |
|
Apparently the cost of not having to deal with a bajillion my password doesn't work support requests. Must have been a lot of calls/emails.
|
# ¿ May 23, 2012 18:52 |
|
quiggy posted:That password is longer than 16 characters, so you can't use it on Battle.net, and is extremely vulnerable to a dictionary attack. Goddamn that is a pretty thorough dictionary if they have, "fuckthisgayearth"
|
# ¿ May 23, 2012 21:16 |
|
Fren posted:Functional programming in zsh. Do you really have to use that lambda character?
|
# ¿ May 24, 2012 06:21 |
|
The whole point of JSON was to be more lightweight than XML, I'm against anything that is going to signficantly bloat JSON libraries or its underlying structure. That said, just give me JSON + a way to handle binary blob data well. If implementing hexadecimals allows this to happen, so be it. But I guess what I want is just JSON+BSON.
|
# ¿ May 29, 2012 19:20 |
|
Maybe allow base64 encoded strings as literals, saves two bytes from the quotes Seems like transporting large blobs of binary data might be useful to some people and I can think of one reason why I'd rather transport the raw binary rather than an base64 encoded string but it's a probably a pretty specific use case. Just something I wouldn't mind if they implemented into some future version of JSON. But then it wouldn't be able to use it anyways while we wait for users to stop using older browsers/implementations. Strong Sauce fucked around with this message at 22:47 on May 29, 2012 |
# ¿ May 29, 2012 22:43 |
|
Internet Janitor posted:Not to pick on you, but: Well like I said, I'm not exactly handling large blobs of data using JSON right now, so there's no real effect on me. I merely stated that I could see that some people would find use in having JSON support a raw binary blob. MongoDB's already taken that idea and implemented it with BSON so Crockford saying that doesn't mean it'll stop people from implementing variations on his original idea.
|
# ¿ May 30, 2012 00:53 |
|
Yeah that bit about "micro" and "soft" not relating to my PENIS was kinda of awkward and weird but I'm more offended by the dance number, specifically that developers at a conference want something like that.
|
# ¿ Jun 9, 2012 02:10 |
|
|
# ¿ Apr 18, 2024 10:08 |
|
So what you're saying is, we're going to run out of IPv6 addresses because every atom in the universe wants to be a wifi hotspot?
|
# ¿ Jun 11, 2012 01:42 |