• Breaking News

    Wednesday, March 31, 2021

    Math knowledge required for Algorithms learn programming

    Math knowledge required for Algorithms learn programming


    Math knowledge required for Algorithms

    Posted:

    I've been coding python for about a year and a half and I think I'm ready to take the next step to algos.

    I think I was a little naïve to the background math that would be required. Are there any recommended courses or topics that are really essential for understanding Algo patterns?

    Currently reading Python Data Structures and Algos by Benjamin Baka

    submitted by /u/Kitchen-Injury-8938
    [link] [comments]

    I created a chatbot in java but it forgets.

    Posted:

    Hello everyone. I made a simple trainable chatbot in java which i am very new to. It is very simple and i can train it but when i close it, it forgets everything. How could i create something where it would remember it? Here is the code:

    import java.util.*;

    public class January {

    HashMap<String, String> knowledge = new HashMap<String, String>(); public January() { knowledge.put("hi", "hello"); } 

    public void answer(String question) { Set<String> keys = knowledge.keySet(); for (String key : keys) { String lowerKey = key.toLowerCase(); String lowerQuestion = question.toLowerCase(); if (lowerKey.contains(lowerQuestion)) { 

    System.out.println("Bot: " + knowledge.get(key));

    return;

     } } trainMe(question); } public void trainMe(String question) { System.out.println("Bot: idk what to answer"); System.out.print("User Suggestion: "); Scanner sc = new Scanner([System.in](https://System.in)); String userInput = sc.nextLine(); knowledge.put(question, userInput); } 

    }

    The other class:

    import java.util.*;

    public class Trainer {

    public static void main(String\[\] args) { Scanner sc = new Scanner([System.in](https://System.in)); String userInput = ""; January chatbot = new January(); while(!userInput.equalsIgnoreCase("stop it")) { System.out.print("User: "); userInput = sc.nextLine(); chatbot.answer(userInput); } sc.close(); } 

    }

    I appreciate any help really.

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

    Currently in bootcamp but need more to get a job

    Posted:

    I worked in another non-related industry for over 10 years. I have an engineering degree in a non-programming related field. I don't have any background or experience at all with programming prior to this bootcamp. My current goal is to get my first job as a software programmer and start my new career. I don't mind getting an internship first, taking a less than ideal job, etc. I'm mostly interested in learning as much as I can in my early years so I can have a foundation for a great career.

    I'm currently in a 3 month long bootcamp. I am learning a lot but I don't see how someone could get a real job after this bootcamp, unless they had previous programming experience (which I don't). I am looking for online free or low cost courses or similar to do after this bootcamp is done, but there are SO many resources online I become overwhelmed. On top of that, a lot of them seem more for beginners and it's likely the material would overlap heavily with the bootcamp material.

    Any recs for resources or to point me in the right direction on how I can best improve my skills after bootcamp that will make me job market ready? I understand there's all types of resources for interviewing and similar, but that isn't the main priority for me right now. Thanks.

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

    2 YoE SWE, no related degree. Should I chase one?

    Posted:

    Hi everyone!

    I am a 25 years old, 2 YoE SWE, with a no related degree (International Relations), working with Go right now and had experiences with Ruby before.

    Every now and then I have some thoughts about having a degree in tech and how it could benefit my career. I'm from Brazil and here we have many options for college degrees related to tech (idk, like 5 different courses maybe, not only CS). It also applies to masters/postgraduate courses, where there are many different courses, some of them are related to software development specific.

    I have a good job as SWE right now and I make more than average for my role and for Brazilian standards, so I am not a person looking for the first job in programming.

    My question is: should I start from the bottom and learn things I already know about programming just to get a second degree? Should I pursue a master degree/postgraduate education for software development specific? Or should I just save my money and keep improving my skills while working and learning online?

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

    Can I learn C#/ Asp.Net Framework by doing Asp.net Core tutorials?

    Posted:

    Hey guys

    I've recently got a new job offer as an entry level .NET developer. I wanted to get better with C# and I found out they plan on using asp.net framework for another 2 years or so before switching to Core.

    Can I learn how C# / Asp net framework works by doing the more updated dotnet core MVC tutorials?
    The reason I'm asking if because I know dotnet Framework is pretty mature but the tutorials surrounding it are pretty dated.

    If not, what advice / tutorials can you suggest in learning these two?
    P.S - please don't suggest Mosh's tutorials on Udemy, I tried them and I really hated how he would skip important steps.

    Thank you!

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

    Can someone explain to me the codes of the following

    Posted:

    import SwiftUI

    class Order: ObservableObject {

    u/Published var items = [MenuItem]()

    var total: Int {

    if items.count > 0 {

    return items.reduce(0) { $0 + $1.price }

    } else {

    return 0

    }

    }

    func add(item: MenuItem) {

    items.append(item)

    }

    func remove(item: MenuItem) {

    if let index = items.firstIndex(of: item) {

    items.remove(at: index)

    }

    }

    }

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

    C# Arithmetic Outputting as 0's

    Posted:

    I'm currently working on a C# program for my class. I've almost built my code with no errors, but my calculations are not performing as intended. This is my last resort. I've begged my professor, TA, classmates, and friends to help me and none of them can figure out my problem. I've posted pictures of the form aspect of the code (Here: https://imgur.com/a/julUWF4 ), and pasted the code here. Any help would be immensely appreciated.

    Side note: I'm somewhat new to coding , so please take it easy on me. If pictures of the assignment or properties of labels and text boxes are needed for reference, please ask as I will be actively monitoring this thread.

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Program_3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } double[] SHIPMENTFEE = { 0.06, 0.0717, 0.07, 0.0874 }; // Array for shipment fees double[] COSTPERPOUND = { 7.87, 9.51, 10.73, 9.99, 11.99, 5.00, 4.58 }; // Array for cost per pound string[] FARMS = { "NE", "NW", "SE", "SW" }; // Array for farms int[] ITEMNUMBER = { 10001, 10002, 10003, 10004, 10005, 10006, 1007 }; // Array for item numbers int[] POUNDS = { 0, 5, 6, 10, 11, 20, 21 }; // Array for pounds double[] DISCOUNT = { 0.00, 0.05, 0.10, 0.15 }; // Array for discount private void calcButton_Click(object sender, EventArgs e) { int PRODUCTNUMBER; double QUANTITY = 0; double INITIALCOST; double DISCOUNTEDCOST; double SHIPMENTCOST = 0; double TOTALPRICE; double POUNDCOST = 0; double DISCDOUBLE = 0; double SHIPTOTAL; bool found = false; if (farmComboBox.SelectedIndex >= 0) { if (int.TryParse(itemEnterTxt.Text, out PRODUCTNUMBER)) { if (double.TryParse(quantityEnterTxt.Text, out QUANTITY)) { for (int i = 0; i < FARMS.Length && !found; i++) { if (farmComboBox.Text == FARMS[i]) { SHIPMENTCOST = SHIPMENTFEE[i]; found = true; } } for (int i = 0; i < ITEMNUMBER.Length && !found; i++) { if (PRODUCTNUMBER == ITEMNUMBER[i]) { POUNDCOST = COSTPERPOUND[i]; found = true; } } for (int i = 0; i < POUNDS.Length && !found; i++) { if (QUANTITY >= POUNDS[i]) { DISCDOUBLE = DISCOUNT[i]; found = true; } } } else MessageBox.Show("Invalid Quantity Entered."); } else MessageBox.Show("Invalid Item Number Entered."); } else MessageBox.Show("Invalid Farm Entered"); // Calculations for total final costs, and outputting to the correct boxes. INITIALCOST = POUNDCOST * QUANTITY; initialCostEnterLbl.Text = $"{INITIALCOST:C2}"; DISCOUNTEDCOST = INITIALCOST * DISCDOUBLE; discountedCostEnterLbl.Text = $"{DISCOUNTEDCOST:C2}"; SHIPTOTAL = INITIALCOST * SHIPMENTCOST; shipmentCostEnterLbl.Text = $"{SHIPTOTAL:C2}"; TOTALPRICE = INITIALCOST + SHIPTOTAL - DISCOUNTEDCOST; totalPriceEnterLbl.Text = $"{TOTALPRICE:C2}"; } } } 
    submitted by /u/Boring-Carob-7768
    [link] [comments]

    How to create a Pixel-Art Character Generator?

    Posted:

    Hi!

    I've got very limited programming knowledge (basic HTML and CSS) but I want to create a program that generates thousands of pixel-art characters

    I want to put these characters on different posters to put in my hallway

    I want to the characters to have the same basic features but then have different other features based on randomly chosen entries I will define (like sunglasses, skin colour, hats, hair etc) and I want these accessories to vary in rarity as I want certain characters to stand out in my poster

    Would this project be possible and how would I go about it?

    Thanks in advance! R

    submitted by /u/2247Nero
    [link] [comments]

    Is there a paid service to introduce coding to kids/teens?

    Posted:

    A friend of mine runs an organization for disadvantaged youth who don't have many chances to join clubs/buy training services outside of what he offers. A lot of them are recent high school grads, or younger high schoolers who don't really know where they want to go career-wise. Recently he was given a grant to increase their available tech in order to offer more interactive means of learning new skills and topics, and one thing he was interested in was buying some sort of software that could introduce coding and programming to the kids. I know there's free resources out there, but if there are better paid options, it might be more beneficial or have more to offer. Does anyone know of any software or subscription based service that could help teach kids the basics in a relatively entertaining way, and give them an opportunity to gain in interest in the computer science or programming field?

    Any suggestions would be appreciated. He has a budget of around $1000 CAD

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

    Getting back on track

    Posted:

    I'm a senior computer engineering student. I used to be really good with coding but unfortunately I swept away from it due to personal life issues, now after 2 years I barely able to write 10 lines of code. I do really understand coding from loops to OOP very good.

    I tried sites like codeingame and other similar sites but I struggle to do so (getting the idea of the code). I can't watch tutorials also it feels like I'm in an unbroken loop repeating the same stuff with no progress...

    Does anyone knows away to do correct me and be able to get back on the track again?

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

    Which database should I use to store about 200GB of financial data?

    Posted:

    Hi,

    I want to store financial information of around 600.000-800.000 companies and my estimated size for all that data is about 200GB as there are many tables with financial data like the balance sheet and income statement for multiple years. I though about using SQLite to store this info, but if I need to use a multi-threading approach to clean and store the data, it won't be possible (I believe) because it only allows one writer process at a time.

    I don't want to store data in the cloud, at least for now (because I don't want to pay for storage yet). I want to store all the data in my computer.

    Although I don't know if SQLite is the best choice, I really like the fact that it sits in a single file and then I can just zip and split it into files to backup into multiple google drives or mega drives.

    Would a Postgresql or any other database be better for this purpose? What are your recommendations? Is it easy to backup all the data in the case I have to change my HDD or want to reinstall windows?

    Edit: My first priority for now is to store the data in my computer and then analyze and make financial models.

    Edit2: The data consists of balance sheets, income statements, a list of owners that own other companies and a list of companies owned by each company.

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

    I'm learning C for the first time and I used getchar() and I don't understand why it's working.

    Posted:

    So we haven't learnt getchar yet in class but we were supposed to make a menu with switchcase and nest in a while loop so it returns to the start. I wanted the program to ask the user to press Enter before it returns. I found this piece of code through google.

    printf ("\n\n Press Enter to Try Again"); while (getchar() != '\n') getchar(); 

    So from what I read getchar() converts userinput to an integer.

    So what does this code mean?

    While userinput does not equal new line ask for userinput?

    Also why does this bottom code with curly brackets not wait for enter while the top one does?

    printf ("\n\n Press Enter to Try Again"); while (getchar() != '\n') { getchar(); } 
    submitted by /u/tinkertailor414
    [link] [comments]

    How do I read incoming Emails in Python?

    Posted:

    Example) I get a Email and my Python script automatically prints out the Email in a String.

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

    Advice

    Posted:

    Hi to all,

    First let me give some context. I started my degree in software engineering in 2013 and dropped out in 2015. Then I started doing business and due to covid I lost my business and had to start a job (I did a top-up bachelors and a marketing masters while I was doing the job). But doing this job doesn't feel like me. Now I feel like I want to restart my degree and get in to programming. But I M Turing 27 and have 3 years left in my degree. So I am not sure where should leave a stable job for this. So I would like some advice on this matter.

    P.S.

    I know this is not a career guidance thread but I feel like it's better to advice from people in the industry rather than career councillors

    submitted by /u/Right-Appointment769
    [link] [comments]

    what does "high level technical question" mean?

    Posted:

    Sorry if this is a stupid question, but does this mean coding a BST or finding a prime number?

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

    Trying to get piped text to appear as variable names

    Posted:

    Hey everyone, I'm working in Qualtrics, and I have a follow-up question for each of my 10 statements in a Matrix Table. I created a Loop & Merge (LM). I was able to modify each statement to appear grammatically correct and was able to use display logic. Here's the problem, the piped text in the follow-up gives the participant the NUMBERED response they chose instead of the variable name (e.g., You rated yourself as 1).

    I am unable to recode with words. Qualtrics only takes numbers when I try and recode. So I am trying to find a way around this.

    I tried Javascript. Messed around with switch and case, if and switch and case, parseInt(), innerHTML.

    I tried HTML. Messed around with switch and case there. Set up an id, tried switch and case, and tried to document.getElementById.

    It did not work, unfortunately. Kept researching, saw that working with formulas in excel could do the trick. Others have used Excel successfully with its concatenate function, just added the formula to a LM field. I figured I could use Excel's "IF" or "SUB" function, but I am stuck. Have not got it to work.

    I am VERY new at using Javascript, HTML, and the like. This is actually pretty fun!! I've been going at this for about a week now, and I still think this can be done. Any guidance would be appreciated! Trying to get variable numbers to change to variable names.

    TL;DR: changing the display of a predetermined number into a text (0 = never, 1 = fairly never, 2 = sometimes, 3 = often, 4 = fairly often)

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

    Looking to create an app like this one

    Posted:

    Hi guys

    I am looking into creating an app like this

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

    There are several game like this one out there already and I am looking to make a version with a slightly different take. I have a few questions if anyone can help.

    1. Roughly how long would it take to learn to build a game like this with no coding knowledge, for android only? Months? Years?
    2. How much would it cost to pay an app developer to make a simple game like this?
    3. What would be the best way to start creating this product? Best app creation service?

    Thanks!

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

    Q: How best to secure OAuth token in JavaScript?

    Posted:

    I've started using the Strapi CMS and its OAuth provider that makes it easy to integrate social media login in my simple JavaScript web app for buying digital items with PayPal.

    Once a user is authenticated, all the app can do is the following

    • Display signed in user's username
    • Display past purchases
    • Initiate a PayPal login and payment authorisation flow (payment collected by server).

    After the login flow has been completed, Strapi returns control back to my app with a JSON object containing the JWT and other properties.

    What is the best way to store this away from prying eyes?

    Encrypted cookie or encrypt it and store in RAM for current session use?

    I thought maybe it would be best for the app not to receive the token at all, but some sort of proxy information that is tied it, with the actual token stored on the backend.

    The backend then regularly checks whether the token is still valid by querying the provider.

    This authentication flow came to my mind but is it fit for purpose?

    Click frontend app social sign in button -> Redirected to OAuth provider sign in -> On success, callback to server by provider, returning JSON auth properties -> Server stores jwt, username, email and associates a UUID to this data -> Callback to frontend app with UUID and username 

    Would be grateful for any tips, or information on libraries that can help in securing OAuth tokens.

    Thanks.

    submitted by /u/gamedev-eo
    [link] [comments]

    Code Calculation is Slightly off and I Don't Know Why

    Posted:

    I am working on an assignment and it requires us to calculate the cost of a pizza order. I believe that the code is mostly correct but the calculation is usually just barely off, sometimes it gets the calculation right but other times it's off by a percentage of the total. Here is the assignment:

    You work at a pizza restaurant, which is starting to accept orders online. You need to provide a python function that will accept an arbitrary order as its arguments, and compute the correct price for the order.

    Your cost-calculator function should have four arguments:

    • pizzas
    • drinks
    • wings
    • coupon

    A single pizza order is formed as a list of toppings. For example

    • A pizza with no toppings (other than cheese and sauce is: [] (an empty list)
    • A pizza with pepperoni and a double order of olives is : ["pepperoni", "olives", "olives"]

    An arbitrary number of pizzas may be ordered, including no pizzas as all

    Drinks come in as a named order (i.e. a keyword argument 'drinks'). If drinks are ordered, they are specified as a list of sizes (possible sizes: "small", "medium", "large", "tub"). For example, drinks=["small", "small", "large"]would indicate an order including two small drinks and a large drink.

    Wings come in as a named order as well (keyword argument 'wings'). If wings are ordered, they are specified as a list of integers (possible sizes: 10, 20, 40, 100). For example, wings=[20]would indicate a single order of 20-piece wings.

    A coupon may be specified as the keyword argument 'coupon'. It is will be a single floating point number between 0 and 1. This indicates the fraction of the pre-tax price that is to be subtracted. For example coupon=.25would indicate a 25%-off coupon.

    A 6.25% tax is applied to every order. The tax is computed on the total cost of the order before a coupon is applied

    Round the price to the nearest cent, using the built-in function round. round(x, 2)will round xto two decimal places.

    Prices

    The prices are as follows:

    Pizza

    • $13.00

    Toppings

    • pepperoni : $1.00
    • mushroom : $0.50
    • olive : $0.50
    • anchovy : $2.00
    • ham : $1.50

    Drinks

    • small : $2.00
    • medium : $3.00
    • large : $3.50
    • tub : $3.75

    Wings

    • 10 : $5.00
    • 20 : $9.00
    • 40 : $17.50
    • 100 : $48.00

    Examples

    The following is an order for a plain pizza, a ham and anchovy pizza, two "tub"-sized drinks, with a 10%-off coupon:

    >>>cost_calculator([], ["ham", "anchovy"], drinks=["tub", "tub"], coupon=0.1) 35.61 

    This order consists only of a small drink.

    >>> cost_calculator(drinks=["small"]) 2.12 

    This is an order of two plain pizzas, a pizza with double-pepperoni, an order of a 10-piece and a 20-piece wings, and a small drink.

    >>> cost_calculator([], [], ["pepperoni", "pepperoni"], wings=[10, 20], drinks=["small"]) 60.56 

    Details

    You can assume that the front-end of the website will never pass your function erroneous orders. That is, you will never receive orders for items that do not exist nor items that contain typos.

    Consider defining individual functions responsible for computing the cost of the pizzas, drinks, and wings, respectively. Have cost_calculatorinvoke these internally. Alternatively, you can read ahead about dictionaries and make nice use of these in this problem.

    Our cost_calculator signature is empty. Part of the assignment is to come up with the correct function signature!

    My here is my code: Untitled2-Copy1 - Jupyter Notebook

    The input cost_calculator([], ["ham", "anchovy"], drinks=["tub", "tub"], coupon=0.1) is supposed to output 35.61 but instead my code outputs 35.38

    submitted by /u/Top-Donut2326
    [link] [comments]

    Is it true that shortest path among all the paths can only be found by BFS instead of DFS?

    Posted:

    This question is inspired from : https://leetcode.com/problems/shortest-path-in-binary-matrix/

    Now, doing a little googling I went to : https://cs.stackexchange.com/questions/4914/why-cant-dfs-be-used-to-find-shortest-paths-in-unweighted-graphs

    Why can't DFS find the shortest path? Using backtracking I can reset a path taking the last node away on each path. It will list all the paths. I can take a minimum of all the paths.

    Why is BFS better or preferred? Or is BFS the only correct solution?

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

    Help with a first project?

    Posted:

    Hello! I'm super new here - have never tried coding before at all! (Well I did lots of scratch as a kid but not sure that counts lol)

    I'm in a class about creative directing and advertising, and would love some advice for how to implement an idea I have. Basically I would like to make a concept for a website where users can make their own custom guitars. This would involve choosing guitar body types, colors, and potentially have the ability to draw directly on the asset.

    My questions are: is this a realistic project? It doesn't seem like it should be too incredibly difficult. I would love to have it be a functional website, but that's not 100% necessary. What language should work best for this? Also - what can I look up to get more information as to how to complete it? I don't even really know what would be involved in making this so literally any help or resources would be greatly appreciated :)

    Sorry if this is is an off topic post, I'm not sure how this subreddit works! Thanks so much for any help in advance!

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

    What are some good resources to learn Web App Dev

    Posted:

    I'm comfortable with java, python and c.

    looking into learning some web technologies and specifically into creating web apps (both browser based and desktop client).

    what resources do you recommend to learn and get a couple project ideas up by end of summer?

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

    Questions about learning programming

    Posted:

    I am trying to learn programming for the first time and I need your help. As a student I am struggling to find enough time to practice and learn programming.

    The main point of me asking you is to figure out how long does it take to learn a single programming language(it's my first time learning programming and I am trying to learn python), efficient way to manage time while learning programming.

    Also is it better to master a few programming language to senior level or learn multiple languages in junior level(considering one of my reasons for learning programming is to get possible extra credit on interviews).

    And considering what is my best option to prove that I know programming in professional enviorments such as potential job interviews or interviews for university/school interviews

    Also it would be nice to know which programming language should I learn. My plans are learning Python-> C->C#->Javascript. I don't know if I should learn both C and C#. I also don't know what to do with Java and JS.

    I'm sorry if these kinds of questions have been ask a lot before and I would appreciate the dedication you put into answering these queations.

    TL;DR: How should I learn programming languages(because I'm dumb)

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

    Thoughts on the notion of programming all day? Success or bust?

    Posted:

    I've been learning programming at a slow rate since I started my senior year of high school. I am currently a sophomore in college, and am looking to pick things up to quickly advance my career as a programmer.

    I am personally used to working/studying 8-12 hour days. However, with breaks and whatnot I probably really get 4-6 hours of work that you could regard as purely efficient. So, it's a chill vibe for me where I personally don't feel that I'm overworking myself or burning out. It's more like "Let me just focus on the tasks at hand for the entire day, so that my mind can revolve around these subjects and understand them completely".

    Applying this concept to programming, I know want to shift my focus to purely programming. My coursework is now manageable at approximately 2 hours a day, leaving me another 10 hours to just be coding all day.

    Has anyone ever had experience with practicing programming like you breathe air? Does it make a huge impact or is it an illusion of getting work done that you're not actually getting done?

    submitted by /u/19hexagon
    [link] [comments]

    No comments:

    Post a Comment