• Breaking News

    Tuesday, April 16, 2019

    Not trying to be Rude ok! but i think this sub needs to be More accepting of the people who asks questions, if I’m asking a question it means I don’t know what I’m talking about and i need guidance, I don’t need you to make me feel like programming isn’t for me. learn programming

    Not trying to be Rude ok! but i think this sub needs to be More accepting of the people who asks questions, if I’m asking a question it means I don’t know what I’m talking about and i need guidance, I don’t need you to make me feel like programming isn’t for me. learn programming


    Not trying to be Rude ok! but i think this sub needs to be More accepting of the people who asks questions, if I’m asking a question it means I don’t know what I’m talking about and i need guidance, I don’t need you to make me feel like programming isn’t for me.

    Posted: 15 Apr 2019 03:37 AM PDT

    I love this sub, but at the same time I'm afraid sometimes to ask questions and receive answers like "lol, you clearly know nothing about coding " or "Go learn before asking " or "Why would you ask that!!!" Not trying to be mean, there are a lots of amazing people out here who helped me a lot, and I'm very grateful for your help!! ... Just saying we have to be a little more understanding and patient with each other. Thanks and sorry if i offended anyone.
    Edit: some people here pointed out that i was highly disrespectful of others, because I included some disrespectful comments of other people in my post, so In order to not offend anyone i deleted them. I also would like to note that i added them in the first place just as an example of the comments that you can encounter when asking questions in this sub. Thanks.

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

    Just made my first game!

    Posted: 15 Apr 2019 09:52 PM PDT

    Just now I finished making my first ever game which was Flappy Bird. The game was very simple but I will continue to add more and more stuff to it each day. I will remember this moment til I die. I was so excited when I finally saw it work without any glitches and honestly I just made me even more motivated to learn. I would like to thank all of you who helped and responded to my posts and gave me guidance. I am honestly so happy i don't even know XDD

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

    The programming community is so nice and accepting, but what are the motivations/reasons programmers answer other people's (especially from beginners) questions?

    Posted: 15 Apr 2019 09:19 PM PDT

    I was just wondering why people answer questions here in r/learnprogramming, other subreddits, StackOverflow, etc.

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

    Does taking a degree in computer science ease the learning progress?

    Posted: 15 Apr 2019 06:50 PM PDT

    For those of you who did a degree in computer science at a university/college, would you say that by simply doing what was need to get the degree was enoguh or did you have to put in a lot of extra time in order to learn how to program? Does it come naturally over time while doing a degree?

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

    What is the convention for putting white space in HTML?

    Posted: 15 Apr 2019 11:45 PM PDT

    The beginner tutorials I've been watching always have the code written like this:

    <html lang="en"> </html> 

    Is that any different than this?:

    <html lang = "en"> </html> 

    Is it a convention to not put white spaces between or is it acceptable? I find it more readable with whitespaces.

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

    Reprompting if statement is false - JS help

    Posted: 15 Apr 2019 11:35 PM PDT

    Good day.

    I am learning JS and I am playing around at work with a text editor on my phone, so i am sorry if my code looks weird.

    I am having trouble getting the code to execute the way I want to. I want it to check the weekDay and either return yes or reprompt and recheck the Boolean value of weekDayCheck.

    Can any one give me some pointers and suggestions on a better way to execute this code?

    And is there any difference to making a function with the function keyword or the const x = () => besides less written code?

    Here is the code I came up with(won't work)

    function weekDay(){ const weekDay = prompt("which day is it?"); return weekDay; }

    const weekDayCheck = () => { if (weekDay === "monday" || weekDay === "tuesday" || weekDay === "wednesday" || weekDay === "thursday" || weekDay === "friday" || weekDay === "saturday" || weekDay === "sunday") {

    return true; } else { return false; }

    }

    weekDay(); weekDayCheck();

    if(weekDayCheck = false) { weekDay(); weekDayCheck();

    } else if(weekDayCheck = true) { alert("yes"); }

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

    How to write a review of a code?

    Posted: 15 Apr 2019 09:07 PM PDT

    I have this assignment where I have to write one page summary of the purpose of the program and the programming logic. I know exactly what the program is doing and how it is done, but I don't how to write it. For instance, do I just follow through what the program is doing? What does the professor mean by " specifics as to what the programs do in terms of programming logic." If I do specify every detail I will end up with 20 pages. I could email the professor but I do not want to look dumb or annoy him/her.

    Instruction:

    Write a one-page summary (double-spaced in Microsoft Word) as to the purpose of the programs, as well as specifics as to what the programs do in terms of programming logic. By reviewing this programming information system, I know it will help you in your further understanding of the Java programming language.

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

    String not getting read correctly? Honestly don't know what the issue is.

    Posted: 15 Apr 2019 08:25 PM PDT

    I wrote this method that prompts the user to declare what color they want to choose, red or black, but the user validation loop that checks for a valid input never exits.

    public static String getColor(Scanner stdIn) { System.out.println("What color are you betting on? (red/black)"); String choice = [stdIn.next](https://stdIn.next)(); System.out.print(choice); //Checks the input for debugging while(choice!="red" && choice!="black"){ System.out.println("Invalid Selection (red/black):"); choice = stdIn.next();} return choice; } 

    A sample from the console reads this

    What color are you betting on? (red/black) red redInvalid Selection (red/black): black Invalid Selection (red/black): red Invalid Selection (red/black): red Invalid Selection (red/black): 

    Based on the print line i added, i know the string is getting stored correctly, but I don't know whats wrong with the loop

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

    How to get rid of coding anxiety?

    Posted: 15 Apr 2019 02:47 PM PDT

    Its been around a year since I started to learn coding during my off hours from work and I find myself in a better position than where I used to be a year back, I took up some small projects which is mostly used only by me. Its going good and Im happy that I started coding coz it helped me automate a lot of work. But every time when I use my project, every time when I click a button, every time when some process takes place I randomly get this anxiety like "what if the code breaks?", "What if the logic I used is the most stupidest thing?", "What if there is a bug in my code that will ruin everything and make me rewrite everything?". I don't know why such questions pop on my head every time and I'm not sure if this is common among freshers or is it something common for even a hardcore developer? Should I try to come over it? or should I try to accept it? how did you feel when you 1st started coding? any advice?

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

    Anyone here looking for a programming partner?

    Posted: 15 Apr 2019 02:46 PM PDT

    Hey everyone! I created a subreddit called r/HabitBuddy a few weeks ago. It's basically a subreddit designed to help you find accountability partners while building new habits (or breaking old ones). We've had a few posts there requesting accountability partners for programming and it'd be great if you could check those out (Post A and Post B), and provide some support to these Redditors. You're level of experience isn't as important as is your commitment to the task! You're welcome to make use of the sub yourself as well.

    Thanks and happy programming!

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

    I need help creating an output file given the name of input file.

    Posted: 15 Apr 2019 06:36 PM PDT

    My code I'm specifically looking to change what's in line 25 and insert other things if necessary.

    The instruction is to take the name of the inputfile and produce an output file with the name of the inputfile with a .bin at the end.

    Input: InputFileName

    Output: InputFileName.bin

    The question is, how do I retrieve that name and convert it into binary format.

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

    A new form of java keyword "this" for me

    Posted: 15 Apr 2019 06:30 PM PDT

    I ran into a new form of "this" that I am not used to seeing next.previous = this; what does this refer to? I checked the api but am not sure what it is actually referring to, since I could only find what I am used to seeing which is this.SOMETHING which corresponds to the current value of SOMETHING of the current iteration. Thank you for your help!

    // Node inner class containing the data, and next and previous references

    private static class Node {

    Node previous;

    int data;

    Node next;

    // constructor to create a Node with data and null previous and next references

    public Node(int data) {

    this.previous = this.next = null;

    this.data = data;

    }

    // constructor to add a new Node with data before another "next" node

    public Node(int data, Node next) {

    this.previous = null;

    this.data = data;

    this.next = next;

    if (next != null)

    next.previous = this;

    }

    // constructor to initialize a new Node with data between its "previous" and "next" node

    public Node(Node previous, int data, Node next) {

    this.previous = previous;

    this.data = data;

    this.next = next;

    if (previous != null)

    previous.next = this;

    if (next != null)

    next.previous = this;

    }

    }

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

    Why my input validation accepts strings when I'm using a char variable in c ++?

    Posted: 15 Apr 2019 10:15 PM PDT

    //This code lets you choose between 'c' or 's' , but when I enter a string starting with c or s (for example cc or soda)

    // the loop ends .Why is that ? thank you for any Answers.

    #include <iostream>

    #include <string>

    using namespace std;

    int main() {

    char drinkSelected;

    do{

    cout << "what do u like Coke(c) or Soda(s)?";

    cin >> drinkSelected;

    }while(drinkSelected != 'c' && drinkSelected != 's' ); // I would like this to accept only a 'c' or 's' not cc or ss or ccc...

    cout << "end of program";

    }

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

    Having trouble really understanding SOAP and REST web services, any tips?

    Posted: 15 Apr 2019 09:53 PM PDT

    Hey guys,

    I have a project coming up soon where I will be using SoapUI for some web service testing. Great, the only problem is, I realize I really don't understand web services. I have been a developer for a few years but it just seems a lot of what I do are components that don't really end up touching them.

    I feel like I've read at least 4 tutorials on the subject, kind of think I understand them, then when the time comes to explain something or use them, I have no clue what I am doing.

    Does anyone know of a tutorial or a project or something that is useful for a web services dunce like me?

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

    Airline Reservation System Code Review (C)

    Posted: 15 Apr 2019 09:40 PM PDT

    Before I post any code or anything, I would like to say that there is an issue and if possible I would appreciate any help on it. I was intending to post this code for review but I have been unable to fix the problem, but otherwise I would say its all good. I am not sure if this is permitted in the subreddit rules (don't think it says anything about combing a review and asking for help, but I might've missed something).

    A bit of context, I am learning to program and this is my first programming language. The following code is for an exercise in C - How to program by deitel, chapter 6 arrays. It's to write a program for an airline ticketing system. If anyone would like I can post the question as well, I feel like it would make the post a bit longer if I did.

    This is the code, I would mostly like to focus on programming efficiency and logic, like how I can improve it and make it shorter while still keeping readability. But reviews on style and etc is very useful too.

    #include <stdio.h> #include <stdlib.h> //global variables for plane and seat classes int plane[10] = {0}; //array representing plane seats int firstCounter = 0; //counter for first class seats int secondCounter = 5; //counter for economy class seats //function prototypes void firstClass (int a); void economyClass(int b); void notEnoughSeats(int c); //function main begins program execution int main(void) { int option; //holds user option value puts("Airplane Ticket Reservation System."); puts("1. First Class"); puts("2. Economy Class"); printf("%s", "Your option is: " ); //prompts user for input scanf("%d", &option); //assign seats based on user input while (option != -1){ //terminates if user inputs -1 if (option > 2) { //alerts user of an an invalid option printf("%s", "Invalid option!\n"); }//end if notEnoughSeats(option); if (firstCounter <= 4){ //ensures this does not get executed when it is greater than 4 firstClass(option); }//end if if (secondCounter <= 9){ //ensures this does not get executed when it is greater than 9 economyClass(option); }//end if printf("%s", "Your option is: " ); //prompts user for input scanf("%d", &option); //gets user input }//end while }//end main //function to calculate seats for first class void firstClass (int a){ if (a == 1){ if (plane[firstCounter] == 0){ //sets array position plane[firstCounter] = firstCounter + 1; //sets array value at position printf("Your boarding pass is: First Class, Seat %d\n", plane[firstCounter]); //prints first class boarding pass firstCounter ++ ; //increments the counter for first class }// end second if }//end first if }//end function //function to calculate seats for economy class void economyClass (int b){ if (b == 2){ if (plane[secondCounter] == 0){ //sets array position plane[secondCounter] = secondCounter + 1; //sets array value at position printf("Your boarding pass is: Economy Class, Seat %d\n", plane[secondCounter]); //prints economy class boarding pass secondCounter ++ ; //increments the counter for economy class }// end if }//end if }//end function //function to present alternative if the seats are full void notEnoughSeats (int c) { char answer; //holds yes or no value //if first class is full if (c == 1 && firstCounter > 4) { printf("%s", "Seats are full. Do you want to book Economy Class (y/n)?: "); //prompts user for input scanf("%c", &answer); if (answer == 'y' || answer == 'Y') { //if the user answered yes if (secondCounter < 9){ economyClass(2); //books user for economy class }// end if if (secondCounter >= 9){ puts("Sorry, seats are full. Please try again for next flight."); }//end if }//end while if (answer == 'n' || answer == 'N') { //if the user answered no puts("Next flight is in 3 hours."); } //end else if }// end if if (c == 2 && secondCounter > 9) { printf("%s", "Seats are full. Do you want to book First Class (y/n)?: "); //prompts user for input scanf("%c", &answer); if (answer == 'y' || answer == 'Y') { //if the user answered yes if (firstCounter < 4) firstClass(1); //books user for first class if (firstCounter >= 4){ puts("Sorry, seats are full. Please try again for next flight."); }//end if }//end while else if (answer == 'n' || answer == 'N') { //if the user answered no puts("Next flight is in 3 hours."); } //end else if }// end if }//end function 

    So, the part not related to the review, when the function not enough seats is executed, it outputs like:

    Seats are full. Do you want to book Economy Class (y/n)?: Your option is: y

    Seats are full. Do you want to book Economy Class (y/n)?: Your boarding pass is: Economy Class, Seat 6

    But it should actually output:

    Seats are full. Do you want to book Economy Class (y/n)?: Your option is: y

    Your boarding pass is: Economy Class, Seat 6

    I am not sure where the issue is, so I have been doing random things like commenting out bits of code but I still don't understand what the problem is.

    I was intending this to be solely a code review but any guidance would be appreciated!

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

    I build a list of great Developer Tools and Resources for Jr Developer

    Posted: 15 Apr 2019 06:52 AM PDT

    Hi,

    I'm Self Taught Front End Developer and I have some great tools and resources in my bookmarks and I want to share it with everyone. This list is just my personal preference.

    Please, feel free to contribute more developers tools and resources

    https://github.com/IliasHad/Developer-Tools-and-Resources

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

    Template function: subscript requires array or pointer type?

    Posted: 15 Apr 2019 09:20 PM PDT

    [deleted]

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

    [C] Separate vowels and consonants from a string using pointers

    Posted: 15 Apr 2019 09:19 PM PDT

    Hello, the comments are my instructor's and not mine.

    I am having issues debugging my code.

    the program should function as follows (items underlined are to be entered by the user):

    Enter a string (20) characters maximum): usteyahdkvmieancgexq

    Original string: usteyahdkvmieancgexq

    All the vowels: ueyaieae

    All the consonants: sthdkvmncgxq

    code:

    #include <stdio.h> int main() { //Declare the arrays to hold the strings char str[21], vowels[21], consonants[21]; //Declare the pointers char *strPointer, *vowelPointer, *consonantPointer; //Print out the prompt to the user printf("Enter a string (20 characters maximum): "); //Scan the user input into str //Only allow 20 characters fgets(str, 21, stdin); //Set strPointer to the beginning of the user's string strPointer = str; //Set vowelPointer to the beginning of the vowels string vowelPointer = vowels; //Set consonantPointer to the beginning of tht consonant string consonantPointer = consonants; //Loop through the user's string until the end of the string while(*strPointer != '\0') { //Check if what strPointer is pointing to is a vowel if(*strPointer == 'a' || *strPointer == 'e'|| *strPointer == 'i' || *strPointer == 'o' || *strPointer == 'u' || *strPointer == 'A' || *strPointer == 'E' || *strPointer == 'I' || *strPointer == 'O' || *strPointer == 'U') { //Move the letter from strPointer to vowelPointer strPointer = vowelPointer; //Move the vowelPointer vowelPointer++; } else { //Move the letter from strPointer to consonantPointer strPointer = consonantPointer; //Move the consonantPointer consonantPointer++; } //Move the strPointer for (int i = 0; i < 21; i++) { strPointer++; } } //Add null terminators where appropriate str[20] = '\0'; vowels[20] = '\0'; consonants[20] = '\0'; //Set the vowel and consonant pointers back to the beginning of their strings vowelPointer = &vowels[0]; consonantPointer = &consonants[0]; //Print the original string and the resulting vowel and consonant strings printf("Original string: %s\n", str); printf("%s\n", vowelPointer); printf("%s\n", consonantPointer); //Return from the program return 0; } 

    where am I going wrong as it compiles? thank you.

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

    How to navigate to new screen using Flutter Bloc

    Posted: 15 Apr 2019 09:10 PM PDT

    Hello .. I am a newbie. I am trying to use Flutter Bloc. I have a couple of questions.

    I have a simple form that collects information and disposes an event.

    void _onSignupButtonPressed() { Person person = Person(_firstNameController.text, _lastNameController.text,null,_genderController.text,_dobController.text, _conditionController.text,null,null,"false"); _personBloc.dispatch( AddPersonButtonPressed(person: person), ); } 

    the bloc code yields a state. the issue is .. the ManagePersonScreen is being rendered within a parent screen

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

    Why do people use es6 instead of calling "require"?

    Posted: 15 Apr 2019 09:02 PM PDT

    For example, why do people seem to use

    import express from 'express'

    rather than

    const express = require('express')

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

    Logical Error- Programatically assign struct elements and struct to a MultiDimensional Array in a loop?

    Posted: 15 Apr 2019 08:56 PM PDT

    The Question:

    data_structure the cell for all the data, is a 5 x 3 cell. <-- because I have 5 sound folders.

    column1= current directory name, column2=files struct <-- as given by dir( ). column3= is the formants struct

    each row = 1 sound type, unique files struct & unique formants struct. The problem is that the code I wrote has a formants struct of length 47 for all the column3 elements, even though not all the directories have 47 files. This means that I'm saving all of the first directory formant data in for ALL column3 data.

    Where did I go wrong with logic?

    The Code <-- took out the signals processing part.

    %% Each Directory is a cell. --- Within each cell you keep the struct array returned by the dir function.

    data_structure=cell(length(num_sounds),3); %preallocate space given # sound types

    disp(data_structure);

    %% fill the data_structure cell columns 1 & 2, with directory names and struct of .wav files.

    for i=1:num_sounds;

    wavPATH=fullfile(sound_dirs{i}, '*.wav'); % fullfile(Ball, '*.wav'); <-- gives specified path

    wavLIST=dir(wavPATH); %saves .wav files in a struct call wavs_in_dir

    data_structure{i,2}=wavLIST;

    data_structure{i,1}=words{i};

    end %all raw data saved into data_structure

    %% data_structure{i,3} holds the processed data <-- Formants

    for i=1:num_sounds;

    NUMwavs=numel(data_structure{i,2});

    ith_file=data_structure{i,2};

    formants(1:NUMwavs)=struct('F1',[],'maxPxx1', [], 'F2',[],'maxPxx2',[], 'F3', [], 'maxPxx3', []);

    for j=1:NUMwavs;

    [y Fs]= audioread(fullfile(sound_dirs{i},data_structure{i,2}(j).name));

    ... signals processing ...

    %% Store all values in formants struct

    % each row has its own formants struct

    formants(j).F1= maxF1;

    formants(j).F2= maxF2;

    formants(j).F3= maxF3;

    formants(j).maxPxx1=maxPxx1;

    formants(j).maxPxx2=maxPxx2;

    formants(j).maxPxx3=maxPxx3;

    data_structure{i,3}=formants;

    end

    end

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

    Questions about Android development

    Posted: 15 Apr 2019 08:54 PM PDT

    Hello. I am working on an Android app that stores expenses. I have a main activity that will show all the expenses that have already been stored and a button that will open a new activity to add a new expense. My plan was, when the user goes to exit the app, any expenses that they added would be saved all at once. So I was wondering whether I should use a service to do this or just have it all done in the onDestroy()/onStop() methods. I feel like this would be a good time to use a service, but everything I've read seem to suggest you should try to "avoid" using services and use threads whenever possible.

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

    (Beginner) I'm using C, can someone please tell me why this code won't loop?

    Posted: 15 Apr 2019 08:43 PM PDT

    #include <cs50.h> #include <stdio.h> #include <string.h> int main(void) { for (int i = 0; i < 3; i++) { printf("%i\n", i); printf("End of first loop.\n"); for (i = 0; i < 2; i++) { printf("\n%i", i); } printf("\nEnd of second loop\n"); } } Output: 0 End of first loop. 0 1 End of second loop $ 
    submitted by /u/termjay94
    [link] [comments]

    Use recursion to print the following

    Posted: 15 Apr 2019 08:25 PM PDT

    Pattern(2) 0 1 0 2 0 1 0 Pattern(0) 0 Pattern(1) 0 1 0

    All I can think of is If n==0: Return 0 Else: Return pattern(n-1), n, pattern(n-1)

    This gives the right pattern but it's nested in a bunch of weird nested tuples.

    Function has to use recursion

    What I've tried:

    def pat(n): """ >>>pat(0) 0 >>>pat(1) 0 1 0 >>>pat(2) 0 1 0 2 0 1 0 """ if n == 0: return 0 else: return pat(n-1), n, pat(n-1) 

    pat(2)

    ((0, 1, 0), 2, (0, 1, 0))

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

    No comments:

    Post a Comment