• Breaking News

    Friday, September 4, 2020

    Please do not downvote someone who is asking for help in solving a code that looks stupid. learn programming

    Please do not downvote someone who is asking for help in solving a code that looks stupid. learn programming


    Please do not downvote someone who is asking for help in solving a code that looks stupid.

    Posted: 04 Sep 2020 02:35 AM PDT

    I don't know if some people here just like to troll beginner programmers by downvoting them or are just feeling salty towards beginner programmers and ugly code. Just don't downvote a post because of that and say nothing about the problem with the bignner's code. I've asked for help maybe twice before in this sub, and while I got some suggestions and advice from those who helped me, I get confused why there are a few who downvote me asking for help to fix a code even though I follow the rules. This is just discouraging for beginner programmers. Do not do that if they're being genuine about asking for help.

    Edit: Since this post has been locked, I'd like to say thank you to everyone who replied, whether it was a friendly or tough advice. I learned a lot! Programming, like any other technical or practical field, tends to have egoistic people or people with superiority complex, but don't give up!

    submitted by /u/Miu_K
    [link] [comments]

    Got my first java certification!

    Posted: 04 Sep 2020 05:34 PM PDT

    After spending most of the summer studying, I passed the java programmer 1 exam! I'm only 16 but I'm hyped for when I get to flex this on a resume. Maybe I can even get an internship

    submitted by /u/kieran_abir04
    [link] [comments]

    Normally I wouldn’t do this but I feel like bragging a bit, I’m so relieved and feel so good right now...

    Posted: 04 Sep 2020 08:33 PM PDT

    I have this internship and am working on a mobile application that is built on Xamarin and DynamoDB. We started working on the project a few weeks ago but just started to look at the code base a week ago (literally none of the students on my team, including myself, have had any experience with the stack so we have been just learning that).

    When I tried the build the project the first time I downloaded it the compiler was reporting hundreds of errors... and I'm like seriously... we were given a project that is completely broken?

    Today our team and mentor worked for a long time to fix the errors or the few that were causing havoc. We never could find the issue. After the meeting I spent the whole rest of the night and found about 3 major errors in the codebase that essentially was responsible for all of the other errors and now I can run the application on the simulator, no more errors. I'm stoked. This is a massive project and I figured it out!

    submitted by /u/mra137
    [link] [comments]

    Please upvote answers, answer follow up questions, and say "Thank You" when people answer or try to answer your questions!

    Posted: 04 Sep 2020 09:05 AM PDT

    This post asking commentors to not give attitude or down vote people who ask "stupid questions" has blown up. However, I'd like to flip the script and talk about how posters can be more polite to people who try to help them:

    1. Asking a question then not responding to answers. This takes many forms:
      1. I have seen commentors literally write page long answers with sample code, with no response from the poster who asked the question, and the correct answer stuck at 1 vote. If someone answers your question, up-vote it at LEAST. Respond with a "Thank you, that helps a lot!" if you want to be more grateful.
      2. If a commentor asks you a question back for clarification, please answer the question! They probably aren't being snide, they usually have a reason for asking the question, because the answer usually hinges on the answer to their question and they don't want to type up a huge "this or that" answer. You are asking them for a favor, so help them help you by answering their question.
      3. When there are multiple correct answers, only one answer gets an upvote or response from the original poster. Even if you already have the answer, the other people answering may have answered A) Earlier. B) Not knowing there was an answer already. They took the time to answer your question, so just because you already have the answer doesn't mean you can ignore them. Up-vote or say thanks.
    2. Asking a follow up question to an answer without trying the answer or researching the answer yourself. At my work, my co-workers will ask me a question about something. I will often answer with one sentence, a brief summary of what to do and the function(s) to look at. 90% of the time this solves their problem because they go Google it or look at the code and solve the problem themselves given a little jump start. If they find my brief answer wasn't enough, they ask a follow up question. A brief answer is not being "snide" or "snobbish." It is often meant to communicate efficiently and point someone in the right direction without laying the explicit answer out. At least Google someone's answer and try to understand it before asking a follow up!
    3. Treating not getting any answers as people being rude. I do see a good number of posts on this sub that have 0 answers (I sort by New.) Interestingly, these 0 answer questions often are not down-voted either: it's just nobody is paying any attention to the question. Often, getting no answers is a sign that your question is not drawing people in to answer: 1) Your question is too vague and people don't know how to answer it. Make your questions specific and list your technology used in your title so people who know that tech are more likely to click on it. 2) People don't understand your question. Make your question clear. This is hard to do and sometime requires some forethought: Should I write the sample code first, then ask the question? Should I slim my sample down and remove extra code, making it easier to read? Should I format my code? (YES!!!) 3) Your question is homework and you are just looking for an answer and you haven't done any work at all to try and answer it. The more effort you put into your question, the more effort people will put into their answers. If you list what you tried that didn't work in your post, this will tell people you have tried and show people your thought process (so they can correct it.) Nobody wants to be free labor for someone else, but people love helping others who are trying hard.

    My final thought: A huge part of modern programming is working with other people. Almost no software project is an individual effort anymore and team work is a huge part of writing code. Communication is vital to teamwork. So, know how to setup your questions and ask good questions. Know when someone is helping you even if they are using very few words to answer. Know how to go off and research on your own after getting any hints that point you the right way. Finally, try not to have too big or too fragile of an ego. While nobody should be verbally abusing you (I don't see this much on this sub) at the same time nobody owes you an answer -- they are doing you a favor by answering you. Put in the effort an help them help you and say "thank you" when you get even a nugget of help.

    submitted by /u/DoomGoober
    [link] [comments]

    How comes programming is not math heavy in the field but a computer science degree is?

    Posted: 04 Sep 2020 07:00 PM PDT

    How comes programming is not math heavy in the field but a computer science degree is?

    submitted by /u/3dasak
    [link] [comments]

    A guide to choose the right teacher for studying online/offline.

    Posted: 04 Sep 2020 08:08 PM PDT

    This is not strictly related to only programming, it applies everywhere. Personally, I am related to programming and whatever happened to me is related while learning programming.

    I have wasted lots of money in my life trying to learn from the wrong teachers, be it offline or online.

    After lots of failures in identifying good teachers, I have finally came to a point, where I can identify good and bad teachers, and it is actually very simple.

    Why should you choose the right teacher?

    1) People will say that everything is free, so what is the matter in choosing all teachers and studying from them?....this is completely wrong. Bad teachers teach contradicting concepts and ruin your concepts.

    2) Read books, this is the best way to learn something, Even while reading books, google the name of the author before buying the book. Look at his qualifications/experience related to the book he is writing. I am reading Tanenbaum's book and the book is just Gold. Tanenbaum has written his own OS. And that can be seen in his book. How clear he has the fundamentals. The only problem that scares me is that if there is not much time to read such great books page by page..:(

    Hence, if there is a good book in that topic, and you haven't already read those books, first priority should be learning from books. No matter what, videos are 2nd hand resources, the 1st hand information will always come from book. But, don't follow bad books.

    3) Watch a video in youtube, coursera, udemy or any platforms. Did you learn anything in that 1 video? Given that you watched it with 100% concentration? If your answer is NO, don't waste time on those videos.

    4) You go to an institute. Do you understand anything in that institute's 1st class? Did you understand anything in the bootcamp's first class. If not, please run away. If you don't understand in an offline inssitute in 1st day(when you haven't paid money), you will never do.

    It is a bit tough to identify good offline institutes as they teach better in the beginning when you don't pay and later start to teach like shit.

    My english is bad as I am from Non English Speaking country, and I am slowly learning English. But I hope this helps.

    TLDR-: If you don't learn anything in 1st video, 1st day; then don't take that course.

    submitted by /u/hnlintune
    [link] [comments]

    [Node.js / APIs] What are best practices for writing a back-end api?

    Posted: 04 Sep 2020 06:32 PM PDT

    I've recently taken some interest in expanding my skills as a front-end developer to include some back-end work. Specifically, I'm working with React & Node.js on Vercel (fka Zeit Now). I'm creating a small test app that is a single product e-commerce store, but I've run into a place where I don't know what "best practices" and "standards" are for creating a "back-end api".

    The back-end of my app is only being used to access the Stripe API (for now). I was hoping y'all might have some insight for me on what "best practice" is for my code.

    Should my server always send my client-side an HTTP code of 200 along with the response object from Stripe (including possibly a status code from the Stripe API of a 402)? My thinking for this is that my server side code technically did was it was supposed to do: make a call to the Stripe API and get a response. And because it was successful, the HTTP code to the client should be 200 along with a response body that has the information from Stripe (which could possibly include an error code).

    Or should my server send my client-side an HTTP code that matches the Stripe API? So if the Stripe API responds with a failure (and even though my back-end code didn't fail) my client-side fetch will receive a code 402 for example.

    Any feedback would be appreciated!

    Below is an example (with some pseudo-code):

    // client.js fetch("/api/payments/create-payment-intent.js", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ items: [{ id: "xl-tshirt" }] }), }) .then(res => { return res.json() }) .then(data => { setClientSecret(data.clientSecret) }) // server.js (Vercel Serverless Functions) [OPTION #1 - always send 200] export default async (req, res) => { const data = req.body const paymentIntent = await stripe.paymentIntents.create({ amount: 400, currency: "usd", }) return res.status(200).json(paymentIntent) } // server.js (Vercel Serverless Functions) [OPTION #2 - parse response object] export default async (req, res) => { const data = req.body const paymentIntent = await stripe.paymentIntents.create({ amount: 400, currency: "usd", }) if (paymentIntent.code === 502) { return res.status(502) } else if (paymentIntent.code === 200) { return res.status(200).json(paymentIntent) } } 
    submitted by /u/joesanchezjr
    [link] [comments]

    edx.org question

    Posted: 04 Sep 2020 08:26 PM PDT

    I am 13 years old that is kinda smart and I was wondering if taking a edx course would be the best option. I already know basic python and java.

    submitted by /u/auugst
    [link] [comments]

    What are best practices for automated website testing?

    Posted: 04 Sep 2020 08:23 PM PDT

    Pretty much the title. I am having trouble setting up automated testing for my websites. I want to be able to plug my code into some kind of system, and the system visits a list of pages, and then it spits out out all the PHP errors, JS errors, etc.

    Is there an easy way to do this? What do you guys use? What are best practices for automated testing of websites?

    I've looked into Selenium, appveyor, and travis-ci. Am I on the right track?

    submitted by /u/RedDragonWebDesign
    [link] [comments]

    Is it ok to take 1-2 days off completelly from learning sometimes?

    Posted: 04 Sep 2020 07:07 AM PDT

    learning for roughly 3-4 months now almost every day and i feel like i need a few days off completely to relax and rest, because i feel like my brain just want to explode.

    submitted by /u/Zozy90
    [link] [comments]

    What are some things you wish Senior Programmers helped you with when you get started?

    Posted: 04 Sep 2020 10:08 AM PDT

    I am an aspiring "Senior" Software Developer with some years of work experience in the industry. I have had the opportunity to join a team recently with team members mostly joining the team right after their studies from the University without much professional work experience.

    So, I would like to gather your thoughts and experience as a newbie on things that you wish you had known when you get started. It would also be interesting about tips and tricks that have helped you find fun at work. I am looking forward to hearing your thoughts on Scrum is managed, how code review is done, how communication work remotely, how Knowledge sharing is done, and so on. Any tips, please.

    submitted by /u/git_world
    [link] [comments]

    Mario.c || CS50 course || Help

    Posted: 04 Sep 2020 07:53 PM PDT

    #include <stdio.h>
    #include <cs50.h>
    int main(void)
    {
    int n;
    do
    {
    n = get_int ("Height: ");
    }
    while (n < 1 || n > 8);
    for (int i = 0; i < n; i++)
    {
    for (int j = 0; j < n; j++)
    {
    if (i + j < n - 1)
    printf(" ");
    else
    printf("#");
    }
    printf("\n");
    }

    }

    This is the code which works completely for the less comfortable solution of the course

    anything after the do-while loop I got so frustrated because I can't understand the logic of doing a for loop inside a for loop and why does this code print half a pyramid I am really trying hard to understand the logic behind each and every part (p.s I copied parts and used the internet to try and understand why one thing results in another)

    Stuff I didn't understand is like why if I put a loop inside a loop it multiplies 8x8 or why i+j < n - 1

    Or why and when to print blank spaces and why put new line at the end this is all very confusing to me

    submitted by /u/ECOMSHIPPING
    [link] [comments]

    [C++] Having trouble with strings

    Posted: 04 Sep 2020 11:34 PM PDT

    Hi! For disclaimer, the following code is my attempt at the LeetCode's problem 1309. I know that the code is horrible, but I still find it amusing how ridiculously hard is it do string manipulations in C++.

    Here is a link to the code. My idea was to create a conversion table that I would use to decrypt the string. We will iterate i until we cannot perform the ahead lookup; if the last character of the string is "#", then we will do nothing as the conversion has already taken place. Otherwise, we will convert the last two characters.

    The error that I am getting is: "Line 341: Char 30: runtime error: member call on null pointer of type 'std::__detail::Hash_node_value_base....." (for some reason I cannot copy the error message from LeetCode).

    submitted by /u/wabhabin
    [link] [comments]

    ModuleNotFound: No module named 'SpeechRecognition'

    Posted: 04 Sep 2020 11:29 PM PDT

    I'm using Python 3.7.8, flask

    ModuleNotFound: No module named 'SpeechRecognition' appears when I try to run my project.

    Post image But it works well when I try it with python -m speech_recognition:

    Post image still not working when I import speech_recognition

    Post image

    submitted by /u/sunshineCinnamon
    [link] [comments]

    Beginner JS/jQuery question

    Posted: 04 Sep 2020 11:15 PM PDT

    Hi. In this code for my calculator:

    function setHeldOperation(operation) { 

    // checking for null (same as undefined) if (heldOperation !== null) { heldValue = heldOperation(heldValue, nextValue); // if returns null, fall back to normal setting } else if (nextValue !== null) { heldValue = nextValue; } nextValue = null; heldOperation = operation; }

    What is setHeldOperation actually doing to (operation) and why do I have to end it with heldOperation = operation to make it work?
    What is heldOperation = operation doing?
    For this. heldValue = heldOperation(heldValue, nextValue); ...these are all my global variables. I'm trying to translate this into decent commentary for the loop.

    I know this sounds ridiculous because the code works but I don't know how it is working and this is the hardest function of my noob project.

    submitted by /u/Nonamesleft550i
    [link] [comments]

    How do I fix my code to hover over username and submit like it does for my password input box? HTML and CSS.

    Posted: 04 Sep 2020 10:46 PM PDT

    Hey I am trying to figure out how to make my hover mimic what it does for the password box. It highlights the outside yellow. This doesn't work for username and submit box. Thank you!

    I used a stock image, you might just make the background black to replace my image.

    ----------------HTML Code-------------

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Form</title>
    <link rel="stylesheet" href="style.css">
    <script defer src= "script.js"></script>
    </head>
    <body>
    <div id="error"></div>
    <form class= "box" id="form" action="/" method="GET">
    <h1>Login</h1>

    <input id="name" name="name" type="text" placeholder="Username" required>

    <input id="password" name="password" placeholder="Password" type="password" required>

    <input type="submit" name="Login" value="Submit">

    </form>
    </body>
    </html>

    ------------------------CSS Code-------------

    body{
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    background-image: url(magic.jpg);
    background-repeat: no-repeat;
    background-size: cover;
    }
    .box{
    width: 300px;
    padding:30px;
    position: absolute;
    top:50%;
    left:50%;
    transform: translate(-50%, -50%);
    background:rgba(0,0,0,0,4);
    text-align: center;
    }
    .box h1{
    color: white;
    text-transform: uppercase;
    font-weight: 700;
    }
    .box input[type="text"],.box input[type="password"]
    {
    border: 0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 3px solid #0367fd;
    padding: 14px 10px;
    width: 220px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25px;
    }
    .box input[type="text"]:focus,.box input[type="name"]:hover{
    width: 270px;
    border-color: yellow;
    }
    .box input[type="text"],.box input[type="password"]
    {
    border: 0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 3px solid #0367fd;
    padding: 14px 10px;
    width: 220px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25px;
    }
    .box input[type="text"]:focus,.box input[type="password"]:hover{
    width: 270px;
    border-color: yellow;
    }
    .box input[type="submit"]{
    border: 0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 3px solid #0367fd;
    padding: 14px 10px;
    width: 220px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25px;
    cursor:pointer;
    }
    .box input[type="submit"]:hover{
    background: yellow;
    }

    submitted by /u/DragonCode2020
    [link] [comments]

    Why did my JS code not work with dot notation, but did with bracket notation

    Posted: 04 Sep 2020 10:32 PM PDT

    I'm following freeCodeCamp and on one of the coding challenges, I tried using dot notation to access an object property and it wasn't working but when I switched it to bracket, it was all good. What am I missing here?

    https://jsfiddle.net/aLme4qvu/ The line I'm talking about is towards the bottom of the code

    result = lookup.val 

    The first example is what worked, the second is the problem code

    submitted by /u/sea_place
    [link] [comments]

    [Python/Pygame] How to keep a window open after the program "ends".

    Posted: 04 Sep 2020 10:04 PM PDT

    So I've been playing with pygame recently, and along the way I've made a few programs to randomly generate and iterate on images. All of these rely on the program never leaving a while loop, where it iterates on some variable forever and the program doesn't end on its own.

    Just now, I decided to try messing with Classes, and I made a class for Buttons. Starting simple, you fill in the cords the button is drawn between and fill in the color, then call a draw function that puts a polygon between those cords and updates the display. I ran the program to make sure I formatted it right, and it blinked up for a frame and vanished.

    "Oh, the program ends and it all closes, lemme just put a 'While True: pass' on the end of that." It stayed there, but it stopped responding, which isn't exactly ideal. I could put the draw function into a while loop, but it feels inefficient to keep drawing the same shapes in the same spot forever.

    It's probably just something I'm missing in the pygame documentation, but how do you keep a window responding and active even when the program isn't currently doing any work?

    submitted by /u/GootPoot
    [link] [comments]

    Question about ideas

    Posted: 04 Sep 2020 09:21 PM PDT

    Hello everyone, I just started learning code, I'm learning Python, later one thinking JS. for Web development and Web application,

    Every tutorial I start, they always say, now you will create what you always wanted, put your crazy ideas to computer, and see your program run and the same.

    But I don't have those crazy ideas, in my mind, it feels like who starting program they already know what a lot of stuff they want to build, I mean I like to code, create stuff, but i don't get many ideas, right now.

    Does it mean, i should change my path or it will come later when I know more?

    It's confusing me..

    submitted by /u/RavesL
    [link] [comments]

    What does "functional requirement" mean?

    Posted: 04 Sep 2020 09:09 PM PDT

    I have a 2 part assignment for a basic data analysis application and the lecturer wants us to prepare "functional requirements" for the report.

    Here's an example of what the program should be able to compute:

    - a menu system that allows user to load data from a file

    - to find the min, max, median,mean, variance and standard deviation of a column

    - display distinct numbers, and the frequency of each number

    and etc.

    The first part of the assignment requires other things too like problem statement, menu system design, structured chart and algorithms for the computations used. We haven't started any of the code yet.

    I've tried googling it, but i still don't get it.

    What is a functional requirement? and how do i go about it?

    submitted by /u/abandonedcrybaby
    [link] [comments]

    How to upload HTML and CSS file to Wordpress?

    Posted: 04 Sep 2020 09:05 PM PDT

    I have some HTML and CSS files and I would like to upload them to the WordPress website. It is very time-consuming to customize a WordPress site so I want to upload my files directly to WordPress.

    submitted by /u/praneeth25
    [link] [comments]

    I wrote a mass emailing script named MassEmailer that you can input any sized text file of email addresses and an email body text file and it will mass send out the email. You can schedule it to send a set amount of emails per day to stay within provider limits until it has been sent to all emails.

    Posted: 04 Sep 2020 08:50 PM PDT

    https://github.com/trevtravtrev/MassEmailer

    Written in 100% python.

    The readme contains all the instructions you should need to run it. The code has docstrings explaining each function. It works perfect but would like to hear feedback for how it can be written to be more user friendly. Please feel free to critique here or use the code in any way you'd like. Please make sure to follow the readme to get the script running for yourself.

    I currently have a 5,000 email address text file and 1 text file with the email body text. I have it set to send 100 emails per day via gmail (this is gmail's limits) and it is set to run once every 24 hours with windows task scheduler. It deletes email addresses from the text file as it sends to them so it can run seamlessly the next scheduled time picking up where it left off. Keep a backup copy of your email list elsewhere.

    If this is popular, I will add updates and maybe even make an interface.

    submitted by /u/codewriterguy
    [link] [comments]

    How do I become better at pointers? (C++)

    Posted: 04 Sep 2020 08:45 PM PDT

    I'm having troubles with pointers and I was wondering how I could become better at pointers and stuff like that in general.

    submitted by /u/NutSunny69
    [link] [comments]

    I'm confused as to what constitutes good/bad practices for pseudocode? Is there a standard?

    Posted: 04 Sep 2020 02:25 PM PDT

    My data structures class is enforcing us to write pseudocode for all of our projects and homework.

    For linear search, I did the following.

    /** * PSEUDOCODE: * ************************************************************ * LinearSearch( a[](int); length(int); n(int)): * Input - a[] : an array of type int * length : an integer related to the length of a[] * n : the target value from the user input * Output - an integer for the index for the found element * (Note: If nothing found, return -1) * START: * for int i = 0 to a[length-1]: * if n is equal to a[i]: * target found, return i * endif * return -1 (if target not found through for loop) * END * ************************************************************ **/ 

    I don't feel like our professor went through thorough detail about what constitutes proper pseudocode, and when I went to office hours, they said "Just enough to describe what the algorithm is doing. That's it."

    Is that sufficient enough? Or anything that I am missing? What are best practices for pseudocode? Do I include parameters? Do I need to specify any functions, arrays, etc?

    submitted by /u/BohemianJack
    [link] [comments]

    No comments:

    Post a Comment