Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
biznatchio
Mar 31, 2001


Buglord
Well I think sheds should be painted blue.

Adbot
ADBOT LOVES YOU

biznatchio
Mar 31, 2001


Buglord

the talent deficit posted:

So that javascript monstrosity I posted? It gets better. The variable names are generated each time you load the page. That's right, they change. I'm also now in contact with the author of the 'framework' and some of the things he's said lead me to believe this is for security. To, y'know, protect the integrity of the form. Check out some of these other quotes:

Now that's comedy right there.

I assume the redacted environment has nothing to do with XML being just a data format.

biznatchio
Mar 31, 2001


Buglord

Fib posted:

post hot programmer chicks

The first person to post a picture of Leah Culver gets a boot up the rear end from yours truly.

biznatchio
Mar 31, 2001


Buglord

forelle posted:

You should always check every pointer before dereference through it, even if you believe with your whole heart it can never be NULL, because you're often wrong.

There are plenty of situations where if an assumption like that is violated in the state of your data, the most sensible thing to do is segfault immediately.

biznatchio
Mar 31, 2001


Buglord

Milde posted:

Anything but ASCII in source code is infuriating as hell though. :)

Back in like 2002 when I was still following Perl 6 development, they had decided that several operators would be Unicode characters.

...I wonder if they ever changed their minds.

biznatchio
Mar 31, 2001


Buglord

pokeyman posted:

Maybe it's doing some really cool fuckery that you can't do with non-application HTML. I don't have a clue what such fuckery would look like, but who am I to say it doesn't exist.

I've used more than a couple HTAs. Javascript running in an HTA has pretty much full system access -- if you can do it with a standalone .js file running through the Windows Scripting Host, you can do it in an HTA.

Local files, printers, system administration, and Office automation (well, any COM automation) are all examples of reasons you'd want an HTA; and since an HTA can include an IFRAME and optionally pass full application-level permission to it, it allows you to grant those extended privileges to any arbitrary URL of your choice, so you can host your actual application logic on a web server somewhere for easy maintenance.

biznatchio
Mar 31, 2001


Buglord

Victor posted:

Anyone in here who claims to have never written code that could be submitted to this thread is a pretender*. The key is that you continue to learn and figure out ways to be less retarded.

* or hiiiilarious

Hell, I'll go so far as to acknowledge that I still write bad code today.

Sometimes short deadlines make for serious design compromises.

biznatchio
Mar 31, 2001


Buglord

fankey posted:

I'm pretty sure 99% of all C# projects on sourceforge are complete garbage.

Cross the word C# out of that sentence and your statement remains true.

biznatchio
Mar 31, 2001


Buglord

Sewer Adventure posted:

He's autistic

Proof that being autistic doesn't mean you're some sort of savant.

biznatchio
Mar 31, 2001


Buglord

Brain Candy posted:

It has cousins that I see far too frequently:

code:
  boolean_expression == true

I don't necessarily consider that a coding horror.

biznatchio
Mar 31, 2001


Buglord

twodot posted:

Is there some pet dictionary of yours I should use, because every dictionary I've looked it up in says it's a nonstandard usage of regardless.

We use ANSI around these parts. None of that nonstandard city talk. :clint:

biznatchio
Mar 31, 2001


Buglord

Janin posted:

Oh good, so all I have to do to make reference code safe is...treat every reference as a magical pointer?

I think C++ is not the right language for you. Your desire for 'safety' clearly surpasses the level of 'safety' inherent in the language itself.

Maybe you'd feel better with a nice cup of Java.

biznatchio
Mar 31, 2001


Buglord

Zombywuf posted:

What you need is Perl 6.

I used to follow Perl 6 development pretty closely. Back in 2001. When I checked in on it a few months ago, they still hadn't delivered a usable product.

I'll check in again on it in 2015. Hopefully it's done by then so I can install it on my copy of the HURD and use it to script entities in Duke Nukem Forever.

biznatchio
Mar 31, 2001


Buglord

Zombywuf posted:

It may not be a usable product yet, but it's definitely growing due to user feedback, and the developers intend on turning it into a modern programming language.

So what advantages would I have for choosing Perl 6 for a new project being started today over, say, a language that exists?

biznatchio
Mar 31, 2001


Buglord

floWenoL posted:

