• Breaking News

    Saturday, May 30, 2020

    created a simple insult generator with pyhton. gave me ideas for my next project. now i have questions. Ask Programming

    created a simple insult generator with pyhton. gave me ideas for my next project. now i have questions. Ask Programming


    created a simple insult generator with pyhton. gave me ideas for my next project. now i have questions.

    Posted: 30 May 2020 10:15 AM PDT

    Hey guys im new to coding but have learned html css and some javascript. im trying to learn python now and made a program that would insult my friends based on the name that they entered into the program. this gave me the idea to use my raspberry pi and use facial recognition to see who a person is and then have a robotic voice read them a compliment that i entered about them. the idea is my family lives across the country and i would love to send them the device and set it on a counter. maybe certain times of the day i can have it active so whoever steps in front of it will be recognized and have the voice compliment them for me as im away. lol is this a doable project? what can i focus on learning that will help me do this??? thank you so much! my neices will love it if i can finish it!!

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

    How do you choose a language and get deeper with it?

    Posted: 30 May 2020 05:13 PM PDT

    As the title says, I think I become like those programmers who knows and learns a lot of programming languages yet never gets deeper with it/sticks to it, worst dont build softwares to it.

    I'm a fast learner and I can pick up languages faster, however once I feel: "Ah looks like I'm ok with this language and I know the basics of it time to jump into another language" instead of learning the language deeply.

    I'm amazed to other users here who knows their language very well and can explain why that function of that language acts like that.

    Also how do you pick a field in programming (web dev, software engineering, ml/ai, etc feel free to add some), do you just feel it or you try to do it and wait if you feel passionate about it?

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

    How do I make a program that displays some stuff?

    Posted: 30 May 2020 10:19 PM PDT

    I want to make a program or a script that would show certain images or graphics based on the values from a webpage. For example, on random.org, if I press the the button "Generate", it would generate a random number between 1 and 100. I want if the number is below 50 to show a red circle or square on the screen, and if the number is over 50 to show a black circle or square...

    What's the easiest and fastest way to do this?

    submitted by /u/Status-Enthusiasm
    [link] [comments]

    Need help with code for Diagonal Difference method in Java

    Posted: 30 May 2020 09:40 PM PDT

    The question is at https://www.hackerrank.com/challenges/diagonal-difference/problem as well

    Given a square matrix, calculate the absolute difference between the sums of its diagonals.

    For example, the square matrix is shown below:

    1 2 3 4 5 6 9 8 9 

    The left-to-right diagonal 1 + 5 + 9 = 15. The right to left diagonal 3 + 5 + 9 = 17. Their absolute difference is | 15 - 17 | = 2.

    Function description

    Complete the diagonalDifference function in the editor below. It must return an integer representing the absolute diagonal difference.

    diagonalDifference takes the following parameter:

    • arr: an array of integers.

    Input Format

    The first line contains a single integer, n, the number of rows and columns in the matrix arr.Each of the next lines describes a row, arr[i], and consists of n space-separated integers arr[i][j].

    Constraints

    -100 <= arr[i][j] <= 100

    Output Format

    Print the absolute difference between the sums of the matrix's two diagonals as a single integer.

    Sample Input

    3 11 2 4 4 5 6 10 8 -12 

    Sample Output

    15 

    Explanation

    The primary diagonal is:

    11 5 -12 

    Sum across the primary diagonal: 11 + 5 - 12 = 4

    The secondary diagonal is:

     4 5 10 

    Sum across the secondary diagonal: 4 + 5 + 10 = 19

    Difference: |4 - 19| = 15

    Note: |x| is the absolute value of x

    This is my code:

    public static int diagonalDifference(List<List<Integer>> arr) {
    int diag1 = 0;
    int diag2 = 0;
    boolean isMatrix = true;
    //checks if it is a matrix
    for(int a = 0; a < arr.size(); a++){
    for(int b = 0; b < arr.get(0).size();b++){
    if(arr.size() != arr.get(0).size()){
    isMatrix = false;
    }
    }
    }
    //adds diagonals top left to bottom right
    for(int i = 0; i<arr.size();i++){ for(int j = 0; j<arr.get(0).size();j++){ if(isMatrix){ diag1 += arr.get(i).get(j); } } } //adds diagonals top right to bottom left for(int i = 0; i<arr.size();i++){ for(int j = arr.get(0).size(); j>0;j--){
    if(isMatrix){
    diag2 += arr.get(i).get(j);
    }
    }
    }
    //returns difference of the two diagonals
    return Math.abs(diag1-diag2);
    }

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

    I have a question about tools to track my time for coding questions

    Posted: 30 May 2020 05:38 PM PDT

    I've been practicing coding technical questions on different platforms (Leetcode and HackerRank). I've found my approach and the time it takes has been inconsistent with my experiences in actual interviews.

    1. Are there any guidelines on the process of answering these questions? (Time breakdowns for formulating an algorithm, test cases, time analysis, code, and final review)
    2. Are there any tools (app or chrome extension) to track my performance/time while I practice answering questions on the coding platforms?

    I want to simulate the process of problem-solving coding questions in technical interviews outside of mock interviews. Just practicing the coding technical question is not enough for me, as it is easier to solve the questions without any pressure.

    Thanks in advance!

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

    In an MVC architecture, where should I put data?

    Posted: 30 May 2020 09:09 PM PDT

    I made a program in java that involves a student profile which has a course and a course has modules.

    Currently, the courses with all their modules are hardcoded and stored within the controller. I want to add a read from file function where the file contains the courses and modules. Where should I put this? Should I make a new class that stores all this? Where do I put that class?

    Normally I'd put data in a database but this time, it has to be inside the program (it's for university).

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

    Question about time complexity of an algorithm

    Posted: 30 May 2020 04:45 PM PDT

    Below is an algorithm ripped straight from this leetcode question. I just had an interview and in it I was asked the question "Write a function to find the first unique character in a string, and return it's index". Although copied from leetcode solutions, this is almost the exact answer I came up with. When asked what the time complexity of this is, I said O(n). The interviewer said I was wrong, and while I was trying to figure out what else it could be he told me that it was O(n log n) because of hashmap accesses being O(log n). I don't think that makes any sense. Am I correct here?

    class Solution { public int firstUniqChar(String s) { HashMap<Character, Integer> count = new HashMap<Character, Integer>(); int n = s.length(); // build hash map : character and how often it appears for (int i = 0; i < n; i++) { char c = s.charAt(i); count.put(c, count.getOrDefault(c, 0) + 1); } // find the index for (int i = 0; i < n; i++) { if (count.get(s.charAt(i)) == 1) return i; } return -1; } } 
    submitted by /u/SuicidalKittenz
    [link] [comments]

    Want to make a simple webapp, have no idea where to start.

    Posted: 30 May 2020 07:57 PM PDT

    I'm looking to make, basically, a contacts app as a web app, it'll allow you to sace contacts and notes.

    I know basic Python and havnt touched HTML+CSS in years (but I can pick it back up), but that's it.

    I've seen suggestions for Java script, react, Django, and so much more.

    Could someone please tell me what I need to create this project, so I can learn that and be a little more efficient than generally learning a bunch of languages?

    Thank you!

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

    I don't know what I'm looking for here.

    Posted: 30 May 2020 01:28 PM PDT

    I'd like to create a web app that displays an animation of words being written on a digital scroll. Kind of eloquently. Like someone writing a book, but just the text being written, not the quill or hand.

    I would like to interact with it. Being able to click on specific sentence and have a small dialog pop up.

    How would I go about implementing such a thing? What software, code, or framework do I need to create this? I was thinking at one point I would need to learn to animate with after effects.

    I'd appreciate any help and guidance.

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

    How to update data automatically (HTML/JQuery) plz help

    Posted: 30 May 2020 06:57 PM PDT

    So I am making a coronavirus tracking website, and I'm having a lot of trouble having my code update the data automatically. The data such as the number of cases will change when I refresh the page, but won't do it automatically. If anyone is able to help me out I would really appreciate it. Here is my JS code for the information:

    // create an async function to handle promised based execution order (async()=>{ // define some globals var update = async()=>{ // download the data console.log('Report: Download Started'); var url = 'https://cov19.cc/report.json?v='+Math.random(); var res = await fetch(url); var report = await res.json(); // set the last updated time $('#last_updated').text(moment.utc(report.last_updated).fromNow()); // get variable data var world = report.regions.world; var total_confirmed = report.regions.world.totals.confirmed; document.getElementById("total_confirmed").innerHTML = total_confirmed.commaSplit(); var total_critical = world.totals.critical; document.getElementById("total_critical").innerHTML = total_critical.commaSplit(); var total_deaths = world.totals.deaths; document.getElementById("total_deaths").innerHTML = total_deaths.commaSplit(); var total_active = world.totals.confirmed - (world.totals.deaths + world.totals.recovered); document.getElementById("total_active").innerHTML = total_active.commaSplit(); var total_recovered = world.totals.recovered; document.getElementById("total_recovered").innerHTML = total_recovered.commaSplit(); // hide the loading icon $('#loader').hide(); }; // store last updated date var old_last_updated; // check for the last update var update_check = async()=>{ console.log('Checking for updates'); var res = await fetch('https://cov19.cc/last_updated.txt'); var last_updated = await res.text(); // if the last updated date is newer than the stored last updated date then update the variable and update the table with the new data if(old_last_updated == last_updated)return; old_last_updated = last_updated; update(); }; // initialize update_check(); // check for updates every 60 seconds setInterval(update_check, 60000); })(); //cov19 prototypes String.prototype.commaSplit = function() { return this.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); }; Number.prototype.commaSplit = String.prototype.commaSplit; 

    In the console of my website, it will say "Checking for updates" but it will never update the data until I refresh. The only thing I wrote was the var's to get the number and cases, I am still new to Jquery so I'm not sure exactly how it works. Here is my HTML code to show the data:

    <p style="font-size: 60px; color: #F5F2D0; text-align: center; font-weight: 600; margin-bottom: 0" id="total_confirmed"> </p> 

    Basically just using id="total_confirmed" etc. Do I need to call the update function in my HTML code for my data to update automatically? thanks

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

    I want to move all the projects from my computer to a new one. Will uploading them to dropbox and downloading them on the new computer work just like cloning from GitHub? Any downside to this?

    Posted: 30 May 2020 06:11 AM PDT

    What I mean is let's say I have project XYZ on laptop A. Then I upload XYZ to dropbox, download, and open it on laptop B. Is this the same as cloning from GitHub?

    I want to do this because I have this big folder called "coding" and it's gonna be a lot of work to commit all my changes on all projects and push them. I'd rather just put the folder on dropbox and open it up from my new computer.

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

    Question about fbi/fim

    Posted: 30 May 2020 03:46 PM PDT

    I've been working on a project to create a family pictures slideshow device using a Pi I own. I have a program running that downloads everything from a Google Photos account into a folder and I would like to auto-start a slideshow from that folder.

    My first approach was to use fbi which worked great, except it can't handle the number of photos in the folder (3000+). After that I tried using fim which works great with large quantities of files but doesn't automatically go full screen and I couldn't find any way to change that. Spent around 1-2 hours looking up stuff on line and couldn't find anything helpful.

    Does anyone know of a way to work around fbi throwing "argument list too long" errors when given a large quantity of files or a way to make fim go auto fullscreen?

    submitted by /u/c-rn
    [link] [comments]

    Can somebody help me make sense of these two codes

    Posted: 30 May 2020 11:39 AM PDT

    #include <stdio.h> #include <string.h> void main(){ char c; int i, n, tr = 1; char *text[]={"sneg","nevreme","mecava"}; n=strlen(text); while (tr){ tr = 0; for(i=0; i<n; i++) { c = *text[i] ? (tr=*(text[i]++)): 0; if (c) printf("%c", c); } } } 

    output is snmneeevcgraevmae. Same thing for the code blow. But I don't see how you get to this. How does it jump to the second word after getting just one char from the first word? Are the indexees of char *text[] 0,1,2 for the three words or do the commas not matter at all?

    #include <stdio.h> void main(int argc, char *argv[]) { int i, tr = 1; while (tr) { tr = 0; for(i=1; i<argc; i++) { char c = *argv[i] ? (tr=*argv[i]++) : 0; if (c) printf("%c", c); } } } 
    submitted by /u/TheLazerShell
    [link] [comments]

    I want to make a program that gleans information from e-mails and creates a spreadsheet from it. Preferably gmail to Google Sheets. What is a good way to go about this?

    Posted: 30 May 2020 11:21 AM PDT

    I have half an idea of how I would do using c++, java or python and locally stored email files and Excel.

    Read in the email file. Look for the relevant string forms (example: dates) and write out to a text file then import the data to a spread sheet or maybe write the data directly to a spread sheet file, but is there any way to do this between gmail and google sheets in the cloud?

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

    Working through Bjarne Stroustrup's "Programming: Principles and Practice Using C++" and stuck on creating a word bleeper.

    Posted: 30 May 2020 10:35 AM PDT

    I'm new to programming and working through this book on my own time. So far I've had no trouble but I'm utterly stuck on Chapter 4's last Try This: Write a program that "bleeps" out words that you don't like; that is, you read in words using cin and print them again on cout. If a word is among a few you have defined, you write out BLEEP instead of that word. Start with one "disliked word." When that works, add a few more. The code that I have written in response is:

    #include "../../std_lib_facilities.h"; int main() { vector<string>sentence; string word = ""; for (string word; cin >> word;) sentence.push_back(word); string disliked = "broccoli"; for (string disliked : sentence) disliked = "BLEEP"; for (int i = 0; i < sentence.size(); ++i) cout << sentence[i] << "\n"; } 

    I'm not receiving any errors running the program but when I enter in a sentence, it spits out nothing in return. As in, the cursor just enters to the line below it. I tried testing the program without the BLEEPing task but it still doesn't print the vector. What is the issue and how can I solve it? I read of a solution using booleans but I have not covered that topic in the book yet so I would prefer to refrain from using that technique.

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

    confused on the asp.net /c# framework

    Posted: 30 May 2020 03:24 AM PDT

    student coming from react and node.js and wanting to learn asp.net core and c#

    What i understand is react is a framwork from js which is the programming language used to execute logic in your code.While node.js is sort of a backend server to call and build our own api's to be used in my main app. Would still use html and css to build our web pages.

    Now my question is asp.net core sort of a replacement for javascript, just that it's written in C#? and what would be a replacement for node.js in the asp.net ecosystem?

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

    Is there an efficient data structure for finding the smallest number above a certain value?

    Posted: 30 May 2020 03:21 AM PDT

    I have a container where I want to push in values and find the largest value much like a heap.

    But I also want to be able to retrieve the smallest value greater than some argument.

    Container values; values.push(105); // values = {105} values.push(26); // values = {26,105} values.push(78); // values = {26,78,105} values.push(79); // values = {26,78,79,105} int q = values.largest() // q = 105 int x = values.pop_least(59); // values = {26,79,105}, x = 79 int y = values.pop_least(10); // values = {79,105}, x = 26 int z = values.pop_least(80); // values = {105}, x = 105 

    I'm trying to write a memory pool. I feel like this might be a sensible strategy. push is a bit like freeing up a contiguous chunk of memory. pop_least is like a request for a chunk of at least a certain size, (where leftovers can be pushed back in).

    Options I've thought of so far:

    Store the values in a vector and insert values ensuring the list remains sorted (O(n) insertion, O(log(n) search).

    Store the values in a map where the hash function then search keys. (O(1) insertion, O(log(n)) search but with lots of hash function calls and loss of cache coherence.

    Store in a map with min-heap buckets. Round the hash values before assigning buckets. O(log(n/m)) insertion, O(log(m)*log(n/m)ish ~ log(n)ish) search.

    Am I barking up the wrong tree? Is there an efficient data structure for this task?

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

    How to show coding skills on a profile/blog site

    Posted: 30 May 2020 01:04 PM PDT

    Hey I'm working on a technical profile/blog page. Any suggestions for showing my coding skills other than building little web apps and such...

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

    Framework/Library/Something for desktop GUI?

    Posted: 30 May 2020 11:39 AM PDT

    Hi, I'm developing something of a personal project. It's a program with a core application that can connect with "frontends" using a very system-agnostic IPC. The core app itself is made in Go, same with the "CLI Frontend".

    I was looking for a framework or library or something for making a Desktop UI that can run other processes.

    The options I though were: - .NET Forms, but it's only for Windows (and I prefer something multi-platform) - Flutter, but support for Windows/Linux is in Alpha state - ReactNative, but (I think) doesn't support calling other apps - Electron, but is very overkill and heavy for just a dumb UI - QT/GTK, but both are in C/C++ (I mean, I could learn it, but I prefer not to) - Local REST API and Website, but I think it complicates the current design by a lot - JavaFX (this is what I currently see as best option of this list), but it's ugly by default and requires JVM installed

    Do you know any interesting and easy to use framework/library/package/whatever for desktop UIs?

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

    learning path for java or c# framework

    Posted: 30 May 2020 11:12 AM PDT

    I was doing php and like to move into something more higher language like C# or Java and a good framework for a specific language. If you're using these stacks can you recommend me a good path

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

    How to automate being alerted when a subreddit meets certain criteria...

    Posted: 30 May 2020 10:45 AM PDT

    How could I be alerted when:

    • A specific subreddit has no post within 8 hours >500 upvotes
    • A specific subreddit has no post within 24 hours >1000 upvotes

    etc. Is this possible in a simple-minded way?

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

    I am trying to create an Algorithm that can recommend users based on certain weighted attribute.

    Posted: 30 May 2020 09:51 AM PDT

    I am not sure how to approach this, I tried creating some formula but It is not accurate. Anyone got suggestion how I can approach this?

    I am building an algorithm that helps my team go through support ticket. Each of us are specialized in certain skill that is represented by point from 1-5. I want the algorithm to automatically give suggestion to which of my colleague should pick up the next ticket based on (our skill score (weighted), total backlog of ticket). The tickets are also represented from severity from 1-5 so 5 being less importance (easy) to 1 being (hard).

    I am trying to develop this algorithm but my approach is very linear model, that is someone with skill score of 2 gets calculated same as someone with skill score of 4. And someone with 3 severity 1 cases gets counted same with someone with 3 severity 5 cases. So this won't work anymore.

    I need it so the calculation knows that someone with 4 severity 5 cases has it easier backlog than someone with 2 severity 1 AND someone with 2 skill score should receive less cases than someone with 5 skill score.

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

    Citrix Virtual Apps and Desktops alternative for SolidWorks

    Posted: 30 May 2020 08:35 AM PDT

    Is there a budget method that allow for Remote Desktop Application (RDP), aka "remote access visualized SolidWorks." Other than paid Citrix Virtual Apps and Desktops subscription?

    It is required to have compatibility with Ryzen, X570, and Radeon (RX 5000) or Radeon Pro (300 USD budget).

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

    How can I detect Hue smart light changes by listening to network traffic?

    Posted: 30 May 2020 07:57 AM PDT

    I've got a computer that communicates with a smart display via web sockets to display information about my home. I want the computer to monitor the network and observe when Hue lights change so that I can display that state change via a UI.

    Is this the right approach?

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

    No comments:

    Post a Comment