Programming

Any Javascript newbies in NYC want to study together in person?

Learn Programming - Mon, 01/15/2018 - 19:58

Hi Reddit,

I'm self-teaching myself Javascript, and am realizing that I learn best in an environment where I'm sitting around others, and can problem solve collaboratively. Right now I'm using the following tutorial site to teach myself: https://javascript.info/js, as well as various YouTube videos.

I'm comfortable with loops, conditionals, variables, and am looking to take my knowledge to the next level -- learning how to work with different frameworks and libraries. Eventually I plan to learn the entire MERN stack. My goal is ultimately to learn more about the web, and understand how to program for the web/mobile.

Weekends would be ideal, but happy to meet up during the week as well.

Does this sound like something anyone would be interested in? Contact me if interested! Look forward to learning together!

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

Having trouble With this java program (fixed)

Learn Programming - Mon, 01/15/2018 - 19:52

It's supposed to take a formatted phone number and turn it into a nonformatted one. (215) 231-521 to 215231521. Why isn't this working?

import java.util.Scanner; public class phnumr { public static void main (String[] args){ System.out.println("Enter phone number"); Scanner console = new Scanner (System.in); String in = console.nextLine(); in.trim(); String sb=in; for(int x=0;x<sb.length();x++){ if(in.charAt(x)==' '|| in.charAt(x)=='(' || in.charAt(x)==')' || in.charAt(x)=='-'){ sb=( sb.substring(0,x) + sb.substring(x+1, sb.length())); System.out.println("1 "+sb); } } System.out.println(sb); } }

Enter phone number

(919) 261-4213

1 919) 261-4213

1 919)261-4213

1 919)21-4213

1 919)21-423

919)21-423

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

Need help trying to write stock tickers and prices to CSV

Learn Programming - Mon, 01/15/2018 - 19:36

Okay, so I'm web scraping with BS and trying to write the stock tickers and price from a WSJ page to a CSV. Here is my code for the writing to CSV.

f = csv.writer(open('wsj.csv','w')) f.writerow(['name', 'price']) data = soup.find('table',{'class':'mdcTable'}) names = data.find_all('a') for name in names: stock = name.text.strip() price = data.find_all(class_='pnum') for prc in price: prices = prc.text.strip() f.writerow([stock,prices])

But whenever I run it, the CSV file comes up with the first row showing the last company name over and over again, instead of all names in the list. The prices show up fine though.

I am new to any sort of programming, and I started learning Python about a month ago. This is probably a stupid error, but I appreciate any help.

submitted by /u/22strokestreet
[link] [comments]

Having trouble With this java program

Learn Programming - Mon, 01/15/2018 - 19:20

It's supposed to take a formatted phone number and turn it into a nonformatted one. (215) 231-521 to 215231521. Why isn't this working?

import java.util.Scanner; public class phnumr { public static void main (String[] args){ System.out.println("Enter phone number"); Scanner console = new Scanner (System.in); String in = console.nextLine(); in.trim(); String sb=in; for(int x=0;x<sb.length();x++){ if(in.charAt(x)==' '|| in.charAt(x)=='(' || in.charAt(x)==')' || in.charAt(x)=='-'){ sb=( sb.substring(0,x) + sb.substring(x+1, sb.length())); System.out.println("1 "+sb); } } System.out.println(sb); } } submitted by /u/SwiftArchon
[link] [comments]

My parents bought me 'The C++ Programming Language Fourth Edition' but they didn't know it is written for people who have programming experience...

Learn Programming - Mon, 01/15/2018 - 19:19

