• Breaking News

    Saturday, June 15, 2019

    What have you been working on recently? [June 15, 2019] learn programming

    What have you been working on recently? [June 15, 2019] learn programming


    What have you been working on recently? [June 15, 2019]

    Posted: 15 Jun 2019 09:12 AM PDT

    What have you been working on recently? Feel free to share updates on projects you're working on, brag about any major milestones you've hit, grouse about a challenge you've ran into recently... Any sort of "progress report" is fair game!

    A few requests:

    1. If possible, include a link to your source code when sharing a project update. That way, others can learn from your work!

    2. If you've shared something, try commenting on at least one other update -- ask a question, give feedback, compliment something cool... We encourage discussion!

    3. If you don't consider yourself to be a beginner, include about how many years of experience you have.

    This thread will remained stickied over the weekend. Link to past threads here.

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

    Congratulations r/learnprogramming on one million subscribers!

    Posted: 15 Jun 2019 06:23 AM PDT

    Congratulations!

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

    [G++] Trouble with Linking GLFW

    Posted: 15 Jun 2019 10:36 PM PDT

    I'm getting used to compiling from the console. I was following an OpenGL tutorial that used visual studio so I tried to adapt it to a console. I'm on Windows 10. my directory:

    Parent

    --bin

    ----glew32.dll

    ----glfw3.dll

    --include

    ----GL

    --------eglew.h

    --------glew.h

    --------glxew.h

    --------wglew.h

    ----GLFW

    --------glfw3.h

    --------glfw3native.h

    --lib

    -----glew32.lib

    -----glew32s.lib

    -----libglfw3.a

    -----libglfw3dll.a

    --src

    ----main.cpp

    this is main.cpp

    #include <GL/glew.h>

    #include <GLFW/glfw3.h>

    int main()

    {

    glfwInit();

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);

    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);

    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    return 0;

    }

    if I just main int main() {return 0;} with the include files, it compiles fine with:

    g++ src/main.cpp -lglfw3 -lglew32 -lopengl32 -mwindows -Iinclude -Llib

    but when I compile with the code shown above I get

    undefined reference to `glfwInit'

    undefined reference to `glfwWindowHint'

    undefined reference to `glfwWindowHint'

    undefined reference to `glfwWindowHint'

    I'm kinda new with this stuff, so I'm unsure about this linking. Could someone walk me through how to properly link this?

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

    My data structures lecturer said that red-black trees are less efficient than AVL trees for traversal. Aren't they wrong?

    Posted: 15 Jun 2019 08:55 PM PDT

    Isn't the time complexity for traversal of any binary tree O(n)? You visit each node once regardless of the tree structure.

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

    Help with java

    Posted: 15 Jun 2019 11:29 PM PDT

    Hi, I am stuck in my programming right now, so any help would be great!

    What I am trying to do is write a method that will find an object that has the same name as the input. I have done that as as public Boolean findItem(String searchName) but I was told that the signature must be the class name, so now it is public Item findItem(String searchName). I am writing this in another class shop, and the Item class is abstract so I need it to return one of the other three child classes, Game, ElectronicGame, or CD. I have also included the code. So what I am lost on is what value I should have in the return statement. Thank you for any help that comes.

    public Item findItem(String searchName){

    for (Item nextItem : items){

    if(searchName.equals(nextItem.getName())){

    return nextItem;

    }

    }

    return ;

    }

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

    Any recommendations books or tutorials for working with images in Javascript and canvas?

    Posted: 15 Jun 2019 11:25 PM PDT

    I want to start working on images and do things like adding annotations, notes, and drawing and writing on top of them. Just looking to get started. Already have some programming and math background so looking for tutorials that assumes I have those prerequisites or that are easy to get through.

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

    how do i create new activites while making my java app ?

    Posted: 15 Jun 2019 11:05 PM PDT

    i am creating an app , i already did the layout design but when i am not sure how do i go on linking them together , for example my signup page is connected to the main activity but creating a new class and trying to connect it with my login activity doesn't seem to be working , why is that

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

    Question about singleton usage

    Posted: 15 Jun 2019 10:55 PM PDT

    I see this PHP example:

    class Singleton { private static $instance = null; private function __construct() { // The expensive process (e.g.,db connection) goes here. } public static function getInstance() { if (self::$instance == null) { self::$instance = new Singleton(); } return self::$instance; } } 
    • Say this class has a method public function countUsers(). Would it be called with:

    $singleton = new Singleton(); $singleton ->getInstance() ->countUsers() 

    I believe it would since the instance feels cyclic in that all its properties/methods are in $instance. However I'm not 100% sure since the static keyword is on $instance yet it is private. I haven't used that combination before.

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

    Reminder: Lynda.com is Probably Free at your Local Library

    Posted: 15 Jun 2019 03:24 AM PDT

    Way to many people don't seem to know this but most all USA and some international libraries provide free access to everything on Lynda.com for members. They have entire road maps laid out for most all programing languages you would want to learn and even cover the foundations before they teach you any programing. Absolute beginner to more advanced topics are covered. Its a great resource and making it free is a no brainier.

    Membership at your local library is free, you can apply at your local library and sometimes just online. You can then use a link from your library's website to go to Lynda where you just enter your library id number and a pin. Then you have instant access to Lynda for absolutely nothing.

    This is just one of the benefits, of course there is also magazine and books on the topic you can check out. Most of which are all digital now a days. You never actually have to drive to your library or return anything. Books right to your iPad, kindle, or computer. They get auto returned after a set period of time. Do not over look your library as source for free information and training. You might be surprised what they give you for free.

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

    Hacker Rank: linked list

    Posted: 15 Jun 2019 10:27 PM PDT

    I'm working on list problem on hacker using python 3. I have trouble understanding how this code works:

    class Node: def __init__(self,data): self.data = data self.next = None class Solution: def display(self,head): current = head while current: print(current.data,end=' ') current = current.next 

    I'm not understanding how Class solution is able to use an instance data when it's not reference Node. current.data and current.next make sense if class Node was reference but doesn't make sense to me if Solution is referenced?

    Link: https://www.hackerrank.com/challenges/30-linked-list/problem

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

    Making a basic java program- How can I send it to friends and have them open without using their console?

    Posted: 15 Jun 2019 06:30 PM PDT

    Hi,

    So as the title suggests, I am writing a very basic java program as a pet project. A few of my friends have wanted to test it as I develop, but some of them do not have JDK and are unfamiliar with compiling files in the console. I have tried converting to an .exe and .jar file, but when I do that, my program does not open properly.
    The issue, I think, is because the program runs in the terminal- I have no GUI.

    Is there a way I can pack a file so that my friends can simply double-click and have it automatically open the console and run the program for them?

    Apologies if this answer is common/vague/simple. I could not find anything on this topic. Thank you for your help.

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

    Python Can't Install

    Posted: 15 Jun 2019 06:12 PM PDT

    I'm trying to install python on my computer, but it says it's already installed, and when I try to uninstall it, it says there is no python installed.

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

    First OpenSource Project on Gitlab

    Posted: 15 Jun 2019 09:56 PM PDT

    So last month I started to seriously learn Python. I've been reading some books on it for about 9 months, putting off actually doing work because of depression and stress. I recently got a new job and its a "make it up as we go" type of job. While I wait for work I decided to learn python on the job to help me be more efficient and more useful to my coworkers. I also study it at home and the repo that I'm linking is a personal project. My background is; BS in engineering, had a major setback in life that took my career, still wanting to fight for a good life so I am programming more, was washing dishes at $12/hr for 9 months so I studied the Python language determined to make it out, previous programming experience is in Matlab, Fortran, and some Arduino.

    With this project I plan to make a set of aerospace analysis tools similar XFoil, and AVL. This is the very early work I've done while learning the language. I will admit that learning the little bit of Git that I know was a headache. Figuring out the way git works, resolving issues with my security tokens and keys, pulling and merging were more difficult than they should have been. It was probably because I didn't set my Gitlab repo up right. So I burned the first one and started a new one. Here is the repo. I'll continuously add more to it as I learn the language. After I get comfortable enough with Python I'll move this project into Cython and Julia.

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

    How does the Apple Music recommendation system work?

    Posted: 15 Jun 2019 05:39 PM PDT

    Can someone explain in-depth how the Apple Music recommendation system works? By "recommendation system" I mean how you like and dislike songs and Apple Music is then able to create playlists it "thinks" you'd like.

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

    Close to giving up on Python Scraping

    Posted: 15 Jun 2019 05:31 PM PDT

    I've been trying for FAR too long to comprehend and learn how to web scrape using Python. I've lost count of the amount of tutorials I've tried and somehow I either have to stop pre-maturely because I run into random errors the tutorial designer doesn't have or I try to create my own version of the code but it breaks down and creates issues the moment I attempt to deviate from the tutorials themselves.

    I'm frustrated and it's started to put me off of programming at all, which I realize is incredibly dramatic but it's legitimately where I'm at.

    Can I get any suggestions for scraping tutorials that are clear, concise, and functional for 3.0 python? I would love to apply it all websites but specifically at the moment I'm trying to just design a simple tool to scrape (using their API) from Wikipedia's content and tables but I just can't get it to work. Any help would be greatly appreciated. Thank you.

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

    I need help with Binary Search Trees.

    Posted: 15 Jun 2019 09:08 PM PDT

    So I'm currently covering BST and I am having a hard time understanding one of the methods that involves deleting a node. It's honestly the most complicated method I have seen in DS&A.

    Anyways, I just need some resources to help me understand what's going on. I tried looking on YouTube but couldn't find anything of value. Thanks.

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

    C# vs Javascript

    Posted: 15 Jun 2019 08:53 PM PDT

    Hello, I am programming this summer and learning either ofbthese languages in my own(books , youtube). In the past I have learned pythong and probarly coded on it for 150-250 hours.

    I would say that I am decent at it for high school student. The problem with python that it had no user interface at all. In the summer I am making an app with a user interface and simple background data. Basically it is an app developed to be used by school( recording absence, viewing time tables).

    I am wondering which of c# or javascript would suit the app more( 2 to 4 months of development time) and be easier for me since this is my second language.

    I feel that I am decent in programming but I am confused on which language should I choose and also which language will be better in the future. Thanks in advance and Sorry if it is long.

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

    Does JavaScript actually not have an inbuilt way of importing external scripts?

    Posted: 15 Jun 2019 04:25 PM PDT

    I've recently started looking at running building a small Chrome extension for myself. If you're not familiar with the way Chrome extensions work, you can basically write JavaScript files which can modify a page's DOM, react to right clicks, trigger downloads etc.

    Importantly, this js runs client-side only.

    Now, my background is working with Python, Scala, Haskell, kdb/q etc. In all those languages, there's a more or less straightforward way to functions defined in one file into another file.

    E.g. define Foo() in mylib.py, then use Foo() in run.py by doing

    from mylib import Foo

    I was surprised to see there is no unique/best practice way to do the same in JavaScript. Based on this SO question, you have:

    • require.js
    • head.js
    • clientside-require
    • browserify
    • glue.js
    • builder.js
    • roll your own solution (???)
    • etc

    One guy posted a spreadsheet with dozens of options, each with certain drawbacks and advantages.

    I have some questions:

    • Am I missing something? Is JavaScript actually missing out on this core feature?
    • How are big projects structured? I can't find a definitive source, different people have different solutions. For example, this guy uses browserify and then rolls his own framework to enable easy debugging and serve files to production.
    • Why are there so many ways to achieve the same thing and why is there no obvious best solution?
    submitted by /u/maest
    [link] [comments]

    How to get started in a career in IT

    Posted: 15 Jun 2019 07:38 PM PDT

    I'm looking for advice on how to get started with a career in IT. I have no experience in the field, I've been working as a truck driver but I'd like to move into IT. I've had people recommend udemy, code academy, and even getting my bachelors degree. Others have told me to get some certifications. Does anyone have any recommendations on which certifications I should get? Any advice on how to get started on this path would be greatly appreciated.

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

    Tic Tac Toe game in C++

    Posted: 15 Jun 2019 07:37 PM PDT

    What's up, Reddit? It's ya girl (and incompetent C++ coder) Superb_Introduction, back at it again with another small project that she needs r/learnprogramming's help to solve!

    So I made a gameboard using a 2D array, and I obviously don't want players to enter coordinates where one number is >= 3 or < 0. Here's my code:

    //============================================================================ // Name : tic_tac_toe.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; int main() { char gameboard[3][3]; char player_one, player_one_upper, player_two, player_two_upper; cout << "TIC-TAC-TOE" << endl; cout << '\t' << endl; cout << "PLAYER ONE: Pick 'X' or 'O'" << endl; cin.get(player_one); cin.ignore(); cin.clear(); cout << "PLAYER TWO: Pick 'X' or 'O'" << endl; cin.get(player_two); cin.ignore(); cin.clear(); player_one_upper = toupper(player_one); player_two_upper = toupper(player_two); if (player_two_upper == player_one_upper) { cout << "ERROR - Player 1 has already chosen that." << endl; exit(1); } char x, o; switch(player_one_upper) { case 'X': x = player_one_upper; cout << "Player 1 is X." << endl; break; case 'O': o = player_one_upper; cout << "Player 1 is O." << endl; break; default: break; } switch(player_two_upper) { case 'X': x = player_two_upper; cout << "Player 2 is X." << endl; break; case 'O': o = player_two_upper; cout << "Player 2 is O." << endl; break; default: break; } // the game board cout << '\t' << endl; cout << "GAME BOARD:" << endl; cout << '\t' << endl; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { gameboard[i][j] = '#'; cout << gameboard[i][j]; } cout << endl; } cout << '\t' << endl; cout << "HOW TO PICK COORDINATES: " << endl; cout << " Columns: " << endl; cout << " =========" << endl; // the coordinates for (int i = 0; i < 3; i++) { cout << "Row " << i << ": "; for (int j = 0; j < 3; j++) { cout << j << ' '; } cout << endl; } cout << "PICKING COORDINATES: Enter the row number, then the column number. Neither can be <0 or >= 3. Have fun!" << endl; // exit(1); char e_or_not, e_or_not_upper; cout << "Press E now to end the game; press any other key to continue." << endl; cin.get(e_or_not); cin.ignore(); cin.clear(); e_or_not_upper = toupper(e_or_not); while (true) { if (e_or_not_upper == 'E') { cout << "Finished." << endl; exit(1); } int a, b, c, d; bool greater_than_3 = false, equals_zero = false; cout << "Player One's Turn." << endl; cout << "Enter the coordinates of where your X or O will go." << endl; cin >> a >> b; greater_than_3 = (a >= 3 || b >= 3); equals_zero = (a < 0 || b < 0); if (x == player_one_upper) { gameboard[a][b] = 'X'; } else if (o == player_one_upper) { gameboard[a][b] = 'O'; } else if (greater_than_3 || equals_zero) { cout << "ERROR - attempting to put X or O outside of the game board." << endl; exit(1); } cout << '\t' << endl; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { // gameboard[i][j] = '#'; cout << gameboard[i][j]; } cout << endl; } cout << "Player Two's Turn." << endl; cout << "Enter the coordinates of where your X or O will go." << endl; cin >> c >> d; greater_than_3 = (c >= 3 || d >= 3); equals_zero = (c < 0 || d < 0); if (x == player_two_upper) { gameboard[c][d] = 'X'; } else if (o == player_two_upper) { gameboard[c][d] = 'O'; } else if (greater_than_3 || equals_zero) { cout << "ERROR - attempting to put X or O outside of the game board." << endl; exit(1); } cout << '\t' << endl; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { // gameboard[i][j] = '#'; cout << gameboard[i][j]; } cout << endl; } cout << '\t' << endl; cout << "Press E now to end the game; press any other key to continue." << endl; cin.get(e_or_not); cin.ignore(); cin.clear(); e_or_not_upper = toupper(e_or_not); } return 0; } /* URL where I got this project idea: http://www.cplusplus.com/articles/N6vU7k9E/ Tic Tac Toe Requires: variables, data types, and numerical operators basic input/output logic (if statements, switch statements) loops (for, while, do-while) arrays Make a two player tic tac toe game. * Modify the program so that it will announce when a player has won the game (and which player won, x or o) ** Modify the program so that it is a one player game against the computer (with the computer making its moves randomly) **** Modify the program so that anytime the player is about to win (aka, they have 2 of 3 x's in a row, the computer will block w/ an o) */ 

    When the row is >= 3, the program goes on and the game board displays with no Xs or Os, but I want it to exit. When the column is >= 3, an X or O is filled in somewhere anyways.

    For example, here's what happened when I inputted (4, 1) as Player One:

    ### ### ### Player Two's Turn. Enter the coordinates of where your X or O will go. 

    Now, here's what happened when I inputted (1, 3) as Player Two:

    ### ### O## Press E now to end the game; press any other key to continue. 

    (1, 3) isn't supposed to be a possible coordinate, and (4, 1) should cause the program to exit.

    What's wrong with my code? Thanks!

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

    [Java] Updating with a new URL still produces the same error referencing old URL

    Posted: 15 Jun 2019 07:19 PM PDT

    Beginner here, sorry in advance if I didn't format this post correctly.

    I am updating my code to reference a particular json file, such as:

    https://gist.github.com/user123.json

    I got a response when I referenced the above URL because it actually 400'd. I tried to update it but I still get the same error referencing the old URL.

    Is the variable I am assigning to the URL cached somehow? It is strange to me.

    Exception in thread "main" java.io.IOException: Server returned HTTP response code: 400 for URL: https://gist.github.com/user123.json

    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at java.net.URL.openStream(Unknown Source) at com.fasterxml.jackson.core.JsonFactory.\_optimizedStreamFromURL([JsonFactory.java:1595](https://JsonFactory.java:1595)) at com.fasterxml.jackson.core.JsonFactory.createParser([JsonFactory.java:793](https://JsonFactory.java:793)) at com.fasterxml.jackson.databind.ObjectMapper.readValue([ObjectMapper.java:2959](https://ObjectMapper.java:2959)) at jacksonProject.UserTest.main([UserTest.java:32](https://UserTest.java:32)) 
    submitted by /u/Successful_Incident
    [link] [comments]

    My grandfather's website runs on Flash and I offered to make him a new one. Things are going great, but I can't for the life of me figure out how to make a "blog"

    Posted: 15 Jun 2019 06:56 PM PDT

    My grandfather has an old and dying website, and since it will break in 2020 when flash dies, I offered to code him a new one over the summer.

    So, I have some experience with programming in c# with unity, and am picking up html and css fast. Javascript seems simple enough, but now that I am looking up tutorials for making a blog, all I get are "make a blog with css". I don't care about how the website looks for now, I want functionality. So: -Is there a library out there for blogs? -If not, How do I program a blog? -Is there something I'm missing/don't understand here?

    Thanks for the help!

    To clarify: I am interested in making it so that my grandfather can log into his website and make a post without touching any code.

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

    Internship focused on unit tests. What to expect?

    Posted: 15 Jun 2019 03:07 PM PDT

    I'm going to be starting an internship at a startup in a few days and I'll be spending the summer mostly writing unit tests. Coming from university I have never really written one and was wondering if anyone had any good resources or advice on how to get started. Also, if anyone has done an internship where the bulk of the work was writing unit tests please let me know what your experience was like and anything you did to help you succeed, thanks.

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

    When is it ok for a beginner to switch from one end to another

    Posted: 15 Jun 2019 06:48 PM PDT

    So basically I've been learning front end ( mostly focused on javascript) and I realized I take greater joy in doing pure js with a premade template. So i thought that maybe backend is more suitable for me. I m interested in many things just not sure if its ok to switch

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

    No comments:

    Post a Comment