• Breaking News

    Saturday, June 16, 2018

    Learning to code by creating arcade games learn programming

    Learning to code by creating arcade games learn programming


    Learning to code by creating arcade games

    Posted: 15 Jun 2018 09:40 AM PDT

    Hello /learnprogramming friends, We've been teaching kids to code python for the last few years and have wrote an instructional platform that helps teach coding concepts in the context of arcade games. The platform has been open sourced and works on Windows, Mac, and Raspberry Pi. Give it a shot! http://predigame.io

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

    What do you wish you'd have known when you started to learn to code that could've enabled you to grow faster?

    Posted: 15 Jun 2018 07:01 PM PDT

    I know that no one can become a serviceable programmer, one who can build use applications, overnight or even over a year, but with so many things to learn in the universe time and efficiency are almost paramount.

    I love learning new things to apply into my life and learning how to code so far has been one of my favorite learning ventures, as I've never seen a subject with as many resources and support.

    For some background I've done two C++ college courses, half of cs50 and mit 6.0.0.1x. Now I'm learning flask to finally start building an app myself.

    What would you guys suggest someone should know if he wants to become capable of building useful apps and learn from doing projects and work (rather than just books and tutorials) as fast as possible? Knowing that 'fast' could still mean an appreciable amount of time.

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

    Is there any place where I can post snippets of code and people can try to figure out if there are ways to make code more computationally efficient, robust, and/or programmatically elegant ?

    Posted: 15 Jun 2018 01:30 PM PDT

    Stackoverflow is mostly for people to get specific answers to specific questions.

    Perhaps there's a subreddit?

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

    First youtube video about what is Git. Very basic knowledge

    Posted: 15 Jun 2018 07:55 PM PDT

    Daily Algorithm Analysis (Day 1!)

    Posted: 15 Jun 2018 08:37 AM PDT

    Hi guys!

    As a way of keeping myself accountable and working towards better programming practices I want to make one post here daily that proposes a simple algorithmic problem/puzzle and attempts to solve that puzzle. I'll be working on my own solution, discussing the problem with you guys, and studying the implementation of others. I thought this might be a fun way to exercise these skills and (hopefully) learn with others. Mods, I figured this would be fine but let me know if this violates any rules I don't know about or if I should structure the post differently.

    I am currently enrolled in the Coursera class 'Algorithmic Toolbox' which is from the Data Structures and Algorithms specialization. This class can be audited for free if you guys are interested in enrolling as well. If you audit the class for free you won't be able to submit the assignments but you will have access to the lectures which discuss many of these problems. I plan on taking a lot of the daily problems from the assignments in this course but I am also trying to avoid proposing any problems that cannot reasonably be solved in the space of a few hours. If you guys have any problems that you find interesting, are struggling with, or find valuable in some way just let me know and I can include it in a daily post.

    Rules and Guidelines

    - Please wrap code and solutions in spoiler tags when possible.

    - Discuss the structure of your code thoroughly and provide an analysis.

    - All language implementations are welcome.

    - Please do not plagiarize the code of others and give credit where credit is due.

    - Please adhere to all other Reddit and r/learnprogramming rules.

    - Use the resource section to view the problem if you are struggling to understand the question. Reddit formatting limits the way in which I can post these questions.

    - Meeting the required program benchmarks is just as important as solving the problem. Strive to meet these parameters.

    Resources:

    Algorithmic Toolbox Course

    GoogleDrive Folder For Daily Problem Resources

    Day 1

    Full credit for today's problem goes to the folks over at Algorithmic Toolbox!

    Maximum Pairwise Product Problem

    I have posted a .zip that contains the PDF with this problem in the resource section. The file is titled "day1.zip"

    ______________________________________________________________________________________

    Find the maximum product of two distinct numbers in a sequence of non-negative integers.

    Input: A sequence of non-negative integers.

    Output: The maximum value that can be obtained by multiplying two different elements from the sequence.

    ______________________________________________________________________________________

    Given a sequence of non-negative integers a[1],...,a[n], compute

    max a[i] * a[j]

    where 1 <= i != j <= n

    Note that i and j should be different, though it may be the case that a[i] = a[j] .

    Input format. The first line contains an integer n. The next line contains n non-negative integers a[1],... ,a[n] (separated by spaces).

    Output format. The maximum pairwise product.

    Constraints. 2 <= n <= 2 * 105; 0 <= a[1],...,a[n] <= 2 * 105.

    Sample 1.

    Input:

    3 1 2 3 

    Output:

    6 

    Sample 2.

    Input:

    10 7 5 14 2 8 8 10 1 2 3 

    Output:

    140 

    Required program benchmarks:

    Time limits (sec.):

    C C++ Java Python C# Haskell JavaScript Kotlin Ruby Rust Scala

    11 1.5 5 1.5 2 5 1.5 5 1 3

    Memory limit. 512 Mb.

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

    In terms of security and data/program corruption, why do we want to make Object variables private, and use public getters and setters?

    Posted: 15 Jun 2018 10:33 PM PDT

    In terms of security and program/data corruption, why do we want to make Object variables private, and use public getters and setters?

    Personally, I feel that getters/setters provide another layer of preventing the user from inputting the incorrect values for an Object, which in turn prevents the program from crashing. And they also allow an object to have confidentiality, in the sense that they aren't exposed, leading to the idea of encapsulation... But is there more to it than just this? I feel like there are more, and better reasons why.

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

    Extracting medical terminology (e.g. drugs, symptoms, etc.) from unstructured clinical notes?

    Posted: 15 Jun 2018 08:30 PM PDT

    Hi! I am fairly new to programming, and I am helping a clinical researcher with one of her projects. Part of it involves extracting patient medication, symptoms, health history, etc. from unstructured text (i.e. psychiatric clinical notes).

    At the moment, I am struggling with an approach to the problem. My first idea is to create files that contain all relevant / possible psychiatric medications and symptoms. Then, after "cleaning" the clinical notes (i.e. conducting sentence splitting, tokenization, stemming, filtering, etc.), I will compare processed n-grams against the files to extract matching strings. For this method, I am mainly concerned about the run-time and the algorithm(s) I will use, as there will be a significant amount of terminology, text, etc. to loop through. My second idea is to train a named entity recognizer, but this requires a significant amount of manual clinical note annotation and training data sets.

    What would you suggest? Is there any other possibilities I can look into?

    Thanks in advance!

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

    What is a good book/reference on data structures?

    Posted: 15 Jun 2018 05:00 AM PDT

    I went through Skiena's Algorithm Design Manual for the second time. As the title says, it is a book on algorithms and their design. There is a short chapter on data structures.

    I want to spend some time with data structures to get more comfortable with them. I have a working idea what the different data structures are, and can work with their implementations (e.g. STL or boost) comfortably. I still want to spend some time just working with data structures to be safe.

    Is Niklaus Wirth's Algorithms + Data Structures = Programs still a good book?

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

    Matlab Functions vs Python Functions

    Posted: 15 Jun 2018 01:44 PM PDT

    Hello,

    I have recently began a project to implement some code from MATLAB to Python. I have mostly worked with java (and by mostly I mean I have done solely java).

    Going through a few textbooks for Python and doing some of the MATLAB classes, I began to translate the code. Conceptually, the hardest thing about this is the math based programming for MATLAB (for Python you have to use multiple packages to get the same thing done).

    My most pressing concern is this line written in MATLAB.

    function [M,Up,my,sing_values] = mvsa(Y,p,varargin) 

    Conceptually, I cannot understand what is going on. I also have not been able to find the MATLAB documentation to explain it. I was wondering if anybody had any ideas about translating that line into Python.

    Thanks in advance!

    If the rest of the code for that function is needed I have provided it down bellow.

    function [M,Up,my,sing_values] = mvsa(Y,p,varargin) if (nargin-length(varargin)) ~= 2 error('Wrong number of required parameters'); end % data set size [L,N] = size(Y); if (L<p) error('Insufficient number of columns in y'); end 
    submitted by /u/amtorrest
    [link] [comments]

    Need help understanding this recursive function to copy a linked list into another linked list?

    Posted: 16 Jun 2018 12:10 AM PDT

    Hi I got this code to copy one linked list to another linked list but but I cannot understand why its inserting at 0 index instead? Then wouldn't the copied list be reversed? But I tried running it and the output is correct and is in order?

    My guess is it inserts the last node first and goes backwards but I'm not sure where it does this in code and I don't even know how this recursive function terminates if its like that?

    Also if I put insert before I call the function again then it would be in reverse order?

     def _copy_aux_(self, node, new_list): if node is not None: self._copy_aux_(node.next, new_list) new_list.insert(0,node.item) def copy(self): new_list=linkedList() self._copy_aux_(self.head,new_list) return new_list 
    submitted by /u/Lsy9891
    [link] [comments]

    What Java code should I research to have similar functionality to "functions" in Matlab?

    Posted: 15 Jun 2018 07:52 PM PDT

    I am fairly inexperienced when it comes to coding, just being honest. I decided I was going to try and learn enough to build a fairly complicated android game app using *android studio.

    I got through enough to have a figure that moves around how I want, but have little idea how to navigate through menus and such. I have a background in engineering, so I have used Matlab and a few similar programs and languages before. As such I was really hoping there was a Java version of Matlab's functions where I could just the code in sections and multiple functions that can move values in and out of each other. I'm basically just struggling with how to segment the code so that I can work on it in sections and just call functions to perform tasks in the main game.

    Any tips? What should I even look up to figure out? A few friends without matlab experience said they thought I was looking for "methods" but they don't seem to do what I'm looking for.

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

    [JavaScript] Is there a JS equivalent for Console.ReadLine()?

    Posted: 15 Jun 2018 11:25 PM PDT

    Trying to collect user input for a class activity. In C# I'd use Console.ReadLine(). What is the equivalent in JS?

    I Googled, but it led me to a Stack Overflow answer that linked to an old Mozilla Dev doc from 6 years ago that's not available anymore.

    TIA

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

    I wrote an Alexa skill to read a Reddit RSS feed

    Posted: 15 Jun 2018 10:57 PM PDT

    I recently have been writing Alexa skills in python (because why not?). I made this skill: https://www.amazon.com/Tom-Casavant-Superpower-Generator/dp/B07D9WG59C/ref=sr_1_2?ie=UTF8&qid=1528746712&sr=8-2&keywords=superpower+generator&dpID=5146tPtAcML&preST=_SY300_QL70_&dpSrc=srch which takes superpowers from r/shittysuperpowers and bestows the user with a power of their own. I wrote a tutorial (mainly for my own use, as writing tutorials helps me learn) which can be found here: http://www.tomcasavant.com/?p=91. I'd love to hear anyone's feedback on the code

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

    Anyone that uses youtube-dl here, a small bit of help?

    Posted: 15 Jun 2018 10:56 PM PDT

    What command can I use to get a higher(if not highest) quality audio file from a video, convert to m4a/mp3, and also have metadata added?

    Can youtube-dl add album art too?

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

    Learning to program currency calculator, need help with web API

    Posted: 15 Jun 2018 10:50 PM PDT

    Hey there guys, recently completed my currency converter project in C++. I now want to include web exchange rates, meaning update the values of my conversions every 24 hours or so. I found this ( https://currencylayer.com/product ) which I believe would work but I have no idea how to get my program to pull in these rates through it's API. Any guides for something like this? This is my currency converters source code.

    https://pastebin.com/Fas61znc

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

    Good projects to do in C?

    Posted: 15 Jun 2018 02:56 AM PDT

    Hi! I've started programming a year ago, and so far my progress with high-level languages (Python and JavaScript) is pretty good.

    Now I want to learn more low-level stuff with manual memory management, and the best language to start with is probably C. However, all my previous learning consisted of doing practical projects, and I struggle to come up with a project idea that would force me to use C instead of Python or JS. That is, using C for it should be much more practical/convenient than more high-level languages. I thought about making games (they have much more strict performance requirements than most apps), but fast higher-level languages like C# still seem more suitable for them.

    Any suggestions?

    Thanks!

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

    Ancient Serial Reader/GPS Java Problem

    Posted: 15 Jun 2018 01:48 PM PDT

    I am working on fixing the GPS functionality on some software that I have taken over from an old employee, and I keep having the following error thrown:

    "org.dinopolis.gpstool.gpsinput.GPSException: port 'COM256' not available. at org.dinopolis.gpstool.gpsinput.GPSSerialDevice.open(GPSSerialDevice.java:135) at org.dinopolis.gpstool.gpsinput.nmea.GPSNmeaDataProcessor.open(GPSNmeaDataProcessor.java:146)"

    Here is the code:

    public void activateGPS(String portName, boolean activate, int gpsCounter, GPSDialog gpsDialog) {

     //lets try loading GPS data and printing it to system.out if (!activate && gpsProcessor != null) { //the GPS was previously activated and we want to close it, or the user // is a moron and clicked OK without enabling the GPS try { gpsProcessor.close(); GPSEnabled.setForeground(new Color(255, 0, 0)); System.out.println("code Executed!"); GPSEnabled.setText("Disabled"); GPSActivated = false; return; } catch (GPSException e3) { Toolkit.getDefaultToolkit().beep(); JOptionPane.showMessageDialog(null, "Error Closing GPS", "SeaView Error", JOptionPane.ERROR_MESSAGE); DefaultExceptionHandler handler = new DefaultExceptionHandler(); handler.logException(e3); } } gpsProcessor = new GPSNmeaDataProcessor(); try { //create GPS Device From Serial Port Hashtable<String, Object> environment = new Hashtable<String, Object>(); environment.put(GPSSerialDevice.PORT_NAME_KEY, portName); environment.put(GPSSerialDevice.PORT_SPEED_KEY, new Integer(4800)); GPSDevice gpsDevice = new GPSSerialDevice(); gpsDevice.init(environment); //TEMP //System.out.println(System.getProperty("java.library.path")); //connect processor with device and open it gpsProcessor.setGPSDevice(gpsDevice); gpsProcessor.open(); JOptionPane.showMessageDialog(null, "GPS connected on port: " + portName, "SeaView Info", JOptionPane.INFORMATION_MESSAGE); gpsDialog.disposeThis(); } catch (GPSException e) { Toolkit.getDefaultToolkit().beep(); //System.out.println("Calling again " + gpsCounter); gpsCounter++; //Call method recursivley until port 100 is reached. if (gpsCounter <= 256) { String comm = "COM" + gpsCounter; //System.out.println("comm " + comm); activateGPS(comm, true, gpsCounter, null); } else { gpsCounter = 0; JOptionPane.showMessageDialog(null, "Error reading GPS.", "SeaView Error", JOptionPane.WARNING_MESSAGE); DefaultExceptionHandler handler = new DefaultExceptionHandler(); handler.logException(e); try { gpsProcessor.close(); // GPSActivated = false; return; } catch (GPSException e2) { Toolkit.getDefaultToolkit().beep(); JOptionPane.showMessageDialog(null, "Error Closing GPS", "SeaView Error", JOptionPane.WARNING_MESSAGE); handler.logException(e2); } } } PropertyChangeListener listener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { Object value = event.getNewValue(); String name = event.getPropertyName(); //System.out.println("Name: " + name); if (name.equals(GPSDataProcessor.LOCATION)) { GPSPosition position = (GPSPosition) value; //System.out.println("The New Location is " + position.getLatitude() + "/" + position.getLongitude()); gpsLat = position.getLatitude(); gpsLong = position.getLongitude(); mainFrame.updateGPS((float) gpsLat, (float) gpsLong); } else if (name.equals(GPSDataProcessor.NUMBER_SATELLITES)) { Integer number = (Integer) value; //System.out.println("Number of satellites: " + number); } } }; try { gpsProcessor.addGPSDataChangeListener(listener); } catch (Exception e) { System.out.println("Error adding change listener" + e); } GPSEnabled.setForeground(new Color(0, 150, 50)); GPSEnabled.setText("Enabled"); GPSActivated = true; } 

    I believe the gpsCounter may be the problem, but it doesn't seem to be reading the NMEA header data at all. I'm at a loss. Any suggestions?

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

    [Python] Beautiful Soup redirects to website home page instead of directory index page

    Posted: 15 Jun 2018 11:24 AM PDT

    Using Python 3.6.5

    my code:

    url = "livescores.com/worldcup/" data = requests.get("http://" + url).text soup = BeautifulSoup(data, 'html.parser') print(soup.prettify()) 

    when i check the contents of the html page, I see that it has retrieve the homepage for livescores.com not livescores.com/live/. Edit: changed url

    any tips would be beneficial.

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

    Just registered for my first semester towards a BS in Computer Science... here goes

    Posted: 15 Jun 2018 11:59 AM PDT

    I graduated with a BA from a great university back in January but... A BA was never my plan... I know it sounds dumb, a degree is a degree, but I really wanted that BS(and I dont feel like a grad school would take me jumping from Arts to Science). If I could go back and slap my 19 year old self I would... But here I am at 25, with the opportunity to go back to school (while working, but its flexible hours). So I'm going to do it! I heavily toyed with the idea of a certificate from a community college, but I've read too many "yea... that's completely useless." stories. So I'm going to go for the BS. I'm not expecting 100K salary as soon as I graduate, just a resume I can be proud of and a degree I can talk about without being embarrassed. Here's hoping I have what it takes!

    PS: I really love this sub. It's much more optimistic than r/cscareerquestions haha

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

    Employee PTO Application

    Posted: 15 Jun 2018 02:04 PM PDT

    I'd like to create some sort of application for HR to record employee PTO. At the moment, she keeps up with everything by hand in a giant binder and just writes in the hours people use. Hopefully, this would make things a little easier for her. I would like to make a desktop application for her to use and I think it would be a fun project for me to attempt. Here's what the database/application would entail:

    • Easily add/edit employees
    • Set PTO for each employee (possibly set PTO by staff type)
    • Enter PTO hours as employees use it
    • Any unused PTO will roll into sick reserve at the end of the year
    • Create reports for specific employees that will display PTO/Sick reserve remaining

    I think MS Access would be able to handle this fairly easily and I have used it in the past for some school projects. Is this the way to go for something small like this? If I were to create a desktop application for something like this, how difficult would that be? I know I'd more than likely be learning C# since we use Windows here, but I'm willing to give that a whirl to create something.

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

    Regular Expression for comma separated days of week in any order

    Posted: 15 Jun 2018 09:35 PM PDT

    I need a regular expression which will validate comma separated days of week in any order. Duplicates are not allowed. Currently I have below expression.

    ^(Mon(,(?=.)|$))?(Tue(,(?=.)|$))?(Wed(,(?=.)|$))?(Thu(,(?=.)|$))?(Fri(,(?=.)|$))?(Sat(,(?=.)|$))?(Sun)?$

    It works well for avoiding duplicates but does not work for any order. i.e. below are valid options. But current regex says 2nd is invalid.

    Tue, Wed, Fri is valid

    Wed, Tue, Fri is valid (but regex says its invalid)

    Actually both orders are correct as per my requirement. What modifications can be done here for the regex?

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

    Why is Javascript so slow compared to Java?

    Posted: 15 Jun 2018 09:31 PM PDT

    I was doing this [Max Increase To Keep City Skyline](https://leetcode.com/problems/max-increase-to-keep-city-skyline/solution/) problem and I had 4 iterations and testing code ran into Time Limit Exceeded.

    So I now didn't know how to iterate less than 4 times and checked the solution. First of all the solution is actually wrong, because it assumes x = y, which is funny considering they call themselves leet. Secondaly the solution actually has 4 loops (in my opinions it should have them more).

    If I am not allowed to iterate separetaly, how am I meant to know max of both y direction and x direction.

    I just don't get this problems. Why are they so important?

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

    Looking For Mentors

    Posted: 15 Jun 2018 09:26 PM PDT

    I currently have a group of 6 young adults who are trying to get on Software Development career paths. Some majored in fields other than computer science (mechanical engineering, aerospace engineering) and would like to make a career change. Others studied computer science or information systems, but didn't get the quality education that they needed in order to be successful. All of them are highly motivated to learn, but they need someone with experience in the field to give them direction and advice. They have access to Udemy for Business which gives them access to all of the videos on Udemy for free. Ideally a mentor would develop training tracks from these video options for them. Maybe even occasionally give them projects and assignments. Anyone who is willing to serve as a mentor will also have access to this in order to help provide advice and direction on what the mentees should take. They will also be free to use the platform for their own personal reasons as well.

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

    No comments:

    Post a Comment