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/

[Programming] Kafkaesque rabbits in the queue at the pub

16061636566100

Posts

  • mightyjongyomightyjongyo Sour Crrm East Bay, CaliforniaRegistered User regular
    One developer at my company legit thought that source controlling the filesystem was an effective way of snapshotting the system..

  • urahonkyurahonky Registered User regular
    I swear to God if my manager revoked access to the development database and requires me to go through him for changes/updates I will fucking quit.

  • urahonkyurahonky Registered User regular
    Sigh so my next task is to squash all of our migrations. We have accumulated ~250 migration files since release and it'd be nice to bring them back down (will allow us to run unit tests a LOT faster)... Except every time I run the command I get a CircularDependencyError. Which means I have to go in and manually edit the migrate files.

    https://docs.djangoproject.com/en/1.8/topics/migrations/#squashing-migrations

    Ugh this doesn't seem all that worth it.

  • urahonkyurahonky Registered User regular
    To manually resolve a CircularDependencyError, break out one of the ForeignKeys in the circular dependency loop into a separate migration, and move the dependency on the other app with it. If you’re unsure, see how makemigrations deals with the problem when asked to create brand new migrations from your models. In a future release of Django, squashmigrations will be updated to attempt to resolve these errors itself.

    Of all the things in the world to have an example for this would be it. But they did show us how to run the squashmigrations command so that's good.

  • urahonkyurahonky Registered User regular
    Seriously? How is there not a single example online of solving a CircularDependencyError without having the simplest example? I can't even make a blank migration using "makemigrations --empty case" because it throws CircularDependencyError at me.

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    I'm finding stupider and stupider ways to not get jobs that I'm super qualified for.

  • DelzhandDelzhand Hard to miss. Registered User regular
    admanb wrote: »
    I'm finding stupider and stupider ways to not get jobs that I'm super qualified for.

    fwiw, the resume/portfolio link in your sig goes to a website with an error message

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    Delzhand wrote: »
    admanb wrote: »
    I'm finding stupider and stupider ways to not get jobs that I'm super qualified for.

    fwiw, the resume/portfolio link in your sig goes to a website with an error message

    Oh hey I'm not jailed anymore!

    On a list of reasons that probably still wouldn't even make top three, but I should still probably kill those entirely.

  • urahonkyurahonky Registered User regular
    Django folks: What's stopping me from going through and wiping out all of my migration files and running "makemigrations" to create the initial?

  • urahonkyurahonky Registered User regular
    edited March 2017
    The answer: everything.

    Edit: actually I think it's because of this django_migrations table....

    urahonky on
  • urahonkyurahonky Registered User regular
    Success! Fuck you Django squashmigrations!

  • EchoEcho ski-bap ba-dapModerator mod
    urahonky wrote: »
    Django folks: What's stopping me from going through and wiping out all of my migration files and running "makemigrations" to create the initial?

    Man, I do that in ASP.NET MVC all the time. It's really weird about foreign keys sometimes.

  • InfidelInfidel Heretic Registered User regular
    Our database migrations are pretty easy since we use Mongo :rotate:

    OrokosPA.png
  • EchoEcho ski-bap ba-dapModerator mod
    Echo's Law: refactoring is like cleaning the shower drain. The longer you wait, the more disgusted the look on your face.

  • AnteCantelopeAnteCantelope Registered User regular
    Infidel wrote: »
    Our database migrations are pretty easy since we use Mongo :rotate:

    I've been using mongo a lot lately. It's great when it's the right tool for the job, but then you find yourself needing to update one thing in thousands of places because what you really needed from the start was a relational database.

  • zeenyzeeny Registered User regular
    Mongo is never the right tool for anything. You can use redis, cassandra, rethink, psql json whatever actually fits your need, but Mongo is a fundamentally broken piece of software that's a nightmare to maintain.

  • DelzhandDelzhand Hard to miss. Registered User regular
    edited March 2017
    I fucking hate "clever" code. I can't tell what the fuck this function does:
    $.fn.commerceCheckShippingRecalculation = function() {
      var recalculate = true;
    
      // Define the callback used with setTimeout to click the recalculation button
      // if there is ongoing AJAX operation.
      var recalculateCallback = function() {
        if ($('[id^="edit-customer-profile-"]').find('.ajax-progress').length) {
          return setTimeout($.fn.commerceCheckShippingRecalculation, 100);
        }
    
        // Trigger the click event on the shipping recalculation button.
        $('[id^="edit-commerce-shipping-recalculate"]').trigger('click');
      };
    
      // If other ajax logic is still running we can ignore the empty field check,
      // as we can expect the forms to change and we want to see what the backend
      // think we should do.
      if (!$('[id^="edit-customer-profile-"]').find('.ajax-progress').length) {
        $('[id^="edit-customer-profile-shipping"] .form-item').children('.required').filter(':not(.chosen-container)').each(function() {
          if (!$(this).val()) {
            recalculate = false;
          }
        });
      }
    
      if (recalculate == true) {
        return setTimeout(recalculateCallback, 100);
      }
    }
    

    What it appears to do in practice is, when a change is made to the address on a form, it gets a new set of shipping rates. But looking at the code, it seems to only ever call itself, or call a function defined in itself that returns itself.

    Edit: Oh, it's clicking a button that happens to be hidden with CSS ( •̑_•̑ )

    Delzhand on
  • urahonkyurahonky Registered User regular
    I'm probably showing my age but holy hell I vastly prefer being explicit in my code.

  • bowenbowen How you doin'? Registered User regular
    explicit is better because you have to be in the now to read clever code

    8 weeks later or 8 years later I'm no longer "in the now".

    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
  • Steel AngelSteel Angel Registered User regular
    bowen wrote: »
    explicit is better because you have to be in the now to read clever code

    8 weeks later or 8 years later I'm no longer "in the now".

    Before my current job I worked as tier 2 support. I try to write my code with the knowledge that 6 months from now someone else without the same background but with a lot more stress and people yelling at him is going to have to figure out what my stuff is doing.

    Big Dookie wrote: »
    I found that tilting it doesn't work very well, and once I started jerking it, I got much better results.

    Steam Profile
    3DS: 3454-0268-5595 Battle.net: SteelAngel#1772
  • LD50LD50 Registered User regular
    edited March 2017
    bowen wrote: »
    explicit is better because you have to be in the now to read clever code

    8 weeks later or 8 years later I'm no longer "in the now".

    Before my current job I worked as tier 2 support. I try to write my code with the knowledge that 6 months from now someone else without the same background but with a lot more stress and people yelling at him is going to have to figure out what my stuff is doing.

    That guy:
    Is you after a weekend of heavy drinking.

    Why is it clicking a button instead of calling whatever the button click calls? Is that button calling something you don't control?

    Edit:
    Or is it just using the page as a way to share program state? Because that... that is not what I would call a 'best practice'.

    LD50 on
  • bowenbowen How you doin'? Registered User regular
    I always apologize "I'm sorry the code below looks shitty, I was in a time crunch"

    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
  • urahonkyurahonky Registered User regular
    bowen wrote: »
    I always apologize "I'm sorry the code below looks shitty, I was in a time crunch"

    My comments are like:
    # Problems? Get gud, mate.
    # Fight me IRL.
    

    I like to be overly hostile with future me so I can get pissed at myself.

  • djmitchelladjmitchella Registered User regular
    I just did a code review where the final name of a parameter was "otherPeopleDoNotIncrementTheCountIfTheyAreNotOwners" because we couldn't think of any more concise way to phrase it which couldn't be misinterpreted. (our best guess is that the bug that was being fixed was caused exactly because "skipNormalUsers" hadn't quite been clear enough..)

  • zeenyzeeny Registered User regular
    edited March 2017
    I wouldn't pass that in a code review. (in case you were serious)

    zeeny on
  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    I would.

  • zeenyzeeny Registered User regular
    I would.

    RIP codebase.

  • RendRend Registered User regular
    Wouldn't you have the object which owns the count validate whether the user was normal or owner and increment the count itself? That sounds like a violation of encapsulation if external sources are expected to increment a count only when appropriate, but I may be misunderstanding.

  • DehumanizedDehumanized Registered User regular
    Yeah did the structure somehow prevent that from becoming private state?

  • bowenbowen How you doin'? Registered User regular
    I just did a code review where the final name of a parameter was "otherPeopleDoNotIncrementTheCountIfTheyAreNotOwners" because we couldn't think of any more concise way to phrase it which couldn't be misinterpreted. (our best guess is that the bug that was being fixed was caused exactly because "skipNormalUsers" hadn't quite been clear enough..)

    java right?

    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
  • bowenbowen How you doin'? Registered User regular
    skipIncrementForNonOwners would be better

    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
  • RendRend Registered User regular
    edited March 2017
    bowen wrote: »
    skipIncrementForNonOwners would be better

    and incrementCount(currentUser); would be better yet

    Rend on
  • LD50LD50 Registered User regular
    Rend wrote: »
    Wouldn't you have the object which owns the count validate whether the user was normal or owner and increment the count itself? That sounds like a violation of encapsulation if external sources are expected to increment a count only when appropriate, but I may be misunderstanding.

    Nah, the 'count' is a hidden button that's clicked by an ajax script.

  • DelzhandDelzhand Hard to miss. Registered User regular
    LD50 wrote: »
    bowen wrote: »
    explicit is better because you have to be in the now to read clever code

    8 weeks later or 8 years later I'm no longer "in the now".

    Before my current job I worked as tier 2 support. I try to write my code with the knowledge that 6 months from now someone else without the same background but with a lot more stress and people yelling at him is going to have to figure out what my stuff is doing.

    That guy:
    Is you after a weekend of heavy drinking.

    Why is it clicking a button instead of calling whatever the button click calls? Is that button calling something you don't control?

    Edit:
    Or is it just using the page as a way to share program state? Because that... that is not what I would call a 'best practice'.

    Drupal's form api provides a way to rebuild sections of a form independently. So the actual callback is highly generalized, something along the lines of "rebuild this form and replace x dom element with the content". The actual event handling (rebuild the shipping options) is handled well, but I failed to notice the most relevant line of code in the example I gave because I was overly focused on finding the return statements.

  • templewulftemplewulf The Team Chump USARegistered User regular
    edited March 2017
    haha that sounds like the division we just put up for sale... same sort of deal. even better, each customer had a different developer, so sometimes they just cloned the repo and continued branching, whistling all the way.


    ....this client isn't from Massachusetts, is it...?

    D:D:D:

    I worked for a subsidiary of a Massachusetts medical software developer that did it this way. They also happened to work in a garbage language for trash people. It was the worst programming job I've ever had, and I worked with PHP.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited March 2017
    Does anybody have experience in Python and a desire to move to the MD/DC area? My wife's company is spectacular, and they've got a lead Python dev position open.

    Edit: If you're going to apply, let me know, so I can get some referrals going.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • bowenbowen How you doin'? Registered User regular
    fucking meditech

    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
  • Steel AngelSteel Angel Registered User regular
    bowen wrote: »
    fucking meditech

    I work at a company that does software that gets used by hospitals, insurance companies, doctor's offices, and research centers that can be customized based on client needs because the industry is so unstandardized it's depressing. Everyone here died a little inside early on in their tenure when they realized the axiom that "the client does not know their own data" also applies to the healthcare industry.

    We've thankfully managed to keep our stuff pretty intelligently managed in terms of the code base but stupid things still happen every now and then and it's not unusual for a conversation to end with "This is what's wrong with healthcare in our country."

    Big Dookie wrote: »
    I found that tilting it doesn't work very well, and once I started jerking it, I got much better results.

    Steam Profile
    3DS: 3454-0268-5595 Battle.net: SteelAngel#1772
  • LD50LD50 Registered User regular
    I assume Bowen was saying "fuck meditech in particular", as in Meditech the company. I 100% stand behind him on that.

  • bowenbowen How you doin'? Registered User regular
    Epic and Meditech are banes on the health field's IT industry

    Epic in particular since Meditech is struggling to modernize their terminal software for meaningful use last I heard.

    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
This discussion has been closed.