• Breaking News

    Thursday, October 22, 2020

    Does coding become less fun when its a job? Ask Programming

    Does coding become less fun when its a job? Ask Programming


    Does coding become less fun when its a job?

    Posted: 22 Oct 2020 08:27 AM PDT

    I really like coding. Its like a puzzle almost. And I want to work in it not just because I like it but also because I think for the most part I'm good at it. But what I'm concerned about, is that while it may seem fun when you're doing it for yourself, does it become less fun when your working for it?

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

    Language Documentation!!!

    Posted: 22 Oct 2020 08:42 PM PDT

    Should I learn a programming language such as java using the official documentation? I have tried to learn with video tutorials, books etc. but they all are outdated.

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

    Encryption Help

    Posted: 22 Oct 2020 07:07 PM PDT

    Help finding ideas for new CS club

    Posted: 22 Oct 2020 05:57 PM PDT

    I've helped restart the defunct cs club at my school. I kind of became the defacto president but I'm not super experienced in coding. I'm a novice at python/java and have done some interaction with the web in python. So far I've mostly been having computer scientists speak about their careers but we need more engaging activities I am wondering if anyone has any resources or ideas for good mid level projects. Being able to meet in person is tricky due to covid and may be impossible. I think our university has some raspberry pis left over from the previous club.

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

    HomeworkHelp (c++)

    Posted: 22 Oct 2020 05:26 PM PDT

    Hello,

    here is the description for my assignment.

    " Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask the user for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month.

    After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period."

    The only error is for the output of total and average rainfall for each year. Every year after year 1 is output as combined total with previous years rather than it's own.

    #include <iostream> using namespace std; int main() { int numYears = 0; // declare variables. const int year = 12; float rainfall = 0.0f, totalRainfall = 0.0f; cout << "This program will calculate average rainfall over a period of years." << endl; // statemate letting user know function of program. cout << "How many years do you wish to average? " << endl; //prompting user to input number of years. cin >> numYears; while (numYears < 1) // condition that number must be at least 1 { cout << "Years must be at least one. Please re-enter: " << endl; // prompting user to enter number again is number less than 0. cin >> numYears; } for (int i = 1; i <= numYears; i++)// start nested loop { cout << "Year " << i << endl; for (int month = 1; month <= year; month++) { cout << "Number of inches of rain for month " << month << ": " << endl; // prompting user to enter number of iniches of rain for each month. cin >> rainfall; while (rainfall < 0) // condition for number not to be negitive { cout << "Rainfall must be zero or greater.\n" << "Number of inches of rain for month " << month << ": " << endl; // prompting user to enter number again if number less than 0. cin >> rainfall; } totalRainfall += rainfall; // store total rainfall } cout << "The rainfall for year" << i << " is " << totalRainfall << " and the average rainfall for the year is " << totalRainfall / year << endl; // output total and average rain fall for the year. }// end nested loop cout << "Over a period of" << numYears * year << "months," << totalRainfall << "inches of rain fell." << endl; // output total inches of rainfall over x number of months cout << "Average monthly rainfall for the period is " << totalRainfall / (numYears * year) << endl; // out average monthly rainfall return 0; } 
    submitted by /u/IceQweenItMe
    [link] [comments]

    Debugging Java Steganography project

    Posted: 22 Oct 2020 03:09 PM PDT

    Hey guys noobie programmer here. I have finished writing a Steganography program and while it does compile on eclipse on my Mac when I run it through Ubuntu with the same code I've been getting this error

    java.io.FileNotFoundException: /home/helb/fichiers_tests_pgm/code.pgm (No such file or directory) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:219) at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157) at java.base/java.util.Scanner.<init>(Scanner.java:639) at Steganographie.getImage(Steganographie.java:53) at Steganographie.main(Steganographie.java:25) Image zoomed and wrote into new file named 'zoomResults.pgm'. An error occurred. java.io.FileNotFoundException: home/helb/fichiers_tests_pgm/stringToImage.pgm (No such file or directory) at java.base/java.io.FileOutputStream.open0(Native Method) at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298) at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237) at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:126) at java.base/java.io.FileWriter.<init>(FileWriter.java:66) at Steganographie.zoom(Steganographie.java:198) at Steganographie.stringToImage(Steganographie.java:249) at Steganographie.main(Steganographie.java:43)

    i've included a pastebin link here https://pastebin.com/qXX1L92g with the full code so if anyone can help me out it would be really really nice. Thanks again.

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

    Question about non-disclousure

    Posted: 22 Oct 2020 11:20 AM PDT

    If an interviewer asks you what you did and what tools you used in your last job, how much are you allowed to talk about?

    i know it depends on your contract but generally speaking

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

    Put string from JSON into a var

    Posted: 22 Oct 2020 08:37 AM PDT

    EDIT: SOLVED. Needed JSON.parse. The whole line isJSON.parse(responseOD.body).access_token`


    I'm a Linux sysadmin with very little coding experience. I was asked to develop a demo RCS chatbot in nodejs that would echo back any message it gets. I'm surprised I even got as far as I did, and I only have one last thing to do. I'm really enjoying this project and I was hoping I could ask for some help for the last piece. I'm trying to create a variable OD and put the value of access_token

    I have this part of my code:

    request5(options5, function (error, responseOD) { if (error) throw new Error(error); console.log(responseOD.body); // <--------------------------- Third line var OD = responseOD.body.access_token; console.log(OD); // <------------------------------- Fifth line var ODtoken = "Bearer ".concat(OD); }); 

    The third line (I've written "third line" in the code snippet) returns this:

     { "token_type": "Bearer", "access_token": "cbYAmA9iElLteoAQrj9GsDT2VrnD", "expires_in": "7776000" } 

    but for some reason, the fifth line (console.log(OD);, I've written "fifth line" in the code snippet) returns:

    undefined 

    Does anyone know why the OD variable won't receive the access_token from the JSON response?

    Huge thanks ahead!

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

    Good way to connect multiple points

    Posted: 22 Oct 2020 01:45 PM PDT

    I wish to create a "road map" in which there is a series of points. Each point can connect to x number of other points. Numerous points may connect to a single point. Any thoughts what a good way to accomplish this is?

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

    Would you translate technical terms in non-English interview?

    Posted: 22 Oct 2020 01:33 PM PDT

    This post is targeted mostly on people living outside English speaking countries, but everyone could give their input.

    Lets say you live in Germany and go to technical on-site interview. The interview process will most likely lead to 3-way dilemma:

    • The interview will most likely be held in your country's official language (which is German in your case)
    • All the documentation and other sources you have every browsed to get knowledge were mainly written in English (with exceptions in very active communities)
    • The technical terms might not always translate between languages

    Obviously, you would not translate names like React, Node, CSS, etc. But what about technical terms like 'design patterns', 'library', 'framework', 'hosting', 'package managers', 'rendering', 'back-end', 'module bundlers', etc?

    Would you try to translate them to something equal in German or would you stick with English, when mentioning them?

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

    What is your favorite online code sandbox tool?

    Posted: 22 Oct 2020 01:33 PM PDT

    Setting up new project locally just for quick ideas and snippets usually is a bit of overkill, since it takes time to set up, requires use of many tools (like editor, browser and terminal) and you end up with extra files in your machine.

    That's where online code sandboxes come in. These requires no setup, includes all tools for tests/preview in single space and allow to quickly get rid of your snippets with just of a press of a button.

    For a long time I used a combination of [jsbin.com](jsbin.com) and [codepen.io](codepen.io), recently moved to [codesandbox.io](codesandbox.io) and never really looked back.

    What is your current favorite online code sandbox and why?

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

    What has been your favorite API to work with recently?

    Posted: 22 Oct 2020 01:33 PM PDT

    Developers often integrate information from other applications into their own software. That's where APIs come in.

    A good API is consistent, well-defined, fast, secure, and returns exactly what is requested. Could you re-call some of your recent favorites?

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

    Hey I wanted to make a new website, for my business. How do I get started?

    Posted: 22 Oct 2020 06:19 AM PDT

    Reports and charts - client-side vs server-side

    Posted: 22 Oct 2020 12:12 PM PDT

    For a web-based application (React front-end; ASP.Net back-end) I need to give users two things:

    1. Interactive charts that presumably fetch data from the server but are client-generated using plotly or one of the other ten million free or paid charting solutions out there.
    2. PDF reports that contain a bunch of "stuff" plus include non-interactive versions of the same charts from (1). User wants to download/schedule/send PDF's, so I'm presuming that they should be server-generated.

    I don't love the idea of developing a both a client-side charting component and a server-rendered charting component. Is there a way that I can "kill two birds with one stone"?

    I recognize that Tableau and PowerBI are appropriate to consider for this, but IMO [could be wrong tho] they are 500-lb gorillas that are cumbersome and costly to integrate. Is there a good lightweight solution for generating PDF-type reports server-side?

    submitted by /u/kirk-wgt
    [link] [comments]

    What exactly does "sane" (or "insane") software mean?

    Posted: 22 Oct 2020 08:06 AM PDT

    I've see developers say "sane" software a lot (eg. Wireguard is said to be sane VPN software). What exactly does this mean? I thought I knew what it meant but when i thought about it I didn't

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

    Implementing ArrayList

    Posted: 22 Oct 2020 07:12 AM PDT

    Hey,

    I'm trying to implement an ArrayList in java by myself.

    This is my code so far:

    Class Arrays:

    public class Arrays { public static Object[] expandArray (Object[]a) { Object[] a1 = new String[a.length * 2]; for(int i = 0; i < a.length; i++) { a1[i] = a[i]; } return a1; } public static void shiftElements (Object[]a, int n) { for (int i = a.length - 1; i > n; i--) { a[i] = a[i - 1]; } } } 

    Class ArrayList:

    public class ArrayList<T> { private Object[] listObject; private int size = 0; private static final int DEFAULT_CAPACITY = 10; public ArrayList() { this(DEFAULT_CAPACITY); } public ArrayList(int initialCapacity) { listObject = new Object[initialCapacity]; } public boolean isEmpty() { return size == 0; } public int size() { return size; } public void add(T obj) { add(size, obj); } public void add(int index, T obj) { if (index >= listObject.length -1) { listObject = Arrays.expandArray(listObject); } if (index <= size) { Arrays.shiftElements(listObject, index); } listObject[index] = obj; size++; } @SuppressWarnings("unchecked") public T get(int i) { return (T) listObject[i]; } } 

    I have the following test cases which actually succeed

    import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; public class ArrayListTest { @Test public void testIsEmpty() { ArrayList<String> list = new ArrayList<String>(); assertTrue(list.isEmpty()); list.add(0, "a"); assertFalse(list.isEmpty()); } @Test public void testSize() { ArrayList<String> list = new ArrayList<String>(); assertEquals(0, list.size()); list.add(0, "a"); assertEquals(1, list.size()); } @Test public void testAddGet() { ArrayList<String> list = new ArrayList<String>(1); list.add(0, "a"); list.add(0, "b"); assertEquals("b", list.get(0)); assertEquals("a", list.get(1)); } @Test public void testNull() { ArrayList<String> list = new ArrayList<String>(); list.add(0, null); assertFalse(list.isEmpty()); assertEquals(1, list.size()); assertEquals(null, list.get(0)); } } 

    But it still seems that something is wrong. Lets say I have the following main method:

    public class ArrayListMain { public static void main(String[] args) { ArrayList<Object> aList = new ArrayList<Object>(); aList.add("T"); aList.add("A"); aList.add("S"); aList.add("K"); aList.add("1"); aList.add(10, "K"); aList.add(0, "K"); for(int i = 0; i < aList.size(); i++) { System.out.println(aList.get(i)); } } } 

    The expected output is the following:

    K
    T
    A
    S
    K
    1
    NULL
    NULL
    NULL
    NULL
    NULL
    K

    But I get the following output:

    T
    A
    S
    K
    1
    null

    Can someone point me in the right direction? Thanks in advance

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

    Not getting back true or false with python?

    Posted: 22 Oct 2020 10:47 AM PDT

    In python Crash Course, I got to chapter 5 titled "IF STATEMENTS."

    If I type in one of the things it puts in there like

    "age = 18

    age == 18"

    All I get in return is "press any key to continue." The same thing happens with trying to do it with words. It doesn't print out true or false. Maybe I am missing something there, but I put it in just as the book says and am not getting the result it says you would. I don't know if it makes any difference, but I have been using visual studio.

    Edit: This is right at the beginning of the chapter, so I don't know what I am missing here.

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

    I need help asap

    Posted: 22 Oct 2020 10:45 AM PDT

    1. Implement and test a member function that inserts a specified value a certain number of times at some starting location in the list.

    // PRECONDITION: The Linked list may or may not be empty.

    //data is the value to be inserted.

    //quantity is the how many times data should be inserted into the list.

    //insertPosition is the location where the inserts are to start. Assume counting starts at 1. So an insertPosition of 1 means to start inserting values at the start of the list. An insertPosition that is less than 1 should be rejected and the function should immediately return false. An insertPosition that is larger than the number of nodes in the list should cause all the inserts to happen at the end of the list.

    // POSTCONDITION: The return value is true if the data is successfully inserted quantity times in the Linked list starting at location insertPosition. Otherwise, if the function fails to accomplish this, it should return false and the Linked List should remain unaffected.

    bool groupInsert (const NODETYPE & data, int quantity, int insertPosition)

    {

    }

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

    Need help with: Email, HTML, Webscraping, Python project.

    Posted: 22 Oct 2020 06:13 AM PDT

    New to programing and I have a project where the only option to export from an app is to email as a html file.

    I want to scrape the file using python and send the file back to sender as a pdf.

    I'm thinking it will work something like this:

    Export html file from app to convertfile@example.com

    Python checks convertfile@example.com inbox for new email with attachment and downloads file.

    Python converts and sends file to orignal sender.

    I'm wondering if I'm on the right track with this approach. If not, what would you suggest as an alternative?

    I can see this causing problems with people spamming convertfile@example.com, sending wrong file types, and downloading a virus.

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

    Rant: I despise R

    Posted: 22 Oct 2020 02:24 AM PDT

    Already posted this in r/Programminglanguages but was politely informed that I was in the wrong place. I must admit I'm mostly venting but I also have some questions.

    So, I'm not a very proficient programmer, but I do enjoy python. So intuitive. So clean. So pretty. Now I'm taking a biology course that uses R for some reason instead of python.

    Is there any advantage to using R over python? I understand the math behind what we're doing so much less when I use R, and so much more when I use python. Honestly I'm not sure if this bias is just because I'm pretty illiterate in R, but R.studio is ffing glitchy, it keeps changing my directory, skipping lines when I try to run all code lines, and I just miss printing things to the terminal....

    Also the installing functions and packages takes forever.

    TLDR; is there an advantage to using R vs Python in genetic biology? Or is it used simply because biologists have used it for a long time and are most comfortable with it?

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

    New to coding , Need some help with a project

    Posted: 22 Oct 2020 03:31 AM PDT

    Morning Guys

    I am pretty new to coding so sorry if this sounds stupidly simple but I am creating something in unity that involves a calculator and I am stuck at trying to code the square root button. Currently my code inputs for each button looks like this

    case "+": _result = _input + _input2; break; case "-": _result = _input - _input2; break; case "*": _result = _input * _input2; break; case "/": _result = _input / _input2; break; case "³": _result = _input * _input * _input; break; case "²": _result = _input * _input; break; case "√": _result = _input; Math.Round(Math.Sqrt(_input), 2); break;

    The square root doesnt seem to work for me after this was what was originally suggested to me , any solutions would be much appreciated

    Thanks

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

    How should I name "nth level siblings" functions over a graph?

    Posted: 21 Oct 2020 11:20 PM PDT

    help , im a noob at this , i don't understand how the if functions don't work

    Posted: 22 Oct 2020 01:03 AM PDT

    i have been working on this simple c program for 3 days and only made some minor improvements in my if functions . but after i input the "salary" , the if function skips the if and if else function , all the way to the else function.

    #include <stdio.h> #include <string.h> int main() { char name[30]; int period=1; double salary; double wtax=0; // 1 daily 2 weekly 3 semi-monthly 4 monthly printf( "Enter name: "); gets(name); printf( "Enter Period: \n1 daily \n2 weekly \n3 semi-monthly \n4 monthly \n: "); scanf("%lf",&period); printf( "Enter salary: "); scanf("%lf",&salary); printf("salary: %lf \n",salary); //Daily if (period == 1) { if (salary <= 685) //stage 1 { wtax = 0; } else if (salary <= 1095) //stage 2 { wtax = (salary - 685)*0.20; } else if (salary <= 2191) //stage 3 { wtax = 82.19 + (salary - 1096)*0.25; } else if (salary <= 5478) //stage 4 { wtax = 356.16 + (salary - 2192)*0.30; } else if (salary <= 21917) //stage 5 { wtax = 1342.47 + (salary - 5479)*0.32; } else //stage 6 { wtax = 6672.74 + (salary - 21918)*0.35; } } //weekl else if (period == 2) { if (salary <= 4808) //stage 1 { wtax = 0; } else if (salary <= 7691) //stage 2 { wtax = (salary - 4808)*0.20; } else if (salary <= 15384) //stage 3 { wtax = 576.92 + (salary - 7692)*0.25; } else if (salary <= 38461) //stage 4 { wtax = 2500 + (salary - 15385)*0.30; } else if (salary <= 153845) //stage 5 { wtax = 9423.08 + (salary - 38462)*0.32; } else //stage 6 { wtax = 46346.15 + (salary - 153846)*0.35; } } //semi-monthly else if (period == 3) { if (salary <= 10417) //stage 1 { wtax = 0; } else if (salary <= 16666) //stage 2 { wtax = (salary - 10417)*0.20; } else if (salary <= 33332) //stage 3 { wtax = 1250 + (salary - 16667)*0.25; } else if (salary <= 83332) //stage 4 { wtax = 5416.67 + (salary - 33333)*0.30; } else if (salary <= 333332) //stage 5 { wtax = 20416.67 + (salary - 83333)*0.32; } else //stage 6 { wtax = 100416.67 + (salary - 333333)*0.35; } } //monthly else if (period == 4) { if (salary <= 20833) //stage 1 { wtax = 0; } else if (salary <= 33332) //stage 2 { wtax = (salary - 20833)*0.20; } else if (salary <= 66666) //stage 3 { wtax = 2500 + (salary - 33333)*0.25; } else if (salary <= 166666) //stage 4 { wtax = 10833.33 + (salary - 66667)*0.30; } else if (salary <= 153845) //stage 5 { wtax = 40833.33 + (salary - 166667)*0.32; } else //stage 6 { wtax = 20833.33 + (salary - 666667)*0.35; } } //others else { printf("\n\ninvalid input\n\n"); } printf ("name : %s \n",name); printf ("salary type : %s \n ",period ==1? "daily" : (period == 2? "weekly" : (period == 3? "semi-monthly":"monthly"))); printf ("with holding tax due : %lf \n \n", wtax); return 0; } 
    submitted by /u/real_crazykayzee
    [link] [comments]

    No comments:

    Post a Comment