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/
Options

SELECT * FROM posts WHERE tid = 'PA PROGRAMMING THREAD'

15960626465100

Posts

  • Options
    jackaljackal Fuck Yes. That is an orderly anal warehouse. Registered User regular
    Basically

    Invariants are what should always be true for an instance (for sufficiently lax definitions of "always").
    Preconditions are what should always be true at the beginning of a subprogram.
    Postconditions are what should always be true at the end of a subprogram.

    Basically think of pre and post conditions as what you would write as asserts at the beginning and end of your functions if you were super anal, and invariants would be asserts at both the beginning and end of ever function in an object (except for the beginning of the constructor).

  • Options
    urahonkyurahonky Registered User regular
    God I hated pre/post/invariants for some reason.

  • Options
    SeolSeol Registered User regular
    Like a lot of CS, they're often taught badly. They're principles that are really, really important for solid software engineering, but like so much, they're a thought process for managing complexity taught with a trivial example. So they seem pointless, because there's no complexity to manage.

    No easy answer to that though - if they were taught with complex examples, they'd get lost in the mix.

  • Options
    GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Pre/post/invariants are one of those "great for students learning the basics of programming, something you'll never think about in the real world" sort of things. Or more precisely, you think about it implicitly, you don't sit and go "what are my pre/post/invariants?".

    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
  • Options
    baronfelbaronfel Would you say I have a _plethora_?Registered User regular
    zeeny wrote: »
    Egit & Subclipse or something better out there?

    Zeeny, you can use Egit, but for me and three other people we've been having tons of issues where merges just won't go through. I use the command line, so I don't see these issues, but every time my group members complain about a merge failing I tell them to cd to the directory and do the merge from the command line, which works as expected.

    So, go Egit if you want to, but in my experience be prepared to go command line diving fairly often.

  • Options
    InfidelInfidel Heretic Registered User regular
    An example of an invariant that is super succinct and I like to use:
    method add(int i) {
      list[count] = i;
      count++;
    }
    

    It does not matter that count is temporarily not representing the number of stored integers in this data structure class, it is only required that count be accurate before and after the method. This is probably called a class invariant and what you are expected to be listing, another common one which is the same thing but just in a different place is a loop invariant where the assertation is true at the start and end of every iteration.

    This is why jackal mentions subprograms, since the actual structure isn't that important. If the subprogram is a method then it's just a class invariant, if it is a loop then it is a loop invariant, etc. Any block of code can apply these concepts.

    OrokosPA.png
  • Options
    InfidelInfidel Heretic Registered User regular
    Why does it need to be a video game review site?

    OrokosPA.png
  • Options
    NightslyrNightslyr Registered User regular
    Not sure if I should ask this here, but does anyone know of a video game review site that uses responsive design, as opposed to a dedicated mobile site/app? I'm trying to get some inspiration/design ideas to steal look at, but haven't found any yet. All the major sites I could think of (IGN, GameSpot, 1*Up) are fixed-size sites.

  • Options
    InfidelInfidel Heretic Registered User regular
    Nightslyr wrote: »
    Infidel wrote: »
    Why does it need to be a video game review site?

    Because that's what I'm working on, and I need to see how they handle navigation at smaller resolutions.

    What does that have to do with video games though?

    Why not look at responsive layouts in general? Those would be easier to find.

    OrokosPA.png
  • Options
    NightslyrNightslyr Registered User regular
    Infidel wrote: »
    Why does it need to be a video game review site?

    Because that's what I'm working on, and I need to see how they handle navigation at smaller resolutions.

  • Options
    NightslyrNightslyr Registered User regular
    Infidel wrote: »
    Nightslyr wrote: »
    Infidel wrote: »
    Why does it need to be a video game review site?

    Because that's what I'm working on, and I need to see how they handle navigation at smaller resolutions.

    What does that have to do with video games though?

    Why not look at responsive layouts in general? Those would be easier to find.

    Hmm... true. I'll see if I can find some with substantial header navigation.

  • Options
    InfidelInfidel Heretic Registered User regular
    Check these out, most of them are examples of how the header changes and what they trim off.

    http://inspirationfeed.com/inspiration/websites-inspiration/60-examples-of-responsive-website-design/

    OrokosPA.png
  • Options
    ecco the dolphinecco the dolphin Registered User regular
    Man

    You're just slipping those posts back in time, aren't you, Infidel?

    Penny Arcade Developers at PADev.net.
  • Options
    InfidelInfidel Heretic Registered User regular
    It's not a bug it's a feature.

    OrokosPA.png
  • Options
    urahonkyurahonky Registered User regular
    Yeah a whole minute!

  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Infidel, winning so hard at Programming Thread he answers questions before they're asked!

  • Options
    ecco the dolphinecco the dolphin Registered User regular
    edited April 2012
    I wonder if it's caused by having more than one machine handling the forums (redundancy? load balancing?), and their times are slowly drifting apart. And then they get resync'd by NTP or something, so the occurrence of the bug goes way down temporarily.

    Imagination!

    Edit: Wait... I didn't get this idea out of a void. Did I get this idea from the previous forums?

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • Options
    InfidelInfidel Heretic Registered User regular
    I wonder if it's caused by having more than one machine handling the forums (redundancy? load balancing?), and their times are slowly drifting apart. And then they get resync'd by NTP or something, so the occurrence of the bug goes way down temporarily.

    Imagination!

    I am pretty sure it is a matter of load balancing database servers.

    Remember how I always go on about Time Is Hard and not using database timestamps for application-side values?

    Yeah...

    OrokosPA.png
  • Options
    InfidelInfidel Heretic Registered User regular
    And I'm stalking this thread so well because I have several projects and every single one is me waiting on someone currently. :rotate:

    OrokosPA.png
  • Options
    bowenbowen How you doin'? Registered User regular
    I wonder if it's caused by having more than one machine handling the forums (redundancy? load balancing?), and their times are slowly drifting apart. And then they get resync'd by NTP or something, so the occurrence of the bug goes way down temporarily.

    Imagination!

    Edit: Wait... I didn't get this idea out of a void. Did I get this idea from the previous forums?

    Yeah we had discussed this previously like 20 some pages back for the same reason.

    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
  • Options
    bowenbowen How you doin'? Registered User regular
    edited April 2012
    I don't even know why it's a thing, there are sequential ID numbers in all these posts, especially with a reply. If you look at nightslayer's post ID it's at least 8 or so ahead of Infidel's that appears before his.

    It doesn't seem like the database is having trouble organizing so much as the display layer is using date to order by rather than ID. Which seems silly.

    bowen on
    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
  • Options
    bowenbowen How you doin'? Registered User regular
    Your microprocessor can't keep up!

    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
  • Options
    bowenbowen How you doin'? Registered User regular
    Busting out the macro processor obviously.

    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
  • Options
    ecco the dolphinecco the dolphin Registered User regular
    bowen wrote: »
    I wonder if it's caused by having more than one machine handling the forums (redundancy? load balancing?), and their times are slowly drifting apart. And then they get resync'd by NTP or something, so the occurrence of the bug goes way down temporarily.

    Imagination!

    Edit: Wait... I didn't get this idea out of a void. Did I get this idea from the previous forums?

    Yeah we had discussed this previously like 20 some pages back for the same reason.

    Damn it - late to the party again!

    So late.

    Penny Arcade Developers at PADev.net.
  • Options
    InfidelInfidel Heretic Registered User regular
    bowen wrote: »
    I don't even know why it's a thing, there are sequential ID numbers in all these posts, especially with a reply. If you look at nightslayer's post ID it's at least 8 or so ahead of Infidel's that appears before his.

    It doesn't seem like the database is having trouble organizing so much as the display layer is using date to order by rather than ID. Which seems silly.

    Chronological post order in a forum seems silly? :rotate:

    Monotonically increasing ID for posts is just another assumption, like "database servers having synced time" is.

    If IDs are pooled then it is not valid either. Also, you can't timeshift an ID etc. etc.

    Proper server NTP infrastructure would address the problem.

    OrokosPA.png
  • Options
    ecco the dolphinecco the dolphin Registered User regular
    bowen wrote: »
    Your microprocessor can't keep up!

    I must overclock it... to THIRTY MEGAHERTZ!

    Bwahahaha! You'll never catch me nooooowwwwwwwww...

    ...

    Suspending - battery voltage low

    Penny Arcade Developers at PADev.net.
  • Options
    bowenbowen How you doin'? Registered User regular
    Infidel wrote: »
    bowen wrote: »
    I don't even know why it's a thing, there are sequential ID numbers in all these posts, especially with a reply. If you look at nightslayer's post ID it's at least 8 or so ahead of Infidel's that appears before his.

    It doesn't seem like the database is having trouble organizing so much as the display layer is using date to order by rather than ID. Which seems silly.

    Chronological post order in a forum seems silly? :rotate:

    Monotonically increasing ID for posts is just another assumption, like "database servers having synced time" is.

    If IDs are pooled then it is not valid either. Also, you can't timeshift an ID etc. etc.

    Proper server NTP infrastructure would address the problem.

    Well more or less, it seems like the ID is using some sort of system that's designed to avoid the "oh no let's of IDs, let's merge them together into a central way!" issues. The NOW() trigger on a new post just seems linked to the server time that is then synced with NTP at the server level. There's no error control what so ever if they drift apart, the ID seems like it's in proper order thus far, but I don't know the intricacies of the system. So if the ID has been ordered properly on a merge of data, by the datetime, I'd assume it would be better to use the ID.

    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
  • Options
    bowenbowen How you doin'? Registered User regular
    Server A:
    1 (a) - 8:00
    2 (c) - 8:01
    3 (d) - 8:01
    4 (f) - 8:02
    5 (g) - 8:03

    Server B:
    1 (b) - 8:07
    2 (e) - 8:09
    3 (h) - 8:09
    4 (i) - 8:09

    What it should look like:
    1 (a) - 8:00
    2 (b) - 8:01
    3 (c) - 8:01
    4 (d) - 8:01
    5 (e) - 8:02
    6 (f) - 8:02
    7 (g) - 8:02

    But they aren't error correcting the time and then using it to index, but I'm suspicious if they're even getting that exact with the time, it almost seems like things within the same minute get reordered too (I'm guessing they only record down to the minute??).

    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
  • Options
    InfidelInfidel Heretic Registered User regular
    bowen wrote: »
    Server A:
    1 (a) - 8:00
    2 (c) - 8:01
    3 (d) - 8:01
    4 (f) - 8:02
    5 (g) - 8:03

    Server B:
    1 (b) - 8:07
    2 (e) - 8:09
    3 (h) - 8:09
    4 (i) - 8:09

    What it should look like:
    1 (a) - 8:00
    2 (b) - 8:01
    3 (c) - 8:01
    4 (d) - 8:01
    5 (e) - 8:02
    6 (f) - 8:02
    7 (g) - 8:02

    But they aren't error correcting the time and then using it to index, but I'm suspicious if they're even getting that exact with the time, it almost seems like things within the same minute get reordered too (I'm guessing they only record down to the minute??).

    They record more than the minute.

    Actually, without knowing the exact DB and setup, it is hard to say whether it is a DB time issue or front-end issue. For example, if the replication is master-slave and all writes are proxied to the master, then a DB NOW() would not introduce this kind of issue. But if there is an active/active setup and replication between, then it could be.

    OrokosPA.png
  • Options
    bowenbowen How you doin'? Registered User regular
    Yeah that's what I'm thinking is going on, their IDs almost seem 100% correct from as far as I can tell whenever this is happening. I think a filter by this would solve the issue, or at least make it a lot less noticeable.

    Plus maybe I could answer a question before you do one day.

    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
  • Options
    an_altan_alt Registered User regular
    Joe K wrote: »
    jdarksun wrote: »
    I'm really amused by the Java hate in this thread.

    i'm amused that someone doesn't understand why there is hatred for java....

    You're not working in legacy code. It's all relative...

    I had fun tracking down an issue today in VFP. In my test cases, everything was working fine. On the server, it refused to work properly. As it turns out, I found a new case where VFP uncompiled or built into an exe works differently than when it's compiled as a DLL. It was like this:
    do case
        case var = "SomeThing"
            doSomeThing()
        case var = "SomeThingElse"
            doSomeThingElse()
    endcase
    

    Uncompiled or as an exe, it behaves exactly as you'd expect. When compiled as a DLL, the doSomeThingElse method never gets called because when var = "SomeThingElse", the first case somehow evaluates as True.

    While there are a number of things I don't like about Java, it can never get as far as hatred. That's reserved for VFP.

    BTW, does anyone have experience with Jython on Tomcat? Is it terribad or not too much trouble? I want to start writing some services in Python and it would save me some trouble to just use existing app servers.

    Pony wrote:
    I think that the internet has been for years on the path to creating what is essentially an electronic Necronomicon: A collection of blasphemous unrealities so perverse that to even glimpse at its contents, if but for a moment, is to irrevocably forfeit a portion of your sanity.
    Xbox - PearlBlueS0ul, Steam
    If you ever need to talk to someone, feel free to message me. Yes, that includes you.
  • Options
    CantidoCantido Registered User regular
    I think my senior design project just got me a job that can accommodate my USAF situation :D

    3DS Friendcode 5413-1311-3767
  • Options
    urahonkyurahonky Registered User regular
    Cantido wrote: »
    I think my senior design project just got me a job that can accommodate my USAF situation :D

    Congrats!!

  • Options
    ecco the dolphinecco the dolphin Registered User regular
    urahonky wrote: »
    Cantido wrote: »
    I think my senior design project just got me a job that can accommodate my USAF situation :D

    Congrats!!

    Whoop whoop! One of us! One of us!

    Penny Arcade Developers at PADev.net.
  • Options
    Joe KJoe K Registered User regular
    an_alt wrote: »
    Joe K wrote: »
    jdarksun wrote: »
    I'm really amused by the Java hate in this thread.

    i'm amused that someone doesn't understand why there is hatred for java....

    You're not working in legacy code. It's all relative...

    I had fun tracking down an issue today in VFP. In my test cases, everything was working fine. On the server, it refused to work properly. As it turns out, I found a new case where VFP uncompiled or built into an exe works differently than when it's compiled as a DLL. It was like this:
    do case
        case var = "SomeThing"
            doSomeThing()
        case var = "SomeThingElse"
            doSomeThingElse()
    endcase
    

    Uncompiled or as an exe, it behaves exactly as you'd expect. When compiled as a DLL, the doSomeThingElse method never gets called because when var = "SomeThingElse", the first case somehow evaluates as True.

    While there are a number of things I don't like about Java, it can never get as far as hatred. That's reserved for VFP.

    BTW, does anyone have experience with Jython on Tomcat? Is it terribad or not too much trouble? I want to start writing some services in Python and it would save me some trouble to just use existing app servers.

    DLL hell is something to never be discussed. Kind of like fight club.

    I havent used Jython, but I have used Play! Framwork to RESTify our app so i can mangle it in Python... slightly roudabout, but not that bad.

  • Options
    AnteCantelopeAnteCantelope Registered User regular
    Speaking of Java, can anyone help me with TextAreas in AWT? I'm trying to use buttons to add stuff to a TextArea, and I've got it so pressing buttons can append stuff, but is there any way to have it insert in the middle?

    If I were just typing it would be trivially easy, but to insert in the middle I need to know the location, and TextArea doesn't appear to have a getCursorLocation() that I can call on losing focus, which could be passed to the buttons.

    (Also it's really annoying that this big and complex assignment basically boils down to "emulate an iPad's keyboard with a mouse")

  • Options
    MusiquaMusiqua Registered User regular
    edited April 2012
    getCaretPosition() inherited from java.awt.TextComponent, perhaps? You might have to store the position if it is not available in the event you're looking in, though.

    .Net question in return:

    We're looking to perhaps create a couple of new web applications for our customers in the future. The ones we have are entirely homemade, but I'm investigating if we can create/use a framework with plugin functionality, so that we can create modules (in Asp.net/C#) to an existing portal when a new product is asked for. Creating synergy, so to speak.

    We're a small shop, so creating our own framework would probably be too time consuming. I'm looking at DotNetNuke and Umbraco and they seem somewhat promising. Does anyone have any experience with any of them, or any other suggestions? They seem a bit more focused on the CMS part than app development part, which worries me a bit.

    Our applications will exist of multiple pages, can they handle that in an not-awkward way?

    We would really prefer to use .Net, as we're mostly C++ and C# coders here.

    EDIT: mojoPortal looks like option 3, and they state they can handle multiple .aspx-pages.

    And unfortunately, we probably need to be able to use both SQL Server and Oracle as the DB. Which DNN can handle, from what I read.

    Musiqua on
  • Options
    CantidoCantido Registered User regular
    urahonky wrote: »
    Cantido wrote: »
    I think my senior design project just got me a job that can accommodate my USAF situation :D

    Congrats!!

    Whoop whoop! One of us! One of us!

    This job is via my college, and part time, yet well paying and related to my degree. That's what makes it perfect. The manager says he wants to buy a PHP shopping cart package that I will edit, but he doesn't know which one he wants. I've done this before but that was five years ago. Are there any that are particularly good?

    3DS Friendcode 5413-1311-3767
  • Options
    zeenyzeeny Registered User regular
    edited April 2012
    The good ones come with ioncube or zend guard protection. You better make sure that customization of what you want is possible for outside parties.

    zeeny on
  • Options
    AnteCantelopeAnteCantelope Registered User regular
    Musiqua wrote: »
    getCaretPosition() inherited from java.awt.TextComponent, perhaps? You might have to store the position if it is not available in the event you're looking in, though.

    Excellent, thanks! Just tried it out and it's a tiny little change to insert text anywhere.

This discussion has been closed.