• Breaking News

    Monday, March 4, 2019

    One thing that's putting me off is, "What do I program?" learn programming

    One thing that's putting me off is, "What do I program?" learn programming


    One thing that's putting me off is, "What do I program?"

    Posted: 03 Mar 2019 09:44 AM PST

    I recently have been learning a handful of languages, Html, Js. Very basics so far. I also stopped for 2 weeks because I lost interest because of the fact that I just don't know what to program. I've never been a good problem solver before, I understand it requires practice, and experience, but one thing that puzzles me is what do I program? I keep trying to think of ideas of what I should create, what can I fix or revolutionize, make better etc.. Will I have a better understanding when I actually know JS from back to front?

    Edit: Not asking for anyone to feed me ideas. Would you guys reccomend I do a few "code with me" courses on building simple things such as snake, tic tac toe and such?

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

    Automating job without telling boss

    Posted: 03 Mar 2019 12:47 PM PST

    Hey I was thinking about automating parts of my job without telling my boss just in case he tells me know. I only make 18 an hour an want more responsibility. What's the Risk of getting fired

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

    I just started c++ and I'm so lost already.

    Posted: 03 Mar 2019 10:34 AM PST

    I've just started with the basics and I'm already struggeling. Could someone please tell me whats the use of

    include <iostream>

    Using namespace std;

    I've already watched 3-4 videos on internet but i just dont get it. It's something related to library but i don't even know what is library in programming. Could someone please explain this to me in a simpler manner🙏

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

    Coding for kids?

    Posted: 03 Mar 2019 05:08 AM PST

    I am looking for app or website that I geared towards kids aged 5-6 years old to get them into coding. Where it's not writing something but like a game based coding or something.

    Is there anything targeted towards this age? Or do I need to wait to get them started?

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

    I am trying to make a rock, paper, scissors game and I've run into problems. Please help me solve them.

    Posted: 03 Mar 2019 06:27 PM PST

    These are the instructions for the assignment that i have to do:

    Implement a C++ console application that simulates a Rock-Paper-Scissor game against the computer. When played between two people, each person picks one of three options (usually shown by hand gesture) at the same time, and a winner is determined. In the game, Rock beats Scissors, Scissors beats Paper, and Paper beats Rock. The program should randomly choose one of the three options (without revealing it), then ask for user input (choice of Rock, Paper or Scissor), and finally compare with user's choice. At that point, the program reveals both choices and prints a statement indicating if the user won, the computer won, or it was a tie. Application should keep track of the current score (i.e. the number of user wins, losses, and ties) and update the screen after every play. User should be prompted after every game if they want to continue playing. At the beginning of the game the program should also ask the user for their name and display this name when showing the score. You do not need to use any user-defined functions for this assignment but you can add whatever you like so long as the criteria at the end of this document has been met. No bonus marks will be given, however.

    In addition to the requirements above, as part of this assignment you are to implement storing of game data into a text file. Game should always ask for a username (it has to be at least 8 characters) and store game results in a file with the same name as the username (username.txt). If the user has played the game before, the data should be read from the file and displayed on screen before starting a new game. At the end of the game the statistics should be saved on the same file. Game should not allow for same usernames unless it is the same user. This means that the game should check for existing usernames and prompt the new user for further authentication if needed. This would also guarantee that every user will have a unique game data statistics stored and not overridden by another user with the same username.

    And this is what I've come up with so far:

    include "pch.h"

    include <iostream>

    using namespace std; int main() { string PlayerUsername; string Playerinput; string Winner; int Wins; int Draws; int Losses; int RNG = rand() % 3 + 1; std::cout << "Print your name.\n"; cin PlayerUsername >> ; std::cout << "Hello >>PlayerUsername>>. This is a rock, paper, scissors game. The rules are as follows: rock beats scissors, paper beats rock, and scissors beats paper. The computer will randomly pick one of the three. Print n1 for rock, print n2 for paper, print n3 for scissors. Input your choice for this turn if you wish to play. Otherwise close the program.\n"; if (RNG == "1" && Playerinput == "rock") { std::cout << "The outcome of this game was a tie." << endl; } else if (RNG == "2" && Playerinput == "scissors") { std::cout << "Computer wins." << endl; } else if (RNG == "2" && Playerinput == "paper") { std::cout << "The outcome of this game was a tie." << endl; } else if (RNG == "2" && Playerinput == "rock") { std::cout << "Computer wins." << endl; } else if (RNG == "3" && Playerinput == "scissors") { std::cout << "The outcome of this game was a tie." << endl; } else if (RNG == "3" && Playerinput == "paper") { std::cout << "Computer wins." << endl; } else { std::cout << "You win." << endl; } cin Playerinput } 

    These are the errors that I've gotten:

    * The system cannot find the file specified is the popup that I get from visual studio community.

    Severity Code Description Project File Line Suppression State

    Error (active) E0065 expected a ';' Rock, Paper, Scissors C:\Users\FULVIO\source\repos\Rock, Paper, Scissors\Rock, Paper, Scissors.cpp 18

    Error (active) E0042 operand types are incompatible ("int" and "const char *") Rock, Paper, Scissors C:\Users\FULVIO\source\repos\Rock, Paper, Scissors\Rock, Paper, Scissors.cpp 21

    Error (active) E0042 operand types are incompatible ("int" and "const char *") Rock, Paper, Scissors C:\Users\FULVIO\source\repos\Rock, Paper, Scissors\Rock, Paper, Scissors.cpp 23

    Error (active) E0042 operand types are incompatible ("int" and "const char *") Rock, Paper, Scissors C:\Users\FULVIO\source\repos\Rock, Paper, Scissors\Rock, Paper, Scissors.cpp 25

    Error (active) E0042 operand types are incompatible ("int" and "const char *") Rock, Paper, Scissors C:\Users\FULVIO\source\repos\Rock, Paper, Scissors\Rock, Paper, Scissors.cpp 27

    Error (active) E0042 operand types are incompatible ("int" and "const char *") Rock, Paper, Scissors C:\Users\FULVIO\source\repos\Rock, Paper, Scissors\Rock, Paper, Scissors.cpp 29

    Error (active) E0042 operand types are incompatible ("int" and "const char *") Rock, Paper, Scissors C:\Users\FULVIO\source\repos\Rock, Paper, Scissors\Rock, Paper, Scissors.cpp 31

    Error (active) E0065 expected a ';' Rock, Paper, Scissors C:\Users\FULVIO\source\repos\Rock, Paper, Scissors\Rock, Paper, Scissors.cpp 36

    Error C2146 syntax error: missing ';' before identifier 'PlayerUsername' Rock, Paper, Scissors c:\users\fulvio\source\repos\rock, paper, scissors\rock, paper, scissors.cpp 18

    Error C2059 syntax error: ';' Rock, Paper, Scissors c:\users\fulvio\source\repos\rock, paper, scissors\rock, paper, scissors.cpp 18

    Error C2446 '==': no conversion from 'const char *' to 'int' Rock, Paper, Scissors c:\users\fulvio\source\repos\rock, paper, scissors\rock, paper, scissors.cpp 21

    Error C2446 '==': no conversion from 'const char *' to 'int' Rock, Paper, Scissors c:\users\fulvio\source\repos\rock, paper, scissors\rock, paper, scissors.cpp 23

    Error C2446 '==': no conversion from 'const char *' to 'int' Rock, Paper, Scissors c:\users\fulvio\source\repos\rock, paper, scissors\rock, paper, scissors.cpp 25

    Error C2446 '==': no conversion from 'const char *' to 'int' Rock, Paper, Scissors c:\users\fulvio\source\repos\rock, paper, scissors\rock, paper, scissors.cpp 27

    Error C2446 '==': no conversion from 'const char *' to 'int' Rock, Paper, Scissors c:\users\fulvio\source\repos\rock, paper, scissors\rock, paper, scissors.cpp 29

    Error C2446 '==': no conversion from 'const char *' to 'int' Rock, Paper, Scissors c:\users\fulvio\source\repos\rock, paper, scissors\rock, paper, scissors.cpp 31

    Error C2146 syntax error: missing ';' before identifier 'Playerinput' Rock, Paper, Scissors c:\users\fulvio\source\repos\rock, paper, scissors\rock, paper, scissors.cpp 37

    Error C2143 syntax error: missing ';' before '}' Rock, Paper, Scissors c:\users\fulvio\source\repos\rock, paper, scissors\rock, paper, scissors.cpp 37

    I would like to know:

    • Why this code is not running.
    • How do I add a way to keep score on a text file.
    • How do I add a way to show the computers choice to the player.

    All feedback and help is appreciated.

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

    [HOMEWORK] Deleting a given node in a singly-linked list in constant time

    Posted: 03 Mar 2019 06:45 PM PST

    Hi, this is a homework problem, and I've spent a lot of time thinking about it, but I think I need a hint to push me in the right direction.

    So basically, I'm tasked with finding a way to delete a given node (passed in as a parameter to a delete(node) method) from a singly-linked list in O(1) time. I'm tempted to say this is impossible due to the nature of linked lists, but I've been assured by TAs that it is indeed possible.

    I got a hint from a TA that the key to solving it is realizing that a node is only distinguishable from other nodes based on the data it holds. Essentially, if Node A's data is switched with Node B's data, node A is indistinguishable from Node B. Even given this information, I don't know how we could possibly find a given node in constant time, because to even reach the node, we have to traverse the list, giving us a worst-case runtime of O(n) if the node is the tail of the list, right? How could you possibly find and delete a node without iterating through the list in some way?

    I feel like I must have some sort of fundamental misunderstanding about the way singly-linked lists work, because with the knowledge I currently have of them, I don't see any way this is possible.

    The answer would be nice, but I'm more looking to understand the problem and answer, so if you just want to provide a hint that will get me going in the right direction, I would really appreciate that, too.

    Edit: Solved! Thanks to u/mcg42ray

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

    Recommended courses for a pursuit in a IOT field

    Posted: 03 Mar 2019 11:56 PM PST

    I'm currently applying for Electrical Engineering programs in Europe and colleges aren't really ranked how it is in America. It's mainly based on the classes you take and for which major. So I was wondering if there is any specific class names or descriptions I should make sure are included

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

    Python Cheat Sheets

    Posted: 03 Mar 2019 05:58 PM PST

    How is writing a cheat using memory addresses possible?

    Posted: 03 Mar 2019 03:50 PM PST

    When you write a cheat, you use cheat engine to find memory addresses, then read or write to them with your program.

    How is this possible if all memory addresses are assigned by the system at run time? Wouldn't they be different every time the program is run?

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

    Learn C# and professional programming in a community with passionate devs

    Posted: 03 Mar 2019 10:03 PM PST

    Dear all,

    Learning is a constant process. You can learn from your own mistakes, you can do it alone. What I would like to offer, is learning inside of a community, with hundreds of people exchanging both professional and casual programming experience!

    C# inn- a friendly discord community would like to invite you to join! We're a young and growing community with almost 2000 members, with dozens of new members joining daily. Our members help each other out and we try to keep as friendly atmosphere as possible. Your opinion matters to us, our staff listens to your needs and suggestions, so we're constantly changing and trying to be a bit better than we were yesterday, by adding/removing channels, coming up with ideas, planning the future. As the name implies, we're mostly focused on C#. We have a lot of people who advocate profesionalism and we want not only to help you do stuff, but do it the right way.

    Also, every weekend we have programming lessons, where people can learn C#, object oriented programming, clean code. We have some people streaming live coding and sometimes some members offer mentorship on a project or topic.

    We want to be a community where people can learn and collaborate, all while having fun. Interested?

    Invitation link: https://discord.gg/Bfme3PD

    Looking forward meeting you!

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

    Fastest way to remove an attribute in VERY LARGE XML

    Posted: 03 Mar 2019 09:23 PM PST

    Background: I downloaded StackOverflow post data (https://archive.org/details/stackexchange), which is 66GB after unzipping. I would like to remove the Body and Title attribute in every row because I only need those metadata. I have only 8GB memory...

    What is the fastest way to do this? RegEx? I prefer to do this in Python / Java / PowerShell.

    Why not use StackExchange's online query? I want to do analysis across the whole SE network, whereas using their data explorer I can only do things site by site.

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

    Can someone help me understand this block of code? [Python]

    Posted: 03 Mar 2019 06:32 PM PST

    current_users = ['eric', 'willie', 'admin', 'erin', 'Ever'] new_users = ['sarah', 'Willie', 'PHIL', 'ever', 'Iona'] #current_users_lower = [user.lower() for user in current_users] current_users_lower = [] for user in current_users: current_users_lower.append(user.lower()) for new_user in new_users: if new_user.lower() in current_users_lower: print("Sorry " + new_user + ", that name is taken.") else: print("Great, " + new_user + " is still available.") 

    What I am having trouble understanding is the list comprehension which I commented out and used the loop instead, but I didn't write this code, I attempted to write it but got it completely wrong so I looked online and I cant understand HOW it is doing what its doing, which is making sure that if you type a username, it checks against all titlecase for that username, like for instance sArAh to sarah

    Basically like how all websites with logins work, you cant use MiChAeL when "michael"is already taken....

    I just don't understand how its working

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

    Programming for a beginner

    Posted: 03 Mar 2019 03:37 PM PST

    Hello everyone I am a civil engineer. So i have no programming experience whatsoever, and I want to learn programming just to experience what is like and possibly try some ideas I heard python is the easiest and the best language to learn right now. Does anyone recommend that or should I learn something else? Any tutorials or recommendations would be appreciated.

    submitted by /u/Ahmad-aburahma
    [link] [comments]

    Python travel distance of a ball bounce Help

    Posted: 04 Mar 2019 12:11 AM PST

    So im trying to write a program that calculates the distance traveled, after a ball is dropped x number of times. Im trying to use a simple geometric sequence, but im running into issues with my code.

    h = int(input("Enter the height the ball was dropped from: "))

    b = int(input("Enter Number of Bounces: "))

    dt = h(1 - .6**b/1 - .6) + h

    print(dt)

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

    How do category/tag filters work in statically generated blog sites?

    Posted: 03 Mar 2019 11:45 PM PST

    I've been trying to build a static blog site using Flask and Markdown. Stuck on filtering by category and tags. Any help is greatly appreciated. Thanks.

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

    What language/programs to use/learn if I want to apply coding into my art?

    Posted: 03 Mar 2019 11:41 PM PST

    Hi.

    I am an artist (sculpture focus) that recently got interested in using coding to make interactive artworks. Currently looking through different programs and saw a couple that I might like (Processing in particular.) Is there anyway to learn/ other suggestions that could help? I am somewhat familiar with the Arduino Language which is a form of C/C++ if I remember correctly.

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

    Equalizing the histogram of a live video feed using swift?

    Posted: 03 Mar 2019 02:51 PM PST

    Not sure if this is the right place for this, just let me know if there's somewhere else I should put it.

    This is a pretty specific question, and I haven't found anything online (stack overflow or any other documentation) about it so I figured I'd try asking here. I'm relatively new to programming, but I've started working on a project in Xcode using Swift that overlays dots onto certain images in a video feed. The problem is, our tracking of these images is often very shaky and any movement of the objects causes it to completely lose its ability to track.

    At this point, we are almost certain we simply need to increase the contrast of the reference images and the video feed. We have tried placing brightly colored physical markers (stickers) on the objects we are tracking, and have eliminated all shadows that could be causing issues. The only thing I can think of that we could still try is equalizing the histogram to increase overall contrast.

    I have used OpenCV with Python before, and it has a very simple function for equalizing the histogram of still images, though I haven't found anything on live videos. I have also seen people break down videos frame by frame, equalize the histogram of each image, and rebuild the video with the "equalized histogram", though since this is a live video feed I don't think this will work.

    Let me know if anyone has any advice or resources I could look into!

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

    Java, C#, C, SQL, PHP... Which order?

    Posted: 03 Mar 2019 12:50 PM PST

    Hi,

    I've just learned HTML, CSS, and JavaScript. I want to start learning the following back-end languages: Java, C#, C, SQL, and PHP. The problem is I don't know where to start. Do you know which order would be the most natural as to which programming languages compliment each other?

    For instance, if you wanted to learn German, Danish, Swedish, French, and Spanish. The ideal thing would be to learn either German, Danish, and Swedish first or French and Spanish first, but learning German then Spanish then Danish then French, and then Swedish would be a lot more complicated as the language fundamentals keep chancing.

    I really hope someone can help me :)

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

    Data Structures - What made it easier for you?

    Posted: 03 Mar 2019 08:53 AM PST

    I'm taking my Data Structures class this summer on its own after my computer science professor told us that it would be the most difficult class we will likely be taking and to take it on its own with him.

    Is there anything that I can do to start prepping myself for the subject and is there anything that really helped you understand it better?

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

    How exactly do I shift a pixel color in colorspace perpendicular to a point and a line ?

    Posted: 03 Mar 2019 03:36 PM PST

    Hi, first of all I'm working in CIE chromaticity color space (2D). I have a point P (x,y) within a line A (Ax + By + C = 0). Now from this point I need to shift it (the pixel) perpendicular to the line A and this point P itself with some amount of value (s).

    I came across this post on Stackoverflow : math - Perpendicular on a line from a given point - Stack Overflow[^] . In this case OP want to find the intersection point from a line and perpendicular across it, in my case I know my intersection point.

    Pixel P is of course intersection point between line A and perpendicular line.

    I'm already able to compute it, and also the line A equation :

    A = y2 - y1; B = x1 - x2; C = (A * x) + (B * y); 

    and the perpendicular line from line A and point P using this :

    m1 = - (A/B); m2 = - (1/m1); b = y - (m2 * x); 

    And the amount of shift I need to add :

    S = sqrt((y2*y1) + (x2*x1)); 

    Basically I think I have all the variable I need. And now that I know the perpendicular line equation (y2 = mx + b) and amount of shifting I need to add (s). How exactly do I apply this to my pixel computation and shift it perpendicularly ?

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

    Any tips for a newbie learning python for data science?

    Posted: 03 Mar 2019 03:36 PM PST

    I'm just getting started with python and aiming to become a data analyst. I was hoping someone could let me know about best sources on internet to learn and grow into this field?

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

    Unable to use custom struct declared in a separate file with std::sort

    Posted: 03 Mar 2019 03:29 PM PST

    //class.h MyClass { public: struct arrangeY { bool operator() (cv::Point pt1, cv::Point pt2) { return (pt1.y < pt2.y); } } yAscending; }; //main.cpp vector<vector<cv::Point>> hull(contours.size()); ... sort(hull[0].begin(), hull[0].end(), yAscending); 

    But I get error saying yAscending is undefined. How do I use std::sort then?

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

    What is the purpose of this line of code? (Javascript)

    Posted: 03 Mar 2019 10:53 PM PST

    I'm learning JS and there's an exercise where you take a phone number as an array and you write multiple functions to get it to return in this format: '(800) 444 -8393'

    This is a little snippet of what I wrote:

    PhoneNumberFormatter.prototype.getAreaCode = function() {

    return 'this.slice(0,3);

    };

    However... the reference solution has this:

    PhoneNumberFormatter.prototype.getAreaCode = function() {

    return '' + this.slice(0,3);

    };

    There's an empty string that's added to the slice method and then returned. But my answers yield the exact same string.

    So what is the purpose of adding that empty string?

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

    No comments:

    Post a Comment