Do you know the difference between Perl 5.x and Perl 6? Or, for that matter, Perl and PERL?

That was actually the posting equivalent of a design pattern. Posting it probably made the author feel smarter and like he actually contributed to what was going on, whether it actually fit into the discussion or not.

biznatchio
Mar 31, 2001


Buglord

ZorbaTHut posted:

"But 1500 lines is just too long! How can you ever understand it?" drat sight better than I can understand thirty 50-line functions strewn about my codebase.

Is strewing the functions about your codebase a requirement for breaking a monolithic function down into smaller bite-sized functions? I mean, I've always kept related functions right next to each other as much as possible, maybe I was just doing it wrong though.

Also I'm rather curious what this magical 1500-line algorithm that couldn't be subdivided further actually was.

biznatchio
Mar 31, 2001


Buglord

Scaevolus posted:

There's a bit of controversy going on as to why the passwords were stored in plain text in the first place, with some arguing that it was because of the very large user base

You heard it here first, folks. Perl can't handle hashing 50,000 passwords.

biznatchio
Mar 31, 2001


Buglord
Hey as long as we're making up terminology I'd like to suggest that we call it 'flobertyfloo' instead.

To be used as in "Man, Bob checked in a bad change and due to our widespread lack of error checking across our entire codebase I spent all week tracking down flobertyfloo."

Or "Wow it's really terrible that no input validation was taking place, or else the flobertyfloo that cost us a million dollars in downtime might have been avoided."

biznatchio
Mar 31, 2001


Buglord

Zombywuf posted:

*sets up accidental spam relay*

Yeah maaaan if you're going to be helping spammers out, the least you could do is validate their email address list for RFC compliance for them first.

biznatchio
Mar 31, 2001


Buglord

niteice posted:

From some old LaTeX code I wrote:
code:
% it rotates variables by 90 degrees
No, I don't know what that means.

Well obviously w becomes E, U becomes C, and z becomes N. X and O are unchanged.

biznatchio
Mar 31, 2001


Buglord

Ender.uNF posted:

And that's why C# is adding async/await. Let the compiler turn your code inside out later.

There's TameJS for node that gives you the same concept for doing inline callbacks with a slightly altered syntax design. I haven't used it myself so I can't vouch for quality, but OkCupid is using it in production, so it must be decently stable.

biznatchio
Mar 31, 2001


Buglord

Zombywuf posted:

Yeah, this is why I shouldn't drink so much. But you know you could have linked to the terrible code I've put on github or something. But hey, if people's appearance is the best you can do well that's just precious.

I dunno man, making fun of someone on a personal level because of their code seems just as justifiable to me as making fun of them because of their lack of care toward their physical appearance. Seriously man, groom yourself, you're an example of everything that's wrong with software developers.</s>

That is to say when you see bad code you should critique the code, not the person. Every single one of us has written bad code, whether out of sheer ignorance, out of resource constraints, or because a quick and dirty hack was all there was time for. That doesn't make us terrible people.

biznatchio
Mar 31, 2001


Buglord

seiken posted:

To be fair, an operating system used by one person ever is unlikely to be plagued with malware.

You could make a compelling argument that an operating system used by one person ever is malware in its own right.

biznatchio
Mar 31, 2001


Buglord

a lovely poster posted:

I'll let you know when I find one. I've been taking $5-$10k raises yearly for the past five or so by job hopping.

That works fine until one day you wake up and you're 40 years old and no Hot New Startups want to hire you, grandpa, and none of the Big Conservative Established companies want to hire you anymore either because your CV shows you never stay in a position for more than 300 days.

biznatchio
Mar 31, 2001


Buglord
I can't help but think that this (good) discussion should be taking place in a thread of its own.

biznatchio
Mar 31, 2001


Buglord

Dessert Rose posted:

Re: nullable values in C#:

