As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

[Programming] Thread: Fixed last bug in 5 month thread

19394969899

Posts

  • Options
    djmitchelladjmitchella Registered User regular
    So, we're using ember-cli as our framework / build environment; you get a lot of stuff for free with that, it's a fairly complete solution. How much?

    This much

    okay, that's more than I expected.. Just plain Ember on its own is much lighter -- I hadn't realised just how many things come as part of javascript builders nowadays.

  • Options
    urahonkyurahonky Registered User regular
    So, we're using ember-cli as our framework / build environment; you get a lot of stuff for free with that, it's a fairly complete solution. How much?

    This much

    okay, that's more than I expected.. Just plain Ember on its own is much lighter -- I hadn't realised just how many things come as part of javascript builders nowadays.

    God I love data visualization stuff.

  • Options
    a5ehrena5ehren AtlantaRegistered User regular
    edited August 2015
    whyyyyyyyyyyyy does this package use a custom install script that uses flags that are incompatible with GNU Install. whyyyyyyyyyyyyyyyyyy

    If I have to edit Makefile.in (or .am) to make your shit cross-compile, HULK SMASH

    a5ehren on
  • Options
    TofystedethTofystedeth Registered User regular
    Got a promotion and a raise today!
    Praise urahonky!

    steam_sig.png
  • Options
    urahonkyurahonky Registered User regular
    Okay I'm having this weird issue with React... shouldComponentUpdate and componentWillUpdate both never get called. The page is rendered and componentDidMount does get called, but I have a console.log in both shouldComponentUpdate and componentWillUpdate but never see it get fired. Anyone have an idea what's going on?

    It's a very, very simple web form for resetting a password. A single input and button is all. I'm not sure what's going on...

  • Options
    ironsizideironsizide You must whip it Registered User regular
    Nothing like writing soup-to-nuts documentation for your replacement to make you realize how 1. woefully underpaid your where and 2. how happy you've got a new job.

    |_
    Oo\ Ironsizide
    camo_sig2.png
  • Options
    JasconiusJasconius sword criminal mad onlineRegistered User regular
    i think i want to learn racket

    i dont know why i punish myself with these smalltalky languages

    but i guess you gotta go with what you know

  • Options
    htmhtm Registered User regular
    Jasconius wrote: »
    but i guess you gotta go with what you know

    Jasconius knows parentheses?

  • Options
    NogsNogs Crap, crap, mega crap. Crap, crap, mega crap.Registered User regular
    edited August 2015
    urahonky wrote: »
    Okay I'm having this weird issue with React... shouldComponentUpdate and componentWillUpdate both never get called. The page is rendered and componentDidMount does get called, but I have a console.log in both shouldComponentUpdate and componentWillUpdate but never see it get fired. Anyone have an idea what's going on?

    It's a very, very simple web form for resetting a password. A single input and button is all. I'm not sure what's going on...

    this usually means youve got a shouldComponentUpdate equal to false somewhere higher up your component tree, i.e. a parent/anscetor of the component you are looking at.

    if a components shouldComponentUpdate returns false, none of the children will rerender either.

    Nogs on
    rotate.jpg
    PARKER, YOU'RE FIRED! <-- My comic book podcast! Satan look here!
  • Options
    urahonkyurahonky Registered User regular
    Nogs wrote: »
    urahonky wrote: »
    Okay I'm having this weird issue with React... shouldComponentUpdate and componentWillUpdate both never get called. The page is rendered and componentDidMount does get called, but I have a console.log in both shouldComponentUpdate and componentWillUpdate but never see it get fired. Anyone have an idea what's going on?

    It's a very, very simple web form for resetting a password. A single input and button is all. I'm not sure what's going on...

    this usually means youve got a shouldComponentUpdate equal to false somewhere higher up your component tree, i.e. a parent/anscetor of the component you are looking at.

    if a components shouldComponentUpdate returns false, none of the children will rerender either.

    I wonder if it has something to do with react-router. This component is it's own thing (it's a password reset page, so there's no parent for it).

  • Options
    urahonkyurahonky Registered User regular
    edited August 2015
    I'm about to lose my goddamn mind.

    In componentWillUpdate:

    I check if this state's password and next state's password do not match, if not then I set this state's password to the next state's password.
    Then I do validation checks on that. I set validLength = true in my state. By the time it makes it to componentDidUpdate or render it's false. Every time.

    This is the output:
    validLength, componentWillUpdate true
    bundle.js:11849 validLength, render false
    bundle.js:11737 validLength, componentDidUpdate false
    

    Here are my functions:
    componentWillUpdate: function(nextProps, nextState){
            if(this.state.password != nextState.password){
                this.state.password = nextState.password;
                this.state.validLength = this.checkValidLength();
                console.log('validLength, componentWillUpdate', this.state.validLength);
            }
        },
    
    componentDidUpdate: function(prevProps, prevState){
            console.log('validLength, componentDidUpdate', this.state.validLength);
        }
    
    render (since it's longer):
    render: function() {
            var header = (
                <div className="panel-header">
                    <span>Password Reset Form</span>
                </div>
            );
    
            var passwordRequirements = null;
            if(this.state.form){
                var prHeader = (
                    <div className="panel-header">
                        <span>Password Reset Requirements</span>
                    </div>
                );
    
                console.log('validLength, render', this.state.validLength);
    
                passwordRequirements = (
                    <Panel header={prHeader} bsStyle='primary'>
                        <Row>
                            <Col xs={12}>
                                {this.state.validLength ? (<i className="fa fa-check fa-md password-reset"/>) : (<i className="fa fa-times fa-md password-reset"/>)}
                                <span className="password-reset">Must be at least 6 characters long.</span>
                            </Col>
                        </Row>
                        <Row>
                            <Col xs={12}>
                                {this.state.validNum ? (<i className="fa fa-check fa-md password-reset"/>) : (<i className="fa fa-times fa-md password-reset"/>)}
                                <span className="password-reset">Must contain at least one number.</span>
                            </Col>
                        </Row>
                        <Row>
                            <Col xs={12}>
                                <i className="fa fa-times fa-md password-reset"/>
                                <span className="password-reset">Must contain at least one capital letter.</span>
                            </Col>
                        </Row>
                        <Row>
                            <Col xs={12}>
                                <i className="fa fa-times fa-md password-reset"/>
                                <span className="password-reset">Passwords must match.</span>
                            </Col>
                        </Row>
                    </Panel>
                );
            }
    
            return (
                <Grid>
                    <Panel bsStyle='primary' header={header}>
                        <Input type="text" label="Username" disabled={this.state.form} valueLink={this.linkState('user')} ref="user"/>
                        {this.state.form ? (<Input type="password" label="Password" valueLink={this.linkState('password')} ref="password"/>) : (null)}
                        {this.state.form ? (<Input type="password" label="Retry Password" valueLink={this.linkState('retryPassword')} ref="retryPassword"/>) : (null)}
                        <ButtonInput onClick={this.handleResetSubmit} type="submit" value="Reset Password" bsStyle='success'/>
                    </Panel>
                    {passwordRequirements}
                </Grid>
            )
        }
    

    urahonky on
  • Options
    urahonkyurahonky Registered User regular
    edited August 2015
    Holy fuck @Nogs everything I knew about React has been a lie up until this point.

    I thought the entire page constantly rendered with shouldComponentUpdate returning true. But this is so, so not true. Holy fuck. I found out that we have a route handler called SignedIn. This route handler verified that there has been activity between it and the API and logs them out after 10 minutes of inactivity. The previous dev set this to run on an interval. Every 2 seconds it would check, update the state and move on.

    All of the stations (except Login/Password Reset) are the children of this Handler.

    I thought REACT was the one updating the state automatically every 2 seconds and calling "shouldComponentUpdate" on itself.

    God damn it I'm so fucking stupid.

    urahonky on
  • Options
    NogsNogs Crap, crap, mega crap. Crap, crap, mega crap.Registered User regular
    edited August 2015
    huh, that sounds weird.

    why would it need to be on a two second ticker?

    could there just be like one timer that resets on action or state change and it only logs people out if the timer gets to a certain upper limit number?

    edit: unless i suppose you have a ticker server side to keep tokens fresh and need to sync between the two.

    even then tho, just have it be on action and not every 2 seconds? dont even have to wait for response to update state. you can optimistically update it and then revert if the response comes back with logged out or something.

    could possibly even include a client side timer like i suggested for truly afkers.

    Nogs on
    rotate.jpg
    PARKER, YOU'RE FIRED! <-- My comic book podcast! Satan look here!
  • Options
    urahonkyurahonky Registered User regular
    Yeah that's what I think I'm going to have to do.... The problem is that this project is due in two weeks and I just NOW found out about this.

    It checks every two seconds because that's what he set it to. It basically checks the timestamp of the last Api call. If it's > 10 minutes, it immediately boots you out.

  • Options
    SaerisSaeris Borb Enthusiast flapflapflapflapRegistered User regular
    That sounds like a pretty serious misuse of React if I'm reading it correctly.

    borb_sig.png
  • Options
    durandal4532durandal4532 Registered User regular
    Okay this is pretty silly but

    basically I want this: https://github.com/bradoyler/GoogleCalReader-jquery-plugin

    To output the text:

    <div>title</div>
    <div>date</div>
    <div>location</div>
    <div>description</div>

    But like, including the text "<div>". The reason for that is that I'm making this page that is pretty much just for me to copy/paste a pull of a certain calendar into a wordpress blog. It's a bit of a weird workaround but it's also fine, it'll save me a ton of time and effort formatting things during the process of input on the page like I do now.

    I've tried a bunch of different ways of escaping the frigging gt/lt symbols and none of them woooork and I don't like fooling around with Javascript it's annoying. So what winds up happening is that it reads the <div> thing as part of the page instead of as text that I want to have visible for copy-pasting.

    '\<div>' didn't work.
    '\&ltdiv&gt' didn't work.
    '\\u003cdiv\u003e' didn't work.

    Right now my very kludgy solution is just having it output

    divtitle/div
    divdate/div
    divlocation/div
    divdescription/div

    and then find/replacing all the and with < and > in Sublime and THEN copy-pasting from that into wordpress. It's just infuriating to me that I can't figure out how to just output these text frigging characters as text.

    Take a moment to donate what you can to Critical Resistance and Black Lives Matter.
  • Options
    NogsNogs Crap, crap, mega crap. Crap, crap, mega crap.Registered User regular
    edited August 2015
    Okay this is pretty silly but

    basically I want this: https://github.com/bradoyler/GoogleCalReader-jquery-plugin

    To output the text:

    <div>title</div>
    <div>date</div>
    <div>location</div>
    <div>description</div>

    But like, including the text "<div>". The reason for that is that I'm making this page that is pretty much just for me to copy/paste a pull of a certain calendar into a wordpress blog. It's a bit of a weird workaround but it's also fine, it'll save me a ton of time and effort formatting things during the process of input on the page like I do now.

    I've tried a bunch of different ways of escaping the frigging gt/lt symbols and none of them woooork and I don't like fooling around with Javascript it's annoying. So what winds up happening is that it reads the <div> thing as part of the page instead of as text that I want to have visible for copy-pasting.

    '\<div>' didn't work.
    '\&ltdiv&gt' didn't work.
    '\\u003cdiv\u003e' didn't work.

    Right now my very kludgy solution is just having it output

    divtitle/div
    divdate/div
    divlocation/div
    divdescription/div

    and then find/replacing all the and with < and > in Sublime and THEN copy-pasting from that into wordpress. It's just infuriating to me that I can't figure out how to just output these text frigging characters as text.

    try & lt ; and & gt ;

    so basically

    & lt ;div& gt ;

    (but with no spaces between &l and t;, etc.)

    lt and gt stand for less than/greater than respectively

    Nogs on
    rotate.jpg
    PARKER, YOU'RE FIRED! <-- My comic book podcast! Satan look here!
  • Options
    DelmainDelmain Registered User regular
    he means "lt{ampersand};" and "gt{ampersand};"

    I believe that works on the forum, at least <

  • Options
    NogsNogs Crap, crap, mega crap. Crap, crap, mega crap.Registered User regular
    yeah, edited to hopefully make more sense

    also just google 'HTML entity list'

    youll get stuff like this http://dev.w3.org/html5/html-author/charref which can be helpful

    rotate.jpg
    PARKER, YOU'RE FIRED! <-- My comic book podcast! Satan look here!
  • Options
    ecco the dolphinecco the dolphin Registered User regular
    edited August 2015
    N00b Level N00bness

    Me: "Man, I wish I didn't have to use console.log() to debug all these scripts."
    Other dev: "You know.. just hit F12 in Chrome, and go to the other tabs-"
    Me: "OH MY GOD ALL THE STATISTICS AND GRAPHS AND WHAT'S THIS?? SOURCES? SCRIPTS!!?"
    Other dev: "Yeah, just set a breakpoint there and-"
    Me: "OH MY GOD IT ALL JUST WORKS I CAN MOUSE OVER STUFF AND SEE VALUES JUST LIKE VISUAL STUDIO I'M SO EXCITED RIGHT NOW"

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • Options
    DelmainDelmain Registered User regular
    N00b Level N00bness

    Me: "Man, I wish I didn't have to use console.log() to debug all these scripts."
    Other dev: "You know.. just hit F12 in Chrome, and-"
    Me: "OH MY GOD ALL THE STATISTICS AND GRAPHS AND WHAT'S THIS?? SOURCES? SCRIPTS!!?"
    Other dev: "Yeah, just set a breakpoint there and-"
    Me: "OH MY GOD IT ALL JUST WORKS I CAN MOUSE OVER STUFF AND SEE VALUES JUST LIKE VISUAL STUDIO I'M SO EXCITED RIGHT NOW"

    Oh, this is how Ecco felt whenever one of us learned about a C thing

  • Options
    hippofanthippofant ティンク Registered User regular
    I snicker at the idea that ecco's coworkers are on some other webforum now, talking about wanting to stab the new guy :bzz:

  • Options
    ecco the dolphinecco the dolphin Registered User regular
    I was honestly really really surprised that they offered me a shot at web dev.

    I clarified with them for like 20 minutes going, "You... do know that I'm an embedded developer, right? Embedded is not web. I do C and C++, not C#."

    And they're like, "Yeah, yeah, look, we've got a lot of really really good C# devs, and we're fairly certain that you'll pick up C#/web dev quickly enough to contribute to our product."

    I'm like, "Okaaaaaayyy.... I mean, this sort of opportunity doesn't just happen every day for an embedded developer...."

    Penny Arcade Developers at PADev.net.
  • Options
    hippofanthippofant ティンク Registered User regular
    I just wrote some code that's inelegant as fuck. But it works. So fuck it. YOCO.

  • Options
    DehumanizedDehumanized Registered User regular
    I was honestly really really surprised that they offered me a shot at web dev.

    I clarified with them for like 20 minutes going, "You... do know that I'm an embedded developer, right? Embedded is not web. I do C and C++, not C#."

    And they're like, "Yeah, yeah, look, we've got a lot of really really good C# devs, and we're fairly certain that you'll pick up C#/web dev quickly enough to contribute to our product."

    I'm like, "Okaaaaaayyy.... I mean, this sort of opportunity doesn't just happen every day for an embedded developer...."

    Living the dream

  • Options
    InfidelInfidel Heretic Registered User regular
    Infidel wrote: »
    @ecco the dolphin doing web dev is going to bring me endless joy

    OrokosPA.png
  • Options
    admanbadmanb unionize your workplace Seattle, WARegistered User regular
    It's like watching the last eight years of my professional life happen really really fast.

  • Options
    ecco the dolphinecco the dolphin Registered User regular
    Oh my gosh.

    This place even does scrums properly.

    Proper sprint planning, retrospectives, story point voting for issues etc.

    You've got to realise guys - I've only ever read about these things online about good professional software development culture. I've never participated in them before.

    This is so... overwhelming, but in a good way!

    Penny Arcade Developers at PADev.net.
  • Options
    NogsNogs Crap, crap, mega crap. Crap, crap, mega crap.Registered User regular
    N00b Level N00bness

    Me: "Man, I wish I didn't have to use console.log() to debug all these scripts."
    Other dev: "You know.. just hit F12 in Chrome, and go to the other tabs-"
    Me: "OH MY GOD ALL THE STATISTICS AND GRAPHS AND WHAT'S THIS?? SOURCES? SCRIPTS!!?"
    Other dev: "Yeah, just set a breakpoint there and-"
    Me: "OH MY GOD IT ALL JUST WORKS I CAN MOUSE OVER STUFF AND SEE VALUES JUST LIKE VISUAL STUDIO I'M SO EXCITED RIGHT NOW"

    now, in your code type "debugger" and refresh with dev tools open.

    auto break point without having to set it in the dev tools. can be real helpful.

    just make sure you dont commit code with debugger in it.

    rotate.jpg
    PARKER, YOU'RE FIRED! <-- My comic book podcast! Satan look here!
  • Options
    Jimmy KingJimmy King Registered User regular
    Oh my gosh.

    This place even does scrums properly.

    Proper sprint planning, retrospectives, story point voting for issues etc.

    You've got to realise guys - I've only ever read about these things online about good professional software development culture. I've never participated in them before.

    This is so... overwhelming, but in a good way!

    Can I join you? I'd even consider switching from Django to .net mvc stuff.

    I am documenting, for the thousandth time, places where the current project is falling apart due to lack of communcation, documentation, and sane process and what we can do to not fuck this up, yet again, on our next project. The process is mostly artists drawing up UIs without a spec for features (which means the mockup become the spec), understanding of the data and how the UI actually effects that data, or bringing in developers to assist. It will then be ignored due to some belief that "we're special and not doing the same things everyone else is" (seriously, that's nearly an exact quote) and somehow this means that we shouldn't do what works well for everyone else in software development even though what we're doing now clearly doesn't work.

    Can I tell you that needs to be 3 shades darker blue, 2 pixels to the left, and a longer shadow? Nope. What I can do is tell you that you better have some sort of field to display and/or edit X, that there's no way to properly associate this data over here with whatever is actually being edited based on that UI, that we need somewhere to manage this other data here, and if we do this idea here we're going to destroy our API rate limits on Third Party API Z in about 5 minutes of being live but here are some alternatives which would work.

  • Options
    SpawnbrokerSpawnbroker Registered User regular
    Oh my gosh.

    This place even does scrums properly.

    Proper sprint planning, retrospectives, story point voting for issues etc.

    You've got to realise guys - I've only ever read about these things online about good professional software development culture. I've never participated in them before.

    This is so... overwhelming, but in a good way!

    My workplace has finally started adopting some of these things.

    Now if I can only get my CTO to stop going "Ehhh we don't need to do planning, this is just a tiny console app to do one thing..."

    I am currently expanding that tiny console app to support a huge new feature, and I have to refactor all of the code because it's a 700 line Main() function. FML.

    Steam: Spawnbroker
  • Options
    bowenbowen How you doin'? Registered User regular
    edited August 2015
    N00b Level N00bness

    Me: "Man, I wish I didn't have to use console.log() to debug all these scripts."
    Other dev: "You know.. just hit F12 in Chrome, and go to the other tabs-"
    Me: "OH MY GOD ALL THE STATISTICS AND GRAPHS AND WHAT'S THIS?? SOURCES? SCRIPTS!!?"
    Other dev: "Yeah, just set a breakpoint there and-"
    Me: "OH MY GOD IT ALL JUST WORKS I CAN MOUSE OVER STUFF AND SEE VALUES JUST LIKE VISUAL STUDIO I'M SO EXCITED RIGHT NOW"

    It's so god damned amazing.

    Then if you work with jetbrain's phpstorm/webstorm you can debug there too.

    Not sure how visual studio works with debugging c# web stuff, I guess that's a thing?

    bowen on
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    SpawnbrokerSpawnbroker Registered User regular
    bowen wrote: »
    N00b Level N00bness

    Me: "Man, I wish I didn't have to use console.log() to debug all these scripts."
    Other dev: "You know.. just hit F12 in Chrome, and go to the other tabs-"
    Me: "OH MY GOD ALL THE STATISTICS AND GRAPHS AND WHAT'S THIS?? SOURCES? SCRIPTS!!?"
    Other dev: "Yeah, just set a breakpoint there and-"
    Me: "OH MY GOD IT ALL JUST WORKS I CAN MOUSE OVER STUFF AND SEE VALUES JUST LIKE VISUAL STUDIO I'M SO EXCITED RIGHT NOW"

    It's so god damned amazing.

    Then if you work with jetbrain's phpstorm/webstorm you can debug there too.

    Not sure how visual studio works with debugging c# web stuff, I guess that's a thing?

    If you're debugging a website on the local machine, you can attach to the process or the web browser.

    If you're debugging an Azure website, you can attach to the Azure website from Visual Studio as long as your account has tenant rights to the website.

    Steam: Spawnbroker
  • Options
    crimsoncoyotecrimsoncoyote Registered User regular
    Oh my gosh.

    This place even does scrums properly.

    Proper sprint planning, retrospectives, story point voting for issues etc.

    You've got to realise guys - I've only ever read about these things online about good professional software development culture. I've never participated in them before.

    This is so... overwhelming, but in a good way!

    This makes me super jelly.

  • Options
    JasconiusJasconius sword criminal mad onlineRegistered User regular
    Saeris wrote: »
    That sounds like a pretty serious misuse of React if I'm reading it correctly.

    i could argue that every use of react is a misuse of react, but my holy warrior gear is in storage

  • Options
    DelmainDelmain Registered User regular
    I work at a 50k+ employee company that does Agile correctly.

    It's not impossible.

  • Options
    NogsNogs Crap, crap, mega crap. Crap, crap, mega crap.Registered User regular
    edited August 2015
    i personally prefer kanban as opposed to scrum as far as agile implementations go.

    no sprints or daily standups. just tickets and priority shifts.

    success is measured by cycle time, not velocity. way more flexible and i feel better for continuous integration.

    sprints just feel like mini waterfall to me most of the time.

    Nogs on
    rotate.jpg
    PARKER, YOU'RE FIRED! <-- My comic book podcast! Satan look here!
  • Options
    SpawnbrokerSpawnbroker Registered User regular
    Delmain wrote: »
    I work at a 50k+ employee company that does Agile correctly.

    It's not impossible.

    Adopt me.

    Steam: Spawnbroker
  • Options
    JasconiusJasconius sword criminal mad onlineRegistered User regular
    i am an active participant in the "fuck it, we'll do it live" methodology

  • Options
    ironsizideironsizide You must whip it Registered User regular
    Jimmy King wrote: »
    I am documenting, for the thousandth time, places where the current project is falling apart due to lack of communcation, documentation, and sane process and what we can do to not fuck this up, yet again, on our next project. The process is mostly artists drawing up UIs without a spec for features (which means the mockup become the spec), understanding of the data and how the UI actually effects that data, or bringing in developers to assist. It will then be ignored due to some belief that "we're special and not doing the same things everyone else is" (seriously, that's nearly an exact quote) and somehow this means that we shouldn't do what works well for everyone else in software development even though what we're doing now clearly doesn't work.

    It's like you work where I am working! Since I work in media, imagine the artists are instructed to work with storyboards as if for a movie, and that's the spec.

    |_
    Oo\ Ironsizide
    camo_sig2.png
This discussion has been closed.