I really want to learn c++ but I am afraid this is the wrong way of learning... I also really don't want to buy the beginner friendly c++ book by: Stroustrup because it would be really expensive and I might upset my parents... I do have some programming experience however and I am asking you guys if it is enough to comprehend this book? Ok, so far I have learned most of html, some css, and a little java script. I also read parts of a Sams Teach Yourself in 24 hours C++ book until I realized I didn't like how it explained things. I then got a tutor that taught me a lot of c++ that ranged from variables to pointers but I never firmly grasped it... All I can say i feel confident about in c++ is writing the 'Hello World' program because I can do it from memory and understand all of it's components but I have learned a lot more than that. From reading the 24 hour c++ book, practicing with the tutor, and looking at online resources I would say i have learned variables, output and input, arithmetic operators, program flow operators, loops, controlling the program flow, pointers, and something else like pointers although i can't remember the name... I have practiced these things but never firmly grasped them... Is this enough knowledge to fully comprehend and learn from 'The C++ Programming language 4th Edition'?

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

Is it more efficent to have more small arrays or less large ones?

Learn Programming - Mon, 01/15/2018 - 18:23

For a specific scenario I am thinking of items in a game, each item has an item ID, quantity, durability, and state variable. Would it be more efficent to do it that way or just have a new item for a new state.

Example: ID, Qnt, Dur, State

23 (Stone Axe), 1, 60, 3 (Rnf)

3 (blubry), 23, 40, 2(Washed)

Or:

ID, Qnt, Dur

22 (DmgStoneAx), 1, 60

23 (StoneAx), 1, 100

24 (RnfStoneAx), 1, 75

2 (BadBlubry), 8, 0

3 (blubry), 23, 20

4 (WashdBlubry), 19, 47

Which method would be more efficent and in what instance would the opposite be more efficent?

Edit: more mobile friendly

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

Replace Java with C# in online course

Learn Programming - Mon, 01/15/2018 - 17:41

I am trying to learn principles of software engineering and i recently stumbled upon some courses taught by UBC on edx.com. The name of the course are, Software Construction: Data Abstraction, and Software Construction: Object-Oriented Design.

My question is, will I be able to understand the course and do the assignments using C# as i have been told that they are very similar.

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

[C++] Problem with "Project Euler" Question nr. 2

Learn Programming - Mon, 01/15/2018 - 17:39

I'm trying to solve question 2 of the Euler Project:

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

This is the code I wrote https://pastebin.com/VytSUbdv I know that my code is probably way to overcomplicated and also probably hard to read (I'm sorry). I'm new to programming so please don't be too harsh.

My problem is that, while my code seems to print the correct fibbonacci sequence, it fails to produce the desired result. I'm not really sure how to fix this so all help would be greatly appreciated.

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

Efficient way to create HTML using JS?

Learn Programming - Mon, 01/15/2018 - 17:07

Hi guys , im writing some code which uses JS to create some HTML, at the moment im trying to create a list.

Javascript:

var para = document.createElement("li"); var node = document.createTextNode("HTML generated by Javascript!"); para.appendChild(node); var element = document.getElementById("greeting").appendChild(para); var newPara =document.createElement("li"); var nodeTwo = document.createTextNode("More HTML generated by Javascript!"); newPara.appendChild(nodeTwo); var NewElement = document.getElementById("greeting").appendChild(newPara);

HTML:

<html> <head> <link rel="stylesheet" type="text/css" href="cascade.css"> <title> the page title </title> </head> <body> <div id="greeting"> </div> <script src="jsLink.js"></script> </body> </html>

My question is , is there a more efficent way of creating a list? 4 lines to create one bullet point seems clunky!

Cheers!

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

Need help with API.

Learn Programming - Mon, 01/15/2018 - 17:02

Well i'm stuck with this simple problem, i got an API URL it's supposed to give me all the information of an online store goods. I've switched from Wordpress to Laravel because i have no idea how wordpress works with API. But my problem came when Guzzle 6 doesn't support json method anymore so i get it as plain text/html. I've tried using json_decode to make it a json, but then it becames NULL. i'd appreciate any help, as this is kinda an emergency, thank you.

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

Anyone have idea on how to scrape data from speedtest.net, can it be done with beautiful soup?

Learn Programming - Mon, 01/15/2018 - 16:57

Hello there, I'm pretty beginner to this type of stuff. I essentially want to scrape the results of speedtest.net I'm not really sure how to do this. Any tutorials out there.

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

Pages