• Breaking News

    Thursday, December 17, 2020

    Doubting my approach to my first Object Oriented Programing project, need advice Ask Programming

    Doubting my approach to my first Object Oriented Programing project, need advice Ask Programming


    Doubting my approach to my first Object Oriented Programing project, need advice

    Posted: 17 Dec 2020 08:05 AM PST

    In my school, as we are learning about Object Oriented Programming, we have an assignement to code a combat game based on pokemon's rules in C++.

    I am almost done with the mandatory part of the project, but I am having doubts with my program's design.

    Here's the deal, I have to have objects for certain elements:

    Object "attack": has a name, power amount, a type (fire, water etc) and a number of use.

    Object "Monster": has a name, , type, hp amount, atack power value, defense value, speed value. Possesses 4 attacks (objects "attack")

    Object "monstertype": inherits from object "monster", has a float value (for exemple: "firetype" has a value representing chance to burn)

    Object "player": has a name, and possesses 3 pokemons (objects "monster").

    I've put all the stats such as hp, attack value etc as protected/private, so that they can only be modified via methods, and I've put setters and getters where I needed some.

    As it is, I think it would be logical to have the class "monster" have a method that says something like attackNumber2(opponent) to attack with his 2nd attack. To have access to that where I am coding the round, I would have to do player->monster->attackNumber2(opponent), but since my monster is protected, I don't have access to it.

    So basically, as my player possesses an object "monster" which doesn't have an inheritance relation, should I put my monster as unprotected/public?Or should I have a method in player which calls the monster's method? (that solution seems too complexe as I would add more pokemons to the teams, thus more methods...)

    I am not used to asking code question, so feel free to ask me to add more information.

    EDIT: solution: use lists to contain the 3 monsters inside the player object, and a list to contain 4 attacks inside the monster object. I had repeated methods for each attack, with lists I'll have one method do it's thing on a selected attack/monster from the list.

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

    Looking for career advice

    Posted: 17 Dec 2020 08:58 PM PST

    For years I've toyed around making games/simulations in Unity as a hobby. I love programming in this way and was thinking that perhaps it could make a good career. I would prefer not to go college so I'm wondering a few things.

    1. Given that I enjoy this type of programming, which programming career do you suggest?
    2. What else in addition to a coding boot camp would you recommend to build a portfolio?
    3. Are there many coding jobs available which allow you to work from home?

    Just trying to get a feel for what's realistic in this field.

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

    Best approach on controlling CPU and GPU fan speeds?

    Posted: 17 Dec 2020 03:50 PM PST

    My goal is to create a program that allows me to control my computer's fan speeds. I am aware of applications such as SpeedFan, or openhardwaremonitor, but I am looking to create something from scratch. I am currently reading up on WMI, but was just wondering if anyone had any tips or previous experience as I dive into this project. It's not commercial or anything like that, just a personal project I wish to complete. I should mention that my computer is on Windows, and the program will be for my computer only. Many thanks.

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

    Stop defaulting base branch to original repo's master in GitHub

    Posted: 17 Dec 2020 03:48 PM PST

    I forked a repo, not because I wanted to contribute to it, but because I wanted to take ownership of it. Now, whenever I go to create a PR on GitHub, the default branch that it wants to merge into is the master branch of the original repository, instead of the master branch of my new repository. How can I change the default to be my repo's master branch?

    https://i.imgur.com/LhbCLox.png

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

    Need advice to get started as a MERN stack freelancer

    Posted: 17 Dec 2020 09:26 PM PST

    So I am almost done with Learning MERN stack , how do I get started to as a freelancer ? I mean where can I find some to projects to work (for free , so that I can get experience) so that I can put them on my portfolio ?? Any suggestions would be helpful .

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

    Programmatically generated self-signed TLS Certificates (?)

    Posted: 17 Dec 2020 01:47 PM PST

    Hi,

    I'm currently struggling to come up with the right way to secure my client-server JVM application. My focus lies on protecting all connections between the client and the server so that a MITM could not read the traffic or even send their own stuff to the client or server.

    • As said, I am working on an application and not a service. This means that I have no control over where exactly the clients and server executables will run. And in turn, that also means I can't work with trusted TLS certificates (more on that later). I think this restriction is what makes my case so complicated.
    • The entire communication between server and client happens via gRPC. Now, gRPC only lists a few encryption / authentication / security measures that are possible to implement, and of those, only one seems to be applicable for my use-case: TLS. The problem is, however, that gRPC with TLS requires some kind of certificate. I can not use a trusted CA, nor can I tell the user to generate their trusted or self-signed CA themselves.
    • This means that the only option I have left is to actually generate the self-signed certificates from within the server application. The Java KeyStore API might help me with that..

    I am a complete beginner in Encryption and SSL/TLS topics, and I don't understand most of the measures I have to take. What I know is that I need:

    • A certificate chain file in .pem format
    • A private key in .pem format

    on the server, and

    • Some kind of ChannelCredentials object

    on the client.

    The behavior that I'd desire would be that the user can specify a password at the first startup of the server application, and then is prompted to supply that password each time the client application requests a connection to the server.

    I am very confused about how to achieve this relatively simple (I thought) behavior. Any help would be greatly appreciated!

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

    Need Help with handling images in an express application !

    Posted: 17 Dec 2020 09:12 PM PST

    So I am new to web development and currently learning express and nodejs by building a personal project . I want to allow users to upload images which I intend to store in uploads folder inside of public folder in express app . My question is how do I get the names of images so that I can append it to the string /public/uploads and store that path as a string in array which in turn would be stored as a JSON in MYSQL database . I intend to fetch the images using path in array to create a bootstrap carousel . How do I accomplish this ?

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

    Does MCTS work for non-binary games?

    Posted: 17 Dec 2020 07:00 PM PST

    All of the tutorials I have read used games that had a definitive win/lose/draw once simulated to its end. I am trying to write a Monte Carlo Tree Search (MCTS) agent for a card game (Hearts for those that know it). It is not as black and white as "I win, opponent loses." It is more like "I am closer to winning after this round than my opponent is to winning."

    The situation I am concerned about is this:

    Let's say it is the computer to play, with cards A and B. A is a 1 point penalty card that the computer will win if it chooses to play it, and B is a card that will allow the computer to give the penalty card to the human player, but sacrifice any chance of winning the human's bonus card C worth -10 points (the goal of the game is to have a low score).

    The human player also gets a choice of cards once the computer has played. C, a bonus card worth -10 points, and D an arbitrary card worth 0 points.

    If the computer chooses B, it will see itself in a 9 point deficit 100% of the time - the player will win the -10 point bonus and the 1 point penalty.

    The choice I am concerned about is the computer picking A - it would see itself winning the penalty point card and the bonus card for a 9 point lead 50% of the time (the promising node), and be at an 11 point deficit the other 50% of the time (the random playout shows the player not giving the computer bonus card C). In reality, there is a 100% chance the computer will be at an 11 point deficit, because the human giving away bonus card C would be an egregious error.

    If it were the last hand of the game and the computer needed the bonus card to not lose, yes playing penalty card A and hoping for a horrible mistake by the player would be the only promising strategy, but what if it is the first hand and the goal is to keep the human player's advantage to a minimum going into the next round?

    How does MCTS handle mistakes that real players would never make in its random playouts? Should I look for a different algorithm (Minimax is out of the question as the tree is too large) or am I missing something?

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

    Move a repository to another server GIT

    Posted: 17 Dec 2020 02:48 PM PST

    Hello everyone! I am trying to move a repository to another server without ruining anything. It is also worth mentioning that I need the full commit history as well. Can anyone give me a hand? Thank you

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

    Transferring data text

    Posted: 17 Dec 2020 06:12 PM PST

    Hello, I am trying to find an approach to "posting data" from one page to another. I have a database where you log in on one (index.html) page through authentication (to an admin page), and i want to update a text box with information back to the first page (index.html). What is the best approach to this?

    Also, are there any imports I could use for an advanced text box that uses features such as bold, underline, italics, etc.) Thank you

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

    I am doing a web development Internship and the requirements for the project are given in 1920px width but my laptop is 1366 x 768 , so I scaled down and did it proportion to my screen.

    Posted: 17 Dec 2020 08:10 AM PST

    But during review I was told I should've followed the given dimension, now I am modifying existing code in responsive mode and setting the given dimensions , its not impossible but I think it is stupid.

    what should I do?

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

    What is a TPS report?

    Posted: 17 Dec 2020 05:51 PM PST

    I think we all know why I'm asking

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

    What level do i have to get to understand new documentation ?

    Posted: 17 Dec 2020 02:05 PM PST

    After learning a bit of python I did my first discord bot with the help of YouTube video, however i wantes to go further so i checked the documentation and I either fogot to read something or i am too underskilled to understand. Is it normal ? I really tought it would be more like a tutorial and that it would have examples of implementation...

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

    App for company internal use

    Posted: 17 Dec 2020 07:00 AM PST

    I work in engineering department in a small electric devices company. Sometime customers ask for a technical report on the devices that comes for repair. I lose a lot of time making them because I need to talk with the worker that was assigned to check the device, take some photos, make a Word document and send it to the customer. My ideia is to have one tablet near the workers so that they can fill a custom form (with checkboxes and dropdown menus) and send it directly to the customer via email or be able to print it. Having a desktop client would be perfect also.

    My ideia is to hire a programmer on Fiverr but don't know where to look for. iOS/Android dev? Some specific language/software?

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

    How to decide first language to learn.

    Posted: 17 Dec 2020 11:49 AM PST

    Still unemployed due to COVID and thought I might as well learn something new to give myself a new skill and job opportunities. I don't want to put my full effort into learning the wrong language at first though. I've already learnt the very very basics of python, C# and delved deeper into HTML/CSS and javascript before realizing web design ain't my thing.

    C# and Python are the best options in my mind currently however I am leaning more towards C# as I view it as providing more freelance/sidework if I ever nab an actual programming job.

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

    "Unexpected end of input"

    Posted: 17 Dec 2020 11:46 AM PST

    I'm learning about continuations in loops. Why am I getting this error from the syntax below? I'm using javascript on visual code. Thank you for your time.

    var john = ['john', 'smith', 1990, 'teacher', 'false'];
    for (var i = 0; i < john.length; i++) {
    if (typeof john[i] !== 'string') continue;
    console.log(john[i]);

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

    Virtual / programmatic-access 2FA authentication

    Posted: 17 Dec 2020 05:43 AM PST

    An API I use has a short-lived access token. To get that token requires manually logging into a site with username / password as well as 2FA, getting the token, and then using that token.

    I was wondering if anyone knew of a sort of "virtual 2FA" I could configure to get around this for testing purposes; as in a library I could configure with a 2FA provider (Google authenticator in our case). I don't really want to make authenticating via this test user bypass 2FA (I'd prefer to entrust the testing app with a secret).

    If there's no virtual 2FA-device type of service existing, I'll probably try use something like PyOTP - so any recommendations on that or alternatives would also be cool!

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

    How do I put a price to my project?

    Posted: 17 Dec 2020 03:41 AM PST

    I know this is a question that comes up a lot in this sub but some guidance would be appreciated anyways as I have never done something like this before.

    So, recently I was approached by someone who needs a small piece of Software and asked me if I could do it and how much I want for the project. I have looked at it and am very confident that I can do it. I think it should take me about 10 hours.

    I am a student currently writing my masters thesis and would do this as a kind of side project.

    Does anyone have any pointers on how I could put a price tag to the project?

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

    Liquid code mentor

    Posted: 17 Dec 2020 10:18 AM PST

    My coworker & I create Shopify sites but rely heavily on apps and built-in theme features. We're tired of not being able to add seemingly simple design attributes and having to hire coders, so we want to learn liquid!

    Anyone know an expert in liquid code that would be willing to mentor us? We would reimburse said person for their time & expertise!

    Just a little about us, we are a digital marketing agency based in Mesa, Arizona called Swello. We're a young, passionate and quickly growing group, all of us under the age of 35.

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

    How to call this command using python? ffmpeg -i t1.jpg -i t1.mp3 t2.mp4

    Posted: 17 Dec 2020 05:28 AM PST

    this doesn't work(I put t1.jpg and t1.mp3 in the same folder as t1.sln)

    import os import subprocess title='test' vid="-i t1.jpg -i t1.mp3"+title+".mp4" output = subprocess.run(['ffmpeg', vid], stdout=subprocess.PIPE).stdout.decode() print(output) #ffmpeg -i t1.jpg -i t1.mp3 t2.mp4 

    https://ibb.co/hRpvQ1d

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

    Best and quick approach to build a website to sell ebooks

    Posted: 17 Dec 2020 09:04 AM PST

    Hey guys I need to build a website that I can tweak however needed. Additionally I need to sell ebooks through the website. I have no idea how to go about with this and I have basic knowledge of website development. I wanted to know the quick and easy way to achieve this, say in a week.

    Thanks in advance

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

    [Typescript] How do I make it so that my input field can't be filled only with spaces?

    Posted: 17 Dec 2020 04:52 AM PST

    I have a task to complete for my uni, but sadly I can't find a proper solution by googling. Any help?

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

    Software Architecture - Full models or not?

    Posted: 17 Dec 2020 12:54 AM PST

    Hello Reddit,

    If I have model, let's call it Person, and multiple applications (A, B).

    Person full model has 3 attributes :

    • Name

    • Address

    • Telephone

    Application A uses only Name and Address, but application B uses Address and Telepone.

    What's the better practice here ? Implement the full model in both applications ?

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

    Remove Objects from LocalStorage Array

    Posted: 17 Dec 2020 07:50 AM PST

    Hi all,

    maybe someone can help me, i have a contact List with different objects ("Persons"). I have set my persons in an array and set this array in localStorage. At the end of each Person, in HTML i have a red "x" to delete these person from my contact list. this works all. But if i want to remove this object in the same function from localStorage, everytime my complete array in localStorage will remove. so i tried much different keys an values by the removeItem-Method but don't get any solution. I show you my code here MyCode.

    Thanks for your ideas, in advance!

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

    No comments:

    Post a Comment