As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
We're funding a new Acquisitions Incorporated series on Kickstarter right now! Check it out at https://www.kickstarter.com/projects/pennyarcade/acquisitions-incorporated-the-series-2

[Programming] djmitchella travelling through snow to rfind duplicate dates for singletons

17879818384100

Posts

  • urahonkyurahonky Registered User regular
    Weird Django problem that I hope someone can help me with:

    I am calling a view in my test and I need to get the body of this request to get a value I'm passing in. Here's the unit test call:
    response = self.client.delete('/track/c/delete/', data={"c_identity": c.identity})
    

    When I put a breakpoint in my view this is what request.body looks like:
    b"{'c_identity': '14ffc943-1cab-4e5f-b059-d8886e3e6076'}"
    

    So I assume that I have to decode it from bytes to a string so I can do json.loads, right? This is what happens when I decode request.body:
    '{\\'c_identity\\': \\'14ffc943-1cab-4e5f-b059-d8886e3e6076\\'}'
    

    How do I get this dictionary object? Obviously json.loads() doesn't work on the above.

  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    Delmain wrote: »
    bowen wrote: »
    Contract to perm makes bowen a sad panda. Starting to see this a lot lately and it's so shitty.

    Friend got fucked out of 3 months pay because they didn't like his "final product" after 3 months so they thought it was kosher under 1099 contract to deny him (partially his fault for not arguing a stronger contract and pay schedule). But since it followed the typical "you need to provide X service in order for your contract to be fullfilled and us to offer a position" it was totes legit.

    His first warning sign should've been the 2 other people that worked with him at the same time.

    /rant

    what the hell kind of contract to hire position doesn't just pay biweekly?

    Also, Jasc, what's the point in contract to hire if you're the one doing the hiring. The only reason I have ever seen that made sense was that it was a recruitment agencies way to get their cut without the company just paying out a couple grand lump sum.

    i work in a dynamic consulting environment where labor demands change almost weekly. we often start with contract and then go perm if the work solidifies and we just need a new permanent member of the team

    however! that just happened, so we are now looking into hiring permanent off the bat. but permanent means willing to relocate to Tampa, FL (i do think relocation assistance is available though, not sure yet, gotta check)

  • DelmainDelmain Registered User regular
    Oh hey, I live there already! We should grab a drink some time.

    I'm not really what you're looking for though.

    crimsoncoyote
  • crimsoncoyotecrimsoncoyote Registered User regular
    Jasconius wrote: »
    Delmain wrote: »
    bowen wrote: »
    Contract to perm makes bowen a sad panda. Starting to see this a lot lately and it's so shitty.

    Friend got fucked out of 3 months pay because they didn't like his "final product" after 3 months so they thought it was kosher under 1099 contract to deny him (partially his fault for not arguing a stronger contract and pay schedule). But since it followed the typical "you need to provide X service in order for your contract to be fullfilled and us to offer a position" it was totes legit.

    His first warning sign should've been the 2 other people that worked with him at the same time.

    /rant

    what the hell kind of contract to hire position doesn't just pay biweekly?

    Also, Jasc, what's the point in contract to hire if you're the one doing the hiring. The only reason I have ever seen that made sense was that it was a recruitment agencies way to get their cut without the company just paying out a couple grand lump sum.

    i work in a dynamic consulting environment where labor demands change almost weekly. we often start with contract and then go perm if the work solidifies and we just need a new permanent member of the team

    however! that just happened, so we are now looking into hiring permanent off the bat. but permanent means willing to relocate to Tampa, FL (i do think relocation assistance is available though, not sure yet, gotta check)

    Tampa, eh? That is pretty close (not as close as Delmain, but my family is there) Hmm... I'm not sure I want to move/change jobs yet, or that I'm what you're looking for but we'll see what happens with this company split later this year.

  • urahonkyurahonky Registered User regular
    urahonky wrote: »
    Weird Django problem that I hope someone can help me with:

    I am calling a view in my test and I need to get the body of this request to get a value I'm passing in. Here's the unit test call:
    response = self.client.delete('/track/c/delete/', data={"c_identity": c.identity})
    

    When I put a breakpoint in my view this is what request.body looks like:
    b"{'c_identity': '14ffc943-1cab-4e5f-b059-d8886e3e6076'}"
    

    So I assume that I have to decode it from bytes to a string so I can do json.loads, right? This is what happens when I decode request.body:
    '{\\'c_identity\\': \\'14ffc943-1cab-4e5f-b059-d8886e3e6076\\'}'
    

    How do I get this dictionary object? Obviously json.loads() doesn't work on the above.

    I figured it out, I had to do the following:
    response = self.client.delete('/track/c/delete/', data=json.dumps({"c_identity": c.identity}))
    

    Then when I got the request in my view I could json.loads() without a problem.

    ecco the dolphinironsizide
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited February 2015
    I've been doing some scripting for my warthog joystick lately...and hoo boy let me tell you about a really terrible implementation of the "C" language that Thrustmaster uses...Thrustmaster C. I mean, it's functional, and really the fact that I can program my stick and throttle to do crazy stuff, I'm down with...but I wish they had just embedded Lua or something.

    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
    bowenironsizide
  • gavindelgavindel The reason all your software is brokenRegistered User regular
    Professor gives us baseline code to use for our graphics class. Python 3.4, Tkinter package, prebuilt buttons and dummy interface to get us started.

    Professor neglects to mention that the program throws a fatal exception on exit invariably.

    Gavindel spends an hour trying to figure out why he's getting this super weird error no matter what he does to his code for the assignment.

    Sad face.

    Angels, innovations, and the hubris of tiny things: my book now free on Royal Road! Seraphim
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Shutting down is hard!

    ecco the dolphingavindelbowen
  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    Well, shutting down properly is hard. Just shutting down is easy-mode! A fatal exception is still shutting down... just not quite as gracefully as one might like. :wink:

  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    Gah. I wish people would quit adding code to our major hot path in the system. I don't care if it's a relatively quick look up, when you do it on every message arrival for 40,000 messages a second, things go bad very fast.

    ecco the dolphinDelmainPolaritie
  • hippofanthippofant ティンク Registered User regular
    Well, shutting down properly is hard. Just shutting down is easy-mode! A fatal exception is still shutting down... just not quite as gracefully as one might like. :wink:

    It is faster though!

  • ecco the dolphinecco the dolphin Registered User regular
    hippofant wrote: »
    Well, shutting down properly is hard. Just shutting down is easy-mode! A fatal exception is still shutting down... just not quite as gracefully as one might like. :wink:

    It is faster though!
    *static_cast< int * >( nullptr ) = 0;
    

    Penny Arcade Developers at PADev.net.
    The Anonymous
  • PolaritiePolaritie Sleepy Registered User regular
    hippofant wrote: »
    Well, shutting down properly is hard. Just shutting down is easy-mode! A fatal exception is still shutting down... just not quite as gracefully as one might like. :wink:

    It is faster though!
    *static_cast< int * >( nullptr ) = 0;
    
    return 0
    

    I did it shorter.

    Steam: Polaritie
    3DS: 0473-8507-2652
    Switch: SW-5185-4991-5118
    PSN: AbEntropy
  • EndEnd Registered User regular
    edited February 2015
    I vaguely remember that when I used to do a little bit of programming with microprocessors, we would call NULL as a function to reset the device.

    I'm not sure if that was considered defined behavior, or if we were just "crashing" it. On these processors, I always assumed that the processor memory mapped the flash and started executing code at position zero (which would probably jump to the proper initialization code?) so it was only a soft reset because we were really just jumping to it, but I never actually looked. (I expect the interrupt table was also there too.)

    End on
    I wish that someway, somehow, that I could save every one of us
    zaleiria-by-lexxy-sig.jpgsteam~tinythumb.png
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited February 2015
    Yeah, typically processors will start executing at 0 or there will be a jump there (x86 is one notable exception), which is usually to the BIOS/ROM init code

    It likely won't reset any attached hardware though which can be "fun"

    Phyphor on
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Of course, the "proper" way to do it is
    _exit(0);
    

    This has the benefit of not running any atexit handlers at all, or flushing any open files and also won't trigger any errors like a throw or abort()

    (It's very fun when one of these are buried in a library and your process just mysteriously terminates for no reason)

    Ethea
  • The AnonymousThe Anonymous Uh, uh, uhhhhhh... Uh, uh.Registered User regular
    Phyphor wrote: »
    Of course, the "proper" way to do it is
    _exit(0);
    

    This has the benefit of not running any atexit handlers at all, or flushing any open files and also won't trigger any errors like a throw or abort()

    (It's very fun when one of these are buried in a library and your process just mysteriously terminates for no reason)
    Technically, whether streams are flushed and/or closed is implementation-defined.

    Also _exit() isn't even standard C, it's a POSIX function that is equivalent to the standard C function _Exit(). :P

  • Jimmy KingJimmy King Registered User regular

    GnomeTank wrote: »
    I've been doing some scripting for my warthog joystick lately...and hoo boy let me tell you about a really terrible implementation of the "C" language that Thrustmaster uses...Thrustmaster C. I mean, it's functional, and really the fact that I can program my stick and throttle to do crazy stuff, I'm down with...but I wish they had just embedded Lua or something.
    Thrustmaster C sounds like a joke language, like Arnold C, but where everything is replaced with porn terms.

    urahonkycrimsoncoyoteDaedalusPolaritieironsizide
  • MvrckMvrck Dwarven MountainhomeRegistered User regular
    Here's a new personal hell: Trying to teach CSS floating, clearing, and the differences in Relative/Absolute/Fixed positioning to someone who is actively trying to ignore everything you say.

    Vegemyteironsizide
  • RendRend Registered User regular
    Mvrck wrote: »
    Here's a new personal hell: Trying to teach CSS floating, clearing, and the differences in Relative/Absolute/Fixed positioning to someone who is actively trying to ignore everything you say.

    What is the situation in which you have to do this?

  • MvrckMvrck Dwarven MountainhomeRegistered User regular
    edited February 2015
    Rend wrote: »
    Mvrck wrote: »
    Here's a new personal hell: Trying to teach CSS floating, clearing, and the differences in Relative/Absolute/Fixed positioning to someone who is actively trying to ignore everything you say.

    What is the situation in which you have to do this?

    A doctor asking for assistance, but refusing to just let me do the damn coding for them.

    Mvrck on
  • PeewiPeewi Registered User regular
    Mvrck wrote: »
    Rend wrote: »
    Mvrck wrote: »
    Here's a new personal hell: Trying to teach CSS floating, clearing, and the differences in Relative/Absolute/Fixed positioning to someone who is actively trying to ignore everything you say.

    What is the situation in which you have to do this?

    A doctor asking for assistance, but refusing to just let me do the damn coding for them.

    Why in the world is a doctor writing CSS in the first place?

    jjae2123
  • NijaNija Registered User regular
    Hello programming thread!

    I am trying to teach myself some basic programming via Codecademy. (Also, I purchased the StackSocial pack Echo[?] posted last week). I am starting with Python and something seems off...

    DQtG6gVl.png

    Is this me just being a complete nub or is something weird happening?

    Priest lvl 110 Warlock lvl 9x DK lvl 110 Paladin lvl 9x Rogue lvl 8x

    Steam Me
  • TryCatcherTryCatcher Registered User regular
    edited February 2015
    You have to calculate the result of the logical operation, use the not modifier on it if it has it then assign it to each variable. The logical operators are the < (more than) and != (different) signs.

    Not familiar with Python's syntax, but for example, not not False is a double denial of False, which means that is value is True. So, bool_five should have True assigned to it

    EDIT: Was wrong whoops. A double denial of False is False, since not False = True and not True = False. So:
    bool_five= False
    

    TryCatcher on
    crimsoncoyote
  • HounHoun Registered User regular
    TryCatcher wrote: »
    You have to calculate the result of the logical operation, use the not modifier on it if it has it then assign it to each variable. The logical operators are the < (more than) and != (different) signs.

    Not familiar with Python's syntax, but for example, not not False is a double denial of False, which means that is value is True. So, bool_five should have True assigned to it:
    bool_five = True
    

    No. "not not False" is False.
    $ python
    Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
    [GCC 4.7.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> bool_five = not not False
    >>> print(str(bool_five))
    False
    

  • NijaNija Registered User regular
    Shouldn't it also prevent me from typing in the question and getting the answer correct?

    Priest lvl 110 Warlock lvl 9x DK lvl 110 Paladin lvl 9x Rogue lvl 8x

    Steam Me
  • bowenbowen How you doin'? Registered User regular
    Sounds like whatever they're using is evaluating "not".

    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
  • hippofanthippofant ティンク Registered User regular
    edited February 2015
    I don't get what's weird here.

    Edit: Oh I see. Yeah, stuff like this usually lets you circumvent the question in silly ways. It's because the interface is going to be re-used for more complicated questions, and they want to give you the freedom to write whatever code you want, rather than being restrictive on the number of lines or whatnot. Students do that sometimes on our own e-labs system, but it's really just not that fruitful for learning.

    hippofant on
  • HounHoun Registered User regular
    Nija wrote: »
    Shouldn't it also prevent me from typing in the question and getting the answer correct?

    I think what's confusing you is that lesson has you set a bunch of variables but never actually do anything with them. It's on you to take the extra step and print the final values so you can see how the various examples evaluated.

    Nija
  • InfidelInfidel Heretic Registered User regular
    @Nija Uhhh, what's your question exactly?

    OrokosPA.png
  • NijaNija Registered User regular
    edited February 2015
    The simulation (?) is asking me to assign a value of not True to bool_one.

    bool_one = not True

    The answer, based on the hint, is not the above, but

    bool_one = False

    Yes, these both get me the same answer, but I would think copying the question as the answer would give me a 'incorrect' or 'try a different method!' rather than 'Yup'.

    Because literally all I did was copy the question into the answer. According to the program (?), I have comprehended this exercise and can move on to the next exercise, where I can probably do the same thing.

    I may just be frustrated because I don't see that as learning. I'm not learning how to use conditionals. I'm cheating.

    Additionally, I can't remember what all the symbols mean because I haven't done these exercises in months.

    I may need to go outside...


    edit
    :
    I guess I should throw this out there: I have no programming experience. I'm sorry if I use incorrect or inappropriate terms.

    Nija on
    Priest lvl 110 Warlock lvl 9x DK lvl 110 Paladin lvl 9x Rogue lvl 8x

    Steam Me
  • TryCatcherTryCatcher Registered User regular
    edited February 2015
    Pfft, I'm almost done with a engineering degree on this (done in March) and still make silly mistakes. Don't sweat it.

    Also, the biggest teacher is the compiler. Use it.

    TryCatcher on
    crimsoncoyote
  • crimsoncoyotecrimsoncoyote Registered User regular
    edited February 2015
    They are asking you to evaluate the expressions they give (eg "not True"), and give a single value answer (ie either "True" or "False"). The reason why what you did works is because it's evaluating what comes after the = itself, and not treating the input as strings

    crimsoncoyote on
  • hippofanthippofant ティンク Registered User regular
    The question is ASKING you to figure out whether they're True or False. The program isn't checking to see if you typed in True or False though; it's using a logical check to see if you entered in something that was equivalent to True or False.

    Again, I know it seems silly, and they could've just done this as a multiple-choice question, but they're going to use this same interface for more complicated programming questions, where they want to give you the freedom to write code that's equivalent to their solution and still get it correct. So just go with figuring out which are True or False rather than short-circuiting the program logic.

    crimsoncoyote
  • HounHoun Registered User regular
    Yeah, just mentally note what you THINK each answer should be (True or False), then append a Print for each variable like I did above and run it to see if you're right.

    I actually remember that exact same lesson confusing me because it seemed like they forgot the step where you do something with the variables, but they're just teaching the concept right now.

    crimsoncoyote
  • InfidelInfidel Heretic Registered User regular
    Ahhhh.

    If they don't want you using an interpreter to give you the answers then they shouldn't put one right there beside straight-forward questions. :wink:

    The questions should hopefully be more meaningful later. If you feel that you're cheating then step through the questions yourself!

    OrokosPA.png
  • ElaroElaro Apologetic Registered User regular
    Okay, good news. I want to set up a website on the padev server! Bad news is, I have no clue where to begin*. Can somebody point me towards a resource on how this whole thing works?

    * I know it starts with getting a paid account on padev.net, but I'd like to not spend money until I know what the hell I should be doing.

    Children's rights are human rights.
  • Mr_RoseMr_Rose 83 Blue Ridge Protects the Holy Registered User regular
    Well… What do you want your website to do?

    ...because dragons are AWESOME! That's why.
    Nintendo Network ID: AzraelRose
    DropBox invite link - get 500MB extra free.
  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    Mvrck wrote: »
    Here's a new personal hell: Trying to teach CSS floating, clearing, and the differences in Relative/Absolute/Fixed positioning to someone who is actively trying to ignore everything you say.

    No, that's just how CSS works. :wink:

    Mahnmutgavindel
  • MvrckMvrck Dwarven MountainhomeRegistered User regular
    Peewi wrote: »
    Mvrck wrote: »
    Rend wrote: »
    Mvrck wrote: »
    Here's a new personal hell: Trying to teach CSS floating, clearing, and the differences in Relative/Absolute/Fixed positioning to someone who is actively trying to ignore everything you say.

    What is the situation in which you have to do this?

    A doctor asking for assistance, but refusing to just let me do the damn coding for them.

    Why in the world is a doctor writing CSS in the first place?

    He's a researcher, and he's generating HTML pages from a MATLAB application. His page formatting was all messed up and he couldn't figure out why, but rather than let me build him a template and stylesheet he wanted it explained so he would know in the future. And then he kept trying to fix bugs rather than focus on what I was telling him. After about 15 minutes of that I "had a meeting" and would check back with him tomorrow.

Sign In or Register to comment.