• Breaking News

    Saturday, March 6, 2021

    How to refresh C++ knowledge Ask Programming

    How to refresh C++ knowledge Ask Programming


    How to refresh C++ knowledge

    Posted: 06 Mar 2021 02:38 AM PST

    Hi,

    I'm not really sure if this is the right place to post this but I didn't really know where else to go. Back in 2015 I graduated from university in England with first class honors in a course for C++ Programming and Video Game Development.

    I spent around 2 years looking for work but after what felt like a dozen final interviews I was never able to find employment, I ended up having to work in Sales because simply not having a job just wasn't viable anymore. To say my confidence was knocked would be a gross understatement.

    I kept up with studies within the field until around 2018 but since then i've somewhat faded away from programming. However I am now looking to get back into it and reignite the job search but i'm at a total loss as to where to start.

    What would you recommend? As you can imagine having a 6 year gap on a CV is horrible and even then my programming knowledge is in need of refreshing. Are there any programming/C++ refresher courses that people recommend or any specific projects that you think I should take on? Any advice is welcomed.

    TLDR: finished uni 6 years ago but didn't find work, stopped studying 3 year ago, whats the best way to become hirable again

    Thank you for your time

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

    Looking for a cross-platform app framework I can use one codebase for desktop and mobile apps

    Posted: 06 Mar 2021 11:26 AM PST

    What I'm looking for is a framework that will allow me to create responsive desktop and mobile apps from one codebase. I also need it to sync data between all platforms and also work offline. One thing I should mention is that I want to use a relational database, so firebase would be out of the question.

    For example, think apple reminders. Works on desktop & mobile, and syncs between your devices. Only, I want to be able to create it for windows, mac, android, and iphone. Again, syncing between all devices, offline support, and one codebase.

    Does something like this exist? I was reading about Ionic but their desktop support seems questionable.

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

    What would be the best language for real-time screen recognition?

    Posted: 06 Mar 2021 03:41 PM PST

    Not sure if it's even possible, but basically I want a software to look for pixel colors and recognize shapes from the screen in the background and act accordingly to what it sees. Which language could be able to achieve such thing?

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

    Why isn't min heap used in heap sort which gives the sorted array directly?

    Posted: 06 Mar 2021 06:31 AM PST

    In heap sort(for ascending order), we first build max heap and then we swap the 0th index with the last index and run the heapify function for each iteration until the array is sorted. My question is why can't we just build a min heap which gives the sorted array easily?

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

    My son wants to make a video game. What would be the best way for us to start?

    Posted: 06 Mar 2021 09:52 AM PST

    I am familiar with a few languages, but not too experienced. Lately just python, but I've used BASIC, VB, C, C++, ASM in the past. He doesn't know anything and is more interested in some sort of GUI game making thing vs text, but I think he's out of luck there. Where should I start? I was thinking pygame? Or how much work is it to get started with an engine like godot or unity? Ideally we'd have something that is quick to get to something that looks like a game so that he doesn't immediately lose interest. Thanks!

    submitted by /u/-_Lost_-
    [link] [comments]

    My script does not want to run on startup

    Posted: 06 Mar 2021 09:38 AM PST

    I am trying to use a rpi4 running ubuntu to send its display output to a small display. It works fine (I do have to run "xhost +" in terminal before running it though because it doesn't work if I don't), but when I put it to run in rc.local, it runs for a bit (like around 150 frames) and then raises this error:

    XIO: fatal IO error 0 (Success) on X server ":0" after 899 requests (899 known processed) with 0 events remaining.

    Any idea why this happens?

    GitHub Link (The file is called SPI_Display.py)

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

    (OOP) How to dynamically create a Discount functionality in a shopping cart

    Posted: 06 Mar 2021 01:07 PM PST

    cross post - https://www.reddit.com/r/learnprogramming/comments/lyuw0u/oop_how_to_dynamically_create_a_discount/?

    I'm writing a shopping cart app. I have a discount of x% if price is greater than $500, discount of y% if # of items is greater than 10, or discount of z% if there's a buy 2 get 1 item free. The list of discount types will grow or shrink so I want to make Discount dynamic.

    I have these three methods:

    -price is greater than $500- check if total price is greater than $500 and apply discount and return total price -number of items greater than 10- check cart size and if it meets condition apply discount and return total price -buy 2 get 1 - will need product ID and it's value and if it's meets the condition subtract the value of the product from total price 

    As you can see, the input of those three methods are all different. How would I OOP(class or interface) to design a dynamic Discount and avoid making a method for each discount types?

    edit- I started to implement what spoker11 suggested but it's not really dynamic...

    public class Discount{ double discountPercent; } public class totalPriceDiscount extends Discount{ double discountPercent; public totalPriceDiscount(double discountPercent){ this.discountPercent = discountPercent; } public bool appliesToItem(double totalPrice ){ if(totalPrice > 500) return true; return false; } public double applyToItem(double totalPrice ){ return totalPrice * discountPercent; } } public class BogoDiscount extends Discount{ double discountPercent; public totalPriceDiscount(double discountPercent){ this.discountPercent = discountPercent; } public bool appliesToItem( List<string> shoppingCart){ // assuming shoppingCart is sorted. string of productId string idCount = 0; string currentId = ""; foreach(var id in shoppingCart){ if(currentId != id){ idCount = 1; currentId = id; } else{ idCount++; if(idCount > 3){ return true; } } } return false; } public double applyToItem(double totalPrice, List<string> shoppingCart, Dictionary<string,int> idToValueMap ){ // assuming shoppingCart is sorted. string of productId List<string> qualifiedIds = new List<string>(); string idCount = 0; string currentId = ""; foreach(var id in shoppingCart){ if(currentId != id){ idCount = 1; currentId = id; } else{ idCount++; if(idCount > 3){ qualifiedIds.Add(id); //add logic to skip to the next unique id } } } foreach(var uniqueId in qualifiedIds){ totalPrice -= idToValueMap[uniqueId]; } return totalPrice; } } 
    submitted by /u/jjsreddit
    [link] [comments]

    While Infinite Loop C

    Posted: 06 Mar 2021 08:54 AM PST

    I have a While Loop with x != 0 as a condition, where x is an unsigned integer, so that the user can input the number 0 to terminate the program, but when I input a letter instead of a number, the program falls into an infinite loop where it repeats the case over and over again. Is there a way to stop this from happening if someone where to input a letter by mistake?

    include <stdio.h>

    int main(void) {

    float m; // Variable for Managers. float h; // Variable for Hourly Workers. float ht; // Weekly Hours. float c; // Variable for Commission Workers. float p; // Variable for Pieceworkers Items Produced. float pp; //Variable for Pieceworkers Item's Price. unsigned int x; // Variable for the Paycode. while (x != 0) { // Continuous Loop Until the User Terminates the Program with Paycode '0'. puts("\nEnter Paycode:"); scanf("%u", &x); switch(x) { case 1: puts("Enter fixed weekly salary of manager:"); scanf("%f", &m); printf("Weekly Salary = %.2f$\n", m); break; case 2: puts("Enter weekly hours:"); scanf("%f", &ht); puts("Enter fixed weekly salary of Hourly Worker:"); scanf("%f", &h); if (ht > 40) printf("Weekly Salary = %.2f$\n", 1.5*(h/40)*(ht-40) + h); // In case the hours exceed 40. else printf("Weekly Salary = %.2f$\n", h); // In case the hours don't exceed 40. break; case 3: puts("Enter Commission Worker Weekly Gross:"); scanf("%f", &c); printf("Weekly Salary = %.2f$\n", (c*0.057) + 250); break; case 4: puts("Enter Number of Items Produced:"); scanf("%f", &p); puts("Enter Fixed Price Per Item:"); scanf("%f", &pp); printf("Weekly Salary = %.2f$\n", pp * p); break; default: if (x == 0) puts("Program is Terminated by the User."); // In case the user terminates the program. else puts("Wrong Entry."); // In case the user inputs a wrong value. break; } } 

    }

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

    Mind map app

    Posted: 06 Mar 2021 12:16 PM PST

    Hello, I cannot find it anywhere, so I thought I asked it here

    In which language or program are mind mapping apps created ?

    Like MindMaster, Mindnote or Mindmup. Is it possible for one person to made it ?

    Thanks in advance

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

    Making money as a programmer

    Posted: 06 Mar 2021 11:57 AM PST

    Hey anyone have any sure fire ways to actually make money programming when ur under 18?

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

    Done with my Computer Science Degree

    Posted: 06 Mar 2021 11:20 AM PST

    I am done with my computer science degree I wasn't really good at maths or databases, i want to be a python and JavaScript backend web developer that eventually learns full stack.

    The problem is i fell in love with any language i was taught (programming in general, except java lol) so i didn't have that much grip on specific language, and didn't know which path i should have chosen till my last semester.

    My final year project was an E-commerce search engine, meaning a website that has scraped data from five e-commerce websites and shows the cheapest price against searched item. The project was made using django and scrapy, but that doesn't necessarily mean i knw much about programming, it was shear luck i was able to find snippets and parts of code i required for my final year project.

    Now what should i do, to prepare for interviewes could anyone of you make a layout for the things i should learn and in which pattern and speed, any help is appreciated

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

    Im trying to build a batch file for a program to run as a service. Its just a textedit.exe but it needs to stay up. If it goes down , I want it to stay up. Just like a service. Anyway to do this with windows.bat files?

    Posted: 06 Mar 2021 11:12 AM PST

    basically I need a wrapper to run my program as a service so I can have it stay up if it goes down after a certain time.

    Anyway to program this for Windows 10?

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

    Session management in Android

    Posted: 06 Mar 2021 07:25 AM PST

    I am working on an android app where I need user authentication and authorisation. I have developed node api for same. When user logs in an app node sends back and jwt token . I store that token in sharedpreference and after that every time user opens app I hit the node api to check if the token is correct. If it is correct I redirect user to home page. Now my concerns are , 1) am i doing it right ? 2) is it good practice to store token in a sharedpreference ? Because I heard that one can access them very easily. 3) what are other ways to manage sessions on Android ?

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

    Help switching from FIFO to SOCKETS (C /C++ & linux) please

    Posted: 06 Mar 2021 03:05 AM PST

    Hello good sirs,i have 3 processes, the first one creates a fifo, the second one opens it and write inside it, And the third one reads it and saves the values inside a file "memory_fd" .

    So to create a fifo :

     //Create a fifo for data exchange between SENSOR and SERVER mkfifo("./tmp/fifo1",S_IRUSR | S_IWUSR); 

    The second one, opens it and write inside it :

    for(i=0;i<10;i++) { samples[i]=i+1; } fifo=open("./tmp/fifo1", O_WRONLY); i=0; while (1) { sleep(1); //browse the samples[] vector circularly if(i<9) buffer=samples[i]; else { i=0; buffer=samples[i]; } i++; printf("SENSOR: Deliver a new value\n"); fflush(stdout); //send the sample in the FIFO ret=write(fifo,&buffer,sizeof(buffer)); 

    And the third one reads it and save the values inside a file "memory_fd"

    static float sliding_window[N]={0}; fifo_fd=open("./tmp/fifo1", O_RDONLY); .. read(fifo_fd,buff,sizeof(*buff)); .. for(i=0;i<N-1;i++) { sliding_window[i]=sliding_window[i+1]; } sliding_window[N-1]=buff; .. write(memory_fd,sliding_window,sizeof(sliding_window)) 

    ---------------------------

    Could you help me recreate the same "design" using sockets please?

    Thank you a lot.

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

    How to create a bit Mask

    Posted: 06 Mar 2021 12:15 AM PST

    I'm having trouble creating a bit mask of 1s. I can only use bitwise operators so I'm not too sure how I would make the mask. All I'm given is the number being used not bit size. I also can't use any loops or conditionals. Any advice on how to approach this problem?

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

    No comments:

    Post a Comment