code:
if (nullableBool.GetValueOrDefault(false)) { ...

That's an awfully verbose way of saying

code:
if (nullableBool ?? false) { ...

biznatchio
Mar 31, 2001


Buglord

comedyblissoption posted:

What is even the point of asking a string reversal question that they just code an implementation of by googling which garners them a success by the interviewers? It seems like a complete waste of time. Wouldn't it be way better to allow googling and just ask questions within the same realm of complexity that aren't easily google-able?

One would presume that's what the other, less googlable problems he mentioned he always asks too are for. It's not a bad idea to give them one that's both simple and easily searched for, because whether or not they go to Google for the answer tells you a lot about them and what sort of understanding of the code they'd end up producing as an employee they'll have.

biznatchio
Mar 31, 2001


Buglord

Damiya posted:

Really? I don't know that I agree with that. I produce good code as an employee but if you give me a problem that I can tell is going to be well solved, many times before me, gently caress yea I'm gonna go to Google to see if there's an implementation jump off point.

It's one thing if someone is just blindly copying stack overflow with no adaptation or fitting the solution to the problem. But why would you want to hire someone that doggedly insists on reinventing every wheel?

There's a lot to be said for reusing existing, working, already-debugged solutions; but if your bar for build versus borrow doing so is as low as writing a simple string reverse, that says a lot. It's literally faster to just write it yourself than it is to open up your browser, search for it, find, and vet a copy/paste solution -- at least once you're at a certain level of skill.

biznatchio
Mar 31, 2001


Buglord

Bruegels Fuckbooks posted:

Exceptions would be better than retvals if morons didn't sprinkle catch(...) {} all over codebases.

On the other hand, you have morons using goto statements. Which is worse?

biznatchio
Mar 31, 2001


Buglord

Cadoc posted:

Recently I was forced to change the line $_SERVER['REMOTE_ADDR'] = IP_FROM_PAYMENT_SERVER_PROVIDER to 1=1 for the payment successfully received function in an multi million online shop. Reason was the fact that the new webserver hoster does not want to set ANY server variable and has the webserver behind a proxy. Apperently "beeing audited" is better than possibly beeing sued for aiding fraud.

Make sure you've gotten your objections to the change and what the potential security ramifications of it are in writing. Chances are it'll never come up, but if it does and they go looking for a scapegoat, you'll want to be sure you've covered your rear end.

biznatchio
Mar 31, 2001


Buglord

New Yorp New Yorp posted:

Nope. catch { throw; } is exactly the same as not catching an exception at all. It's useless.

That's not true, actually. throw; alters the line number in the stack trace for the method containing the throw; statement to point to the line of the rethrow rather than the line in that method where the exception originally occurred.

That makes catch { throw; } strictly worse than not having a try/catch at all (if the performance waste isn't already enough). Plus, the stack trace changing behavior masking the true exception source is annoying as poo poo in cases where you actually want to do real error handling before rethrowing an exception.

biznatchio fucked around with this message at 17:10 on Oct 17, 2017

biznatchio
Mar 31, 2001


Buglord
Shocking new exploit discovered! If you can edit files on the user's drive, you can replace the Cyberpunk launcher EXE with any arbitrary executable code of your choosing! Come on CDPR, this is amateur hour!

biznatchio
Mar 31, 2001


Buglord
I really think everyone's overlooking the perfectly reasonable option of using Lotus Notes to store people's names and building your application as an extension within.

biznatchio
Mar 31, 2001


Buglord
"Is that really a precise statement?"

"Sure it is, just look at the program."

"YOU look at it."

biznatchio
Mar 31, 2001


Buglord

Plorkyeran posted:

The entire premise of the video is that the code is currently incorrect and does not match the requirements, and the goal is to make the code understandable so that it can be made to do what the requirements say. This is a very different scenario from having some code which is currently working correctly but no one actually knows what the correct behavior is. In that scenario, changing >= to > to "simplify" it would be completely insane, but in the scenario given in the video the authoritative reference on whether it should be > or >= is the requirements doc, not the old version of the code. After refactoring the code the next step is to align the code with the doc, and that's the case regardless of what changes you make during refactoring.

The idea of having an authoritative requirements doc is now quaint, but it was normal at the time the video was made.

Yeah but the way the video presents it, that change isn't being made to match a requirements doc. The way the dialogue in the video presents it, the change is being made purely because "having both 'less than' and 'less than or equal' conditions in the same function is confusing"; and then when Lady Programmer correctly says "you can't do that, it changes the meaning of the code", the narrator just handwaves it away by getting Lady Programmer, whose dialogue indicates she has no idea what the number is actually for, to say "well it's probably an approximation for one-third" and that unfounded guess is used to justify the change.

The narrator does not say "the requirements indicate the comparison should be 'less than one-third'." And there's no reason to think it is, since none of that entire segment is about fixing defects in the code; only in refactoring it into something more readable.

It's a shame because the rest of the film is actually really good refactoring/formatting advice that holds up today; but that bit is just blatantly wrong. It can't even really be justified with floating point hand-waving because in the era this film was made, the code would have very probably been have been running with decimal encoded numerics. (Or, at the very least, it was common enough that a film whose target audience is developers who need to be told to name their variables sensibly shouldn't be teaching them assumptions based on floating point.)

biznatchio fucked around with this message at 06:44 on Dec 29, 2022

biznatchio
Mar 31, 2001


Buglord
Business requirements should be documented. If that comparison comes from a business rule and not just a result of implementation detail, then yes, there should be something written somewhere that says why that comparison is being done. Developers should not be the ones writing this, though; this should come from the business (and ideally have been written before any code was ever typed into an IDE).

But saying "> and >= are both used in one function and by golly that's just too much complexity for a developer to understand" is tripe that not only creates worthless busywork, but it also indicates that you don't trust that your developers know how to read literally the most basic code constructs possible; and it also makes your documentation more worthless because if that's your standard of 'what needs to be explicitly documented', then you're going to be burying the needle of the actual interesting stuff, the knowledge that the documentation should be providing beyond what a naive reading of the code already provides, in a bunch of time-wasting "here's what the code says, just written in English" haystack.

I say this as a professional developer who can understand upwards of three different boolean operators within the same class file!

biznatchio
Mar 31, 2001


Buglord

redleader posted:

i live in this absurd and unrealistic fantasy land, assuming that asking someone in a slack dm counts as "documented"

That's the beauty of it. If it's not written down as a requirement then you still absolutely shouldn't be changing the logic during a refactor!

biznatchio
Mar 31, 2001


Buglord

QuarkJets posted:

The logic was broken, preserving broken logic is unnecessary

As mentioned above, literally none of the people involved in the refactor said anything about the logic being incorrect. The change was presented as being based entirely on a guess by someone who had no idea what the code was for.

And as also mentioned above, even if the logic was wrong, you shouldn't mix refactoring with functional changes.

biznatchio
Mar 31, 2001


Buglord

qsvui posted:

I think he meant the logic about that particular line. He's right, none of the people in the video even implied there was a bug there. They clearly didn't know why the logic was like that, so the safer thing to do was leave it be.

I don't even know why the video even mentioned that the code was buggy because they didn't say whether the bug was fixed or not by the end.

There's also that, unless you contrive very specific requirements, the change they made to the line won't actually fix what they guess the intended behavior is supposed to be; and if the system is a fixed-point system (which is a possibility considering the pseudo-language is based on COBOL and Fortran), would in fact make the code more wrong.

They suppose "well this condition is 'less than 25%' so this condition should just be 'less than 1/3rd'". If we assume they guessed correct and that's what the logic should actually be, then the change they made does not actually make the code do that comparison -- regardless of whether the underlying system is fixed-point or floating-point -- because .33 is already lower than 1/3rd; and changing the operator doesn't *make* it 1/3rd.

But it *does* suddenly mean that 0.33 exactly (which is only possible in fixed-point) would not match the condition, when it should because 0.33 exactly is less than 1/3rd but they just added it to the set of values that will incorrectly fail the condition. There's a test case right there that would have passed pre-change and failed post-change.

And in either case, with the change or without the change, values that mathematically would calculate out to >0.33 and <(1/3) -- for example 0.332 (which is >0.33 in floating point comparisons; and rounds to 0.33 in fixed point scale 2) -- would fail the check even though by the presumed logic they should pass it. (Well they'd have passed pre-change fixed-point, but failed post-change fixed-point; but they also fixed >=(1/3) to <0.335 failing pre-change fixed-point but passing post-change fixed-point, so let's call that a wash.)

So at best (floating-point) they failed to fix the supposed defect. At worst (fixed-point) they failed to fix the defect and introduced a regression.

biznatchio fucked around with this message at 09:37 on Dec 31, 2022

Adbot
ADBOT LOVES YOU

biznatchio
Mar 31, 2001


Buglord

raminasi posted:

Is it doing some weird interop thing?

Yes, interop between bad developers and a compiler that wants them to be good.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply