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/

cmd /v:on /c "set TITLE=Programming Thread & echo !TITLE!"

19394959799

Posts

  • Jimmy KingJimmy King Registered User regular
    C# developer just get paid ridiculous money everywhere. Here in Richmond I have to fight to find a linux oriented anything - python, ruby, php, whatever - that has a budget for over $70k for a developer. My friends who are c# devs complain if they have to take high 90s plus large bonuses. Bastards.

    All the cool shit is in Boston and NYC on the east coast, though. NoVa/DC is also pretty good, not quite as good, but definitely some cool stuff going on there and not all of it doing government contracts.

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited January 2013
    jaziek wrote: »
    More MVC Nub questions

    ok, so I got the dropdown lists to populate from the database table that I want them to, so that's fine, but when I select my item and hit submit, it doesn't actually pass the selected item to the create method properly.

    What I'm trying to do is create a pair by selecting two players from a list of all players. Then (haven't actually done this yet, but it'll be easy) infer the Pair type (mixed, mens, ladies) based on the genders of the two selected players.
    @model Tournament.Models.DoublesPair
    
    @{
        ViewBag.Title = "Create";
    }
    
    <h2>Create</h2>
    
    @using (Html.BeginForm()) {
        @Html.ValidationSummary(true)
    
        <fieldset>
            <legend>DoublesPair</legend>
    
            <div class="editor-label">
                @Html.LabelFor(model => model.Player1)
            </div>
            <div class="editor-field">
                @Html.DropDownList("Players", String.Empty)
                @Html.ValidationMessageFor(model => model.Player1.PlayerName)
            </div>
    
            <div class="editor-label">
                @Html.LabelFor(model => model.Player2)
            </div>
            <div class="editor-field">
                @Html.DropDownList("Players", String.Empty)
                @Html.ValidationMessageFor(model => model.Player2.PlayerName)
            </div>
    
    
    
    
            <p>
                <input type="submit" value="Create" />
            </p>
        </fieldset>
    }
    
    <div>
        @Html.ActionLink("Back to List", "Index")
    </div>
    
    @section Scripts {
        @Scripts.Render("~/bundles/jqueryval")
    }
    
    Is my very simple view code.

            //
            // GET: /Pair/Create
    
            public ActionResult Create()
            {
                ViewBag.Players = new SelectList(db.Players, "PlayerID", "playerName");
                return View();
            }
    
            //
            // POST: /Pair/Create
    
            [HttpPost]
            public ActionResult Create(DoublesPair doublespair)
            {
                if (ModelState.IsValid)
                {
                    db.Pairs.Add(doublespair);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
    
                return View(doublespair);
            }
    
    and there's the relevant controller code.

    a9OIRvu.png
    In the debugger I can see that the values which I thought would be set by selecting an item in the dropdown are apparently still null. So what do I need to do to actually get them to post?
    In my mind, my code is pretty much the same as the tutorial I'm using, but it just isn't working.

    I would guess what is actually being sent is

    Players=<id of first selection>
    Players=<id of second selection>

    Thus it's failing to bind to Player1 and Player2. Are you running any dev tools on your web browser? 'cause being able to inspect the requests you're sending to the server is pretty much necessary for debugging web dev.

    My guess is you want this:
    @Html.DropDownList("Player1", ViewBag.Players)
    @Html.DropDownList("Player2", ViewBag.Players)
    

    admanb on
  • bowenbowen How you doin'? Registered User regular
    Now you know why I'm partly looking to get into google, and mostly looking at anything in NYC.

    The only thing I'm worried about is job security. Like I could murder children and still work for my boss.

    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 Registered User regular
    edited January 2013
    Google is a tough place to get in to, but if you can do it, it's good stuff. My ex-cousin-in-law worked for Google before he got hired away by Square. He loved it.

    Long hours though.

    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
  • bowenbowen How you doin'? Registered User regular
    Long hours are fine if I get paid mucho dinero.

    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 Registered User regular
    edited January 2013
    I am the opposite. I would rather take a minor pay cut, but work less hours. I am burnt out with being gung ho work 50+ hours a week guy. I did that basically from 18-28. I value my time away from work too much.

    If I was working on something I really wanted to work on (like, you know, my game, which hopefully becomes a real job someday), I'd be willing to work a lot more hours. I'm burnt out on grinding 50+ hours on other peoples code ideas.

    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
    DrunkMc
  • bowenbowen How you doin'? Registered User regular
    Yeah. My max is probably 50 hours a week anyways. I've been putting in a ton of OT hours in the form of working through lunch, I don't get paid for it though. But fuck it I want to get this EHR done and wrapped 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
  • jaziekjaziek Registered User regular
    edited January 2013
    admanb wrote: »
    jaziek wrote: »
    More MVC Nub questions

    ok, so I got the dropdown lists to populate from the database table that I want them to, so that's fine, but when I select my item and hit submit, it doesn't actually pass the selected item to the create method properly.

    What I'm trying to do is create a pair by selecting two players from a list of all players. Then (haven't actually done this yet, but it'll be easy) infer the Pair type (mixed, mens, ladies) based on the genders of the two selected players.
    @model Tournament.Models.DoublesPair
    
    @{
        ViewBag.Title = "Create";
    }
    
    <h2>Create</h2>
    
    @using (Html.BeginForm()) {
        @Html.ValidationSummary(true)
    
        <fieldset>
            <legend>DoublesPair</legend>
    
            <div class="editor-label">
                @Html.LabelFor(model => model.Player1)
            </div>
            <div class="editor-field">
                @Html.DropDownList("Players", String.Empty)
                @Html.ValidationMessageFor(model => model.Player1.PlayerName)
            </div>
    
            <div class="editor-label">
                @Html.LabelFor(model => model.Player2)
            </div>
            <div class="editor-field">
                @Html.DropDownList("Players", String.Empty)
                @Html.ValidationMessageFor(model => model.Player2.PlayerName)
            </div>
    
    
    
    
            <p>
                <input type="submit" value="Create" />
            </p>
        </fieldset>
    }
    
    <div>
        @Html.ActionLink("Back to List", "Index")
    </div>
    
    @section Scripts {
        @Scripts.Render("~/bundles/jqueryval")
    }
    
    Is my very simple view code.

            //
            // GET: /Pair/Create
    
            public ActionResult Create()
            {
                ViewBag.Players = new SelectList(db.Players, "PlayerID", "playerName");
                return View();
            }
    
            //
            // POST: /Pair/Create
    
            [HttpPost]
            public ActionResult Create(DoublesPair doublespair)
            {
                if (ModelState.IsValid)
                {
                    db.Pairs.Add(doublespair);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
    
                return View(doublespair);
            }
    
    and there's the relevant controller code.

    a9OIRvu.png
    In the debugger I can see that the values which I thought would be set by selecting an item in the dropdown are apparently still null. So what do I need to do to actually get them to post?
    In my mind, my code is pretty much the same as the tutorial I'm using, but it just isn't working.

    I would guess what is actually being sent is

    Players=<id of first selection>
    Players=<id of second selection>

    Thus it's failing to bind to Player1 and Player2. Are you running any dev tools on your web browser? 'cause being able to inspect the requests you're sending to the server is pretty much necessary for debugging web dev.

    My guess is you want this:
    @Html.DropDownList("Player1", ViewBag.Players)
    @Html.DropDownList("Player2", ViewBag.Players)
    

    I tried it like that but it tells me that there's no such thing as Player1 or Player2. I think I've just defined my models wrong.

    I have something like
    
    public class player{
            
           public int PlayerID {get; set;}
           public Gender PlayerGender {get; set;} 
           public string PlayerName {get; set; }
    }
    
    

    and
    
    public class DoublesPair{
    
         public int PairID {get; set;}
         public Player Player1 {get; set;}
         public Player Player2 {get; set;}
    
    }
    
    

    In the player class is it better to have ints for representing the players that correspond to their playerIDs, or should I actually do it the way I am now?

    jaziek on
    Steam ||| SC2 - Jaziek.377 on EU & NA. ||| Twitch Stream
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited January 2013
    The models are fine as database models (though I would change PlayerGender and PlayerName to Gender and Name; the prefixes are redundant) but trying to bind to them is wrong. You want to change the signature of your create method to something like
    [HttpPost]
    public ActionResult Create(int Player1, int Player2)
    

    Then use those values to query the database for the appropriate players and create a new DoublesPair with those. You really only want to bind to a complex object if you're creating all the values for the complex object out of your form data. Since most of the data already exists in the database, you don't want to bind it.

    admanb on
    Nightslyr
  • gjaustingjaustin Registered User regular
    GnomeTank wrote: »
    I am the opposite. I would rather take a minor pay cut, but work less hours. I am burnt out with being gung ho work 50+ hours a week guy. I did that basically from 18-28. I value my time away from work too much.

    If I was working on something I really wanted to work on (like, you know, my game, which hopefully becomes a real job someday), I'd be willing to work a lot more hours. I'm burnt out on grinding 50+ hours on other peoples code ideas.

    Yeah, I'd love to find a job where I only needed to work 30 hours a week.

    It's not like I get more real work than that done anyway!

  • Jimmy KingJimmy King Registered User regular
    That rails shop I've been talking to is off to an excellent start. Yesterday the in house (not 3rd party headhunter) said she'd confirm with a developer and then get let me know if 2pm today would work for a 2nd interview and then didn't e-mail me back. I e-mailed at 1pm today (if I had a direct phone number for her I'd call it... may have to try their main office number and see where that leads) and have no response yet.

  • Gilbert0Gilbert0 North of SeattleRegistered User regular
    Advice time:

    Anyone here using Oracle Forms (old tech yes I know)? Anyone migrated Oracle Forms to either AEPX or VB .NET forms? Any pros/cons to using either APEX of .NET?

    Both seem to have tools to help with the transition process but has anyone actually done it?

  • GnomeTankGnomeTank Registered User regular
    VB.NET Forms? Do you mean WinForms?

    WinForms (Windows Forms) is a .NET library, that can be used from any language (C# is the most common).

    I have no idea what APEX is, and have never done Oracle Forms.

    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
  • EtheaEthea Registered User regular
    So in other news I am doing my first development on CMake. I have been given the task of cleaning up and adding tests for a Sublime Text 2 generator.

    GnomeTankbowen
  • GnomeTankGnomeTank Registered User regular
    If you guys added C#/Mono support to CMake, I'd have your babies.

    One of the biggest pains in the ass with Mono/.NET cross-platform is the differing build systems. I have to maintain MSBuild files on Windows and Nant files for Linux builds.

    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
  • bowenbowen How you doin'? Registered User regular
    Oh god I am excited 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
  • Gilbert0Gilbert0 North of SeattleRegistered User regular
    Apex is Oracle Application Express. Here's their guide for the conversion.

    Here's the technet for the .Net. It's says VB .NET though it's from 2005

    Doing a little more looking it looks like Forms2Net is what I need.
    What is Forms2Net?

    The Forms2Net is the first and worldwide-unique , Microsoft Visual Studio add-in that allows for the high-quality migration of Oracle Forms applications to the Microsoft .NET platform.

    The Forms2Net© tool family consists of 3 members:
    - Forms2Net© Analyzer , a freely available tool for estimating the complexity and effort for migrating your Oracle Forms application.
    - Forms2Net© Converter , a powerful Microsoft Visual Studio add-in that automatically converts Oracle Forms versions 4.5 up to 10g to the Microsoft .NET equivalent either in HTML5, WPF, Silverlight, ASP.NET or Windows Forms (C# or VB.NET).
    - Reports2Net© Converter , for migrating automatically the Oracle Reports to Microsoft Reporting Services.

  • EtheaEthea Registered User regular
    GnomeTank wrote: »
    If you guys added C#/Mono support to CMake, I'd have your babies.

    One of the biggest pains in the ass with Mono/.NET cross-platform is the differing build systems. I have to maintain MSBuild files on Windows and Nant files for Linux builds.

    Yeah I don't see C# being a supported language in the near future. I expect once Fortran support becomes more stable, and we develop more and more toolchain support for osx / visual studio generators we will see a push again for C# support. But really C# seems to be easy to compile on Linux compared to the entirely different builds systems for C/C++/Obj-C.

  • GnomeTankGnomeTank Registered User regular
    It's not hard, it's not like maintaining an entire GNU make chain, but it's certainly annoying having to maintain MSBuild and Nant files, which is kind of the point of CMake...to get rid of that :/

    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
  • bowenbowen How you doin'? Registered User regular
    If someone wanted to add in support for c# they could push a patch to your company, though, since you're OSS?

    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
  • electricitylikesmeelectricitylikesme Registered User regular
    Anyone know anything about C# events and COM interop?

    Notionally I'm going for a function callback pattern here, since I have an object where the specific way it's response should be handled varies based on why it's created.

    So I want the pattern to be:
    object.Send(SendCallback1)
    object2.Send(SendCallback2)
    
    on my client side.

    The problem is, it doesn't seem at all obvious how the VBA side of things would implement this. I've found a reference where you can just use direct callbacks (pass in a function pointer, invoke that directly from C#) but everyone is all "use events!"...but that seems like it's way more complicated to do.

  • GnomeTankGnomeTank Registered User regular
    Gilbert0 wrote: »
    Apex is Oracle Application Express. Here's their guide for the conversion.

    Here's the technet for the .Net. It's says VB .NET though it's from 2005

    Doing a little more looking it looks like Forms2Net is what I need.
    What is Forms2Net?

    The Forms2Net is the first and worldwide-unique , Microsoft Visual Studio add-in that allows for the high-quality migration of Oracle Forms applications to the Microsoft .NET platform.

    The Forms2Net© tool family consists of 3 members:
    - Forms2Net© Analyzer , a freely available tool for estimating the complexity and effort for migrating your Oracle Forms application.
    - Forms2Net© Converter , a powerful Microsoft Visual Studio add-in that automatically converts Oracle Forms versions 4.5 up to 10g to the Microsoft .NET equivalent either in HTML5, WPF, Silverlight, ASP.NET or Windows Forms (C# or VB.NET).
    - Reports2Net© Converter , for migrating automatically the Oracle Reports to Microsoft Reporting Services.

    Yeah, if it can support WPF, that's would I would convert to. May make you learn a new technology, but WinForms is dead. It's not going "away", but there is no movement on it, no new development. WPF is where the movement is at.

    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
    Dehumanized
  • bowenbowen How you doin'? Registered User regular
    Anyone know anything about C# events and COM interop?

    Notionally I'm going for a function callback pattern here, since I have an object where the specific way it's response should be handled varies based on why it's created.

    So I want the pattern to be:
    object.Send(SendCallback1)
    object2.Send(SendCallback2)
    
    on my client side.

    The problem is, it doesn't seem at all obvious how the VBA side of things would implement this. I've found a reference where you can just use direct callbacks (pass in a function pointer, invoke that directly from C#) but everyone is all "use events!"...but that seems like it's way more complicated to do.

    Events are easy in C#?

    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 Registered User regular
    COM interop is a special beast.

    Generally it uses the sink/source COM event model...aka shitty shitsville. I believe the generated wrapper types use .NET events, but under the hood they go through IEventSink on the COM side.

    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
    bowen
  • electricitylikesmeelectricitylikesme Registered User regular
    GnomeTank wrote: »
    COM interop is a special beast.

    Generally it uses the sink/source COM event model...aka shitty shitsville. I believe the generated wrapper types use .NET events, but under the hood they go through IEventSink on the COM side.

    Hm. Ah screw it, I'm going to go with the "AddressOf function" way of doing things, since it appears to be not insane (or at least keeps things cleaner on the VBA side).

  • EtheaEthea Registered User regular
    GnomeTank wrote: »
    It's not hard, it's not like maintaining an entire GNU make chain, but it's certainly annoying having to maintain MSBuild and Nant files, which is kind of the point of CMake...to get rid of that :/

    I thought monodevelop could read C# project files.

    bowen wrote: »
    If someone wanted to add in support for c# they could push a patch to your company, though, since you're OSS?

    Yes. I think we would accept C# support if it was implemented properly ie read this bug report to see what we want from a person submitting C# support.

    Now if you want basic C# support I would look at this post to see how to add C# support to a C++ project mainly for wrapping / linking to c++ libraries.

  • GnomeTankGnomeTank Registered User regular
    MonoDevelop can read Visual Studio Solution files with some caveats. That said, I don't install MonoDevelop on every *NIX machine I want to build C# on. I just install the Mono build chain (specifically to get mcc) and build using Nant. I do all my code writing and debugging on Windows/Visual Studio. If I absolutely must debug a *NIX specific issue, I'll use mdb.

    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
  • jaziekjaziek Registered User regular
    admanb wrote: »
    The models are fine as database models (though I would change PlayerGender and PlayerName to Gender and Name; the prefixes are redundant) but trying to bind to them is wrong. You want to change the signature of your create method to something like
    [HttpPost]
    public ActionResult Create(int Player1, int Player2)
    

    Then use those values to query the database for the appropriate players and create a new DoublesPair with those. You really only want to bind to a complex object if you're creating all the values for the complex object out of your form data. Since most of the data already exists in the database, you don't want to bind it.


    Thanks. I've now got to the point where I can create a database entry for a pair, which consists of an ID and two ints which are the player IDs of each of the players, but now the default behaviour of the index page is to show the list of all pairs in the pairs table, but this happens when it tries to convert the data in the table to a list

    PrbEbAz.png

    now, I get why it happens, an I know how I'd get around it in a really hacky way that would lead to a ton of database queries every time you refresh the page. So, for what you said earlier about it being fine for the DoublesPair class to have Player objects, but for the table to store them as ints corresponding to the respective player's PlayerID... what do I do now?

    Steam ||| SC2 - Jaziek.377 on EU & NA. ||| Twitch Stream
  • ecco the dolphinecco the dolphin Registered User regular
    I have just discovered that the GUID reported by some of our devices is using a very unorthodox generation algorithm:

    Whatever the last 16 bytes left over in the stack happened to be.

    Luckily (?), it persists between reboots because the one or two function calls beforehand manage to use at least 16 bytes of the stack the same way every time.

    Unluckily, this means that every device which has this bug will, I suspect, have the exact same GUID.

    Well played, programmers before me.

    Well played.

    Penny Arcade Developers at PADev.net.
  • Jimmy KingJimmy King Registered User regular
    Does that make it a GRID?

    ecco the dolphin
  • Jimmy KingJimmy King Registered User regular
    About an hour ago Jeff Atwood tweeted about GUIDs. I thought I was about to learn that you're secretly Jeff Atwood.

  • SmasherSmasher Starting to get dizzy Registered User regular
    I have just discovered that the GUID reported by some of our devices is using a very unorthodox generation algorithm:

    Whatever the last 16 bytes left over in the stack happened to be.

    Luckily (?), it persists between reboots because the one or two function calls beforehand manage to use at least 16 bytes of the stack the same way every time.

    Unluckily, this means that every device which has this bug will, I suspect, have the exact same GUID.

    Well played, programmers before me.

    Well played.
    I'm futilely trying to understand the set of assumptions and beliefs that makes this make sense.

    Do they not understand the uniqueness requirement? If not, why didn't they just return some constant identifier?

    Did they understand the same device needs to consistently return the same result? If not, what did they think the GUID was for and why didn't they just return a random number?

    If they understood the stack retrieval mechanism well enough to understand it would return consistent results on a given device, why did they think it would return different results on other devices?

    If they didn't understand the stack retrieval mechanism well enough and thought it would return different results on different devices, why did they think it would return consistent results on the same device?

    :Psyduck:

  • ecco the dolphinecco the dolphin Registered User regular
    Smasher wrote: »
    I have just discovered that the GUID reported by some of our devices is using a very unorthodox generation algorithm:

    Whatever the last 16 bytes left over in the stack happened to be.

    Luckily (?), it persists between reboots because the one or two function calls beforehand manage to use at least 16 bytes of the stack the same way every time.

    Unluckily, this means that every device which has this bug will, I suspect, have the exact same GUID.

    Well played, programmers before me.

    Well played.
    I'm futilely trying to understand the set of assumptions and beliefs that makes this make sense.

    Do they not understand the uniqueness requirement? If not, why didn't they just return some constant identifier?

    Did they understand the same device needs to consistently return the same result? If not, what did they think the GUID was for and why didn't they just return a random number?

    If they understood the stack retrieval mechanism well enough to understand it would return consistent results on a given device, why did they think it would return different results on other devices?

    If they didn't understand the stack retrieval mechanism well enough and thought it would return different results on different devices, why did they think it would return consistent results on the same device?

    :Psyduck:

    Welllllllll

    I may have only told you half the story.

    The other half is that did use the OS to generate a GUID, but due to never checking/using return values, the OS generated GUID never actually makes it to the copy of the GUID on the stack.

    Penny Arcade Developers at PADev.net.
    bowen
  • TofystedethTofystedeth Registered User regular
    So in the first session of my Assembly Language class today, we took a background knowledge quiz.
    The front half of the page was all C. I had one class that used C rather than C++ or Java and it was about 8 years ago.
    I answered with B which was "I used to know how to solve this a long time ago but have forgetton" on all of them I think.

    One of them I thought I'd be able to get, since it was starting out with some values and pointers and references, and I was all "I think I can take a stab at this!"
    and then the output I was supposed to determine was a printf with about 6 formatting codes and a pile of arguments.
    Fffffff

    steam_sig.png
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    jaziek wrote: »
    admanb wrote: »
    The models are fine as database models (though I would change PlayerGender and PlayerName to Gender and Name; the prefixes are redundant) but trying to bind to them is wrong. You want to change the signature of your create method to something like
    [HttpPost]
    public ActionResult Create(int Player1, int Player2)
    

    Then use those values to query the database for the appropriate players and create a new DoublesPair with those. You really only want to bind to a complex object if you're creating all the values for the complex object out of your form data. Since most of the data already exists in the database, you don't want to bind it.


    Thanks. I've now got to the point where I can create a database entry for a pair, which consists of an ID and two ints which are the player IDs of each of the players, but now the default behaviour of the index page is to show the list of all pairs in the pairs table, but this happens when it tries to convert the data in the table to a list

    PrbEbAz.png

    now, I get why it happens, an I know how I'd get around it in a really hacky way that would lead to a ton of database queries every time you refresh the page. So, for what you said earlier about it being fine for the DoublesPair class to have Player objects, but for the table to store them as ints corresponding to the respective player's PlayerID... what do I do now?

    I don't have a great answer for you 'cause it really depends on how your ORM handles relationships. Your database entry for a doubles pair being two IDs is the best way to do it, both from a design and technical perspective. Your ORM should be using that relationship to build a join the efficiently connects those IDs to their full data.

    Nightslyr
  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    Yeh I have a
    So in the first session of my Assembly Language class today, we took a background knowledge quiz.
    The front half of the page was all C. I had one class that used C rather than C++ or Java and it was about 8 years ago.
    I answered with B which was "I used to know how to solve this a long time ago but have forgetton" on all of them I think.

    One of them I thought I'd be able to get, since it was starting out with some values and pointers and references, and I was all "I think I can take a stab at this!"
    and then the output I was supposed to determine was a printf with about 6 formatting codes and a pile of arguments.
    Fffffff

    Sometimes school is very silly. In the real world, you can just look up printf format codes until you memorize the important ones (cough %zu cough). Memorizing stuff like that is NOT what school is for, and sometimes professors forget that.

    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • GnomeTankGnomeTank Registered User regular
    admanb wrote: »
    jaziek wrote: »
    admanb wrote: »
    The models are fine as database models (though I would change PlayerGender and PlayerName to Gender and Name; the prefixes are redundant) but trying to bind to them is wrong. You want to change the signature of your create method to something like
    [HttpPost]
    public ActionResult Create(int Player1, int Player2)
    

    Then use those values to query the database for the appropriate players and create a new DoublesPair with those. You really only want to bind to a complex object if you're creating all the values for the complex object out of your form data. Since most of the data already exists in the database, you don't want to bind it.


    Thanks. I've now got to the point where I can create a database entry for a pair, which consists of an ID and two ints which are the player IDs of each of the players, but now the default behaviour of the index page is to show the list of all pairs in the pairs table, but this happens when it tries to convert the data in the table to a list

    PrbEbAz.png

    now, I get why it happens, an I know how I'd get around it in a really hacky way that would lead to a ton of database queries every time you refresh the page. So, for what you said earlier about it being fine for the DoublesPair class to have Player objects, but for the table to store them as ints corresponding to the respective player's PlayerID... what do I do now?

    I don't have a great answer for you 'cause it really depends on how your ORM handles relationships. Your database entry for a doubles pair being two IDs is the best way to do it, both from a design and technical perspective. Your ORM should be using that relationship to build a join the efficiently connects those IDs to their full data.

    If he's using Entity Framework (likely), that's exactly what it should be doing. If it's not, that leads me to believe the EF model was created incorrectly.

    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
    Nightslyr
  • GnomeTankGnomeTank Registered User regular
    Yeh I have a
    So in the first session of my Assembly Language class today, we took a background knowledge quiz.
    The front half of the page was all C. I had one class that used C rather than C++ or Java and it was about 8 years ago.
    I answered with B which was "I used to know how to solve this a long time ago but have forgetton" on all of them I think.

    One of them I thought I'd be able to get, since it was starting out with some values and pointers and references, and I was all "I think I can take a stab at this!"
    and then the output I was supposed to determine was a printf with about 6 formatting codes and a pile of arguments.
    Fffffff

    Sometimes school is very silly. In the real world, you can just look up printf format codes until you memorize the important ones (cough %zu cough). Memorizing stuff like that is NOT what school is for, and sometimes professors forget that.

    It was a pre-knowledge quiz. I don't think it was a course requirement to memorize those, the professor just wanted to get a broad idea of everyone's skill level coming in to the course.

    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
  • DrunkMcDrunkMc Registered User regular
    GnomeTank wrote: »
    I am the opposite. I would rather take a minor pay cut, but work less hours. I am burnt out with being gung ho work 50+ hours a week guy. I did that basically from 18-28. I value my time away from work too much.

    If I was working on something I really wanted to work on (like, you know, my game, which hopefully becomes a real job someday), I'd be willing to work a lot more hours. I'm burnt out on grinding 50+ hours on other peoples code ideas.

    Same way. I get more and better quality work done in 40hrs then in 60hrs. Ever since than (with rare exceptions) I do Eight and Skate! (Eight hours and go home....not sure if its obvious). :)

  • urahonkyurahonky Registered User regular
    I cannot understand why people don't go to the doctor's if they are sick. There is a guy here who has been coughing for a week straight. Not just "coughing" but long, 15 seconds or more of a cough... And then he doesn't wash his hands. I'm on day 13 of antibiotics and can't fucking kick whatever I have because everyday I come to work I get sicker because these fucks don't want to see a doctor.

    bowenDrunkMc
This discussion has been closed.