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/

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

19192949697100

Posts

  • bowenbowen How you doin'? Registered User regular
    Application.ExecutablePath might be better than .

    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 What the what? Portland, OregonRegistered User regular
    urahonky wrote: »
    Infidel wrote: »
    Yeah, likely the path isn't what you think it is.

    But if I have something wrong in the file name it points directly to that folder where the images are created. And why is it showing up in the stupid editor window if it isn't running or throwing an error. If the image didn't exist in that place then it would error out on me like it always does.

    If your images folder is at the root of your app, then you need to root out that path. The reason it's working in the designer is because the designer has a different current working resource path than the runtime will. It's annoying, and another reason to never use the editor.

    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
  • InfidelInfidel Heretic Registered User regular
    urahonky wrote: »
    Error 1 Could not find file 'C:\Users\kharris\Documents\Visual Studio 11\Projects\ccmidsTestApp1\ccmidsTestApp1\images\fdsa.pngasdf'. C:\Users\kharris\Documents\Visual Studio 11\Projects\ccmidsTestApp1\ccmidsTestApp1\MainWindow.xaml 31 15 ccmidsTestApp1

    Well then I'm not sure from what you posted. :rotate:

    OrokosPA.png
  • bowenbowen How you doin'? Registered User regular
    edited May 2012
    UriSource=string.Format("{0}/images/{1}",Application.ExecutablePath,"asdf.png");
    
    maybe? I am not really on the up and up in knowing if you can slap functions like that into wpf/xml code.

    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
  • urahonkyurahonky Registered User regular
    GnomeTank wrote: »
    urahonky wrote: »
    Infidel wrote: »
    Yeah, likely the path isn't what you think it is.

    But if I have something wrong in the file name it points directly to that folder where the images are created. And why is it showing up in the stupid editor window if it isn't running or throwing an error. If the image didn't exist in that place then it would error out on me like it always does.

    If your images folder is at the root of your app, then you need to root out that path. The reason it's working in the designer is because the designer has a different current working resource path than the runtime will. It's annoying, and another reason to never use the editor.

    C:\Users\kharris\Documents\Visual Studio 11\Projects\ccmidsTestApp1

    Would be the root right? That contains the .sln and .suo files.

  • bowenbowen How you doin'? Registered User regular
    Probably not. Don't try and move your images folder, that's not going to solve your problem. Your problem is your code is not taking the environment into consideration when it's run, so it assumes the "." always refers to the folder the images are in, which may differ from where your executable is run from and points it's current directory towards. Ever change a windows shortcut? You can specify a different "current directory" than where the application is originating from, which will FUBAR your code because it's basing it off that.

    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 What the what? Portland, OregonRegistered User regular
    urahonky wrote: »
    GnomeTank wrote: »
    urahonky wrote: »
    Infidel wrote: »
    Yeah, likely the path isn't what you think it is.

    But if I have something wrong in the file name it points directly to that folder where the images are created. And why is it showing up in the stupid editor window if it isn't running or throwing an error. If the image didn't exist in that place then it would error out on me like it always does.

    If your images folder is at the root of your app, then you need to root out that path. The reason it's working in the designer is because the designer has a different current working resource path than the runtime will. It's annoying, and another reason to never use the editor.

    C:\Users\kharris\Documents\Visual Studio 11\Projects\ccmidsTestApp1

    Would be the root right? That contains the .sln and .suo files.

    The root of the project, not the solution. Where is the csproj file? Is the 'images' directory right off 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
  • urahonkyurahonky Registered User regular
    Well it's gotta be a path issue. I put the full file path into it and it showed the image... But I'd like to be able to use relative pathing (I know... I know...) just so we can make this work on everyone's machine.

  • urahonkyurahonky Registered User regular
    GnomeTank wrote: »
    urahonky wrote: »
    GnomeTank wrote: »
    urahonky wrote: »
    Infidel wrote: »
    Yeah, likely the path isn't what you think it is.

    But if I have something wrong in the file name it points directly to that folder where the images are created. And why is it showing up in the stupid editor window if it isn't running or throwing an error. If the image didn't exist in that place then it would error out on me like it always does.

    If your images folder is at the root of your app, then you need to root out that path. The reason it's working in the designer is because the designer has a different current working resource path than the runtime will. It's annoying, and another reason to never use the editor.

    C:\Users\kharris\Documents\Visual Studio 11\Projects\ccmidsTestApp1

    Would be the root right? That contains the .sln and .suo files.

    The root of the project, not the solution. Where is the csproj file? Is the 'images' directory right off of that?

    Yeah it's:

    TestApp1\TestApp1\Images
    And TestApp1\TestApp1 contains the .vbproj file

  • bowenbowen How you doin'? Registered User regular
    Yes, that's why you don't use "."

    Because your debug environment is far different from your runtime one.

    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
  • JHunzJHunz Registered User regular
    Off the top of my head, I think you need to mark your image file with a build action of embedded resource for that to work properly.

    bunny.gif Gamertag: JHunz. R.I.P. Mygamercard.net bunny.gif
  • InfidelInfidel Heretic Registered User regular
    JHunz wrote: »
    Off the top of my head, I think you need to mark your image file with a build action of embedded resource for that to work properly.

    Or "Copy to output folder" such things etc. etc.

    When you posted that error, you implied that was different from what you had before. :P

    So it wasn't different at all? Not found error?

    OrokosPA.png
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    No, do not mark it Embedded Resource, mark it Resource. Embedded Resource is an embedded Win32 resource (old school resources), Resource is a new-school WPF resource pack.

    You need to change the path to /images/file.jpg

    If you're trying to get to it from an assembly outside of the executing one, the path would be:
    pack://application:,,,/<AssemblyNameHere>;component/<pathtofile>

    Where <AssemblyNameHere>, is the name of your assembly. In your case, TestApp1.

    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
  • urahonkyurahonky Registered User regular
    Infidel wrote: »
    JHunz wrote: »
    Off the top of my head, I think you need to mark your image file with a build action of embedded resource for that to work properly.

    Or "Copy to output folder" such things etc. etc.

    When you posted that error, you implied that was different from what you had before. :P

    So it wasn't different at all? Not found error?

    The error I posted said the file was not found (obviously) and it was pointing to the correct folder where all the images reside.

    I have also added each image as a resource and it still didn't work as well as using "/images/file.jpg". I'm at a loss. I swear this image problem didn't happen early this morning, but now they just are completely wrecked.

  • an_altan_alt Registered User regular
    Infidel wrote: »
    an_alt wrote: »
    Does anyone have any good links on different testing methodologies and where they're most useful? I'm much better at writing tests that I used to be, but I'm sure I'm not "doing it right". For example, I have no idea how to write regression tests that involve services which I won't have credentials for once my part in the project ends.
    Wouldn't the credentials be parametrized somewhere and updated by whoever ends up maintaining the app?

    Our clients have relationships with third parties. Credentials are between the third parties and our clients and change regularly. The non-production services we have access to for testing go down or get altered without notice once the software for our clients is shipped. In cases like that, I check if something blows while calling the service and that I get a proper credential error returned, which is more like parity checking than actual testing.

    There are other situations where I can easily check some things, but I don't understand how to check a wide enough range of important things.

    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.
  • InfidelInfidel Heretic Registered User regular
    an_alt wrote: »
    Infidel wrote: »
    an_alt wrote: »
    Does anyone have any good links on different testing methodologies and where they're most useful? I'm much better at writing tests that I used to be, but I'm sure I'm not "doing it right". For example, I have no idea how to write regression tests that involve services which I won't have credentials for once my part in the project ends.
    Wouldn't the credentials be parametrized somewhere and updated by whoever ends up maintaining the app?

    Our clients have relationships with third parties. Credentials are between the third parties and our clients and change regularly. The non-production services we have access to for testing go down or get altered without notice once the software for our clients is shipped. In cases like that, I check if something blows while calling the service and that I get a proper credential error returned, which is more like parity checking than actual testing.

    There are other situations where I can easily check some things, but I don't understand how to check a wide enough range of important things.

    If they change regularly, they need to be updated by whoever is maintaining? It is either done or it isn't, not sure I'm understanding your problem here.

    You aren't responsible for unit testing someone elses service either. :)

    OrokosPA.png
  • baronfelbaronfel Would you say I have a _plethora_?Registered User regular
    edited May 2012
    @Urahonky The problem is definitely what Gnome mentioned above. I've been bit by it several times before. Use the pack syntax and set the image to the Resource Build Action and all will be well.

    Image pointing like that is an annoyingly wonky part of WPF.

    baronfel on
  • Jimmy KingJimmy King Registered User regular
    DrunkMc wrote: »
    So, I think I'm going to write my web crawler in Python. Any specific editors people like for that? I'll be doing development on Windows. Any tips and tricks that you wish you knew? I did PERL a few years back, but never Python. Should be fun!

    If you want a full IDE, Aptana is really nice and free. PyCharm is also pretty good most of the time, but I found it to be a bit buggy and would just randomly corrupt my workspace on occasion and it's not free.

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    You really don't need a full IDE for Python/Ruby. Just grab Sublime Text and Console2 and be done with it.

    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
    I still can't figure out how to copy text in console2.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • urahonkyurahonky Registered User regular
    edited May 2012
    baronfel wrote: »
    @Urahonky The problem is definitely what Gnome mentioned above. I've been bit by it several times before. Use the pack syntax and set the image to the Resource Build Action and all will be well.

    Image pointing like that is an annoyingly wonky part of WPF.

    I don't know how to do the pack syntax. :( Is that a part of XAML or is it a part of VB/C#?

    e: I realize Gnome posted it above but I have no idea where to put that... in the UriSource?

    urahonky on
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    In the Source of the Image tag.

    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
  • urahonkyurahonky Registered User regular
    Wow that works. That is absolutely ridiculous. Why is it so much more complicated than in Java?

  • bowenbowen How you doin'? Registered User regular
    Better*

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • urahonkyurahonky Registered User regular
    Haha, there's NO way that doing that pack thing is better than "./images/file.jpg" :P

    And it's not really working for something else I'm trying... Ugh...

  • urahonkyurahonky Registered User regular
    Alright so I figured it out.

    "/images/file.jpg" works just as well as that pack does. But you have to set it to Resource and you have to rebuild it about 3 times for it to actually show up.

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    urahonky wrote: »
    Alright so I figured it out.

    "/images/file.jpg" works just as well as that pack does. But you have to set it to Resource and you have to rebuild it about 3 times for it to actually show up.

    It was the Resource thing all along most likely. You'll notice I said last page to make sure the build action was Resource, hehe.

    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
  • urahonkyurahonky Registered User regular
    GnomeTank wrote: »
    urahonky wrote: »
    Alright so I figured it out.

    "/images/file.jpg" works just as well as that pack does. But you have to set it to Resource and you have to rebuild it about 3 times for it to actually show up.

    It was the Resource thing all along most likely. You'll notice I said last page to make sure the build action was Resource, hehe.

    I swear I had done that multiple times it just didn't take. :P I'm using Visual Studio 11 beta or whatever so maybe it was just a bug or something.

  • an_altan_alt Registered User regular
    Infidel wrote: »
    If they change regularly, they need to be updated by whoever is maintaining? It is either done or it isn't, not sure I'm understanding your problem here.

    You aren't responsible for unit testing someone elses service either. :)

    No, but I am responsible for making sure that changes to my integration module haven't screwed up integration with any third party services or applications it connects to. The services should be the easy part to automate, but the credential issue makes proper testing difficult.

    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.
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Are any of you good with sed/awk?

    Basically, I have a yaml file (my Rails database config), that is checked in to source control. I want to fill in 99% of my production environments database info, but not the password. I'd like to put a replacement token in place of the password, and then use the tail output of a file (mysql.pass) to replace that replacement token as part of my production deploy.

    I know this can be done with sed/awk, but I am not a UNIX command master.

    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
  • InfidelInfidel Heretic Registered User regular
    GnomeTank wrote: »
    Are any of you good with sed/awk?

    Basically, I have a yaml file (my Rails database config), that is checked in to source control. I want to fill in 99% of my production environments database info, but not the password. I'd like to put a replacement token in place of the password, and then use the tail output of a file (mysql.pass) to replace that replacement token as part of my production deploy.

    I know this can be done with sed/awk, but I am not a UNIX command master.

    A simple token replace is done with sed, something like:
    SQLPASS=`cat mysql.pass`
    sed "s/TOKEN/$SQLPASS/g" inputfile > outputfile
    

    You can also do a sed in-place on the inputfile, but I don't recommend it. Usually you have your input template > output final in these scenarios.

    OrokosPA.png
  • InfidelInfidel Heretic Registered User regular
    an_alt wrote: »
    Infidel wrote: »
    If they change regularly, they need to be updated by whoever is maintaining? It is either done or it isn't, not sure I'm understanding your problem here.

    You aren't responsible for unit testing someone elses service either. :)

    No, but I am responsible for making sure that changes to my integration module haven't screwed up integration with any third party services or applications it connects to. The services should be the easy part to automate, but the credential issue makes proper testing difficult.

    You probably want to make a mock of the service, since you're not actually testing the service itself.

    The results that you expect can be captured and then mock it in for tests.

    OrokosPA.png
  • CantidoCantido Registered User regular
    Uh oh. Mom says I'm supposed to have An Idea and use my fancy learnin' degree to become a millionare. Now.

    3DS Friendcode 5413-1311-3767
  • baronfelbaronfel Would you say I have a _plethora_?Registered User regular
    Infidel wrote: »
    an_alt wrote: »
    Infidel wrote: »
    If they change regularly, they need to be updated by whoever is maintaining? It is either done or it isn't, not sure I'm understanding your problem here.

    You aren't responsible for unit testing someone elses service either. :)

    No, but I am responsible for making sure that changes to my integration module haven't screwed up integration with any third party services or applications it connects to. The services should be the easy part to automate, but the credential issue makes proper testing difficult.

    You probably want to make a mock of the service, since you're not actually testing the service itself.

    The results that you expect can be captured and then mock it in for tests.

    And this is why interfaces are magical! Most good mocking frameworks will let you stub out a dummy implementation of an interface that you use for testing instead of being hard-linked to an actual service somewhere. You can just whip up a test data set, mock up the service, and set up an expectation to return your test data set.

    Keep in mind that your system test phase will want that real service, though...

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Oh Rails, you had me at Hello World.

    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
  • SaerisSaeris Borb Enthusiast flapflapflapflapRegistered User regular
    So, regarding PAdev hub accounts, I'm hoping @Infidel or someone else can tell me if these Linode servers would be suitable for some stuff I'd like to host. Basically, I just have a portfolio of Web development projects that I add to regularly, and I need a webhost for a domain name I own. I would need SSH access, CGI/FastCGI, MySQL, mod_rewrite (or something else for URL rewriting), and recent versions of PHP, Perl, Python, Ruby, and Lua. This gets ~10 hits a day, serves mostly low-bandwidth textual content, and the database access is very minimal (~10 tables, ~1000 records max).

    Is this the sort of thing that this shared Linode would be good for?

    borb_sig.png
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Saeris wrote: »
    So, regarding PAdev hub accounts, I'm hoping @Infidel or someone else can tell me if these Linode servers would be suitable for some stuff I'd like to host. Basically, I just have a portfolio of Web development projects that I add to regularly, and I need a webhost for a domain name I own. I would need SSH access, CGI/FastCGI, MySQL, mod_rewrite (or something else for URL rewriting), and recent versions of PHP, Perl, Python, Ruby, and Lua. This gets ~10 hits a day, serves mostly low-bandwidth textual content, and the database access is very minimal (~10 tables, ~1000 records max).

    Is this the sort of thing that this shared Linode would be good for?

    I'm not Infidel, but I can answer mostly in the affirmative for him. He's very responsive about installing things you need, and a lot of what you want is already there. Not sure about mod_rewrite and FastCGI, but SSH check, MySQL check, Python, PHP, Ruby, Perl, check, Lua is a pretty simple install. I think it would be perfect for you.

    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
  • CantidoCantido Registered User regular
    I got the PHP job. I'll get to work on a shopping cart again! I also get to pick the cart. I know it should have Zend Guard.

    3DS Friendcode 5413-1311-3767
  • VeganVegan Registered User regular
    edited May 2012
    Hey, everyone. Not A Programmer in the house here.

    I'm going to be starting an Associate Degree education in Web Programming (I can provide specifics if it's important) and I was wondering if I could get an idea of hardware requirements for a laptop. Right now my only computer is hooked up to my TV and there's no way I'm hunching in front of that for all of my class work.

    I can't imagine that the hardware requirements would be very demanding for those sorts of projects, correct?

    Also, how concerned should I be about being bad at math?

    Vegan on
    steam_sig.png
  • InfidelInfidel Heretic Registered User regular
    GnomeTank wrote: »
    Saeris wrote: »
    So, regarding PAdev hub accounts, I'm hoping @Infidel or someone else can tell me if these Linode servers would be suitable for some stuff I'd like to host. Basically, I just have a portfolio of Web development projects that I add to regularly, and I need a webhost for a domain name I own. I would need SSH access, CGI/FastCGI, MySQL, mod_rewrite (or something else for URL rewriting), and recent versions of PHP, Perl, Python, Ruby, and Lua. This gets ~10 hits a day, serves mostly low-bandwidth textual content, and the database access is very minimal (~10 tables, ~1000 records max).

    Is this the sort of thing that this shared Linode would be good for?

    I'm not Infidel, but I can answer mostly in the affirmative for him. He's very responsive about installing things you need, and a lot of what you want is already there. Not sure about mod_rewrite and FastCGI, but SSH check, MySQL check, Python, PHP, Ruby, Perl, check, Lua is a pretty simple install. I think it would be perfect for you.

    Yes to everything except possibly Lua, might have to install that one still can't recall.

    OrokosPA.png
This discussion has been closed.