• Breaking News

    Monday, June 1, 2020

    Why aren't chat apps able to message other chat apps like we do with email? Ask Programming

    Why aren't chat apps able to message other chat apps like we do with email? Ask Programming


    Why aren't chat apps able to message other chat apps like we do with email?

    Posted: 01 Jun 2020 09:57 AM PDT

    I was thinking about how cross-play is possible now (Playstation gamers playing with Xbox gamers) and how email works.

    When it comes to messaging, you're stuck with the app that your contacts use.

    Why don't they work like email? Where you can different services and still talk to each other.

    I'm assuming it's not because it's technically impossible, but because people don't demand it, or because no one invented a protocol that everyone could use.

    So, what would it take?

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

    Java calculator program help

    Posted: 01 Jun 2020 07:44 PM PDT

    I need to make a program in java that asks the user if they want to add or subtract and so on. I'm trying to get it to ask if he needs an operation that requires two numbers or just needs one. The problem I run into is the first panel apers and says " What operation would you like to perform" but then when I put what I need the second panel doesn't appear. Why aren't the other panels appearing? I believe the problem is because of the if statements. It's my first program for my class so I'm still not sure how to use if statements that well.

    /*
    *This program will perform basic functions of a calculator
    */
    import javax.swing.JOptionPane;
    public class MyCalculator1 {
    public static void main(String[] args){
    String Operation = JOptionPane.showInputDialog(" What operation would you like to perform"+
    "\n (+,-,*,/,%,power,max,min,sqrt,cbrt,sin,cos,tan,log):");

    if(Operation.equals("+") && Operation.equals("-") && Operation.equals("*") && Operation.equals("/") &&
    Operation.equals("%") && Operation.equals("power") && Operation.equals("max") && Operation.equals("min")){

    String x = JOptionPane.showInputDialog(" Please enter the 1st number:");
    String y = JOptionPane.showInputDialog(" Please enter the 2nd number:");
    int a = Integer.parseInt(x)+Integer.parseInt(y);
    int b = Integer.parseInt(x)-Integer.parseInt(y);
    int c = Integer.parseInt(x)*Integer.parseInt(y);
    double d = Double.parseDouble(x)/Double.parseDouble(y);
    int e = Integer.parseInt(x)%Integer.parseInt(y);
    double f = Math.pow(Integer.parseInt(x), Integer.parseInt(y));
    int g = Math.max(Integer.parseInt(x),Integer.parseInt(y));
    int h = Math.min(Integer.parseInt(x),Integer.parseInt(y));
    if (Operation == "+"){
    JOptionPane.showMessageDialog(null,"The sum of "+x+" and "+y+" is:"+a);}
    else if (Operation == "-"){
    JOptionPane.showMessageDialog(null,"The difference of "+x+"and "+y+" is:"+b);}
    else if (Operation == "*"){
    JOptionPane.showMessageDialog(null,"The product of "+x+" and "+y+" is:"+c);}
    else if (Operation == "/"){
    JOptionPane.showMessageDialog(null,"The quotient of "+x+" and "+y+" is:"+d);}
    else if (Operation == "power"){
    JOptionPane.showMessageDialog(null,x+" raised to the power "+y+" is:"+f);}
    else if (Operation == "%"){
    JOptionPane.showMessageDialog(null,"The reminder of "+x+" and "+y+" is:"+e);}
    else if (Operation == "min"){
    JOptionPane.showMessageDialog(null,"The smallest value between "+x+" and "+y+" is:"+h);}
    else if (Operation == "max"){
    JOptionPane.showMessageDialog(null,"The largest value between "+x+" and "+y+" is:"+g);}
    }
    else if(Operation == "sqrt" && Operation == "sin" && Operation =="cos" && Operation == "tan" && Operation =="cbrt" && Operation =="log"){
    String z = JOptionPane.showInputDialog(" Please enter the number:");
    }

    }
    }

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

    Career path for c++/Qt developer

    Posted: 01 Jun 2020 02:17 PM PDT

    I am a software developer (automotive field) working with c++ and Qt since 3 years. As of now, i feel a bit lost as of how do i continue along a specific career path. I am sure a lot of people must have been in this dilemma.

    I like programming and i like space stuff too. I have been trying to get into space industry where i can challenge my skills and improve myself as a programmer but so far i got rejections. Understandably, due to inexperience in the field.

    I would love to learn from the community developers here as how did they manage to transition between industries. What skills did they acquire in order to do so. Or, in general, what skills does it take to get into space industry as a programmer.

    Developers can share their experiences here. Would help a lot of budding developers like me.

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

    Suggestions

    Posted: 01 Jun 2020 05:52 PM PDT

    Hi guys..... I am a newbie in the world of programming and I am really conflicted on which language to start with. I mean i have read a lot of post, blogs and videos etc mostly about python, basic and JavaScript but I don't seem convinced which shuld be my first language. I am interested in game programming and web development. Read a blog about python it highlighted that first programming language actually goes a long way in shaping one's career. I would greatly appreciate your suggestions and assistance.... Thanks

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

    To those that are involved in hiring programmers...

    Posted: 01 Jun 2020 02:09 PM PDT

    I recently graduated with an associates in computer science with a focus in computer programming. I was hoping this would be enough to land me a job, however, it looks like my knowledge is still lacking to actually get a real job. Even entry level jobs request a bachelors.

    Here are my questions

    1. What skills should I be looking to add to my resume? And on my resume where should I list skills I obtained through self study?

    2. I have been told to develop a portfolio, what kind of projects are impressive?

    3. I have thought about internships but everyone I have applied to wants a junior or senior working on their bachelors? Are their internships available for Just us Associates Degree holders?

    4. What things disappoint you about candidates that you don't hire? In other words, what are the main reasons you are not hiring someone?

    If anyone can spare the time to answer, advise, or just share input I would appreciate it

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

    Best practice regarding tradeoff between code neatness/understanding and performance

    Posted: 01 Jun 2020 08:06 PM PDT

    Hey everyone,

    I'm using my time in quarantine by working on my first side project after recently graduating from university which calculates probabilities of certain outcomes in a game of Yahtzee given your roll number and the current values of your 5 dice. Doing so requires a bit of combinatorics and frequent raising of probabilities to a certain power. My question is: Is it ever reasonable to give up small performance advantages in favor of legibility and understanding of the code?

    Taking the following block of code in Java as an example:

    probability = Math.pow(0.16667, 5) + (nCr(5,4) * Math.pow(0.16667, 4.0) * Math.pow(0.83333, 1.0)) + (nCr(5,3) * Math.pow(0.16667, 3.0) * Math.pow(0.83333, 2.0)) + (nCr(5,2) * Math.pow(0.16667, 2.0) * Math.pow(0.83333, 3.0) * probBreakEven(roll + 1, count + 2)) + (nCr(5,1) * Math.pow(0.16667, 1.0) * Math.pow(0.83333, 4.0) * probBreakEven(roll + 1, count + 1)) + (Math.pow(0.83333, 5.0) * probBreakEven(roll + 1, count)); 

    The above calculates the probability of rolling 3 or more of a certain value of dice over 2 remaining turns (it is the case where you have already rolled the dice once, and have had none of the desired value appear). Some parts are clearly redundant, such as nCr(5, 1) (which calculates 5C1) and Math.pow(0.16667, 1.0), but as they run in O(r) and O(1) time respectfully, I'm wondering if it's worth keeping these trivial function calls in for the sake of cleanly mirroring the combinatorics equation? Or is it better to leave them out and ensure the block is well commented explaining what the calculation is doing?

    I'd appreciate any input on best practices!

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

    How to learn JavaScript

    Posted: 01 Jun 2020 04:02 AM PDT

    I am starting to learn JavaScript after HTML and CSS. And I am confused about which is the best was to learn it I like online classes and following along and i also like sites like Codeacademy Any advise?

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

    Need help fixing a 404 error when application is deployed to heroku

    Posted: 01 Jun 2020 04:47 PM PDT

    I have been working on a small portfolio project to help me in the application process. My idea was to use the nodemailer npm package to create a working contact form, using react to build the frontend and express to handle the backend. The app itself works as intended in development mode and in production when I run it on my local machine, but when I deploy it to heroku, I get a 404 when I try to hit the route that sends the actual email.

    I'll post a link to the stackoverflow post I made earlier today, it has all the code snippets attached. Thank you in advance for any insight you may have, I'm all out of ideas.

    https://stackoverflow.com/questions/62142379/react-app-with-express-backend-returns-404-for-api-calls-when-hosted-on-heroku

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

    Recently completed a full stack webdev bootcamp, working on resume and portfolio. Would it be taky to buy a portfolio template?

    Posted: 01 Jun 2020 04:43 PM PDT

    So i'm looking here: https://themeforest.net/search/react%20portfolio

    These seem cheap enough, professional, sleek, and look stunning. I think if i'm allowed to work with and use this code, it could help my understanding of how it was created which would be cool. and save me a ton of time creating one myself.

    Has anyone had experience with this website and using these examples?

    is it taky to buy a template?

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

    What is the best and right way to open-source packages from a company monorepo?

    Posted: 01 Jun 2020 03:27 AM PDT

    There are a few tools to split commits from sub-dirs to a branch which you can then push to a public repo/monorepo.

    E.g. `git subtree`, https://github.com/facebook/fbshipit, https://github.com/splitsh/lite, https://github.com/ingydotnet/git-subrepo.

    A lot of these approaches though rely on the source-of-truth being the internal company monorepo. PRs are synced internally, merged, and then pushed out. It means that someone outside the organization cannot be a maintainer, and the speed of PR merges is dictated by the available resources inside the company. So I'd argue this is not the right OSS way of doing things.

    Even if there are two public monorepos out in the open you can have similar problems trying to collaborate, because to modify one line of a package, you may need to pull a huge monorepo and its tooling down.

    Does anyone have a solution or an example of an OSS-friendly approach to monorepo open-sourcing?

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

    I made an app in code.org, is there anyway to use the app without a web browser?

    Posted: 01 Jun 2020 05:02 AM PDT

    I know this is stupid as hell and I shouldn't use code.org for developing apps, but I kinda suck at coding as it is, and I wanted to use the app I made in it, however, it seems it is web browser based, even after exporting the file. Does anyone know how to use it out of a web browser?

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

    Is there a better way to combine these two if statements?

    Posted: 01 Jun 2020 06:13 AM PDT

    Edit: I guess I wasn't as clear as I thought I was when asking the question... Sorry about that.

    I think I got my answer, and am just going to keep it as is.

    Thanks for all the responses!


    This is some some C++ code that I saw a co-worker write. Personally I think it could be simplified and optimized a little bit. If a simplification of this block works in pure C too, that'd be awesome.

    x = someFunc(); if ( x == z ){ x = someFunc(); } if ( x == z){ // do stuff } else{ // do other stuff } 

    Basically, this block really seems like it could be reduced in size quite a bit, either by combining the if-statements somehow, or looping somehow, but I'm just not seeing it... I figure at the very least, they could be combined into one single if-elseif-else type statement

    Thanks in advance if anyone has any suggestions? :) And sorry if this seems trivially easy haha

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

    How can I write a python program to solve cartoon algebra puzzles?

    Posted: 01 Jun 2020 01:45 PM PDT

    I came up with an idea to write a program to solve those viral emoji/cartoon maths problems, such as this: viral algebra puzzle

    My goal is for the user to input one of these questions as an image, and then the output of the program would be the answer to the question, and the values for each of the variables.

    I want to use Python for this project, but I have no idea where to start. Can anyone with more experience point me in the right direction, maybe helping me decide what packages/libraries I should be using. Furthermore, how feasible of an idea is this for someone who is at a beginners level still?

    I assume some image recognition would be required, but I am unsure of the details/how to go forward with this.

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

    Does anyone here have experience / recommend "source insight"

    Posted: 01 Jun 2020 01:31 PM PDT

    If price is not a consideration (my org pays for it), would you recommend its usage? is it really that much better than all the other editors?

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

    Open source tool to automate test data creation for office files

    Posted: 01 Jun 2020 01:09 PM PDT

    Does anyone know of any open source tools that helps automate creating test data as office files, such as word, excel, etc. For example, generating word docs with bookmarks, tables, etc. if specified?
    Thanks

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

    Turning GeoTiff files into ASCII files in a loop, python

    Posted: 01 Jun 2020 12:52 PM PDT

    I'm a current masters student, and my final thesis is a modelling project. I've got hold of some .tif files but need to input them in the model in ascii format.I've found the gdal_translate function that can translate .tif into ascii, which works fine but I have 100's of .tif files I need to translate. Is it possible to do it in a loop?I don't have a lot of experience in python so currently I have managed to iterate though all the .tif files in a folder and add them to a list named "files".I then tried using the code:

    for filename in files:

    gdal_translate -of GTiff filename.tif filename.asc

    But this doesn't work, and I'm not sure what to do next as I have little python experience. does anyone know how to translate all these files from .tif to ascii in a loop?

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

    How to generate flashcards for language learning?

    Posted: 01 Jun 2020 12:28 PM PDT

    I don't know the first thing about programming, but I have an idea and I would appreciate some guidance on how to get started. I'm trying to automatically create language learning flashcards for a program called Anki. I would like to take some text files and search for all definite/indefinite articles (le/la and un/une in French) and then exact the sentences they are found in and format the text a little bit.

    I would like to take something like this:
    "Un homme avec une chemise." and turn it into:
    "{{c1::Un}} homme avec une chemise.; Un homme avec {{c1::une}} chemise."

    What would I need to learn to make this work? I have some interest in learning a bit of programming in the future, but right now I just want to learn what I need to get this to work. Thanks.

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

    Looking to extract data from a website to analyze words

    Posted: 01 Jun 2020 05:10 AM PDT

    Sorry if this is not the right sub to ask but I would like to be able to extract data from a website, essentially words so as to be able to analyze recurring words. Do you guys know if this is feasible at all, or if there is an already existing software to do that? Thank you!

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

    Bundling vs Zipping

    Posted: 01 Jun 2020 05:43 AM PDT

    I saw that both Mercurial and Git provides an option to "bundle" your files wherein you can convert an entire repo (or changesets) and share that file to share the repo. Now lets say I want to have a backup of my repo, I figured doing a tar and then storing it safely would be enough, until I noticed the bundle option. What is the difference between doing a bundle and regular zip/tar? I did notice that the bundle file is a lot smaller than the zip, how does Mercurial achieve this? Is going the bundle route a safe option? One disadvantage I could think of is (at least from a company standpoint, half the people in my company haven't heard of the bundle command and therefore would be stumped if they say a .hg file in the backup as opposed to a zip file)

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

    Javascript Order of Operations

    Posted: 01 Jun 2020 09:26 AM PDT

    I've had this issue for a while, and I can't for the life of me figure out what I'm always doing wrong.

    I'm convinced Javascript is designed to run precisely the opposite way of how I intend every single time. I'm having an issue with a simple mail sending function where it clears out the variables before it sends the email.

    Here's the function: https://imgur.com/a/2LwpkEL

    I've done a lot of google searching on this issue, and I must not be putting my question the right way, because it seems like there must be an obvious answer, but I can't seem to figure it out.

    Why is the function running twice? I have it running in an onSubmit event in a form, so my hunch is that it has something to do with that, but the alert runs twice on submit every time.

    Thanks in advance for the help!

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

    What happens if you put ASCII "control" characters in a link url and click it? Something bad?

    Posted: 01 Jun 2020 12:56 AM PDT

    Looking at a reference doc for a project, it says to remove ASCII control characters from user-input urls... For the project I'm working on, I don't need much validation or idiot-proofing of urls (http://a is fine, for example), but something about "ASCII control characters" has me... shook? And I can't find an explanation of why they would cause particular havoc in urls...

    Bonus question: "For security reasons, the Unicode character U+0000 must be replaced with the REPLACEMENT CHARACTER (U+FFFD)" is this something I should be worried about when parsing user input from a web app? It sounds like it could throw a wrench into things, I'm just not sure if this is something that's already done automatically by HTML inputs or Javascript for instance, or if it's something I should be checking before every database write, etc...

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

    Please could I get some help on this?

    Posted: 01 Jun 2020 03:39 AM PDT

    Hi, I' m working on a job board project, I'm using React/Node/Node-Fetch/Express/Redis

    I have a working fetch for Github jobs. But I'm a bit stuck on this one.

    This is for a website called Reed.co.uk - here are the docs: https://www.reed.co.uk/developers/jobseeker

    At the moment Github Jobs does not require an API key in the header.

    However Reed is saying this: ' You will need to include your api key for all requests in a basic authentication http header as the username, leaving the password empty.'

    I have my API key for Reed, just wondering how I would go about putting it in the header.

    Below is my current code for the Reed fetch

    var fetch = require('node-fetch'); const redis = require("redis"); const client = redis.createClient(); const { promisify } = require("util"); const setAsync = promisify(client.set).bind(client); const baseURL = 'https://www.reed.co.uk/api/1.0/search?keywords=accountant' async function fetchReed() { let resultCount = 1, onPage = 0; const allJobs = []; //fetch pages while (resultCount > 0) { const res = await fetch(`${baseURL}`); const jobs = await res.json(); allJobs.push(...jobs); resultCount = jobs.length; console.log('got', resultCount, 'jobs'); onPage++; } console.log('got', allJobs.length, 'logs') if (resultCount == 0) { console.log('0 jobs left to get.') } //filter const foundJobs= allJobs.filter(job => { const jobDesc = job.jobDescription.toLowerCase(); const jobLoc = job.locationName.toLowerCase(); if ( jobDesc.includes('remote') || jobLoc.includes('remote') ){ return true } return false }) console.log('filtered down to ', foundJobs.length) //set in redis const success = await setAsync('reed', JSON.stringify(remoteJobs)); console.log({success}); } fetchReed(); module.exports = fetchReed; 

    Any help would be great

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

    No comments:

    Post a Comment