Jump to content

ydoaPs

Moderators
  • Posts

    10567
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by ydoaPs

  1. Wrong field my eye advances in computers make the study of things like dna possible. It is all science at the end of the day.

    You need a ready made script to convert strings to camelcase and don't even know what a factorial is, and you expect us to believe that you're competent enough in both programming and computer science to make headway in computer vision? Sounds legit.

     

    If you want to create artificial intelligence, you need to create life first - artificial life.

    Why? What makes molecules fizzing capable of information transformations that gates buzzing aren't?

  2. I can't learn calculus, its too much. C++ is out of the question too. Pretty sad when computer science is my major.

    As far as I can tell, it's not C++ itself that is causing your problems in that course; It's not clear that you understand the fundamentals of programming. If you can't grok that, then any specific language will be a burden. If math and logarithmic thinking in general are such stressors, perhaps it would do you some good to switch majors.

     

    I've known quite a few people who have benefited a great deal personally by switching majors. It sounds like this would be a good avenue for you as well.

  3. Wikileaks released an email cache yesterday. This email gets rid of some of the mystery about why Clinton never released her speech transcripts. It contains several excerpts that the campaign deemed more damaging than releasing the transcripts.

     

    Do you think that it was smarter for them to keep them than to release them, or would it have worked better for them to have released them in the first place?

  4. beating themselves up?

    if that turns you on then you

    Miss, are perverted.

     

    Haiku thread has been

    resurrected! yay yay yay

    we all love Haiku!

    Necronomicon

    It is a powerful thing.

    Need supervision

  5. I'm wondering how many values 5Worlds wants to hold in this list. When do we start worrying about incredible RAM usage from holding the ridiculous list affecting the speed instead of the time it takes to evaluate a for loop?

     

    Also, where do we draw our arbitrary cutoff? Just go until the list is big enough to slow the computer to the point that computation is faster?

     

    And why are you talking about python lists when you're not using python?

  6. What?

     

    And your code is incomprehensible, appears to be very inefficient and will run out of precision for the sort of numbers being talked about.

     

     

    factorial(n) {
        if n > 1
            return n * factorial(n-1)
        else
            return 1
    }
    

    As far as I know, there is no shortcut for calculating this. (Although there might be techniques for evaluating the number of permutations to avoid overflowing.)

     

    Nice recursive (but not infinitely so) code. It's clear and actually does a factorial.

  7. Make your comments descriptive and useful (e.g. don't comment a line that increments a counter with /* increment counter */, try something like /* keep track of the number of lines we have processed */). Imagine you are explaining your code to someone else (who isn't as smart as you) when writing comments.

     

    Add comments at the start of each file saying what that file contains.

     

    Add comments at the start of each function/procedure saying what the function does, what parameters it takes and what it returns. Add comments at each step in the function explaining what it is doing and why it is doing it that way - it is OK to document your design decisions in the comments. Otherwise, one day you might come back and think, "that seems an odd way of doing it; I think I'll simplify it .... Oh no! Why doesn't it work any more!?"

     

    As well as using meaningful variable names, add comments to the declarations with more info (e.g. why it is that type /* We use a set rather than a list here to automatically remove duplicates, and we don't care about the ordering */)

     

    If you "temporarily" comment out lines to try a different implementation then:

    1. Add a comment explaining why those lines are commented out

    2. Consider deleting them when you are happy with the new version

    3. Start using a version control system!

     

    Keep the comments up to date with the code; e.g. if a function is given an extra parameter, update the comments.

    A common analogy is to comment like you're explaining it to a rubber duck.

  8. I noticed that a lot of the programming questions here, while phrased in terms of coding in specific languages, are actually rooted in a broader context of programming itself. People are having problem with the ideas behind programming in general. If we help people with algorithm building, the language-specific syntax falls into place.

     

    So, this thread is for tips on programming in general. This isn't about programming in python or programming in java. This is about the fundamental heart of what one needs to do. If anything, it's tips on how to code in PseudocodeTM.

     

    I'll start:

     

    One of the biggest thing about programming is being able to break a problem down into chunks and then break those subproblems down. Keep doing that until you get a picture of what specifically you need to do to accomplish each major step. So, if your program needs to do things in three big steps, start even lower than pseudocode; start with a list.

     

    Step 1

    Step 2

    Step 3

     

    Then, take each of those steps and do the same thing.

     

    Step 1:

    Step 1a

    Step 1b

    Step 1c

    Step 2:

    Step 2a

    Step 2b

    Step 2c

    Step 3:

    Step 3a

    Step 3b

    Step 3c

     

    You may or may not notice the indentation. That brings up my second tip.

     

    Use indentation, called "whitespace", in your programs and even pseudocode. Some languages require you to have whitespace indentation (like python and the never ending tabs v spaces war), but many do not. It is still good practice for writing though. Most languages have interpreters or compilers that ignore anything about whitespace other than whether there is at least one space between two letters, so it won't hurt the program but it will help you. Writing, or at least planning, with whitespace keeps ideas organized. Look at the example in the previous tip. You see each substep, and it's clear where in the logic that it belongs. It makes code easier to read and understand, even if it's not required.

     

    Speaking of readability and understanding, that's where my last two tips come in.

     

    Make good names. Names like "MyFunction" or MY_CONSTANT are bad names. They don't tell you what the function is doing or what the constant is for. Make names descriptive, and your code will be easier to understand and easier to read. Rename (or "refactor") if you need to. Many programming environments will even let you replace all instances of one name with instances of the new name, so it won't even be a long tedious thing. Renaming, if giving a new name, is a good thing. It promotes clarity.

     

    Comment everywhere. Comment to the point that you think you're overcommenting, and then comment some more. Future you will likely have no idea what your code is doing, so leave good notes for future you to use to figure it out.

     

    Your turn.

  9. How would I? People often use pseudonyms.

     

    My point is that we are the ones having the discussion. You aren't, as far as I know, running for office, so you don't have the excuse of using the hyperbole of a politician. If you make a claim here, you're expected to back it up. So back them up.

    Some people use their names instead of silly scenarios about Swans being all jacked up on Tea.

  10. Actually, I do have a further question. How can I get it to validate the input of an angle, making sure it falls within -90 degrees and 90 degrees and notifying the user when the angle does not fall within these margins? Thanks.

    The most important part of programming is being able to break your problem down into parts. Get general steps. Once you've got big steps, go to each step and break it down. Repeat until you know exactly what code you need to write.

     

    So, for this one, you have:

     

    Step 1:

    Make sure the angle is between -90 and 90.

     

    Step 2:

    Tell the user if the angle is invalid.

     

    Now, you don't need to convert the angle yet, since you're comparing against degrees and the input is degrees. So, if you have the input stored as a variable and the converted angle stored as a variable, use the input. Having an angle in degrees, what operation do you need to perform to check to see if the angle is within 90 degrees of 0?

     

     

    Here's what I've got so far. Maybe you can tell me where I'm way off point. Thanks for your help sensei.

     

     

    #define USE MATH DEFINES

    #include <iostream>;

    using namespace std;

     

    int main()

    {

    double angle;

    const double PI=3.14159;

     

    cout << "Finding sine, cosine, and tangent of angles. \n"

     

    // Have user enter an angle between -90 degrees and 90 degrees (measured in degrees, not radians)

    cout << "enter agnle:";

    cin >> angle;

     

    return 0;

     

    }

    Those parts I talked about before? You want to do them outside of the main function. Make each big part its own function and give it a good name. Then your main function should be mostly calling your other functions.

     

     

    All this program is supposed to do is take an angle between -90 and 90 (in degrees), convert it to radians, and provide sin, cos, and tan for that angle. It also has to have a feature that notifies the user when angle is invalid, so it has to validate the input. I really just want to get done with this thing and go to bed. Its been a long week, I'm tired, and its due in 2 hours.

    So, break this list into steps, and tackle them one at a time.

     

     

    Step 1:

    Take a value from the user.

    Step 2:

    Make sure it is within 90 degrees of 0, and notify the user if it isn't (or if it isn't in degrees or a number at all).

    Step 3:

    Create a new variable holding the angle in radians.

    Step 4:

    Output the angle, sin, cos, and tan for the input angle.

     

    Break each step down more if possible, and tell us what you have. Don't worry about C++ syntax yet. Just think about the logical steps. What big picture things do we need to do?

     

     

    ps. What for using #define USE MATH DEFINES if you're not linking proper header file which is using it, and you're defining PI by yourself ?

    Because you instructed to do so and they didn't understand why. We need to help the OP with the actual algorithm first and then we can talk about code. The problem here seems to be rooted in "How do I program?" instead of "How do I code in C++?".

  11. There are atemporal models, but they obviously don't conceive of motion as the same object in different places at different times. Rovelli's evolving constants model is particularly intriguing.

  12. This thread is about Langevin's The Evolution of Space and Time

    Here in English https://en.wikisource.org/wiki/Translation:The_Evolution_of_Space_and_Time

    And in French https://fr.wikisource.org/wiki/L’Évolution_de_l’espace_et_du_temps

     

    Quoted from page 45

     

     

    (enhancing by me)

    The first bold part is understood by me as the contrary of the second bold part.

     

    (I checked the original text in French and it is not an error in translation)

     

    Where is my error?

    With the minkowski metric, we get a pretty neat spacetime distance equation.

     

    (spacetime distance)2 = (temporal distance in a frame)2 - (spatial distance in the same frame)2

     

    A neat feature of the spacetime distance is that it's frame invariant. It's the same for all observers. So, for each observer (those for whom the events are simultaneous and those for whom it is not), the spacetime distance is the same.

     

    So:

     

    (temporal distance in frame 1)2 - (spatial distance in frame 1) = (temporal distance in frame 2)2 - (spatial distance in frame 2)2

     

    In a frame where the events are truly simultaneous, their temporal distance is zero. So:

     

    (spatial distance in simultaneous frame)2 = (spatial distance in a non-simultaneous frame)2 - (temporal distance in the same non-simultaneous frame)2

     

    So, the further apart in time two events are in a frame, the further apart they are spatially in that frame. The simultaneous frames will have the minimum spatial distance between the two events.

  13. SwansonT,

     

    He did disqualify himself as one who unites and as one to stand for the country in the eyes of the world, and alienate entire swaths of people at an alarming rate.

    Considering that they're back in the state of a statistical tie with Hillary continuing her pattern of trending downward, wouldn't that imply that she alienates "entire swaths of people" at an even higher rate?

    I think the best indication of what a candidate will do as POTUS is what the candidate has done on behalf of our nation or common folk in general.

    Like her history of putting profits over the safety of people and their environment by pushing fracking on the US and the world? Like her history of being anti-LGBTQ+? Like her history of destroying black communities by supporting and advocating for "welfare reform", by being sponsored by private prisons, and by enthusiastically advocating for continuing the war on drugs? Like her using superPACs and sharing tax havens with Donald Trump? If we're going by deeds rather than words, then Hillary is an awful choice. After all, just look at her foreign policy experience that she's so proud of.

     

    On the other hand, McCain stopped and public ally corrected a supporter who called Obama a secret Muslim during a 2008 campaign stop, and then went on to compliment him as a family man.

    In contrast, during that primary season, the Clinton campaign was in full on race baiting mode. They fueled the aforementioned conspiracy by disseminating photos of Obama in African garb. Unlike McCain, who flat denied birtherism calling it ridiculous, Clinton did *wink wink nudge nudge* "I don't know".

  14. My claim was, "An FBI investigation, led by a Republican appointed and endorsed agent, has found no prosecutorial criminality in any of Hillary's email related actions." If there was prosecutorial criminality, I'm certain the Republican led FBI would have recommended that action, which they didn't. How is that not the same?

    The second to last sentence. Again, read what the FBI actually announced. A great deal of it was pointing out that she in fact did things that would get anyone else reamed.

  15. The Attorney General said that she would accept the FBI's recommendations. She did and, to-date, there are no prosecutorial efforts announced or currently pursued by her office against Mrs. Clinton--that is unless you know something everyone else doesn't?

    Now, that's not the same claim.

     

     

    So can you blame anyone for not knowing what security classification a document might be?

    As someone who worked with classified material everyday in the US and absolutely would not have gotten off with zero consequences having done what Clinton did, yeah, I can.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.