|
Kharya posted:Basically it comes down to, "If it ain't broke, don't fix it."
|
# ¿ Jan 3, 2009 03:36 |
|
|
# ¿ Apr 24, 2024 23:45 |
|
Veritron posted:[-D AE_Title] I worked for a medical imaging company that had its own horrific (Ruby) script to generate and send DICOM files.
|
# ¿ Feb 27, 2009 03:38 |
|
Ryouga Inverse posted:Don't check in commented out code because you're half done with it. Check in only code that builds.
|
# ¿ Sep 12, 2009 03:55 |
|
niteice posted:From some old LaTeX code I wrote:
|
# ¿ Mar 10, 2010 14:11 |
|
If you want a laugh, I strongly recommend searching phpfreaks.com's forums for all of Q695's posts: http://www.phpfreaks.com/forums/index.php?action=profile;area=showposts;u=70191 haku posted:You have programming training?!?! Q695 posted:Yes, I have a degree in IT (my BS), focusing in Web Development (my AAS), and looking for work more along the lines of QA and eventually becoming an architect. Why is that so shocking? edit: aaah hahahaha http://www.phpfreaks.com/forums/index.php/topic,240167.0.html is pure gold. Q695 believed that using an HTML <input> type of 'password' automatically encrypted the data (with SSL) before sending it to the server. Q695 posted:Why did a college professor lie to me about it then? Why wouldn't password automatically encrypt the data when sending it? I can appreciate not being knowledgeable; you have to learn somehow. He's just so arrogant in his stupidity, when his suggestions are almost all bad ideas and he's proven wrong by smarter people in almost every post. He's a jackass to people that try to help him, too: http://www.phpfreaks.com/forums/index.php/topic,240090.0.html Lysidas fucked around with this message at 03:13 on Mar 19, 2010 |
# ¿ Mar 18, 2010 21:31 |
|
TRex EaterofCars posted:That reminds me of php's microtime() function. Goddamnit whoever wrote that is a cocksucker. If you're unfortunate enough to use PHP on Windows, microtime() will make you want to tear your eyes out. code:
|
# ¿ Jun 3, 2010 21:49 |
|
nielsm posted:from O(n) to O(n^2) It seems to be worse than that when you allow backreferences
|
# ¿ Apr 13, 2011 04:58 |
|
NotShadowStar posted:Here's the thing about school that they don't teach you: to think about what you're hearing. In this case, whenever somebody tells you to do the same thing in every instance, you should immediately start coming up with a counter-example and take them to task. This isn't being That Jerk In Class, this is seeing if their case holds up in every instance, or watch them fall apart because what they told you wasn't correct. This is a good point, but if you're learning introductory programming it isn't really worth it. When I was a TA for elementary Java programming, I got a lot of success out of telling the students "here's a rule; treat it as the truth until you learn why it isn't". For example: quote:If you're having trouble with the first few assignments, here's some advice. Every program that you write should have this structure: It let the students concentrate on what they needed to know at the moment and not on the boilerplate magic characters that let their programs compile. Of course by week 3 or 4, they're making classes that don't need a public static void main, but by then they learn why they were inserting that stuff in the first place and why they don't need it now.
|
# ¿ May 19, 2011 18:30 |
|
NotShadowStar posted:One of the big reasons why I left the biological sciences was the code was universally terrible. Outstandingly so. Like 'well that's brilliant that it works, but you shouldn't be doing it'. The tool authors didn't know what the gently caress, refused to listen to anyone who had actual experience in the 'real world' (me), and I couldn't talk to the PIs because they're like 'it works who gives a gently caress'. Which left people like me trying to glue this wretched poo poo together was left holding the bag. GrumpyDoctor is right; this is all scientific programming. When I started to implement an algorithm for my bioinformatics research, my advisor told me: quote:I can tell you've worked in industry, since you want your implementation to be perfect. Don't worry about that. Make it work well enough, get results, publish the paper, and move on.
|
# ¿ Jun 15, 2011 22:00 |
|
Zombywuf posted:Tell me that when you've got an IP address conflict. That has absolutely nothing to do with hardware failure (e.g. capacitors exploding, dielectric breakdown and electromigration in CMOS transistors, very noisy inputs to a crappy power supply causing odd spikes in voltage at seemingly-random intervals).
|
# ¿ Oct 28, 2011 06:05 |
|
Munkeymon posted:AFAIK Open Office still has this problem This is oddly reminiscent of Wine developers' complaints about having to faithfully reproduce bugs in the Win32 API, since lots of programs depended on or worked around those bugs I seriously doubt that this is the real explanation, but it wouldn't surprise me.
|
# ¿ Oct 31, 2011 18:10 |
|
Beef posted:How often does a new Ruby or Python update gently caress up your code, either directly or indirectly through incompatible libraries? I usually have enough of a library hell in C/C++, Java and in lesser degree Common Lisp. Python 2 releases: typically not much. You might see some breakage if you were using strings as exceptions: code:
code:
Python 2.x -> 3, though: (Actually it's not that bad. Run the code through 2to3.py, fix anything that it couldn't, remove some unnecessary calls to list that it isn't smart enough to omit, and you'll probably be fine. This is only for pure Python code: I don't think there's an automated way to update extension modules written in C.)
|
# ¿ Nov 7, 2011 14:59 |
|
LOOK I AM A TURTLE posted:Vaguely on the subject of "input" in Python: One time a coworker of mine wrote code that essentially did this: What are you talking about? Assuming that something() can return True and do_a_thing() can return False, code:
EDIT: unless my assumptions are wrong and I just made an rear end out of myself, of course. That seems pretty likely in retrospect. It seemed like you were saying that input is always true because it's a built-in function, but you might have also meant that something() and do_a_thing() return values such that the code always executes. Either way, overwriting built-in names is often a surprise to people coming from other languages. Lysidas fucked around with this message at 16:58 on Jan 18, 2012 |
# ¿ Jan 18, 2012 14:25 |
|
tef posted:I dunno. Once the big libraries are across (NumPy, Django) and stable I can see python 3 replacing 2 a little more. NumPy already works flawlessly with Python 3, as does IPython, SciPy, NetworkX, BioPython, CVXOPT, etc. etc. etc. I use Python 3 exclusively in my research. It's really coming along. Hell, the development version of matplotlib even seems to work. (I tried a released version a few weeks ago, maybe 1.1.0, and setup.py build crashed and burned. Looks like it's actually building successfully now!) I'd guess that Django will support Python 3 within a year, two at most. It also looks like (hopefully) Ubuntu 14.04 LTS will only install Python 3 by default, with 2.7 as optional and semi-deprecated. Arch already does this; if you install Python you get Python 3. RHEL will probably be on 2.6/2.7 for the next 20 years though.
|
# ¿ Jan 18, 2012 22:59 |
|
More Python 3 -nesscode:
code:
Hell, until 3+, you could assign to True and False: code:
EDIT: Looks like this was a 3.0 thing: http://docs.python.org/py3k/whatsnew/3.0.html#changed-syntax Lysidas fucked around with this message at 03:17 on Jan 20, 2012 |
# ¿ Jan 20, 2012 03:13 |
|
The matrix operations on dict python-ideas thread seems to me like it belongs in this thread.julien tayon posted:Proposing vector operations on dict, and acknowledging there was an The details of the proposal make a surprising amount of mathematical sense, but to me (and everyone who replied on the mailing list) the implementation is bizarre. julien tayon posted:
Sturla Molden posted:
I can see how you can view dicts as a sorted set of key-value pairs in terms of the natural ordering of the keys, but this guy doesn't seem to be able to articulate an answer to "why the hell do you want to do this; if you're going to do linear algebra on sparse matrices why don't you use any of the appropriate SciPy classes that benefit from decades' worth of optimization (e.g. using LAPACK)" Maybe he's a genius and the joke's on me, but his inability (or unwillingness) to answer simple questions makes me wonder: julien tayon posted:
(maybe stealth) EDIT: I should have looked closer at that SciPy page -- one of the sparse matrix types is based on a dictionary of keys. It looks like the main advantages of this type are that they're easy to build, certain matrix operations are fast (e.g. addition), and you can very easily transform them to other SciPy matrix types when you need to do anything more advanced. I'm starting to think that the only horror is wanting to include a watered-down version of SciPy matrix manipulation in the standard library. Lysidas fucked around with this message at 18:15 on Feb 8, 2012 |
# ¿ Feb 8, 2012 18:07 |
|
tef posted:it sounds like an algorithmic circle jerk So is that like dining philosphers
|
# ¿ Feb 20, 2012 22:51 |
|
hobofood posted:CInt casts as int I haven't used VB.NET, only VBscript -- does cint still clamp the value to a 16-bit signed integer (i.e. -32768 to 32767)?
|
# ¿ Mar 7, 2012 21:13 |
|
Suspicious Dish posted:the top result for "php mysql tutorial" also has this issue. This site and page are hilarious. quote:Why Would I Want A Database? Why would I want a database? Why, to have a database of course! I'd love to have one of those sites which get "all there information from a database". The "Websites" bullet point is actually describing a template system, but it isn't too far off. I hate this site for the bad writing more than I dislike the horrible technical advice.
|
# ¿ Apr 25, 2012 19:55 |
|
If your boss suggests hiring a second inexperienced code monkey to help the first, show him a clip from the end of Simpsons S05E11 - "Homer the Vigilante" (after the townspeople start to dig for treasure and fail to find anything): "I guess we're not going to find anything." "Uh, how are we going to get out of here?" "We'll dig our way out!" "No, no, dig up, stupid!"
|
# ¿ May 14, 2012 22:50 |
|
rjmccall posted:It's trying to lazily generate the list of 9s, but IEEE limits the precision as an optimization so that the implementation can use less memory. Let me unpack that a bit. A real computer has to do arithmetic in fixed chunks of bits, so you have to think of a number as an infinite stream of these chunks of bits. If you've ever done stream programming, you know that it's more efficient to work with streams with buffering on. Since you're constantly finishing with some chunks and needing more, this has to be a circle buffer to keep the GPU up with the memory bus, and you've got a second buffer which is taking the result, which is called double-buffering. It's the size of these buffers that's different when you have a float or a double, got it? So where does this 8 come from? First thing you've got to understand is that, like that dude said on reedit, an integer is really equal to a repeating bunch of nines. Now, in the first version of floating-point numbers, there was this bug when you had a bunch of nines like that, and a couple nines from somewhere else, and you were multiplying them together, and the multiplier would do one multiply and put a chunk into the result buffer, and it would forget that it needed to do a carry on that chunk, so you got 9 * 9 == 81 and it would put down 81 in the buffer and then it would overwrite that 1 with the next 9 which it correctly carried from the next multiplication, see, 99 * 9 == 810 + 81 == 891. If this doesn't make sense, just remember, it's was a bug, right? But they didn't notice right away, because there weren't enough DBAs looking at the problem, so it just stayed in for awhile, and ever since they've had to emulate that bug perfectly because IEEE is a standard and it's supposed to be portable. And the reason the 8's all the way back is because, remember, it's 9s all the way down on the integral side, and you have to multiply them all by the two 9s on the other side, so you've got plenty of places where this bug can show up. Anyway, that's why I do all my currency calculations with regexps, and if you've got a problem with that, just remember, optimization is the way the devil gets ya. This reads a lot like TimeCube
|
# ¿ May 22, 2012 07:22 |
|
Suspicious Dish posted:And at least people aren't linking Djikstra on my rear end and calling me human scum this time. The core Linux kernel developers are extremely competent C programmers, and their views on this subject are pretty informative.
|
# ¿ Jun 20, 2012 22:38 |
|
ToxicFrog posted:The entire windows command line is a horror. I dare you to figure out consistent rules for wildcard expansion and quoting in that fucker. There aren't any because that isn't always handled by the shell but by the program you're invoking. Close, but the truth is worse. I'm having a hard time finding a definitive source for this, but everything I've read says that wildcard expansion is handled by the filesystem driver EDIT: This might count as definitive: the FindFirstFile Win32 API function can take a wildcard as its argument. You're correct that programs are free to interpret wildcards themselves (and I bet a depressing number of programs do), but there is a common function available. Lysidas fucked around with this message at 19:59 on Jul 20, 2012 |
# ¿ Jul 20, 2012 19:55 |
|
Strong Sauce posted:I'm pretty sure golbez was joking, what with the downs smiley and all. That, or he was saying that he felt like it was a stupid question as he was asking it -- along the lines of "I feel like I should know this, but ..." IPython is a fantastic enhancement to Python's REPL. It does a whole lot more, too, but that's most of what I use it for. Some languages like R are (almost) all REPL. Running a script in "batch mode" is no different than typing each line in sequence, unlike e.g. Python. The Python interactive interpreter behaves a bit differently than when an entire script is parsed in to VM bytecode before executing it.
|
# ¿ Aug 10, 2012 00:07 |
|
Bug #54547: wrong equality of string numbersquote:I'm just gonna paste in that PHP Sadness article to show why this is such a big Comparing two strings and finding that they're tested for numeric equality is utterly ridiculous.
|
# ¿ Sep 5, 2012 02:55 |
|
Poe's Law definitely seems to apply to that.
|
# ¿ Sep 25, 2012 22:44 |
|
Using "months" as a unit of time is enough of a pain that Python's built-in timedelta objects don't support it. timedeltas represent an absolute time duration, and (as was shown in the previous few posts) months don't work that way. The dateutil package's relativedelta object provides this functionality though -- as the name suggests, the duration of time represented by one of these objects is relative to what you're adding it to.Python code:
|
# ¿ Nov 1, 2012 05:46 |
|
Ithaqua posted:That seems like a great example of code that can easily be refactored to be a lot more descriptive about what the gently caress it's actually doing. I'd like to see how you can refactor that code to be more descriptive about how it works, given that there are entire papers written about the technique. Sure, better comments make a world of difference, but attempting to make this code self-documenting is probably a serious waste of time.
|
# ¿ Nov 23, 2012 22:42 |
|
how!! posted:why would you need to look through commit history to fix a bug? Just fix the bug. I've fixed many bugs, and can't tell you of a single time where I had to look through the history in order to fix it. Tell me this again after working for a manufacturer of devices that are subject to FDA regulation "Oh, you found this rare but very serious bug that can destroy patient data? Who introduced it at what time, and what was the next released version that contains the bug?" Management would then talk to the sales team to find all affected customers (since not all of them upgraded the devices' software for every minor version) and we'd cut a hotfix release that was immediately distributed to whoever it affects.
|
# ¿ Jan 3, 2013 20:31 |
|
JetsGuy posted:True. The larger point I was making was that in scientific programming the only concern is does it work, and beyond that there's not much concern about writing it in a certain "style". A very important (and often overlooked) corollary to "does it work" is "when it fails, does it do so in an obvious, interpretable way?" The author of the Abandon Matlab blog wrote a pretty thorough post about this. This is one of the reasons why I dislike the usage of Perl in bioinformatics analysis pipelines -- the language seems to encourage logic that plays fast and loose with data types and correctness of the results. If (for example) I'm adjusting base positions because of a difference in 0-based and 1-based indexing, I want to know right away if there are problems with the input data. If a file is corrupt and I try to add 1 to a string, Perl can happily turn "hello" into "hellp". Python requires you to convert strings to integers first, and you'll receive a very nice ValueError: invalid literal for int() with base 10: 'hello' when you try to do so.
|
# ¿ Apr 15, 2013 18:21 |
|
I use R quite a bit, and have taught some short courses on it for genetics grad students at my university. It's a very neat language; you can get a lot done without much code and the language's syntax is quite flexible. I use it for virtually all of my statistical and numerical analysis; I recently got a lot of use out of the survival and rpart packages.
|
# ¿ Apr 16, 2013 01:55 |
|
Suspicious Dish posted:If you have master based on origin/master and you do "git pull" or "git pull --rebase", it doesn't actually update the origin/master ref, which I found confusing. Bare git pull does update all remote tracking branches for the remote that you're pulling from. It's git pull origin master that doesn't update the ref.
|
# ¿ Apr 18, 2013 00:27 |
|
On that note, I find it virtually impossible to get any work done without having gitk --all open.
|
# ¿ Apr 20, 2013 17:35 |
|
quiggy posted:Ah, the server I ran it on is running 2.2 apparently. Welp Wow. Out of curiosity, what distribution/version? 2.2 was released in 2001 and hasn't had a release since 2003. That random seed doesn't work on 3.3, incidentally.
|
# ¿ May 20, 2013 20:17 |
|
oh PHP http://blog.kevburnsjr.com/how-to-prevent-a-leak-like-tumblrs posted:[UDPATE] Turns out PHP returns 200 when it encounters a fatal error. Inconceivable.
|
# ¿ Jun 2, 2013 22:36 |
|
quote:From: Sathyanathan, Justin (emphasis mine)
|
# ¿ Jun 17, 2013 15:57 |
|
Agreed. I'm amazed by how patient many of the list members are. I also like the wording and tone of this response: quote:Please next time you ask consider doing two things:
|
# ¿ Jun 17, 2013 16:25 |
|
QuarkJets posted:Mathematician code is a million times worse. Here's a psuedocode example of something that I saw recently: Variable names like that make sense when you're in the middle of implementing an algorithm from a paper or textbook, but you rename them after you get it working e: and you haven't needed to extend object since December 2008 Lysidas fucked around with this message at 22:35 on Jun 21, 2013 |
# ¿ Jun 21, 2013 22:31 |
|
I would have mentioned that too, but I figured it was a side effect of you typing pseudocode from memory. That "works" in 2.4 but not 2.6, and I don't have a 2.5 installation handy to see whether it works in that version.Python code:
Python code:
Python code:
|
# ¿ Jun 22, 2013 01:50 |
|
|
# ¿ Apr 24, 2024 23:45 |
|
QuarkJets posted:Would the int even be accessible in any way? IE, if I called MyObject(args) would I get an int instances instead of a MyObject instance if that's what the constructor returns? No; the value returned by __init__ is lost. Remember that all Python functions return None unless you specify otherwise -- if the return value of __init__ was used as the instantiated object you'd get None when creating an instance of any class. Python __init__ methods are better described as "initializers" than "constructors". You can define a real constructor that returns the wrong thing, if you really want to: Python code:
|
# ¿ Jun 22, 2013 04:02 |