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] djmitchella travelling through snow to rfind duplicate dates for singletons

11920222425100

Posts

  • EchoEcho ski-bap ba-dapModerator mod
    Duuuh. Stupid fucking file permissions.

    Apparently it's not an existing file to mod_rewrite unless Apache can read it.

  • bowenbowen How you doin'? Registered User regular
    Yay file permissions!

    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
  • EchoEcho ski-bap ba-dapModerator mod
    Yeah, should have been the first thing I checked when some files worked and others didn't.

    Worst part is I remembered having bumped into this exact same thing before.

  • EchoEcho ski-bap ba-dapModerator mod
    edited October 2014
    Echo on
    bowenTryCatcherecco the dolphinironsizideCampyVegemyteEvigilant
  • bowenbowen How you doin'? Registered User regular
    Echo wrote: »

    I want to see a test case for this.

    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 October 2014
    Echo wrote: »

    Oh man

    That code is beautiful

    Rend on
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    There really seems to be a huge gap in Node deployment tools on the small end. Everything seems to be based around these huge elaborate push deploys, using Docker and such. I just want something super simple that takes a config file, listens for new builds from Travis, pulls the changeset and bounces the effected apps. Looks like I'm going to be writing something custom, probably using forever's API.

    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
  • ecco the dolphinecco the dolphin Registered User regular
    Deploy more monkeys!

    Penny Arcade Developers at PADev.net.
    ASimPerson
  • DyasAlureDyasAlure SeattleRegistered User regular
    so finished my last assignment, made a graphic using a class given to me, and graphics.

    On the code I wrote to find only the tens place, I was stupid and passed a double to an int (declared int in method call) and it failed. I didn't catch it until I lost the point. I only lost two points on the test, so I'm happy. I could have done better though.

    Now, I have to write a program to ask if SAT/ ACT and computer a score. Ask GPA questions and computer score. Using two scores computer a score. Do this for two test cases, than say which case is better looking on paper.

    I have plans on what I'm going to do, but I started writing something like this
    public static void main(Straings[]arg)
    {
         double score = student(console, studentNumber);
    }
    
    public static double student(Scanner console, int studentNumber)
    {
         // do stuff
         return satCompute(console, studentNumber);
    }
    
    public static double satCompute(Scanner console, int studentNumber)
    {
         // do stuff
         return gpaCompute(console, studentNumber, satScore);
    }
    
    public static double gpaCompute(Scanner console, int studentNumber, double satScore)
    {
         // do stuff
         return totalScore(console, studentNumber, satScore, gpaScore);
    }
    
    public static double totalScore(Scanner console, int studentNumber, double satScore, double gpaScore)
    {
         / do stuff
         return totalScore
    }
    

    I was told chaining is bad. Now, I can easily write it another way. This is in no way compile code, but I was just curious about the no chaining thing. I do have the limitation of 15 lines of code per method. I don't think that will be hard though.


    My%20Steam.png?psid=1My%20Twitch%20-%20Mass%20Effect.png?psid=1=1My%20Youtube.png?psid=1
  • ironsizideironsizide You must whip it Registered User regular
    edited October 2014
    I wound find it easier to follow if you called satCompute and gpaCompute within totalScore and call totalScore within student. To me it says what you need to do to compute the total score, and then where you need the total score to be attached (a student record).

    edit: betterer wording. And a Geth Crackle?

    ironsizide on
    |_
    Oo\ Ironsizide
    camo_sig2.png
    Geth
  • EndEnd Registered User regular
    edited October 2014
    Rend wrote: »
    ...because it was fine for me to obliterate my local Branch since this was my initial pull.

    btw, if you do ever obliterate any changes where you had commits and you need to get them back, the reflog is incredibly useful

    basically git stores a log of commits that your branches and your HEAD were on, and since a commit (as identified by its sha1) is immutable, this log means those lost commits are still findable until git garbage collects them (after they fall off the reflog and aren't reachable by a branch). Even commits changed via rebase/--amend/whatever are just new commits based on old commits.

    End on
    I wish that someway, somehow, that I could save every one of us
    zaleiria-by-lexxy-sig.jpgsteam~tinythumb.png
    Ethea
  • DyasAlureDyasAlure SeattleRegistered User regular
    edited October 2014
    ironsizide wrote: »
    I wound find it easier to follow if you called satCompute and gpaCompute within totalScore and call totalScore within student. To me it says what you need to do to compute the total score, and then where you need the total score to be attached (a student record).

    edit: betterer wording. And a Geth Crackle?

    Yeah, I guess that would make more sense. I'm re doing the whole thing anyway, and I'm not worried. I was just curious what the chaining got such a negative response.

    Edit:
    Also, I'm used to declaring all my variables at the top of the program. I'm told not to for this class. Grr...

    DyasAlure on
    My%20Steam.png?psid=1My%20Twitch%20-%20Mass%20Effect.png?psid=1=1My%20Youtube.png?psid=1
    Geth
  • HounHoun Registered User regular
    DyasAlure wrote: »
    ironsizide wrote: »
    I wound find it easier to follow if you called satCompute and gpaCompute within totalScore and call totalScore within student. To me it says what you need to do to compute the total score, and then where you need the total score to be attached (a student record).

    edit: betterer wording. And a Geth Crackle?

    Yeah, I guess that would make more sense. I'm re doing the whole thing anyway, and I'm not worried. I was just curious what the chaining got such a negative response.

    Edit:
    Also, I'm used to declaring all my variables at the top of the program. I'm told not to for this class. Grr...

    Encase the whole thing in a class. Not at the top anymore!

    ironsizide
  • gavindelgavindel The reason all your software is brokenRegistered User regular
    Huh. Project description: "Use whatever language you'd like. We recommend Java or Python."

    So I do my project in Python 3.4. Then the TA pops up to mention the code has to be in Python 2.4, you know, 24 hours before the due date.

    What the fuck is going on that we're grading with Python 2.4?! I guess instead of trying to get more than a 60 on a major course project, I'll spend my last day converting to a version of Python from November 2004.

    Angels, innovations, and the hubris of tiny things: my book now free on Royal Road! Seraphim
    InfidelNaphtali
  • LD50LD50 Registered User regular
    Rewrite it in befunge.

    gavindel
  • gavindelgavindel The reason all your software is brokenRegistered User regular
    And turn in the specification on a stone slab.

    Angels, innovations, and the hubris of tiny things: my book now free on Royal Road! Seraphim
  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    The python community's indecision about python v2 and python v3 causes me a little frustration. Nothing major; just "grump, grump, mumble, mumble, gotta make a 'choice'".

    If you want to use v3 you'd better make sure any libraries you're going to want to use support v3 as well or dog help you; whereas with v2 you're 99.9% sure to be able to use the library you want but you also know you're using a version of python that someone, somewhere is wanting you to quit using because goddamnit v3 is out and usable and why the fuck won't anyone use it. :?

  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Still there's no reason for them to use 2.4 instead of 2.7 though

    TofystedethHouniTunesIsEvilEchomightyjongyoDelmaina5ehrenVegemytean_alt
  • EndEnd Registered User regular
    edited October 2014
    I keep having to use 2.6 for work because redhat, so still not even 2.7 for me either

    way better than having to use 2.4 though. I think 2.4 was the version I first learned python on.

    End on
    I wish that someway, somehow, that I could save every one of us
    zaleiria-by-lexxy-sig.jpgsteam~tinythumb.png
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    Phyphor wrote: »
    Still there's no reason for them to use 2.4 instead of 2.7 though

    the teachers ancient text book is in 2.4!

    re: 3.x vs 2.x, i don't think it's so much about Python's indecision as there are just so many people out there with 2.x code that would break on 3.x and for what benefit?

    their decision is that they will ignore 3.x for as long as they can

    Naphtali
  • HounHoun Registered User regular
    End wrote: »
    I keep having to use 2.6 for work because redhat, so still not even 2.7 for me either

    way better than having to use 2.4 though. I think 2.4 was the version I first learned python on.

    Wait, what? Redhat's on 2.6? Even my Debian Wheezy box is on 2.7!

  • LD50LD50 Registered User regular
    Jasconius wrote: »
    Phyphor wrote: »
    Still there's no reason for them to use 2.4 instead of 2.7 though

    the teachers ancient text book is in 2.4!

    re: 3.x vs 2.x, i don't think it's so much about Python's indecision as there are just so many people out there with 2.x code that would break on 3.x and for what benefit?

    their decision is that they will ignore 3.x for as long as they can

    That aspect of the python community is literally the worst thing about it.

  • HounHoun Registered User regular
    LD50 wrote: »
    Jasconius wrote: »
    Phyphor wrote: »
    Still there's no reason for them to use 2.4 instead of 2.7 though

    the teachers ancient text book is in 2.4!

    re: 3.x vs 2.x, i don't think it's so much about Python's indecision as there are just so many people out there with 2.x code that would break on 3.x and for what benefit?

    their decision is that they will ignore 3.x for as long as they can

    That aspect of the python community is literally the worst thing about it.

    No value judgments, just an honest question: How often do most languages change in a fashion that completely breaks old code?

  • bowenbowen How you doin'? Registered User regular
    The ones that don't break code revise every 10-20 years. The ones that do, revise every few months/years, even then, it's a small thing for the benefits the changes bring. Python and Java are the biggest offenders to the "break everything between versions" java will do it between minor revisions, so it's even worse than python.

    It wouldn't surprise me to hear there's people still running Java 1.4.2.

    Meanwhile everyone and their mother are jumping ship to newer versions of C++ or .NET when it comes out.

    PHP is kind of a mixed bag, they give ample warning, but the biggest issue is hosting companies don't want to change because it requires them to be involved in server maintenance more than a cron backup job.

    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
  • HounHoun Registered User regular
    Interesting. I'm not too familiar with Java, so I didn't know that it broke things on updates.

    Python is actually the only one I've ever heard of breaking due to what I guess you'd call an "ideological redesign". Which is weird. I can actually understand both sides of the 2.x/3.x argument, but don't have a vested interest in either. I started learning Python in 2, updated a few scripts to 3 later, but lately have been back in 2 because it was already installed.

    Geth
  • LuvTheMonkeyLuvTheMonkey High Sierra Serenade Registered User regular
    To be fair, the 2.x/3.x divide is the only breaking divide I know of in the past....15 years of Python history. I believe all 2.x revisions are forward compatible between themselves (save bug fixes) and the same is true of the 3.x releases.

    Molten variables hiss and roar. On my mind-forge, I hammer them into the greatsword Epistemology. Many are my foes this night.
    STEAM | GW2: Thalys
  • LD50LD50 Registered User regular
    The changes between 2.7 and 3 aren't even all that drastic. I wouldn't say they were any more drastic than the changes ruby went through between 1.8 and 1.9. The major issue isn't that the 'end users' are unwilling to update their code, but that the library and tool authors won't. The python community is relying on modules that are super fucking out of date and nobody is updating those or replacing them.

    The worst part about the whole situation is that now the python development team has to keep an ancient version of python on life support with security patches and whatnot rather than spending those resources on the current branch. They've already had to extend the LTS for 2.7 twice now.

  • bowenbowen How you doin'? Registered User regular
    Houn wrote: »
    Interesting. I'm not too familiar with Java, so I didn't know that it broke things on updates.

    Python is actually the only one I've ever heard of breaking due to what I guess you'd call an "ideological redesign". Which is weird. I can actually understand both sides of the 2.x/3.x argument, but don't have a vested interest in either. I started learning Python in 2, updated a few scripts to 3 later, but lately have been back in 2 because it was already installed.

    Java breaks weird things you wouldn't expect. Serialization is one of the big ones, @urahonky‌ can tell you all about those, even in the minor revisions of each version.

    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
    edited October 2014
    Oh sweet Jesus... Serialization. Yeah I can tell you that if you're using JDK 1.5.6 it will certainly have issues on JDK 1.5.7.

    urahonky on
  • TofystedethTofystedeth Registered User regular
    Oh yay, I'm finally messing around in the other reporting tools for our EHR (which were made by the vendor). It's making me pine for SAP.
    Grab all the column headers I need, put in a filter that I only want DRG codes from the CPT4 code vocabulary. Drag the actual DRG code column header into the filter pane: "You can't filter by this column"
    WTF thing!? So my only choice for this query is to return every procedure associated with every CPT4 code in the system?

    steam_sig.png
  • Jimmy KingJimmy King Registered User regular
    lkajsfdlkjsdf.

    Stupid shitty API documentation. It just said when is_return is true, we swap the addresses for you. With the UI we've got in this web app, it was easier for me to just swap them myself when needed. Well, months later I come to discover that the flag does more than just swap two fucking mailing addresses for you. It also affects generated customs forms, available shipping options, actual shipping rates, etc. That stuff was kind of important to know.

  • EndEnd Registered User regular
    Houn wrote: »
    End wrote: »
    I keep having to use 2.6 for work because redhat, so still not even 2.7 for me either

    way better than having to use 2.4 though. I think 2.4 was the version I first learned python on.

    Wait, what? Redhat's on 2.6? Even my Debian Wheezy box is on 2.7!

    RHEL has extremely long lived releases without much churn. RHEL 6 released in 2010, and RHEL 7 only came out this year I think.

    I wish that someway, somehow, that I could save every one of us
    zaleiria-by-lexxy-sig.jpgsteam~tinythumb.png
  • DedwrekkaDedwrekka Metal Hell adjacentRegistered User regular
    At what point in learning to code will programming threads stop sounding like alien language?

  • EtheaEthea Registered User regular
    Dedwrekka wrote: »
    At what point in learning to code will programming threads stop sounding like alien language?

    I will tell you once it happens for me.

    mightyjongyoTofystedethurahonkyan_altEvigilant
  • HounHoun Registered User regular
    Dedwrekka wrote: »
    At what point in learning to code will programming threads stop sounding like alien language?

    I'm just here for the linguistic immersion.

  • RendRend Registered User regular
    Dedwrekka wrote: »
    At what point in learning to code will programming threads stop sounding like alien language?

    Approximately the same time as you realize the most common use for threading is to accomplish network or computationally intensive tasks without freezing the UI.

    bowen
  • RendRend Registered User regular
    In all seriousness, working nontrivially in android will force you to get a pretty good handle on threading. Android development demands it.

  • urahonkyurahonky Registered User regular
    Rend wrote: »
    Dedwrekka wrote: »
    At what point in learning to code will programming threads stop sounding like alien language?

    Approximately the same time as you realize the most common use for threading is to accomplish network or computationally intensive tasks without freezing the UI.

    Man I feel like I need to work on this skill. I did some threads in Java but nothing nearly as fun as helping the UI from freezing whenever I'm gathering data.

  • mightyjongyomightyjongyo Sour Crrm East Bay, CaliforniaRegistered User regular
    It starts with threads to stop things from freezing, then it turns into writing your own message passing architecture so that you can share information between threads.

  • RendRend Registered User regular
    urahonky wrote: »
    Rend wrote: »
    Dedwrekka wrote: »
    At what point in learning to code will programming threads stop sounding like alien language?

    Approximately the same time as you realize the most common use for threading is to accomplish network or computationally intensive tasks without freezing the UI.

    Man I feel like I need to work on this skill. I did some threads in Java but nothing nearly as fun as helping the UI from freezing whenever I'm gathering data.

    The general pattern I've used in android is pretty simple:

    The UI thread (which android starts on):
    ...
    workerThread = new Thread(workerMethod);
    workerThread.start();
    ...
    private void workerMethod(){
      modelComponent.start();
    }
    
    ...
    
    ModelComponent.start(){
      while(isRunning){
        //do stuff
      }
    }
    

    Whenever you want to change the UI...
    changeUI(){
      Looper mainLooper = Looper.getMainLooper(); //In android this gets the UI thread (syntax notwithstanding)
      Handler h = new Handler(mainLooper);
      h.post(new Runnable{
        @Override
        public void run(){
          //Make some changes
        }
      });
    }
    

    If the main thread you run on is also the UI thread, which it will be in most instances, this pattern (UI thread spawns children who post back to it when necessary) works well. If your UI thread is not the main thread, then likely the UI thread will be a sibling to the worker thread(s), and you'll have something like
    MainThread -> UIThread
               -> WorkerThread1
               -> WorkerThread2
               ...
               -> WorkerThreadN
    
    ...and you'll post back to the main thread, which will pass messages to the UI thread when the UI needs to do something.

    urahonkyironsizide
Sign In or Register to comment.