• Breaking News

    Monday, March 4, 2019

    Class design question to create an infection class that determines if a patient has an infection or not. Ask Programming

    Class design question to create an infection class that determines if a patient has an infection or not. Ask Programming


    Class design question to create an infection class that determines if a patient has an infection or not.

    Posted: 04 Mar 2019 09:47 PM PST

    I have an upcoming interview where this question might be asked. I might only have about 10-15 minutes to solve this program on a whiteboard. This question is not verbatim but what I could gather from online:

    "Create an infection class that determine whether a patient has an infection. An infection could be determined by several factors, one of them is based on fever. Everyone would have a different "normal" fever level, 1 degree fluctuation is considered normal. Identify infection locations."

    • Since everyone will have a different normal body temperature, my solution to handle this is to calculate the median value. Every time a patient temperature is recorded, we'll store it in an array with previous temperature, and calculate the median which will return an index and use that index to grab the median value.
    • Since +1 fluctuation is normal, I will add 1 degree to my median value and compare that against the recently recorded temperature. If the temperature is above my median+1 value, then the patient has a fever.

    The part where I'm confused is if fever is only one factor in determining an infection, how would I actually determine if the patient has an infection? Or would I only need to return a percentage of how much having a fever plays a part in determining the infection? The last sentence said to identify infection locations but that is impossible for a program to do since it would need a real doctor diagnosis. Please help.

    Guesswork is fine since the requirement is pretty much open to interpretation. I just trying to gain insights.

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

    Having a hard time with software testing homework

    Posted: 04 Mar 2019 06:08 PM PST

    What language for work order project?

    Posted: 04 Mar 2019 08:11 PM PST

    Hello!

    I plan to create a relatively simple work order program that will only be used locally. I am guessing that SQL will be necessary, but as someone who only has experience with HTML + Java, I could really use some advice as to which language(s) I should familiarize myself with.

    Thanks in advance :)

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

    How to google C and only C?

    Posted: 04 Mar 2019 05:48 AM PST

    I am coding with C and need to google a few stuff every now and then, but most of the answers are either for C++ or C#. How can I filter them out in google search?

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

    In C, how would I go about making a for/while loop that varies h from 10^-1 to 10^-8, in powers of 10?

    Posted: 04 Mar 2019 10:12 PM PST

    I have been struggling with loops for a while now as I always seem to make infinite loops.

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

    Questions about BPG.

    Posted: 04 Mar 2019 08:54 PM PST

    I'm a noob when it comes to programming and know almost nothing about webdev but I have a couple questions.

    If someone wants to make a website hosting images that use the BPG format which can dramatically decrease image size without worrying about licensing issues with HVEC wouldn't it be possible to convert images to BPG and then back to PNG and display those?

    Sorry if the question is stupid!

    My second question, does the type of container (let's say PNG vs JPG) have an effect on loading time or use of resources for images of the exact same size? (say if you have a webpage with 500 PNG images and a webpage with 500 JPG images of the same size, would they take a different time to load?)

    Thank you!

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

    Want to use a Raspberry Pi or the like to control servos and LEDs, what programming language would be best suited for this? Python?

    Posted: 04 Mar 2019 08:28 PM PST

    Can I run multiple node servers on a single CPU?

    Posted: 04 Mar 2019 08:21 PM PST

    I'm trying to understand how node.js servers work. Say I'm running on a t2.nano that has 1 vCPU or 1 CPU. On one CPU can I run 3-4 node servers?

    Because on a local vm with 2 CPU allocated, I can run a number of node servers by just opening up new terminals, but each node server runs on a new PID. How does work exactly? They must all be running on the same thread, right? But they're running on different event loops?

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

    (C) Probably a stupid question but why doesn't this if/else statement work?

    Posted: 04 Mar 2019 08:06 PM PST

    I have:

    #include <stdio.h> int main(){ int test = 0; if (test = 0){ printf("yes"); } else{ printf("no"); } return 0; } 

    When I compile and run it, it prints no. However, when I change it to:

    #include <stdio.h> int main(){ int test = 0; if (test = 1){ printf("yes"); } else{ printf("no"); } return 0; } 

    it prints yes for some reason! How can I change it so that the first one prints yes and the second one prints no?

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

    Node.js Event Loop question

    Posted: 04 Mar 2019 07:09 PM PST

    Hello,

    I have a question regarding Node's event loop and subprocesses. I have a node application that is using Bull.js. Bull.js runs in the background, but I'm not sure how this relates to Node's event loop. For example, a node server runs on a single thread. When I run the Bull.js listener in the background, is this running on another thread/subprocess?

    If this is the case, then does this mean that I need at least two CPUs to run an internal Node.js service - one for the Node.js server and one for Bull listener to run?

    Also, Bull.js allows you to sandbox a job, where it forks the process. Does this mean, there are three threads being used - Node server, Bull.js listener and the sandboxed job?

    Any help would be appreciated.

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

    Java scanner not reading file after export.

    Posted: 04 Mar 2019 06:47 PM PST

    I have been STRUGGLING to get this thing to work. I have an app that uses a scanner object to read a txt file. When I run the app in Eclipse, it reads the file fine. However, when I export it as a runable jar file, I get this error message:

    Error: java.io.FileNotFoundException: .\AustinBotScript.txt (The system cannot find the file specified) 

    and this is what the code to open the file looks like:

    private void openFile(String fileName) { try { this.searchABS = new Scanner(new File("./AustinBotScript.txt")); } catch (FileNotFoundException e) { Start.appendOutput("Error: " + e); } 

    It doesn't matter where i put the file, it is the same error every time. Also, the file is in the project bin folder, and also it is in the main root folder when I export it as a Jar. I have spent hours upon hours trying different things and I just can not get it to work. If someone would be as kind as to help me fix this issue I would be very thankful.

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

    Handling QNANs with SSE instructions

    Posted: 04 Mar 2019 12:14 PM PST

    I've got some SSE code which sometimes - not often - generates QNANs in some of the results. So a typical result might be:

    { QNAN, 0.123456, 1.235932, 10.289922 }

    Each result gets accumulated, but it seems that if I call _mm_add_ps then the QNAN ends up in the accumulator.

    Is there any way to force it to be treated as a zero so I can keep accumulating? It's a function which tends to 0 anyway, it just flips to a QNAN at 0.

    Or is there some simple/quick set of instructions to convert QNANs to zeroes while leaving the non-QNANs alone?

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

    Can I serve a react app from an express server?

    Posted: 04 Mar 2019 02:07 PM PST

    I know I can use express to server basic HTML and other file types, but I'm wondering if it makes sense to serve my whole app via express. I realize express is a backend, server package and react is front-end but I'm curious if this makes sense.

    At work we have react apps with an express backend and everything is run as one. I'm trying to understand how this works, but I want to know the basics first. Any insight you might have is appreciated!

    Thanks

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

    How to sort ALL of my chrome bookmarks into a dated list

    Posted: 04 Mar 2019 01:56 PM PST

    When I press F12, I can get an epoch code for individual links and convert them into our date system. Is there any tool available that can take all of my bookmarks, sorted by folder, sub folder, etc, and create a legible list sorted from newest to oldest? If not, can anyone point me to the right direction to begin creating it? Thanks!~

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

    Displaying values from WordPress API using observable

    Posted: 04 Mar 2019 04:07 AM PST

    Hello,

    I'm trying to fetch and display some of the posts using WP API, I got to the point where I can see the data in the console:

    1. {found: 1437, posts: Array(20), meta: {…}}
      1. found: 1437
      2. meta: {links: {…}, next_page: "value=2018-07-23T18%3A09%3A10%2B00%3A00&id=40614", wpcom: true}
      3. posts: (20) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
      4. __proto__: Object

    So I'm trying to use pipe to subscribe to observable and try to display some values from posts:

    <ul id="todo-list">
    <li *ngFor="let post of posts$['posts'] | async">
    {{post.title}}
    </li>
    </ul>

    However component displays nothing and console shows no errors. Could someone help me to understand how can I display data from async observable call? Thanks in advance.

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

    Loop exercise C++

    Posted: 04 Mar 2019 11:07 AM PST

    Hey all, my instructor has given us a list of 10 loop exercises he wants us to work on. I'm having trouble with the last one. I'm using C++. Any help would be greatly appreciated. Thanks!

    Create a guessing game, in which the computer secretly chooses a random natural number less than 10. Read input line-by-line, prompting before each one; if the input is not a number, print an error message; if the input is a number but not in the range of possible choices, print a different error message; if the input is the correct number, print a count of how many wrong guesses were made (counting only numbers in range) and stop.

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

    Can static libraries that don't rely upon the C standard library be compiled on one OS, then moved to another?

    Posted: 03 Mar 2019 11:42 PM PST

    I know that for full programs this is impossible because of executable file formats and syscalls, however if you had a file with: int add(int a, int b) { return a + b; } Could you compile it as an object file or static library on Linux, and then use it on macOS or Windows?

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

    What GUI library does Android and iOS use at the lowest level?

    Posted: 04 Mar 2019 07:04 AM PST

    Oauth2 token requests to Coinbase Pro (crypto exchange) Help

    Posted: 04 Mar 2019 02:51 AM PST

    Hi all. Iv been learning JavaScript on UDEMY so I can create a day trading robot on the Coinbase Pro crypto currency exchange as its impossible to safe guard my investment without one. I need more control over stop orders than CoinbasePro offer on their site.

    I got so many ideas how I would apply my trading logic but I cant trade because I cant yet connect to the secure API using my passphrase, key and secret key that I have set up. I am still very much a noob and don't know if I have the right tools in the first place? I am using XAMPP as a local host and sublime text for my editor. I have the documentation from the DEV site but Iv got no success from my first attemp.

    The example below is asking to place a buy order for 1 bitcoin (fat chance of that lol) but i would at least like some sort of error that show I actually communicated with the API properly. Until I can do this Im just stuck and I can't find any examples on the web for my specific problem, Iv even wrote to UDEMY support for help. Meanwhile Im just watching my investment go down the pan!

    CoinbasePro DEV site - https://docs.pro.coinbase.com/#creating-a-request

    This is the nodeJS example but Im using just JavaScript so this is probably the problem. Is nodeJS the compiler or should I be using PHP and run it from XAMPP? These are the basic things I am struggling with. To me Im not clear enough on which are compiler, translators, what software is best to run server side. I really dont want to pay for a host server yet as wanted to run locally. Im not confident enough to know whats secure yet lol. This is basic basic stuff but when I was at college in the early 90s its was only COBOL and C++ and Iv forgotten everything!

    How would you guys do this? What tools would you use?

    Thanks

    // My .JS file

    var crypto = require('crypto');

    var secret = '3aoS68gJFzCU----MY-SECRET-KEY----wuRpd9ZmS5UMP6EYkfDwbiD3bwRWw==';

    var timestamp = Date.now() / 1000;

    var requestPath = 'https://api.pro.coinbase.com/orders';

    var body = JSON.stringify({

    price: '1.0',

    size: '1.0',

    side: 'buy',

    product_id: 'BTC-USD'

    });

    var method = 'POST';

    // create the prehash string by concatenating required parts

    var what = timestamp + method + requestPath + body;

    // decode the base64 secret

    var key = Buffer(secret, 'base64');

    // create a sha256 hmac with the secret

    var hmac = crypto.createHmac('sha256', key);

    // sign the require message with the hmac

    // and finally base64 encode the result

    console.log(hmac)

    return hmac.update(what).digest('base64');

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

    Problem on Strongly Connected Components [Graph]

    Posted: 03 Mar 2019 10:34 PM PST

    This is the problem.

    I went about it like this -

    I remove the node with the least quality index and check for connected components in the graph. Then I look for the CCs that are bigger than K. I keep removing the least quality index node until the biggest CC's size gets less than K.

    Can you guys recommend a better way? Thanks!

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

    No comments:

    Post a Comment