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

PA Programming Thread: Arguing, Cursing, and Recursing

1151618202187

Posts

  • smokmnkysmokmnky Registered User regular
    edited April 2011
    smokmnky wrote: »
    EvilMonkey wrote: »
    I ditched ASP.NET long ago but I'm assuming something like this would work...
    foreach (Control c in Panel1.Controls)
    {
       if (c is Textbox)
       {
          // Get the ID/Text info you need
          // Do whatever
       }
    }
    

    Thank you, sadly however I think I'm too much of a newbie to figure out what to put in that. I'll have to research it a bit more but at least I have a direction to look at.

    Why are you populating a drop-down with text boxes? Are the users allowed to change the values of the drop-down?

    No, they are choosing a number (1-47) and then my code shows that number of text boxes.

    smokmnky on
  • SkyEyeSkyEye Registered User regular
    edited April 2011
    'Kay. I'm on Windows 7 and need to use GCC as a C compiler. I have the gcc-4.6.0.tar file and don't know what I'm supposed to do with it. What am I not getting? Is there some for-UNIX-users-only band of information that I'm not privy to?

    SkyEye on
    Steam: Autumn_Thunder - SC2: AutumnThundr.563 (NA) - Hearthstone: AutumnThundr.1383

  • ecco the dolphinecco the dolphin Registered User regular
    edited April 2011
    SkyEye wrote: »
    'Kay. I'm on Windows 7 and need to use GCC as a C compiler. I have the gcc-4.6.0.tar file and don't know what I'm supposed to do with it. What am I not getting? Is there some for-UNIX-users-only band of information that I'm not privy to?

    That sounds like the source code for the compiler you've got there.

    What you probably want for Windows is the precompiled binary.

    There are two popular Windows distributions that includes GCC:

    * MinGW: http://www.mingw.org/

    and

    * Cygwin: http://www.cygwin.com/

    Which one you'd use depends on what you need to use it for.

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited April 2011
    To add to what ecco said, you can think of tar files as being like zip files in which a bunch of stuff is stuck together. As with tar.

    You can unpack them a number of third party zip tools. I'm a big fan of 7zip.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited April 2011
    Since I've finally contributed to the thread, I'd like to dredge up my earlier question.

    It seems that just about any site loads poorly on my LAMP server, and the more http requests it makes (scripts, images, etc.) the slower it loads. The super bizarre thing is the tracepath results.

    tracert on Win7 with no problems:
    1 1 ms 1 ms 1 ms 192.168.15.41
    2 7 ms 22 ms 11 ms 73.236.168.1
    3 11 ms 8 ms 11 ms te-4-1-ur02.swmpls.mn.minn.comcast.net [68.85.16
    7.197]
    4 9 ms 9 ms 9 ms te-0-10-0-4-ar01.crosstown.mn.minn.comcast.net [
    68.86.232.97]
    5 13 ms 17 ms 19 ms te-0-0-0-2-ar01.roseville.mn.minn.comcast.net [6
    8.87.174.210]
    6 20 ms 19 ms 19 ms te-0-2-0-0-cr01.chicago.il.ibone.comcast.net [68
    .86.93.129]
    7 19 ms 24 ms 19 ms 4.71.248.41
    8 19 ms 30 ms 19 ms vlan51.ebr1.Chicago2.Level3.net [4.69.138.158]
    9 41 ms 36 ms 52 ms ae-3-3.ebr2.Denver1.Level3.net [4.69.132.61]
    10 49 ms 36 ms 39 ms ae-1-100.ebr1.Denver1.Level3.net [4.69.132.37]
    11 70 ms 72 ms 73 ms 4.69.132.57
    12 70 ms 70 ms 72 ms ae-92-92.csw4.SanJose1.Level3.net [4.69.153.30]

    13 202 ms 152 ms 268 ms ae-43-90.car3.SanJose1.Level3.net [4.69.152.197]

    14 71 ms 71 ms 71 ms TWITTER-INC.car3.SanJose1.Level3.net [4.71.113.1
    94]
    15 80 ms 78 ms 74 ms 199.16.159.37
    16 84 ms 74 ms 74 ms r-199-59-148-11.twttr.com [199.59.148.11]

    tracepath on Ubuntu LAMP server plugged into the same router:
    1: templewulf-LAMP.local (192.168.15.51) 0.172ms pmtu 1500
    1: 192.168.15.41 (192.168.15.41) 2.510ms asymm 36
    1: 192.168.15.41 (192.168.15.41) 1.824ms asymm 36
    2: 73.236.168.1 (73.236.168.1) 15.627ms
    3: no reply
    4: te-0-10-0-4-ar01.crosstown.mn.minn.comcast.net (68.86.232.97) 13.963ms
    5: te-0-0-0-6-ar01.roseville.mn.minn.comcast.net (68.87.174.226) 12.333ms
    6: te-0-2-0-0-cr01.chicago.il.ibone.comcast.net (68.86.93.129) 20.842ms
    7: no reply
    8: vlan51.ebr1.Chicago2.Level3.net (4.69.138.158) 31.963ms
    9: ae-3-3.ebr2.Denver1.Level3.net (4.69.132.61) 44.366ms asymm 7
    10: ae-1-100.ebr1.Denver1.Level3.net (4.69.132.37) 51.970ms asymm 7
    11: 4.69.132.57 (4.69.132.57) 73.408ms asymm 9
    12: ae-82-82.csw3.SanJose1.Level3.net (4.69.153.26) 74.034ms asymm 8
    13: ae-43-90.car3.SanJose1.Level3.net (4.69.152.197) 76.398ms asymm 8
    14: no reply
    15: no reply
    16: no reply
    17: no reply
    18: no reply
    19: no reply
    20: no reply
    21: no reply
    22: no reply
    23: no reply
    24: no reply
    25: no reply
    26: no reply
    27: no reply
    28: no reply
    29: no reply
    30: no reply
    31: no reply
    Too many hops: pmtu 1500
    Resume: pmtu 1500
    I don't use tracepath at all, but assuming it works like tracert I don't even know how to interpret these results.

    Thoughts?

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited April 2011
    SkyEye wrote: »
    'Kay. I'm on Windows 7 and need to use GCC as a C compiler. I have the gcc-4.6.0.tar file and don't know what I'm supposed to do with it. What am I not getting? Is there some for-UNIX-users-only band of information that I'm not privy to?

    That sounds like the source code for the compiler you've got there.

    What you probably want for Windows is the precompiled binary.

    There are two popular Windows distributions that includes GCC:

    * MinGW: http://www.mingw.org/

    and

    * Cygwin: http://www.cygwin.com/

    Which one you'd use depends on what you need to use it for.

    Even if you were to compile GCC from source (which is what I presume is in the tarball), you would need a working GCC to do so, along with a unix-ish environment. MinGW and Cygwin both provide the unix-ish environment and provide a working GCC, so there's no real need to compile it.

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • thatassemblyguythatassemblyguy Janitor of Technical Debt .Registered User regular
    edited April 2011
    Ugh, I'm being asked for a "front-end" code sample for a job application. Do I attach the most complicated class I've ever written in javascript (an autosaving sub-view of a web application, 500 lines in total), or the simple elegant wrapper for setTimeout and clearTimeout intended for use with a live-updating text box that prevents AJAX request flooding, something simple but more half-assed from the web-app with the auto-saving view, or just some PHP from a fairly basic CakePHP app I built (since I'm applying for a PHP job).

    Or am I just over-thinking this completely?

    They also want something "of my choice" which is the hardest of all. Get in some PHP (I really don't have any cool PHP to choose from)? Show a simple jQuery thing (job requires jQuery)? Show an awesome AI routine from a rogue-like I was working on?

    If the job is PHP maintenance/development, send what ever coding samples relate to that. Also, you should be asking them for a sample of their code to see how well they've maintained. The acronym NDA might be batted around, but to me fair is fair. I want to know how good/crappy a code baseline is going to be before I commit to an offer - sometimes there isn't enough money in the world to deal with what some people call "code".

    thatassemblyguy on
  • ecco the dolphinecco the dolphin Registered User regular
    edited April 2011
    templewulf wrote: »
    Since I've finally contributed to the thread, I'd like to dredge up my earlier question.

    It seems that just about any site loads poorly on my LAMP server, and the more http requests it makes (scripts, images, etc.) the slower it loads. The super bizarre thing is the tracepath results.

    tracert on Win7 with no problems:
    1 1 ms 1 ms 1 ms 192.168.15.41
    2 7 ms 22 ms 11 ms 73.236.168.1
    3 11 ms 8 ms 11 ms te-4-1-ur02.swmpls.mn.minn.comcast.net [68.85.16
    7.197]
    4 9 ms 9 ms 9 ms te-0-10-0-4-ar01.crosstown.mn.minn.comcast.net [
    68.86.232.97]
    5 13 ms 17 ms 19 ms te-0-0-0-2-ar01.roseville.mn.minn.comcast.net [6
    8.87.174.210]
    6 20 ms 19 ms 19 ms te-0-2-0-0-cr01.chicago.il.ibone.comcast.net [68
    .86.93.129]
    7 19 ms 24 ms 19 ms 4.71.248.41
    8 19 ms 30 ms 19 ms vlan51.ebr1.Chicago2.Level3.net [4.69.138.158]
    9 41 ms 36 ms 52 ms ae-3-3.ebr2.Denver1.Level3.net [4.69.132.61]
    10 49 ms 36 ms 39 ms ae-1-100.ebr1.Denver1.Level3.net [4.69.132.37]
    11 70 ms 72 ms 73 ms 4.69.132.57
    12 70 ms 70 ms 72 ms ae-92-92.csw4.SanJose1.Level3.net [4.69.153.30]

    13 202 ms 152 ms 268 ms ae-43-90.car3.SanJose1.Level3.net [4.69.152.197]

    14 71 ms 71 ms 71 ms TWITTER-INC.car3.SanJose1.Level3.net [4.71.113.1
    94]
    15 80 ms 78 ms 74 ms 199.16.159.37
    16 84 ms 74 ms 74 ms r-199-59-148-11.twttr.com [199.59.148.11]

    tracepath on Ubuntu LAMP server plugged into the same router:
    1: templewulf-LAMP.local (192.168.15.51) 0.172ms pmtu 1500
    1: 192.168.15.41 (192.168.15.41) 2.510ms asymm 36
    1: 192.168.15.41 (192.168.15.41) 1.824ms asymm 36
    2: 73.236.168.1 (73.236.168.1) 15.627ms
    3: no reply
    4: te-0-10-0-4-ar01.crosstown.mn.minn.comcast.net (68.86.232.97) 13.963ms
    5: te-0-0-0-6-ar01.roseville.mn.minn.comcast.net (68.87.174.226) 12.333ms
    6: te-0-2-0-0-cr01.chicago.il.ibone.comcast.net (68.86.93.129) 20.842ms
    7: no reply
    8: vlan51.ebr1.Chicago2.Level3.net (4.69.138.158) 31.963ms
    9: ae-3-3.ebr2.Denver1.Level3.net (4.69.132.61) 44.366ms asymm 7
    10: ae-1-100.ebr1.Denver1.Level3.net (4.69.132.37) 51.970ms asymm 7
    11: 4.69.132.57 (4.69.132.57) 73.408ms asymm 9
    12: ae-82-82.csw3.SanJose1.Level3.net (4.69.153.26) 74.034ms asymm 8
    13: ae-43-90.car3.SanJose1.Level3.net (4.69.152.197) 76.398ms asymm 8
    14: no reply
    15: no reply
    16: no reply
    17: no reply
    18: no reply
    19: no reply
    20: no reply
    21: no reply
    22: no reply
    23: no reply
    24: no reply
    25: no reply
    26: no reply
    27: no reply
    28: no reply
    29: no reply
    30: no reply
    31: no reply
    Too many hops: pmtu 1500
    Resume: pmtu 1500
    I don't use tracepath at all, but assuming it works like tracert I don't even know how to interpret these results.

    Thoughts?


    I wonder if it's something like this?

    i.e. try reducing the MTU sent out via Ubuntu to 1450 or so. There may be a network device halfway through that's messing up the MTU negotiations.

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited April 2011
    I wonder if it's something like this?

    i.e. try reducing the MTU sent out via Ubuntu to 1450 or so. There may be a network device halfway through that's messing up the MTU negotiations.

    I couldn't get any improvements after doing sudo ifconfig eth1 mtu 1450, even after restarting apache.

    Though I did notice that I had two interfaces: eth1 and eth0_rename. When I checked out Preferences > Network Connections, it listed eth0_rename twice with no mention of eth1.

    Of course, being retarded, I deleted both eth0_rename entries and lost SSH and VNC connectivity. Since I don't want to hook up another keyboard / mouse, I'll try again tomorrow. :lol:

    Edit:
    And neither interface was listed in /etc/network/interfaces, just the loopback device. I don't actually know where else that would be kept.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited April 2011
    jackal wrote: »
    Jasconius wrote: »
    The entire idea of iterating UI controls to find one in particular as a common practice is so laughable that I am amazed that it is commonplace in .NET

    Wait, no I'm not.

    It is not commonplace in .NET. Where would you get that idea.

    I've seen it in a lot of ASP.NET code.

    Jasconius on
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    edited April 2011
    smokmnky wrote: »
    smokmnky wrote: »
    EvilMonkey wrote: »
    I ditched ASP.NET long ago but I'm assuming something like this would work...
    foreach (Control c in Panel1.Controls)
    {
       if (c is Textbox)
       {
          // Get the ID/Text info you need
          // Do whatever
       }
    }
    

    Thank you, sadly however I think I'm too much of a newbie to figure out what to put in that. I'll have to research it a bit more but at least I have a direction to look at.

    Why are you populating a drop-down with text boxes? Are the users allowed to change the values of the drop-down?

    No, they are choosing a number (1-47) and then my code shows that number of text boxes.

    Ok. The iteration code isn't what you want to do to get any controls from the previous page. That cross-page posting example you had is the way to do it. You may want to create a map or list of previous page text boxes that you hand-off so you can find them by name. Or make them properties of the previous page with getters only.

    Once you have the text boxes and layouts, it's just a matter of calling textbox.Text to get the value from the textbox. If you need to convert them, look at the long.TryParse(....) method or int.TryParse(...) methods.

    Kakodaimonos on
  • SkyEyeSkyEye Registered User regular
    edited April 2011
    SkyEye wrote: »
    'Kay. I'm on Windows 7 and need to use GCC as a C compiler. I have the gcc-4.6.0.tar file and don't know what I'm supposed to do with it. What am I not getting? Is there some for-UNIX-users-only band of information that I'm not privy to?

    That sounds like the source code for the compiler you've got there.

    What you probably want for Windows is the precompiled binary.

    There are two popular Windows distributions that includes GCC:

    * MinGW: http://www.mingw.org/

    and

    * Cygwin: http://www.cygwin.com/

    Which one you'd use depends on what you need to use it for.

    Even if you were to compile GCC from source (which is what I presume is in the tarball), you would need a working GCC to do so, along with a unix-ish environment. MinGW and Cygwin both provide the unix-ish environment and provide a working GCC, so there's no real need to compile it.

    Got it. Thanks, guys.

    SkyEye on
    Steam: Autumn_Thunder - SC2: AutumnThundr.563 (NA) - Hearthstone: AutumnThundr.1383

  • syndalissyndalis Getting Classy On the WallRegistered User, Loves Apple Products regular
    edited April 2011
    So I have an HTML5/CSS question, and it involves position: fixed, overflow, and the <video> tag.

    I have a fixed header on my page for a design I am doing right now, and for the most part it has worked out really well for me.

    That is, until I start playing with HTML5 video.

    This is what happens when I scroll:

    http://grab.by/9Vmd
    http://grab.by/9Vmc

    This is seriously annoying because it works so well everywhere I have done this, and I would hate to have to scrap the design because I cannot get the video to adhere to the overflow like everything else does.

    syndalis on
    SW-4158-3990-6116
    Let's play Mario Kart or something...
  • jackaljackal Fuck Yes. That is an orderly anal warehouse. Registered User regular
    edited April 2011
    Jasconius wrote: »
    jackal wrote: »
    Jasconius wrote: »
    The entire idea of iterating UI controls to find one in particular as a common practice is so laughable that I am amazed that it is commonplace in .NET

    Wait, no I'm not.

    It is not commonplace in .NET. Where would you get that idea.

    I've seen it in a lot of ASP.NET code.

    I can't think of the last time I've seen it in winforms or WPF. It's probably just web programmers being web programmers (which is to say generally bad).

    jackal on
  • EvilMonkeyEvilMonkey Registered User regular
    edited April 2011
    He's potentially polling ~50 text boxes in what is pretty much a training/practice exercise. I don't see the big deal with iterating through the controls in this scenario and I didn't claim that it was the "best" approach. You want me to scare him by suggesting to use jQuery instead? :P

    EvilMonkey on
    [PSN: SciencePiggy] [Steam]
  • jackaljackal Fuck Yes. That is an orderly anal warehouse. Registered User regular
    edited April 2011
    I wasn't trying to insult smokmnky, or your solution. Smokmnky isn't even doing what Jasconius was saying (looking for a particular control) as far as I can tell.

    jackal on
  • bowenbowen How you doin'? Registered User regular
    edited April 2011
    jackal wrote: »
    Jasconius wrote: »
    The entire idea of iterating UI controls to find one in particular as a common practice is so laughable that I am amazed that it is commonplace in .NET

    Wait, no I'm not.

    It is not commonplace in .NET. Where would you get that idea.

    If you're trying to change specific controls in your panels, linq would probably work better than doing a test to make sure you have a text box.

    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
  • Jimmy KingJimmy King Registered User regular
    edited April 2011
    Ugh, I'm being asked for a "front-end" code sample for a job application. Do I attach the most complicated class I've ever written in javascript (an autosaving sub-view of a web application, 500 lines in total), or the simple elegant wrapper for setTimeout and clearTimeout intended for use with a live-updating text box that prevents AJAX request flooding, something simple but more half-assed from the web-app with the auto-saving view, or just some PHP from a fairly basic CakePHP app I built (since I'm applying for a PHP job).

    Or am I just over-thinking this completely?

    They also want something "of my choice" which is the hardest of all. Get in some PHP (I really don't have any cool PHP to choose from)? Show a simple jQuery thing (job requires jQuery)? Show an awesome AI routine from a rogue-like I was working on?
    Why not submit both? I have a public, read only, svn repository that I pass the url for to any recruiters, hiring managers, interviewers, etc. that I talk to along with a short description of the projects or at least the projects they would be most interested in looking at.

    Jimmy King on
  • Alistair HuttonAlistair Hutton Dr EdinburghRegistered User regular
    edited April 2011
    Everyone should have the joy of working with VBA using hungarian notation.

    In defence of HN: Hungarian Notation as actually described is a reasonable way of encoding intent into variable names. Knowing intent is a good thing. That said, Hungarian Notation as it is actually used is a vile abomination that fills variable names with line noise.

    That is, Apps Hungarian is good, System Hungarian should get people shot.

    Alistair Hutton on
    I have a thoughtful and infrequently updated blog about games http://whatithinkaboutwhenithinkaboutgames.wordpress.com/

    I made a game, it has penguins in it. It's pay what you like on Gumroad.

    Currently Ebaying Nothing at all but I might do in the future.
  • bowenbowen How you doin'? Registered User regular
    edited April 2011
    I use hungarion notation when referencing controls.

    For instance, tbx or txt for text fields depending on what project. btn for button, etc.

    I used to use them for datatypes too, but most of my datatypes are so shortlived (in scope and usually not more than 100 or so lines of code) that it wasn't really necessary at this point. If I were working on a larger C/C++ document I'd probably use them there too.

    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
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    edited April 2011
    I just let the type inference take care of it for me nowadays.

    Kakodaimonos on
  • InfidelInfidel Heretic Registered User regular
    edited April 2011
    syndalis wrote: »
    So I have an HTML5/CSS question, and it involves position: fixed, overflow, and the <video> tag.

    I have a fixed header on my page for a design I am doing right now, and for the most part it has worked out really well for me.

    That is, until I start playing with HTML5 video.

    This is what happens when I scroll:

    http://grab.by/9Vmd
    http://grab.by/9Vmc

    This is seriously annoying because it works so well everywhere I have done this, and I would hate to have to scrap the design because I cannot get the video to adhere to the overflow like everything else does.

    Err, that is not an overflow issue? The video is not part of the header, why would it be affected by any overflow property? It's not spilling out of, it's covering up. That is a z-index issue.

    Not sure what your code is like to say for sure so you should share it.

    Infidel on
    OrokosPA.png
  • syndalissyndalis Getting Classy On the WallRegistered User, Loves Apple Products regular
    edited April 2011
    Infidel wrote: »
    syndalis wrote: »
    So I have an HTML5/CSS question, and it involves position: fixed, overflow, and the <video> tag.

    I have a fixed header on my page for a design I am doing right now, and for the most part it has worked out really well for me.

    That is, until I start playing with HTML5 video.

    This is what happens when I scroll:

    http://grab.by/9Vmd
    http://grab.by/9Vmc

    This is seriously annoying because it works so well everywhere I have done this, and I would hate to have to scrap the design because I cannot get the video to adhere to the overflow like everything else does.

    Err, that is not an overflow issue? The video is not part of the header, why would it be affected by any overflow property? It's not spilling out of, it's covering up. That is a z-index issue.

    Not sure what your code is like to say for sure so you should share it.

    You are right that this was a z-index issue; that's what I get for posting my question at like 3 in the morning... I figured it out and all is well. The jsvideo plugin had its own CSS with a mountain of reeeeaaallly high z-index numbers, so I have to bump up my header accordingly without breaking the <video> fullscreen stuff.

    syndalis on
    SW-4158-3990-6116
    Let's play Mario Kart or something...
  • InfidelInfidel Heretic Registered User regular
    edited April 2011
    I follow the OVER NINE THOUSAND rule for when I want a z-index for my top layer items when I am possibly interacting with third-party CSS, it normally works for me! :lol:

    Infidel on
    OrokosPA.png
  • bowenbowen How you doin'? Registered User regular
    edited April 2011
    That's actually a pretty good rule.

    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
  • EtheaEthea Registered User regular
    edited April 2011
    just use 2,147,483,647 for your z index if you want to be ontop. Pray that no other library thinks the same way.

    Ethea on
  • smokmnkysmokmnky Registered User regular
    edited April 2011
    Ok. The iteration code isn't what you want to do to get any controls from the previous page. That cross-page posting example you had is the way to do it. You may want to create a map or list of previous page text boxes that you hand-off so you can find them by name. Or make them properties of the previous page with getters only.

    Once you have the text boxes and layouts, it's just a matter of calling textbox.Text to get the value from the textbox. If you need to convert them, look at the long.TryParse(....) method or int.TryParse(...) methods.

    So that's what I think I'm doing anyway. I have the drop down create text boxes in the Panel but the problem is that I can't actually get the "results" page to actually see the text boxes. It's like they only exist on that original page and once the submit button is pressed they are wiped out.
    jackal wrote: »
    I wasn't trying to insult smokmnky, or your solution. Smokmnky isn't even doing what Jasconius was saying (looking for a particular control) as far as I can tell.

    I didn't take any offense, and you are right I'm not looking for a particular control, I'm looking for all of them.

    smokmnky on
  • EvilMonkeyEvilMonkey Registered User regular
    edited April 2011
    smokmnky wrote: »
    Ok. The iteration code isn't what you want to do to get any controls from the previous page. That cross-page posting example you had is the way to do it. You may want to create a map or list of previous page text boxes that you hand-off so you can find them by name. Or make them properties of the previous page with getters only.

    Once you have the text boxes and layouts, it's just a matter of calling textbox.Text to get the value from the textbox. If you need to convert them, look at the long.TryParse(....) method or int.TryParse(...) methods.

    So that's what I think I'm doing anyway. I have the drop down create text boxes in the Panel but the problem is that I can't actually get the "results" page to actually see the text boxes. It's like they only exist on that original page and once the submit button is pressed they are wiped out.
    jackal wrote: »
    I wasn't trying to insult smokmnky, or your solution. Smokmnky isn't even doing what Jasconius was saying (looking for a particular control) as far as I can tell.

    I didn't take any offense, and you are right I'm not looking for a particular control, I'm looking for all of them.
    I'm assuming you've tried iterating through PreviousPage.Controls (rather than Panel1.Controls)?

    If I'm understanding Kakodaimonos correctly, he's suggesting something more elegant. When you create the text boxes add them to a list that you would access via something like PreviousPage.MyCreatedTextBoxes

    EvilMonkey on
    [PSN: SciencePiggy] [Steam]
  • smokmnkysmokmnky Registered User regular
    edited April 2011
    Here's what i've been attempting anyway:

    This creates the Dropdown and after the user selects a number creates that many text boxes
    protected void ddlSwitchPortSelection_SelectedIndexChanged(object sender, EventArgs e)
            {
                int MaxPorts = System.Convert.ToInt32(ddlSwitchPortSelection.SelectedItem.Text);
                tMaxPorts.Text = MaxPorts.ToString();
                
                for (int i = 0; i < MaxPorts; i++)
                {
                    Label myLabel = new Label();
                    TextBox myTextBox = new TextBox();
                    int PortNumber = i + 1;
                    for (int a = 0; a < MaxPorts; a++)
                    {
                        myLabel.Text = "HostName for Port Number " + PortNumber;
                        myLabel.ID = "Port Number" + PortNumber.ToString();
                        myTextBox.ID = MaxPorts.ToString();
                        Panel1.Controls.Add(myLabel);
                        Panel1.Controls.Add(myTextBox);
                        Panel1.Controls.Add(new LiteralControl("<br>"));
                    }
                }
            }
    

    Here's where I try to find the info entered in the text box created above:
    if (PreviousPage != null)
                {
                    TextBox SourceTextBox =
                        (TextBox)PreviousPage.FindControl("0");
                    if (SourceTextBox != null)
                    {
                        ltest1.Text = SourceTextBox.Text;
                    }
                }
    

    Now I know that 2nd part would just show one text but right now I'm just trying to get one item before i move on to getting all (well up to) 47.

    smokmnky on
  • SnowblindvictimSnowblindvictim Flying casual Registered User regular
    edited April 2011
    Would you guys happen to know about the creation/drawing of binary trees and their relation to Java?

    Snowblindvictim on
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    edited April 2011
    smokmnky wrote: »
    Here's what i've been attempting anyway:

    This creates the Dropdown and after the user selects a number creates that many text boxes
    protected void ddlSwitchPortSelection_SelectedIndexChanged(object sender, EventArgs e)
            {
                int MaxPorts = System.Convert.ToInt32(ddlSwitchPortSelection.SelectedItem.Text);
                tMaxPorts.Text = MaxPorts.ToString();
                
                for (int i = 0; i < MaxPorts; i++)
                {
                    Label myLabel = new Label();
                    TextBox myTextBox = new TextBox();
                    int PortNumber = i + 1;
                    for (int a = 0; a < MaxPorts; a++)
                    {
                        myLabel.Text = "HostName for Port Number " + PortNumber;
                        myLabel.ID = "Port Number" + PortNumber.ToString();
                        myTextBox.ID = MaxPorts.ToString();
                        Panel1.Controls.Add(myLabel);
                        Panel1.Controls.Add(myTextBox);
                        Panel1.Controls.Add(new LiteralControl("<br>"));
                    }
                }
            }
    

    Here's where I try to find the info entered in the text box created above:
    if (PreviousPage != null)
                {
                    TextBox SourceTextBox =
                        (TextBox)PreviousPage.FindControl("0");
                    if (SourceTextBox != null)
                    {
                        ltest1.Text = SourceTextBox.Text;
                    }
                }
    

    Now I know that 2nd part would just show one text but right now I'm just trying to get one item before i move on to getting all (well up to) 47.

    That will work. Page.FindControl takes the string ID reference to the previous pages control. You just need to figure out how you're handing those IDs to the next page.

    Kakodaimonos on
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited April 2011
    Concerning my previous question about my LAMP server being sluggish when serving twitter content, I think I fixed it. I have no idea how, but it's pretty snappy now.

    I fucked up the server pretty bad, and somehow in fixing that, it's all good. One thing I did notice was that I had two entries for eth1 in /etc/udev/rules.d/70-persistent-net.rules. I commented one out in the process of getting my Ethernet back up.

    I'm too scared to change anything to verify, but I just thought I'd throw that out there.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • bowenbowen How you doin'? Registered User regular
    edited April 2011
    Us programmers always fuck up our dev machines, don't worry about it.

    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
  • SporkAndrewSporkAndrew Registered User, ClubPA regular
    edited April 2011
    Yeah, not a week goes by that I don't kill a dev server. Just keep reliable backups in case you do anything too catastrophic.

    But therein lies the reason you always use a dev environment rather than just testing on live. It's not a big deal if my dev server takes an hour to rebuild itself, but if I pulled that on a production server then my head would roll.

    SporkAndrew on
    The one about the fucking space hairdresser and the cowboy. He's got a tinfoil pal and a pedal bin
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited April 2011
    bowen wrote: »
    Us programmers always fuck up our dev machines, don't worry about it.

    Oh, I'm not worried about it. I just wanted to post a possible solution that might have fixed my problem.

    I have /home on a separate partition. I am fully prepared to reinstall at a moment's notice! :lol:

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Jimmy KingJimmy King Registered User regular
    edited April 2011
    I am so glad I pushed back on moving my platform at work to ec2 when I was pushed to do so. I would be in a world of shit right now.

    Jimmy King on
  • EtheaEthea Registered User regular
    edited April 2011
    Jimmy King wrote: »
    I am so glad I pushed back on moving my platform at work to ec2 when I was pushed to do so. I would be in a world of shit right now.

    Really wouldn't have been your fault that Amazon decided that they should place all the storage for a single region in one data centre rather than spread it out across the eastern seaboard. When you purchase time across the multiple clusters in a region you would expect them to be geographically distinct.

    Ethea on
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited April 2011
    bowen wrote: »
    Us programmers always fuck up our dev machines, don't worry about it.

    I've managed to get it so that Windows essentially deadlocks itself when starting new processes, still not sure how I did it. Had to reinstall to fix it

    Phyphor on
  • smokmnkysmokmnky Registered User regular
    edited April 2011
    smokmnky wrote: »
    if (PreviousPage != null)
                {
                    TextBox SourceTextBox =
                        (TextBox)PreviousPage.FindControl("0");
                    if (SourceTextBox != null)
                    {
                        ltest1.Text = SourceTextBox.Text;
                    }
                }
    

    Now I know that 2nd part would just show one text but right now I'm just trying to get one item before i move on to getting all (well up to) 47.

    That will work. Page.FindControl takes the string ID reference to the previous pages control. You just need to figure out how you're handing those IDs to the next page.

    Yeah the problem is finding those IDs. it should just be a 0 or a 1 or whatever but they don't seem to exist beyond that first page

    smokmnky on
  • SnowblindvictimSnowblindvictim Flying casual Registered User regular
    edited April 2011
    Hello code peoples. Another C question for ya.

    Given this code:
    void inner4(vec_ptr u, vec_ptr v, data t *dest)
    {
    long int i;
    int length = vec_length(u);
    data_t *udata = get_vec_start(u);
    data_t *vdata = get_vec_start(v);
    data_t sum = (data_t) 0;
    for (i = 0; i < length; i++){
    sum = sum + udata[i] * vdata[i];
    }
    *dest = sum;
    }
    

    I have to write a version of the "inner product procedure" that uses "four way loop unrolling."
    This is my code:
    void inner4(vec_ptr u, data_t *dest) {
    long int length = vec_length(u);
    long int limit = length-2;
    data_u *data = get_vec_start(v);
    data_t acc = IDENT;
    long int i;
    for (i = 0; i < limit; i+=3) {
    acc = acc OP data[i] OP data[i+1] OP data[i+2];
    }
    for (; i < length; i++) {
    acc = acc OP data[i];
    }
    *dest = acc;
    }
    

    Is this right?

    Snowblindvictim on
This discussion has been closed.