As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
We're funding a new Acquisitions Incorporated series on Kickstarter right now! Check it out at https://www.kickstarter.com/projects/pennyarcade/acquisitions-incorporated-the-series-2

[Programming] Thread: Fixed last bug in 5 month thread

1181921232499

Posts

  • TofystedethTofystedeth Registered User regular
    When I was a kid I had this adventure book where this group of teenagers end up ensnared in some mad scientist's scheme and at several points throughout it they have some problem they need to solve, and just happen to have access to a computer and BASIC and the book pauses and tells you go write a program to solve it. In the back of the book it had example programs that solve it. Like, one was the matchstick game. I forget what the others were. Anybody ever read those?

    steam_sig.png
    ecco the dolphin
  • Jimmy KingJimmy King Registered User regular
    When I was a kid I had this adventure book where this group of teenagers end up ensnared in some mad scientist's scheme and at several points throughout it they have some problem they need to solve, and just happen to have access to a computer and BASIC and the book pauses and tells you go write a program to solve it. In the back of the book it had example programs that solve it. Like, one was the matchstick game. I forget what the others were. Anybody ever read those?
    Holy shit, no. I had tons of those Choose Your Own Adventure books... but this I've never seen. I want this book.

  • TofystedethTofystedeth Registered User regular
    I think it may have been the Micro Adventure series, though I only ever read the one, and at the time I was only in it for the sci-fi geeky adventure stuff and didn't do any of the programming. Occasionally I would try and read the code but only understood a little. These days I really regret not actually firing up QBASIC on our 486 and trying them out.
    http://grathio.com/2012/12/combining-fiction-and-code-to-teach-programming/

    steam_sig.png
  • Jimmy KingJimmy King Registered User regular
    Hey, maybe this here fancy college education is paying off. I just used my knowledge of plain old pure math and applied it to a problem to solve it, all on my own and completely naturally without making a conscious effort to apply math. That's crazy.

    crimsoncoyoteEvigilantIncindiumecco the dolphinKambingmightyjongyoPolaritiegavindel
  • ecco the dolphinecco the dolphin Registered User regular
    edited April 2015
    bowen wrote: »
    Infidel wrote: »
    Because fuck your objects, I have parallel arrays!

    This kind of programming is very... Perl-like.

    @ecco the dolphin did this dev work primarily with perl like... 5-10 years ago or something?

    Based on his scripts that I've examined, I would very much doubt his perl abilities...

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
    bowen
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    What's the best way to support Python 2.6, 2.7 and 3.0 (32 and 64 bit) all at the same time?

  • ecco the dolphinecco the dolphin Registered User regular
    edited April 2015
    Oh god

    The more I refactor this, the more it seems like that about 12/13 of these values are just temporary values used to generate the other 4/5 outputs. In other words, the original code looks something like:
    for( int i = 0; i < size; ++i ) d[i] = opA( a[i], b[i], c[i] );
    for( int i = 0; i < size; ++i ) e[i] = opB( d[i] );
    for( int i = 0; i < size; ++i ) f[i] = opC( e[i] );
    for( int i = 0; i < size; ++i ) g[i] = opD( f[i] );
    ... etc ...
    

    ... I might be able to simplify the life out of it (and reduce storage requirements) just by doing one big loop instead of many smaller ones. I'm... just... flabbergasted.

    Normally, I'd say that I've missed something, but right now... I'm not so certain...

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
    crimsoncoyote
  • Jimmy KingJimmy King Registered User regular
    edited April 2015
    What's the best way to support Python 2.6, 2.7 and 3.0 (32 and 64 bit) all at the same time?

    I have not actually bothered to try, but in general, some combo of `from __future__ import <blah blah blah>` and six is pretty much the standard for 2.6+ and 3.x support. For 32 and 64 bit... are you writing libs where some of the code is in C or C++ or just pure Python? Pure Python should just work.

    Jimmy King on
    Kambing
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    There's some Numpy and C/C++ code mixed in.

  • htmhtm Registered User regular
    Oh god

    The more I refactor this, the more it seems like that about 12/13 of these values are just temporary values used to generate the other 4/5 outputs. In other words, the original code looks something like:
    for( int i = 0; i < size; ++i ) d[i] = opA( a[i], b[i], c[i] );
    for( int i = 0; i < size; ++i ) e[i] = opB( d[i] );
    for( int i = 0; i < size; ++i ) f[i] = opC( e[i] );
    for( int i = 0; i < size; ++i ) g[i] = opD( f[i] );
    ... etc ...
    

    ... I might be able to simplify the life out of it (and reduce storage requirements) just by doing one big loop instead of many smaller ones. I'm... just... flabbergasted.

    Normally, I'd say that I've missed something, but right now... I'm not so certain...

    Yeah, that's... special

    Why can't they do that stuff in just one loop?

    Also, your original idea of a vector of a struct with the five doubles in it seems like a good one. I kind of doubt the original author was optimizing for cache locality and even if they were, they probably shouldn't have been. Putting them in one vector saves you 4x the amount of memory bookkeeping (as performed by std::vector).

    If the data sets are really big, consolidating to one vector of one structs will also (probably) gain you performance on vector insert/deletes. Modern implementations of STL (i.e. C++11 or later) finally have the smarts to special case POD types so that it will move them around using memcpy/memmove. And on most platforms those will be really fast. They'll either be implemented as compiler magic and/or SIMD-optimized asm code.

    ecco the dolphinbowen
  • LD50LD50 Registered User regular
    Oh god

    The more I refactor this, the more it seems like that about 12/13 of these values are just temporary values used to generate the other 4/5 outputs. In other words, the original code looks something like:
    for( int i = 0; i < size; ++i ) d[i] = opA( a[i], b[i], c[i] );
    for( int i = 0; i < size; ++i ) e[i] = opB( d[i] );
    for( int i = 0; i < size; ++i ) f[i] = opC( e[i] );
    for( int i = 0; i < size; ++i ) g[i] = opD( f[i] );
    ... etc ...
    

    ... I might be able to simplify the life out of it (and reduce storage requirements) just by doing one big loop instead of many smaller ones. I'm... just... flabbergasted.

    Normally, I'd say that I've missed something, but right now... I'm not so certain...

    That is not the code of someone who understands programming. That is the code of someone who can identify patterns and copy them to get desired results.

    ecco the dolphinmightyjongyocrimsoncoyoteDelmainbowenPolaritieEvigilantgavindelThe AnonymousTryCatcher
  • ecco the dolphinecco the dolphin Registered User regular
    edited April 2015
    *sob*

    I just found this:
      unsigned validPts =0;
      ...
      if(validPts < 1)
          validPts = 0;
    

    *sob*

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
    InfidelmightyjongyocrimsoncoyoteSmasherDelmainEtheabowena5ehrenMahnmutRendPolaritieTofystedethEvigilantjjae2123TryCatcher
  • InfidelInfidel Heretic Registered User regular
    Shut it down.

    Shut it down, forever...

    OrokosPA.png
    ecco the dolphin
  • htmhtm Registered User regular
    *sob*

    I just found this:
      unsigned validPts =0;
      ...
      if(validPts < 1)
          validPts = 0;
    

    *sob*

    ...

    It's hard to believe people fail FizzBuzz until you start reading their code.

    ecco the dolphinmightyjongyoPolaritieThe AnonymousTryCatcher
  • ecco the dolphinecco the dolphin Registered User regular
    Hey

    Sorry for dumping all this into the thread like this

    It's just that I need to vent. =(

    I hope that some of you get a chuckle out of this, at least!

    Penny Arcade Developers at PADev.net.
    htmadmanbLD50ironsizide
  • crimsoncoyotecrimsoncoyote Registered User regular
    LD50 wrote: »
    identify patterns and copy them to get desired results.
    Sounds like a plan! ;-)

    Two of my coworkers are leaving their positions this month. The first is moving to PM next week, and should be good for her, imo.

    The second accepted an offer at another company to help them get started in automating tests. They told him that he would become a manager or something, once the framework is all set up, and they hire a few engineers under him in a couple years? I just really hope he got that in writing because that sound suspiciously like it will go unfulfilled, and was one of the major factors of him accepting the offer. He at least was told the could work from home once a week, and they sounded pretty lax on PTO

  • bowenbowen How you doin'? Registered User regular
    htm wrote: »
    *sob*

    I just found this:
      unsigned validPts =0;
      ...
      if(validPts < 1)
          validPts = 0;
    

    *sob*

    ...

    It's hard to believe people fail FizzBuzz until you start reading their code.

    Listen, just because it says unsigned doesn't really mean it was!

    I'm wondering if this variable was signed at one point and that was an artifact that got left in when it was.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
    htmecco the dolphin
  • NightslyrNightslyr Registered User regular
    Infidel wrote: »
    It is in the same boat as PHP, where there are solutions and good practices and books, but is haunted by the shit devs that have left an amazing legacy out there.

    Related: I'm currently attempting to tell someone on SO to ditch WordPress because it's fucking horrid, and some dude who apparently makes a living with that pile of shit is getting defensive. Sorry, dude, but The Loop is idiotic outside of a simple blog format, and globals everywhere is both idiotic and dangerous.

    PSN/XBL/Nintendo/Origin/Steam: Nightslyr 3DS: 1607-1682-2948
    Switch: SW-3515-0057-3813 FF XIV: Q'vehn Tia
    ironsizide
  • EtheaEthea Registered User regular
    htm wrote: »
    Also, your original idea of a vector of a struct with the five doubles in it seems like a good one. I kind of doubt the original author was optimizing for cache locality and even if they were, they probably shouldn't have been. Putting them in one vector saves you 4x the amount of memory bookkeeping (as performed by std::vector).

    If the data sets are really big, consolidating to one vector of one structs will also (probably) gain you performance on vector insert/deletes. Modern implementations of STL (i.e. C++11 or later) finally have the smarts to special case POD types so that it will move them around using memcpy/memmove. And on most platforms those will be really fast. They'll either be implemented as compiler magic and/or SIMD-optimized asm code.

    std::vector bookkeeping overhead is generally not a significant concern as it is ~128bits iirc. As far as the SIMD-optimization it really depends on the usage of the vectors inside the function. If the functions are doing something simple like:
    d[i]= a[i]*b[i]+c[i];
    

    Than the current layout is preferred, and moving to something like boost::simd::pack<T> is fairly trivial.

    ecco the dolphin
  • urahonkyurahonky Registered User regular
    I loathe making Jira tickets for some reason.

    Evigilantelectricitylikesmetemplewulf
  • a5ehrena5ehren AtlantaRegistered User regular
    Cross-compiling Boost to an uncommon platform (MIPS64) sucks balls.

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    So I bought my own license to ReSharper Ultimate last night. I own licenses for WebStorm and RubyMine, and I don't mind giving JetBrains money. ReSharper Ultimate is pretty nice, it's ReSharper, dotTrace, dotMemory, dotDover and ReSharper C++ in one package. It's not cheap (249 for the single developer license), but I use ReSharper so much, and I'm tired of uhh "borrowing" my work license.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
    ironsizide
  • bowenbowen How you doin'? Registered User regular
    GnomeTank wrote: »
    So I bought my own license to ReSharper Ultimate last night. I own licenses for WebStorm and RubyMine, and I don't mind giving JetBrains money. ReSharper Ultimate is pretty nice, it's ReSharper, dotTrace, dotMemory, dotDover and ReSharper C++ in one package. It's not cheap (249 for the single developer license), but I use ReSharper so much, and I'm tired of uhh "borrowing" my work license.

    What does it add over Visual Studio?

    Genuinely curious about that.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    I only remember one thing from my one-month trial of ReSharper and it's Sublime-style file switching.

    Which is basically cocaine to me.

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    bowen wrote: »
    GnomeTank wrote: »
    So I bought my own license to ReSharper Ultimate last night. I own licenses for WebStorm and RubyMine, and I don't mind giving JetBrains money. ReSharper Ultimate is pretty nice, it's ReSharper, dotTrace, dotMemory, dotDover and ReSharper C++ in one package. It's not cheap (249 for the single developer license), but I use ReSharper so much, and I'm tired of uhh "borrowing" my work license.

    What does it add over Visual Studio?

    Genuinely curious about that.

    ReSharper? Oh man, I can't even begin to describe everything it does over the top of Visual Studio. It's one of those things that you have to use it to fully understand, and once you've used it, it's rare to want to go back. The real obvious additions are much improved refactoring tools, a unit test runner that blows Microsoft's out of the water, much better code formatting support, in-line code suggestions (such as suggestions to fix overnesting, or to convert a foreach in to a cleaner LINQ expression)...the list goes on and on. It just takes everything that makes Visual Studio a top notch C# environment and turns it to 11.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
    bowencrimsoncoyoteironsizide
  • bowenbowen How you doin'? Registered User regular
    I'm sold.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited April 2015
    The only caveat to ReSharper I have is that it's not a slouch on CPU and memory usage, because it does quite a bit of static analysis and code tree walking, so if your development machine is under powered, it can cause Visual Studio to be a touch more sluggish than normal. Both at work and at home I have i7 machines with 16GB of RAM for development, so I don't notice...but people on older CPU's with 4GB of RAM, or developing on a VM in an over utilized farm, might notice some sluggishness from Visual Studio with ReSharper going.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
    Delmain
  • bowenbowen How you doin'? Registered User regular
    btlvAnR.png

    I might be good!

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
    Polaritie
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    i have a statement to make


    large, universally purposeful javascript libraries which have been written in such a fashion that they can only operate on a Node.JS server and not inside of a browser window for no reason at all are the reason the guy at the liquor store knows my name

    bowenDelmainCarpyironsizideVegemyteMvrck
  • crimsoncoyotecrimsoncoyote Registered User regular
    edited April 2015
    Anyone else feel like they wear a Technical Writer hat 90% of the time? >_>

    crimsoncoyote on
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    Anyone else feel like they wear a Technical Writer hat 90% of the time? >_>

    I hate that hat, but I only have to wear it about 5% of the time. What are you doing that requires so much writing?

    ironsizide
  • crimsoncoyotecrimsoncoyote Registered User regular
    I'm exaggerating (quite) a bit. Mostly I've been updating our open tickets with our partner.
    It just feels like it takes forever.

    Geth
  • InfidelInfidel Heretic Registered User regular
    Speaking of which, some specs to update once I'm back on my main project...

    Doing a 24/7 data conversion for another thing and not getting much sleep. Just work up from nap.

    OrokosPA.png
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Jasconius wrote: »
    i have a statement to make


    large, universally purposeful javascript libraries which have been written in such a fashion that they can only operate on a Node.JS server and not inside of a browser window for no reason at all are the reason the guy at the liquor store knows my name

    It's probably more that the developer is making use of ES5 features, something he can be guaranteed exist in Node, but not in a browser. Having to do all the polyfilling and/or code refactoring required to support browsers it not always something people want to do.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • crimsoncoyotecrimsoncoyote Registered User regular
    Infidel wrote: »
    Doing a 24/7 data conversion for another thing and not getting much sleep. Just work up from nap.

    I see what you did there ;-)

    ecco the dolphinbowenCarpy
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited April 2015
    GnomeTank wrote: »
    Jasconius wrote: »
    i have a statement to make


    large, universally purposeful javascript libraries which have been written in such a fashion that they can only operate on a Node.JS server and not inside of a browser window for no reason at all are the reason the guy at the liquor store knows my name

    It's probably more that the developer is making use of ES5 features, something he can be guaranteed exist in Node, but not in a browser. Having to do all the polyfilling and/or code refactoring required to support browsers it not always something people want to do.

    This is correct. It's ES5 related. I am fortunate enough to be able to tell clients that they can't use stupid browsers tho.

    I just feel like there's a way to make these things more universal so that I don't have to run a browserify task and then monkeypatch the file to be window compatible

    like.... write your functionality agnostically and then create the appropriate node/browser setups or something

    Jasconius on
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    been feeling pretty good about my excel formula resolver. its nice and recursive, got a few basic math functions wired up

    then I got to IF.... no problem, just a few extra tokens to keep an eye out for

    and then. and then it happened.

    "A1=3=D4" is a thing that could happen

    this will not be solved at 4:40PM no sir

    the formula.js lib has an "IF" helper... but that code just looks... wrong. very wrong. or dependent on some other function that is not in the comments to properly format the logical expression

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited April 2015
    Being called in to debug/fix something in a demo environment and finding out they turned off all the environment VMs.

    #justthursdaythings

    edit: WHY SINUSES, WHY

    admanb on
  • ecco the dolphinecco the dolphin Registered User regular
    edited April 2015
    Goddamn it

    Better variable names man

    What the heck is "position" referring to?

    There are at least 4 physical positions in this system, not including any of the virtual positions.

    The variable name is so vague as to be meaningless, and worst case misleading. D:

    Edit:

    Protip for Programmers

    What is obvious right now in the heat of the moment will not be obvious in a few week's time when you/someone else revisits the code.

    Either comment the code, or make it so that there's no ambiguity in your variable/function names.

    Personal Opinion: A difference between a good developer and a crappy code monkey is the bolded - you write code not just to solve the immediate problem, but also think about maintenance and how it will interact with other code/people.

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
    SageinaRagecrimsoncoyotebowen
  • ecco the dolphinecco the dolphin Registered User regular
    edited April 2015
    Ecco's Daily WTF
    const bool output_to_network = true;
    const bool not_output_to_network = false;
    

    I kid you guys not.

    This is what I just found. This also has many associated multiple levels of fail - ignoring the obvious WTFs there:

    1.) This was inside a header file for an unrelated class. What the header file for a class is doing controlling network output is a mystery.
    2.) A "Find in Files" indicates that nothing else references this. Why is this even here in the first place?*
    3.) Placed without decoration in a namespace shared between multiple classes. Whhhhy? Why would you hurt another developer and stop them using those names like this?

    Thankfully, due to #2, I can just nuke it from orbit.

    *sigh*

    This day is going to be so good when it's over.

    * Yes, it was probably used at one stage. And now it's just leftovers. Should have been removed when the functions that were using it were removed.

    EDIT #2:

    Hey, guess what I just found by going down a few lines:
    const double divide_zero = 1e-4;
    ...
    const double DIVIDE_ZERO = 0.0000001;
    

    Well done whoever wrote this. Well done.

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
    crimsoncoyotea5ehrenbowen
This discussion has been closed.