• Breaking News

    Saturday, August 10, 2019

    What have you been working on recently? [August 10, 2019] learn programming

    What have you been working on recently? [August 10, 2019] learn programming


    What have you been working on recently? [August 10, 2019]

    Posted: 10 Aug 2019 09:11 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]

    Free Java curse on Udemy.

    Posted: 10 Aug 2019 07:59 AM PDT

    Not sure if it's always free, but I just got it for free.

    (https://www.udemy.com/practice-java-by-building-projects/)

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

    Please help me with programming my Mega Man Royale game server. I don't know how to netcode at all and the server starts really slowing down after 25 people.

    Posted: 10 Aug 2019 05:02 PM PDT

    Hi, I need some help. I don't know how to write an efficient server. It's in nodejs using socket.io at http://megamanroyale.com

    Right now, I have the clients emit their location to the server 10 times a second, and as soon as the server receives the message, it broadcasts it to all other connected clients.

    broadcast(client, opcode, data){ //console.log(`Broadcasting to room ${this.id}`); for(let p in this.players) { if(this.players[p] !== client){ //Make sure we aren't emitting to ourself this.players[p].socket.emit(opcode,data); } } 

    }

    So basically, every time the server receives a packet, it sends a packet out to all the other players. This seems super inefficient, as the amounts of packets are exponentially rising with the player count. If there are 5 players, there are 52 *10 = 250 packets a second, which is ok, but with 25 players there are 252 *10 = 6250 packets a second which is way too much. Once this game is done I'm hoping for 100 player games. My server can't handle it even at 25 players and it lags behind a full 5-10 seconds at times.

    That said, I don't know how I'm supposed to do it differently! Should I save all of the player's packets and then concatenate them into one large buffer and send it ten times a second? Is there some example I can use for reference? Any resources on the "theory" of writing efficient server code?

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

    What is the best way to activate a time ticking bomb in a program?

    Posted: 10 Aug 2019 10:54 PM PDT

    I have a program of Villains and Heroes. The Villains create bombs, arm them, and plant them in various locations. When they want to, they can activate them and then there's a countdown. If the hero doesn't defuse it successfully by end of countdown, it blows up.

    Each new bomb that gets activated opens a new thread and its countdown timer runs in that separate thread (its an exercise in multi threading).

    I currently considering two possibilities to trigger the bombs:

    1. The villains triggerBomb() method creates a new thread with the class (which implements Runnable) that handles the bomb's time ticking behavior. It then starts it up.
    2. The villainstriggerBomb() method sets Bomb object's isTriggered to true value. Inside Bomb there is an event listener that fires up when isTriggered is set to true with the bomb time ticking behavior that creates a new thread and starts it.

    I wonder which choice is better software design. The first one seems more straightforward, but I lean more towards the second since that way I have a variable that tells me the state of the bomb. Sure I can just set isTriggered to true in the first method as well, but I intuitively believe its unreadable and error prone, even though I am not sure why.

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

    Thoughts on Coursera

    Posted: 10 Aug 2019 06:45 PM PDT

    Long time reader, maybe second/third time poster.

    Recently I've decided to work on my programming skills. I'm currently in CC (or was) and will start (finish up) at a regular 4 year in the fall studying computer science. tbh I'm about 2-3 years out from graduation, but I'd like to learn how to program, so that when I'm out of school, I'm -somewhat- ready to go (maybe even during school, try to get an internship/co-op so I don't have to do retail sales like I'm doing now).

    On Coursera, I came across an "IBM Data Science" certification( https://www.coursera.org/professional-certificates/ibm-data-science ). Essentially it's take a few different courses (basics, SQL, focus on Python -so it seems) and bam I get a cert and I can put it on my Linkedin. My question is:

    1. Is it worth it? It would cost around $40/month and the pace is how I quickly/slowly I go through it (it est. 3 months).
    2. If it's not, is there anything on Coursera worthwhile?
    3. If not, where do you recommend I begin? I've done Codecademy and felt like I was just memorizing and typing out what I saw... not actually learning anything (if that makes sense). There was one like Codecademy too, except it's free. But I kind of got that same experience from it.

    Thanks!

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

    When would be the best time to switch to another programming language?

    Posted: 10 Aug 2019 09:05 PM PDT

    Before starting, yes, I read the FAQ, but the answers were not enough for me.
    Title. I'm a beginner; I started in highschool with Java, like 4 or 5 months ago, but the classes were so slow I just practiced myself. At this moment, I'm starting to enter the OOP subject (I actually started some time ago, but I stopped programming for some time and I'm just getting back at it).

    I'd like to switch from Java to Python, but I don't know if I should do it now or get deeper into Java, then switch. Any recommendations? Thank you, beforehand!

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

    simple debugging question. Why is my code keep printing out a barrage of exception messages in java?

    Posted: 10 Aug 2019 07:07 PM PDT

    I have an assignment. What the assignment is doesn't matter because I got it to work. Anyway, what I want to do isn't necessary, but I would like to make it fancier by adding a try/catch exception. The code looks like this

    import java.util.InputMismatchException;

    import java.util.Scanner;

    import java.io.*;

    public class HeadsTailsRecursion_bdm { //Begin class

    `public static void main(String[] args) { //Begin main` `Scanner input = new Scanner(`[`System.in`](https://System.in)`);` `int x = 1;` `do {` `try { //Begin try` `System.out.print("Enter the amount of times you will toss the coin: ");` 

    int toss = input.nextInt();

    System.out.print("Enter how many dollars you want to initially bet: ");

    int bet = input.nextInt();

    System.out.println("The total money you could loose is " + cost(toss, bet));

    x = 2;

     `} // End try` `catch(InputMismatchException e) { //Begin catch` `System.out.println("You can't do that");` `} // End Catch` `} /*End do*/ while(x == 1);` `} //End Main` `public static int cost(int yeet, int cash) { //Begin cost method` `if (yeet == 1) { //Begin if` `return (cash);` `} //End if` 

    return (int) ((cash * Math.pow(2, (yeet-1))) + cost(yeet-1, cash));

    `} //End cost method` 

    } //End class

    anyway, when I try to run this, and I purposely type in "w" for the first scanner, the program prints out a never-ending barrage of "Enter the amount of times you will toss the coin: You can't do that". What I want to know is why it is doing this? It may be a very simple debugging question, but it would be nice to get some feedback (considering I've been at this self-inflicted problem for about 10 minutes). Tell me everything that is in the bounds of rule 10

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

    What's a proper way to store a graph on a server?

    Posted: 10 Aug 2019 08:57 PM PDT

    I want to start a project that's going to be reliant on graphs. I was thinking about storing the nodes and edges in a database but I came to the realization that DB access might cost me if done frequently.

    Would a graph database be a good option?

    I think I'd have around 100-300 nodes so I don't even know if a database is really necessary for it.

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

    What is a good way to update database with only changes in scraped data?

    Posted: 10 Aug 2019 11:35 PM PDT

    I'm developing a website that uses scraped data from another website (about 40 pages). This other website makes small changes in its data often. Majority of the data remains the same for a good amount of time. I have the web-scraper as a python script that runs as a cron job every hour, and updates the database I'm using for the website to be developed.

    The problem

    Currently, what I'm doing to update the database is truncating an entire table and re populating it again.

    This is obviously an expensive operation because 40 pages produces a lot of data and majority of it the same, and that is why I want to avoid it.

    My question

    Ideally, I'd like to do something that only updates the parts in the database that are actually changed in the website.

    Is there a better way to store the scraped data? Or is there another approach I should take?

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

    I really want to learn Web Development

    Posted: 10 Aug 2019 07:01 PM PDT

    Can anybody here help me with this, where should I start learning or so ?
    I only know little bit of HTML and CSS, but I want to improve my knowledge, and become self-taught web developer.

    I really would appreciate if any of you guys would help me a little bit here .

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

    How should one use comments efficiently during code? What are the best practices?

    Posted: 10 Aug 2019 02:47 PM PDT

    I'm relatively new to programming, and I know for sure that comments are an incredibly useful tool which yields a lot of uses in your code. But I am kind of confused: when do I use comments? What do I write in them? Do I always need to use them? What are the best practices for using comments?

    I hope you can give me some answers reddit.

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

    I'm learning web development, but I want to make an Android app. Use React Native or switch to Java?

    Posted: 10 Aug 2019 10:09 PM PDT

    Hey everyone

    I've been studying web development for a while, I can build static pages on my own and I know some JavaScript but I'm still a newbie. I made a learning plan I'm very proud of, I searched the deepest corners of the web for the best JavaScript resources, but most importantly I'm loving webdev!

    A few days ago I had an idea for an app, one that solves a specific problem of mine, and its an idea I'm very passionate about. Great! I have something to work towards, now I can learn with a purpose instead of just for the sake of it!

    Problem is, it has to be Android-only. The app could work on PC (with Electron), but the app is mainly designed around being mobile-first.

    Now I know of React Native, but I'm worried about users having a terrible experience due to the bad performance. I want something more efficient, and I'd have to use Kotlin/Java for that.

    I'm really not sure what to do. I really wanna make this app, but I don't wanna switch to Java/Android development, as web development seems a lot more attractive to me. Moreover it would mean completely redoing my learning plan and spending days searching for the best stuff on Java instead.

    Should I switch to Java? Or should I just bite the bullet and use React Native?

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

    Any good python video series?

    Posted: 10 Aug 2019 09:43 PM PDT

    I'm trying to find a python tutorial series that isn't dogshit and isn't unbearably boring

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

    Looking for some guidance!

    Posted: 10 Aug 2019 08:39 PM PDT

    So I've recently become interested in learning to code, and learning to code python in particular. I have some background doing coding for building automation systems at work, but I'd like to expand that into learning python and eventually, into the world of machine learning. More for personal interest/hobby reasons than anything at this point. Does anyone have any tips on getting started? Are there decent online resources for learning? Is it worth paying for an online course and if so, which ones? Any Info or direction you folks have would be appreciated :)

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

    Get information off another site (Web Scraping?) and Google DialogFlow (JavaScript)

    Posted: 10 Aug 2019 08:30 PM PDT

    I am trying to make a Google Assistant Action using DialogFlow. I need help getting information off of another website using web scraping.

    Let's say I want to get a player's picture off of espn.com. I have the players name inside of a variable, but I am not sure how to use this to search espn and find their picture.

    Can anyone help me with this? I appreciate any help or guidance!

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

    javascript error, getElementById returns null. help please!

    Posted: 10 Aug 2019 08:26 PM PDT

    Im playinig around with javascript and was making a simple to do list app. it works up until i try to delete somethingand call my deleteItem function. I then get an error stating that removeChild cannot be executed because parameter 1 is not of type node. so i looked at the console log and my child variable returns null. why is this?

    <body> <input id="itemadd" type="text"> <button onclick="myFunction()">add</button> <div id="div1"> <h1>To Do:</h1> </div> <script> var numberId=0; var buttonId=0; function myFunction() { var x = document.getElementById('itemadd').value; var para = document.createElement("p"); var node = document.createTextNode(x); para.appendChild(node); var para2 = document.createElement("button"); var node2 = document.createTextNode("delete"); para2.appendChild(node2); var element = document.getElementById("div1"); element.appendChild(para); element.appendChild(para2); para.setAttribute("id", numberId); para2.setAttribute("id", buttonId); para2.addEventListener("click", deleteItem, false ); numberId++; buttonId--; console.log(numberId); console.log(buttonId); } function deleteItem(){ var parent = document.getElementById("div1"); var child = document.getElementById(numberId); console.log(parent); console.log(child); parent.removeChild(child); } </script> </body> 
    submitted by /u/Agent__Johnson
    [link] [comments]

    Assessment based python coaching session! Free sample assessment link included

    Posted: 10 Aug 2019 08:21 PM PDT

    https://www.extremepython.com/

    giving away a free sample assessment with explanations on the site

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

    Finally understood recursion - Used this video, hope it helps some of you.

    Posted: 10 Aug 2019 03:30 PM PDT

    After reading and watching multiple videos on recursion, this video was the one where it all finally clicked.

    https://www.youtube.com/watch?v=Mv9NEXX1VHc

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

    The Odin Project - Full stack Ruby on Rails or Full stack JavaScript?

    Posted: 10 Aug 2019 03:29 PM PDT

    I'm somewhat familiar with JavaScript.

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

    PRINTF IMPLEMENTATION...

    Posted: 10 Aug 2019 07:04 PM PDT

    Hello guys,

    I'm currently working on a project where i must re-code printf in c, and as everyone know, there's some different specifiers in the function. So for example if we take '%d' it means that we're talking about "int" data, but if we add 'll' for example, we're talking now about "long long int" data. more than this printf can have multiple arguments.

    I'm wondering if there's a way to create all variables possible and use just the one we need, without taking unnecessary memory.

    Thanks

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

    EE wants to make the switch to programming

    Posted: 10 Aug 2019 06:41 PM PDT

    Hello all,

    I have a BS in electrical engineering and mostly went for the hardware focused courses, but now I'm feeling the pull to program. In large part based on all the possibilities coding has to offer, the larger amount of jobs, and continued evolution of the field and it's ease to learn. My issue is that I have barely any coding experience or skills, I believe I would want to go for webdev so I know I need to be working on JavaScript, php, and html. Is there anything else I should be aware of or should be tackling to make this change in field? Thanks ahead for the help.

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

    Trying to install code blocks on windows 64 bit and keep running into issues. I've googled everything and even tried youtube to no avail. Would really appreciate the help

    Posted: 10 Aug 2019 06:34 PM PDT

    Title is basically it.

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

    Where would you start If you had a great idea for an app but didn’t know where to start?

    Posted: 10 Aug 2019 06:33 PM PDT

    How would you build an app if you had no experience building apps? If you had a great idea for an app but didn't know where to start what would you do?

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

    [C++]...Would appreciate any feed back on this program iv really put a good bit of effort into. Please let me know if I did it like garbage or whatnot..

    Posted: 10 Aug 2019 06:29 PM PDT

    Hey Everone!!

    So i have been honestly slaving over this code, and I would so very much appreciate any honest feedback..

    It as a challenge from my book, which in short, asked me to make a menu to allow a user to create a "Structure" account and fill its members. It also wants the user to be able to Alter their account structure members info...

    I think I messed my self up by spending to much time on input validations and such..but it bugs me to no end when the program crashes because of invalid input...

    If anyone has the time to check it out any input will be appreciated, Id like to know how poorly or not I did different elements of the program...

    If it is so sloppy and confusing without comments, I'll add comments line by line fo everything. Also, I know I need to use std:: instead, I am working on that!

    Also if your able to break it Please let me know how! I'm so tired of testing it for hours trying to find as much input issues as I could...

    once again thank you for your time!

    https://pastebin.com/rLLvqJ0b

    edit: Also the chapter im on is on struct so that's why its asking to be done in that way, but I feel like it would be better to do them as classes and in different .h .cpp files then #including them to manage all the related functions more cleanly..

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

    Getting started from scratch with a relatively clear goal. Help to build a path to follow?

    Posted: 10 Aug 2019 06:22 PM PDT

    Hey there!

    I'll start saying that I'm completely new to programming, and that I want to learn so I can use it at my job. I am a researcher in a field of chemical sciences, and I want to try and merge it with statistics/computing, and eventually machine learning.

    I'm here first to know which language should I start learning. I spent couple of months years ago learning Python, but I mostly forgot everytthing. I guess it is still one of my best choices.

    What I would like to do is choose and learn a language that would be suitable for building what I want to do.

    My very initial project would be building a simple program that allows me to:

    1. Input data such as: "experiment A, B, C... can be -or not- carried out under conditions X, Y, Z...". This would build a "database".
    2. Then, I would "ask" the program if I could run "experiment B" using "subject 1", which has "condition X and Z" as properties. The program would tell me if it would be possible.

    This would be the basic idea of what I want to program.

    Eventually, some other features would be added:

    1. I would like to be able to make the program extract input from external databases, ideally in an automatic manner.

    2. Properties or conditions would be weighed, so instead of "yes" or "no" answer to "can I run this experiment" I would get a % of feasibility.

    3. Long term, would be able to emulate an advanced statistic model, such as the ones machine learning or neural networks are based on (I really don't know much about this, but I think the basic idea under those and seems like what I want to pursue).

    After this wall of text, my questions are:

    - Am I good going for python? Any other suggestion? (I know that I'm not marrying my first language, but I'd like to focus in one that would work for me in the long term).

    - Which path/tutorials/books/resources would you recommend for being able to write and run a program such as the one I describe? How much time till I get there, on average, would you say one needs starting from scratch?

    - Am I talking non-sense with my long term goals? I know everything about my science, but I don't have a clue about programming or statistics yet. But I intend to learn and direct my research career to a statistics-supported one.

    if you made it through my wall of text, thankee sai, and hope you can give me some advice!

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

    No comments:

    Post a Comment