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] Thread: Fixed last bug in 5 month thread

1767779818299

Posts

  • RendRend Registered User regular
    You probably made a typo somewhere honestly.

  • bowenbowen How you doin'? Registered User regular
    edited July 2015
    It's supposed to work like that yeah. Spaces will fuck it up, and sometimes if it's a sub item CSS and HTML don't play nice together (if span.patient-info is actually under like div.span.patient-info I've seen this happen). I just make everything a top level class because why the fuck not?

    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
  • RendRend Registered User regular
    edited July 2015
    urahonky wrote: »
    bowen wrote: »
    Maybe your CSS class is not proper?

    This actually might be a case of me being dumb and knowing very little CSS. I'm used to sass. If I have the class set to "patient-info" and it's a span. In my CSS I had span.patient-info... Was this wrong? I changed it to just '.patient-info' and that seemed to pull the right changes... But only some of them didn't work before.

    I highly recommend if your work involves a lot of web stuff that you take the time to learn css.

    I think I've probably mentioned this exact thing to you before, like a year ago or something. You were having almost identical trouble then, iirc (I could be remembering someone else)

    Even if normally you don't touch css, the solution of "I could make this vertically centered so much easier in javascript" is so comically wrong to me that it's almost difficult to comprehend. Javascript should not be your method of laying out a static HTML page- HTML layout is what css is for! That's like using a jquery plugin to add two numbers together. Learning how to use it will save you a lot of time and effort later for when it's really the only option, and won't even take you very long.

    Rend on
    builderr0rbowenDisruptedCapitalistironsizide
  • bowenbowen How you doin'? Registered User regular
    There's a lot of tools that are basically using javascript to make things easier for people generating static sites.

    I think they're awful tools because of the kind of dependency they build and then you need to dig in anyways, might as well just start it all from the base since you can control so much more.

    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
  • DehumanizedDehumanized Registered User regular
    It was outdated as hell even when I got it, but when I was working on a big web-based project, having this CSS reference manual around was invaluable. Really wish it was updated for CSS3.

    urahonky
  • urahonkyurahonky Registered User regular
    Rend wrote: »
    urahonky wrote: »
    bowen wrote: »
    Maybe your CSS class is not proper?

    This actually might be a case of me being dumb and knowing very little CSS. I'm used to sass. If I have the class set to "patient-info" and it's a span. In my CSS I had span.patient-info... Was this wrong? I changed it to just '.patient-info' and that seemed to pull the right changes... But only some of them didn't work before.

    I highly recommend if your work involves a lot of web stuff that you take the time to learn css.

    I think I've probably mentioned this exact thing to you before, like a year ago or something. You were having almost identical trouble then, iirc (I could be remembering someone else)

    Even if normally you don't touch css, the solution of "I could make this vertically centered so much easier in javascript" is so comically wrong to me that it's almost difficult to comprehend. Javascript should not be your method of laying out a static HTML page- HTML layout is what css is for! That's like using a jquery plugin to add two numbers together. Learning how to use it will save you a lot of time and effort later for when it's really the only option, and won't even take you very long.

    I didn't mean that if I could use JS then I would be able to easily vertically center... I meant that if I could use React then I could build this report in just a few seconds flat since I could make it look pretty real easy. I know CSS (well, sass, not sure the difference). And I know you can edit the CSS using Chrome but for some reason none of my changes were actually being reflected on the page.

  • urahonkyurahonky Registered User regular
    So the problem was that my display was set to inline. When I set it to block then it allowed me to pad the top. TIL!

    Rend
  • DisruptedCapitalistDisruptedCapitalist I swear! Registered User regular
    Yep, inline is very handy if you're making a document or something. If you're making a webpage it's a fucking nightmare.

    bowen
  • TofystedethTofystedeth Registered User regular
    TIL: CSS has a unit called ex which is the height of a lowercase 'x'.

    steam_sig.png
    bowenMahnmut
  • hippofanthippofant ティンク Registered User regular
    Rend wrote: »
    urahonky wrote: »
    bowen wrote: »
    Maybe your CSS class is not proper?

    This actually might be a case of me being dumb and knowing very little CSS. I'm used to sass. If I have the class set to "patient-info" and it's a span. In my CSS I had span.patient-info... Was this wrong? I changed it to just '.patient-info' and that seemed to pull the right changes... But only some of them didn't work before.

    I highly recommend if your work involves a lot of web stuff that you take the time to learn css.

    I think I've probably mentioned this exact thing to you before, like a year ago or something. You were having almost identical trouble then, iirc (I could be remembering someone else)

    Even if normally you don't touch css, the solution of "I could make this vertically centered so much easier in javascript" is so comically wrong to me that it's almost difficult to comprehend. Javascript should not be your method of laying out a static HTML page- HTML layout is what css is for! That's like using a jquery plugin to add two numbers together. Learning how to use it will save you a lot of time and effort later for when it's really the only option, and won't even take you very long.

    Yeah. Uh, no offense @urahonky, but if you're relying on JS to layout your webpages, something is direly wrong. Almost all webpage layout should be do-able just with straight HTML and CSS; if you're doing it with JS, that's kinda a bad kludge.

    Though maybe I'm just old, and I should recognize that we've now entered a world where using JS to layout a webpage doesn't use an appreciably higher amount of resources.

  • urahonkyurahonky Registered User regular
    The problem is that my artistic skill lean towards "fuck ugly" when it comes to using straight HTML. If I can use bootstrap and pop a few panels here and there then life is easier.

  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited July 2015
    TIL: CSS has a unit called ex which is the height of a lowercase 'x'.

    I... wat? Is that a roundabout way of making an "x" try to look more like a multiplication-symbol kind of a thing? That seems silly as all hell...

    To documentation-land!

    [ed] WEIRD! I get it now, but still... WEIRD!

    iTunesIsEvil on
  • ironsizideironsizide You must whip it Registered User regular
    builderr0r wrote: »
    I think my hardest CS class so far was probably Assembly. Luckily I'll never have to use that again. :P

    My hardest class was Calc III - trigonometric calculus. I got a D+ and nearly walked again (I'm a paraplegic).

    Fun Fact: The head of the computer center of the university I went to was a former student who failed this course and at the time hadn't finished his CompSci degree as a result. So I was in good company.

    I don't 'get' trig, in calculus or otherwise. Gnarly calculus kept me out of the physics field as well.

    |_
    Oo\ Ironsizide
    camo_sig2.png
    builderr0r
  • RendRend Registered User regular
    ironsizide wrote: »
    builderr0r wrote: »
    I think my hardest CS class so far was probably Assembly. Luckily I'll never have to use that again. :P

    My hardest class was Calc III - trigonometric calculus. I got a D+ and nearly walked again (I'm a paraplegic).

    Fun Fact: The head of the computer center of the university I went to was a former student who failed this course and at the time hadn't finished his CompSci degree as a result. So I was in good company.

    I don't 'get' trig, in calculus or otherwise. Gnarly calculus kept me out of the physics field as well.

    My hardest cs class BY FAR was algorithms. Analyzing recursive algorithms using generating functions required a level of math pretty much nobody was prepared for. That class routinely kept half a dozen or more people per semester from achieving their degree.

  • hippofanthippofant ティンク Registered User regular
    Rend wrote: »
    ironsizide wrote: »
    builderr0r wrote: »
    I think my hardest CS class so far was probably Assembly. Luckily I'll never have to use that again. :P

    My hardest class was Calc III - trigonometric calculus. I got a D+ and nearly walked again (I'm a paraplegic).

    Fun Fact: The head of the computer center of the university I went to was a former student who failed this course and at the time hadn't finished his CompSci degree as a result. So I was in good company.

    I don't 'get' trig, in calculus or otherwise. Gnarly calculus kept me out of the physics field as well.

    My hardest cs class BY FAR was algorithms. Analyzing recursive algorithms using generating functions required a level of math pretty much nobody was prepared for. That class routinely kept half a dozen or more people per semester from achieving their degree.

    This isn't unusual. I feel like Algorithms and Operating Systems are the two ... like final checkpoint courses for a CS degree. Some people bomb out in first year, sure, but fourth-year courses are typically hard to fail, especially since students get to choose what to take, and so Algorithms and Operating Systems are the last, hardest, mandatory courses.

    Personally, my experiences with the two courses were really different though. Algorithms was hard, in that I'd lock myself in my room for 3 days straight for each assignment, but I ended up pulling a 97. Operating Systems was hard, because my partner was a completely useless flake, and I was taking it in 4th year due to a scheduling conflict, so I just ended up not doing any of the assignments and powered through on the exam, because I had too much other work to do.

  • hippofanthippofant ティンク Registered User regular
    urahonky wrote: »
    The problem is that my artistic skill lean towards "fuck ugly" when it comes to using straight HTML. If I can use bootstrap and pop a few panels here and there then life is easier.

    Well, I don't design either. (I got a 60 in grade 9 art!) But HTML and CSS should be sufficient to pop a panel anywhere, based on the desires of someone who can design. Just div absolute!

  • builderr0rbuilderr0r Registered User regular
    edited July 2015
    I'm taking Algorithms this semester and it's going fine. (I'm actually doing homework for that class right now :P - Huffman Coding)

    Calc III isn't required for computer science majors at my school luckily - only Calc I & II. The hardest math class I've taken is Statistics (which I'm taking now) but I think I just have a hard professor. He makes the exams extremely long, so I have to rush through everything. 90% of the class is still taking the test when the time is up, but it's all our fault apparently.

    builderr0r on
    steam_sig.png
  • EchoEcho ski-bap ba-dapModerator mod
    TIL: CSS has a unit called ex which is the height of a lowercase 'x'.

    It's a typography thing, together with em-width.

    DisruptedCapitalist
  • EchoEcho ski-bap ba-dapModerator mod
    urahonky wrote: »
    So the problem was that my display was set to inline. When I set it to block then it allowed me to pad the top. TIL!

    Spans are inline. You want a div for block.

    bowenbuilderr0rDisruptedCapitalist
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    I always found algorithms and theory of computation easy, but I was a math major and then went on for a masters in CS. The hardest class was computational fluid dynamics.

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    I found algorithms moderately hard, loved theory of computation, but I was terrible at Calc 2 (not required, I inflicted that on myself) and Discrete Calc (required).

  • ecco the dolphinecco the dolphin Registered User regular
    My hardest class was Radio Systems Engineering (yeah, yeah, did a EEE degree, not a CS degree, but I thought it might be fun to contribute).

    You know that moment in your life when you learn F=ma, and you're like, "Wow, this is pretty cool."

    And then later, you learn about relativity, how Newton's laws were just an approximation (but very accurate at low velocities), and then your mind is blown at the implications? And then there's some higher order physics beyond that which I'm sure exists, but I'm unaware how to adequately describe, and then your mind is so exploded that you just start drooling at the mouth when you start hearing about it?

    Radio Systems engineering is like that, but for electrical signals.

    You know how in high school, you're taught V=IR, and how the voltage at both ends of an ideal wire is the same? Then in an electronics degree, you get taught V=IZ, the generalised form of Ohm's Law for steady state AC circuits (which simplifies back to V=IR for DC circuits), then you get introduced to transient analysis (a whole other ball game, Laplace transforms etc). So all this is building on high school physics, which is nice and all, and everything makes sense.

    So for everyday purposes, you can assume that the voltage on both ends of a wire is the same.

    This is a lie an approximation which Radio Systems Engineering exposes.

    All wires are actually transmission lines - even your ideal wire. This ends up having to be considered in any form of medium/high speed electronic design (rule of thumb: > 100MHz). The higher the frequency, the more concerned with it you have to be.

    I mock those digital designs who thought they would never have to deal with anything analogue ever again. Digital is just saturated analogue signals, after all. :P

    Penny Arcade Developers at PADev.net.
    DisruptedCapitalistironsizideCampya5ehrenelectricitylikesme
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    Oh that explains so much. I should've known you were one of those analog weirdos.

    a5ehren
  • ecco the dolphinecco the dolphin Registered User regular
    Oh that explains so much. I should've known you were one of those analog weirdos.

    I have a beard and everything!

    I've got books by Bob Pease, had a CRT scope I called old Betsy - but realistically, modern day MDOs are much better.

    Penny Arcade Developers at PADev.net.
  • urahonkyurahonky Registered User regular
    Feels good to be able to close 7 Jira tickets in one day. I can't wait for tomorrow's stand up!

    ecco the dolphincrimsoncoyote
  • PeewiPeewi Registered User regular
    I haven't done any programming in a while, so I'm making a basic calculator in C# just to do something.

    One thing I'm a little confused about is that the first time I tried dividing by zero it threw an exception (like I would expect), but every time after that it returns infinity. I have no idea what changed to cause this.

  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    Integer division will throw an exception, floating point will return +-INF.

  • PeewiPeewi Registered User regular
    Okay, that's probably it. I started out with integers and then realized that I wanted decimals.

  • KambingKambing Registered User regular
    Programming related; done, finally!

    aKDBcCS.jpg?1

    @TwitchTV, @Youtube: master-level zerg ladder/customs, commentary, and random miscellany.
    ecco the dolphinDehumanizedKakodaimonosmightyjongyogavindelCokebotlebuilderr0rhtmMNC DoverurahonkyInfidelironsizideTofystedethcrimsoncoyoteMahnmutbowenEtheaPolaritieDisruptedCapitalistTomantaelectricitylikesmeschussNijajjae2123BahamutZEROdjmitchella
  • NogsNogs Crap, crap, mega crap. Crap, crap, mega crap.Registered User regular
    urahonky wrote: »
    Long story short: I need to be able to create an HTML page that will be converted to a PDF and then that PDF will be sent to a print queue. This all needs to happen on the back-end so the user will never actually see this page.

    I could write this thing in 5 minutes with React but since I don't think you can actually use Javascript in this html -> pdf converter I'm stuck doing it the old fashioned way.

    well

    react can be rendered serverside and sent as a html payload to anything. look up isomorphic/universal react tutorials.

    react can build a page and deliver it to a non-javascript browser just fine.

    rotate.jpg
    PARKER, YOU'RE FIRED! <-- My comic book podcast! Satan look here!
  • ecco the dolphinecco the dolphin Registered User regular
    Kambing wrote: »
    Programming related; done, finally!

    Now you've just got to prepare for your defense!

    Remember

    The best defense is a good offense.

    Who are these jokers to be asking you about program synthesis with types? You should be the one asking them questions. :P

    Penny Arcade Developers at PADev.net.
    htmTofystedethcrimsoncoyote
  • CokebotleCokebotle 穴掘りの 電車内Registered User regular
    I've got a quick C++ question for you guys. I'm going through some online tutorials to get a refresher/learn about C++11, and I'm getting an odd error relating to std::ostream in Visual Studio 2013.

    I'm playing around with operator overloads for a rational number class, and to use 'cout' the '<<' operator has to be overloaded (to output numerator/denominator). Then if I try to write a conversion operator from 'Rational' to 'string' to output, I get an error about '<<' not having any matching operands of type 'std::ostream << std::string'. I'm not sure what I'm doing wrong - I'm pretty sure that I have all the code right:
    Operator overloads:
    Rational::operator std::string () const {
    	const static int maxstring = 64;
    	char s[maxstring];
    	_snprintf(s, maxstring, "%d/%d", _n, _d);
    	return std::string(s);
    }
    
    std::ostream & operator << (std::ostream & o, const Rational & r) {
        return o << r.numerator() << '/' << r.denominator();
    }
    
    Problematic code in int main():
    Rational b(5, 3);      // "5/3"
    string s = "Rational as a string: ";
    s += b;
    cout << s << endl;
    return 0;
    

    Does anyone have any suggestions? It doesn't work after converting the object, but 'cout' works fine like this:
    Rational a = 7;
    cout << "a is: " << a << endl;
    

    工事中
  • ecco the dolphinecco the dolphin Registered User regular
    Could you paste the full error message(s), please?

    Penny Arcade Developers at PADev.net.
  • CokebotleCokebotle 穴掘りの 電車内Registered User regular
    edited July 2015
    Could you paste the full error message(s), please?

    Error List:
    Error 1 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion) c:\users\guest\documents\cppesstrain\ex_files_cpp_esst\exercisefiles\chap04\rational - copy (2).cpp 86
    2 IntelliSense: no operator "<<" matches these operands
    operand types are: std::ostream << std::string c:\users\guest\documents\cppesstrain\ex_files_cpp_esst\exercisefiles\chap04\rational - copy (2).cpp 86

    Cokebotle on
    工事中
  • ecco the dolphinecco the dolphin Registered User regular
    edited July 2015
    And you are including <string>, right?

    Because operator<<( ostream&, const std::string& )* is defined in that header.

    * Yes, I have told a technical lie on what the actual operator overload is, because I don't want to type out the template. =P

    But you would have included <string>, because otherwise there would be a lot more barfing error messages...

    Edit: Needs more context!

    Can you simplify it down - i.e. basically do:
    #include <string>
    #include <iostream>
    
    using namespace std;
    
    int main( int, char *[] )
    {
      string s = "Rational as a string: ";
      cout << s << endl;
      return 0;
    }
    

    ?

    I assume that you've got a using namespace std; somewhere, from the lack of std:: prefixes?

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • CokebotleCokebotle 穴掘りの 電車内Registered User regular
    edited July 2015
    Ah, that was it! Yes, I'm using the std namespace, but wasn't including <string>. I was only using <cstdio> and <iostream>. Thanks!

    I got a ton of build messages, but the only errors returned were the two I pasted. I don't actually call string outside of that one line - everything else is done with literals.

    Edit: I skimmed through the related video again and they never added <string> to their code and yet it worked fine in Xcode?

    Cokebotle on
    工事中
    ecco the dolphin
  • ecco the dolphinecco the dolphin Registered User regular
    edited July 2015
    Cokebotle wrote: »
    Ah, that was it! Yes, I'm using the std namespace, but wasn't including <string>. I was only using <cstdio> and <iostream>. Thanks!

    I got a ton of build messages, but the only errors returned were the two I pasted. I don't actually call string outside of that one line - everything else is done with literals.

    Oh good!

    Hey, I realise that this is a small side project for you, so it's not as much of an issue, but:

    * Try not to use an underscore prefix for your member variable names. The underscore prefix is reserved by the language for other purposes (C++ library, system libraries). Some popular alternatives are the m_ prefix, or the underscore suffix.

    * Try not to have any warnings. The default warnings displayed by Visual Studio 2013's compiler is actually pretty good nowadays, and if you get warnings, they tend to point towards Bad Things in your code.


    Edit:
    Cokebotle wrote: »
    Edit: I skimmed through the related video again and they never added <string> to their code and yet it worked fine in Xcode?

    Yeah, I'm absolutely unfamiliar with the Xcode environment, I'm afraid. It could be that one of their header files includes <string>, and so they get away with not explicitly including it. Perhaps someone else more familiar with Mac dev can comment?

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • CokebotleCokebotle 穴掘りの 電車内Registered User regular
    Cokebotle wrote: »
    Ah, that was it! Yes, I'm using the std namespace, but wasn't including <string>. I was only using <cstdio> and <iostream>. Thanks!

    I got a ton of build messages, but the only errors returned were the two I pasted. I don't actually call string outside of that one line - everything else is done with literals.

    Oh good!

    Hey, I realise that this is a small side project for you, so it's not as much of an issue, but:

    * Try not to use an underscore prefix for your member variable names. The underscore prefix is reserved by the language for other purposes (C++ library, system libraries). Some popular alternatives are the m_ prefix, or the underscore suffix.

    * Try not to have any warnings. The default warnings displayed by Visual Studio 2013's compiler is actually pretty good nowadays, and if you get warnings, they tend to point towards Bad Things in your code.


    Edit:
    Cokebotle wrote: »
    Edit: I skimmed through the related video again and they never added <string> to their code and yet it worked fine in Xcode?

    Yeah, I'm absolutely unfamiliar with the Xcode environment, I'm afraid. It could be that one of their header files includes <string>, and so they get away with not explicitly including it. Perhaps someone else more familiar with Mac dev can comment?

    Thanks for the tips! I'll keep them in mind. I definitely make sure I have no warnings just to be safe.

    The code I'm using are exercise files from Lynda.com videos (woo, university access!), so their code also only includes <cstdio> and <iostream>. I didn't see the instructor explicitly adding #include <string> to his copy in Xcode in the video, but it worked. *shrug*

    工事中
This discussion has been closed.