• Breaking News

    Saturday, January 2, 2021

    Building an app that competes with an app I freelanced Ask Programming

    Building an app that competes with an app I freelanced Ask Programming


    Building an app that competes with an app I freelanced

    Posted: 02 Jan 2021 12:23 PM PST

    I was freelanced to build software for cheap. The client didn't know quite what they were asking for so I built the app with more features than was asked I think. I gave them a simple version of the app that they asked for, and the more advanced app I sold to others. I know I haven't broken any laws but was this ethical?

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

    Question for FAANG, do you write microservices within your team from scratch or do you have company wide libraries/framework you build with?

    Posted: 02 Jan 2021 08:08 PM PST

    I work in a much non-FAANG like company, but we have some "microservices" and all code is based on a single language, so we have a cloud-team (I think they are called) who have a library and all our microservices have to be based on that. On a couple of occasions there were "enhancements" which broke all our "microservices", please note that them pushing their code automatically updates all our services, we can't opt-out of a new version. From what I read online, microservices should not have common code like that, however a person who seems to follow this more than I do, says it's normal for FAANG companies as well to have some kind of a core-microservice-team that develops libraries which are used within all (or lets say majority of) microservices.

    So I really want to hear from someone with a first-hand experience working for FAANG if the microservices you write do use some shared library that another team controls, or if all the code is truly developed within your group as online resources on microservices tend to imply.

    (Please note that I have surrounded our "microservices" in quotes, as they all use the same database, which is seems to be another no-no in the microservice word.)

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

    C++ why isn't my vector outputting to the console like it should be?

    Posted: 02 Jan 2021 12:17 PM PST

    Sorry for some of the messy code, but I made a change and i'm not sure where it stopped working. Program as it stands currently should output the deck, then output the shuffle decked. I made a change somewhere and it stopped doing that.

    #include <iostream> #include <iomanip> #include <string> #include <fstream> #include <cctype> #include "Card.h" #include "Deck.h" #include <vector> #include<bits/stdc++.h> using namespace std; struct PlayingCard { string cardNumber; string cardSuit; int cardValue; }; void showMenu(int &choice); //int blackjackGame(int betAmount, int userBalance); int threeCardGame(int betAmount, int userBalance); int highCardGame(int betAmount, int userBalance); int getValidBet(int betAmount, int userBalance); vector<PlayingCard> createDeck(vector<PlayingCard> &playingDeck); vector<PlayingCard> shuffleDeck(vector<PlayingCard> &playingDeck); //vector<PlayingCard> cardDrawDealer(vector<PlayingCard> playingDeck, vector<PlayingCard> dealerHand, int); //vector<PlayingCard> cardDrawUser(vector<PlayingCard> playingDeck, vector<PlayingCard> userHand, int); int main() { int userBalance; int userChoice; int betAmount; string userName; bool keepGoing = true; /* Creates playing deck. Deck playingDeck; playingDeck = Deck(); playingDeck.printDeck(); cout << "Shuffled Deck..." << endl; playingDeck.shuffle(); playingDeck.printDeck(); */ vector<PlayingCard> playingDeck; createDeck(playingDeck); shuffleDeck(playingDeck); vector<PlayingCard> userHand; vector<PlayingCard> dealerHand; /* // Draw Hand for (int i = 0; i<2; i++) { userHand.push_back(PlayingCard()); userHand[i] = playingDeck[0]; playingDeck.erase(playingDeck.begin()); dealerHand.push_back(PlayingCard()); dealerHand[i] = playingDeck[0]; playingDeck.erase(playingDeck.begin()); } // Output hands cout << "User Hand...." << endl; for (int i=0; i < 2; i++) { cout << userHand[i].cardNumber << " of " << userHand[i].cardSuit << " Value: " << userHand[i].cardValue << endl; } cout << "Dealer Hand...." << endl; for (int i=0; i < 2; i++) { cout << dealerHand[i].cardNumber << " of " << dealerHand[i].cardSuit << " Value: " << dealerHand[i].cardValue << endl; } */ cout << "Welcome to the casino program!" << endl; cout << "Please enter your name." << endl; cin >> userName; cout << "Please enter your starting balance." << endl; cin >> userBalance; while(keepGoing) { showMenu(userChoice); switch(userChoice) { case 1: //blackjackGame(betAmount,userBalance); break; case 2: threeCardGame(betAmount,userBalance); break; case 3: highCardGame(betAmount,userBalance); break; case 4: break; default: break; } } return 0; } void showMenu(int &choice) { // User Menu cout << "Please select a game" << endl; cout << "1) Blackjack" << endl; cout << "2) Three Card Poker" << endl; cout << "3) High Card Flush" << endl; cout << "4) Exit" << endl; cin >> choice; // Validates input while(choice < 1 || choice > 4) { cout << "You must enter either 1,2,3 or 4" << endl; cout << "Select an option (1,2,3,4)" << endl; cin >> choice; } } int getValidBet(int betAmount, int userBalance) { cout << "Please enter the amount you would like to bet" << endl; cin >> betAmount; while(betAmount > userBalance || betAmount < 1) { cout << "Invalid entry." << endl; cout << "Please enter the amount you would like to bet" << endl; cin >> betAmount; cout << endl; } return betAmount; } int blackjackGame(int betAmount, int userBalance) { cout << "Your current balance is $" << userBalance << endl; betAmount = getValidBet(betAmount, userBalance); cout << betAmount; vector<PlayingCard> playingDeck; createDeck(playingDeck); shuffleDeck(playingDeck); vector<PlayingCard> userHand; vector<PlayingCard> dealerHand; int drawCount = 2; //cardDrawUser(playingDeck, userHand, drawCount); //cardDrawDealer(playingDeck, dealerHand, drawCount); cout << "Get ready to play!" << endl; // Output hands cout << "User Hand...." << endl; for (int i=0; i < 2; i++) { cout << userHand[i].cardNumber << " of " << userHand[i].cardSuit << " Value: " << userHand[i].cardValue << endl; } cout << "Dealer Hand...." << endl; for (int i=0; i < 2; i++) { cout << dealerHand[i].cardNumber << " of " << dealerHand[i].cardSuit << " Value: " << dealerHand[i].cardValue << endl; } } int threeCardGame(int betAmount, int userBalance) { cout << "Your current balance is $" << userBalance << endl; betAmount = getValidBet(betAmount, userBalance); cout << betAmount; } int highCardGame(int betAmount, int userBalance) { cout << "Your current balance is $" << userBalance << endl; betAmount = getValidBet(betAmount, userBalance); cout << betAmount; } vector<PlayingCard> createDeck(vector<PlayingCard> &playingDeck) { string cardFaces[13] = {"TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING", "ACE"}; string cardSuits[4] = {"HEARTS", "DIAMONDS", "SPADES", "CLUBS"}; int cardValues[13] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11}; int suitCounter = 0; // Creates Deck for (int i=0; i < 52; i++) { playingDeck.push_back(PlayingCard()); playingDeck[i].cardNumber = cardFaces[i % 13]; playingDeck[i].cardSuit = cardSuits[suitCounter]; playingDeck[i].cardValue = cardValues[i % 13]; if ((i+1) % 13 == 0) { suitCounter = suitCounter + 1; } } return playingDeck; } vector<PlayingCard> shuffleDeck(vector<PlayingCard> &playingDeck) { srand(time(NULL)); // Shuffles Deck for (int original = 0; original < 52; original++) { int r = rand() % 52; PlayingCard tempDeck[52]; tempDeck[original] = playingDeck[original]; playingDeck[original] = playingDeck[r]; playingDeck[r] = tempDeck[original]; } return playingDeck; } /*vector<PlayingCard> cardDrawDealer(vector<PlayingCard> playingDeck, vector<PlayingCard> dealerHand, int drawCount) { for(int counter = drawCount; counter > 0; counter--) { dealerHand.push_back(PlayingCard()); dealerHand[drawCount] = playingDeck[0]; playingDeck.erase(playingDeck.begin()); } return dealerHand; } vector<PlayingCard> cardDrawUser(vector<PlayingCard> playingDeck, vector<PlayingCard> userHand, int drawCount) { for(int counter = drawCount; counter > 0; counter--) { userHand.push_back(PlayingCard()); userHand[drawCount] = playingDeck[0]; playingDeck.erase(playingDeck.begin()); } return userHand; } */ 
    submitted by /u/Nickt1596
    [link] [comments]

    Ways to switch from one industry to tech in Europe

    Posted: 02 Jan 2021 10:24 AM PST

    Hey everyone! I'm a bachelor in business management from Latvia looking to switch into tech. I had erasmus+ exchange semester in Portugal and I know that, for instance, some colleges there had programs dedicated to bachelors who wanted to make this switch. I've also seen that in Latvia Accenture has some bootcamp's for learning basics in tech. I was wondering if there are other colleges in Europe with similar programs (and good quality) or bootcamp's for doing the switch. Will be happy to see what you guys recommend, just want to understand what opportunities are out there. Thanks!

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

    Relying too heavily on guides for a project?

    Posted: 02 Jan 2021 05:28 PM PST

    I'm a senior Computer Science major currently writing my first compiler to reinforce my knowledge of C, Data Structures, MIPS Assembly (easier to compile to than x86) and Theory of Computation. My main hurdle was building the AST and generating the assembly for expressions (which is a big portion of course) so I used this wonderful github repo A Compiler Writing Journey but I worry that I'm relying on it too heavily. While I am learning and trying to understand every piece after coding it, I feel as though I can't progress without having it open in another window. I did take a junior level course on programming languages where we covered parsing and ASTs but never went in depth in terms of actually making them. Is this acceptable when learning something new or should I try to implement more by myself?

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

    Are there places that offer functional group chat code for free?

    Posted: 02 Jan 2021 04:57 PM PST

    I feel so stupid. I know only a little bit about web development. I bought and completed half a course which walked me through the steps of building a Facebook clone with HTML, CSS, PHP, and a little bit of JS. I was working on creating something a year and a half ago and was diving into the world of development before I got sidetracked by a different project and stopped thinking about the programming world. I have forgotten a lot of what I learned. But now, for the project I am working on, I am needing to dive back in and develop a very simple website with a few functionalities.

    I am prepared to go back and start those courses again and program the chat functionality I need. But I just realized that there might be some way I can save a lot of time. Is there free code out there that I can add to my website and customize it?

    I really don't need anything special.

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

    ELI5 React Native vs React API, React.js

    Posted: 02 Jan 2021 09:00 AM PST

    Is this all the same?? Or are there different languages involved? I know it's all react and has the same logo, but I'm super confused. Sorry for dumb question.

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

    Installing Android Studio

    Posted: 02 Jan 2021 02:24 PM PST

    Hello, I wanna install Android Studio for Linux and 32 bit compatible. I've searched in the website but there is a huge amount of versions and I don't know which one to take. Can you help me find it ? If really wanted, I can run the Windows version under Wine or something else, but please notice it's the last thing I wanna do because if I want to add more tools after I feel it will be a pain...

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

    Suggest places of low competition to search for freelance gigs

    Posted: 02 Jan 2021 02:11 PM PST

    This is a popular problem, but for some reason, I couldn't find a comprehensive discussion of such a topic here.

    I want to find freelance gigs, but I'm new to freelancing. I genuinely enjoy solving complex problems and I coded lots of projects of different complexity for myself. But obviously on places like Upwork, Fiverr, etc I'm just a random dude with an empty profile. It's no surprise I had zero success getting a job there.

    So far I noticed that I had a bit of success in places where I don't compete for a job with a bunch of "10 y experience professionals with 4.9 stars based on 700 reviews"

    I found a couple of gigs on r/slavelabour and r/forhire. I also found some on a small job board which is in my native language.

    My question is: can you suggest any other similar places of low competition?

    Any advice on finding the first freelance gigs would also be valuable.

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

    Curious wannabe techie

    Posted: 02 Jan 2021 01:45 PM PST

    I'm so puzzled by these terms my teachers have us learning bash and Linux but there is many words they have been throwing at me that it makes no sense what I'm doing all I know is that it somehow makes talks easier as you can do more things with little commands, when I search it up I can't find anyone explaining these things without them using other technical terms and these things are all related. So the questions I have are: 1.) what is a terminal 2.) what is cli 3.) what is bash 4.) What is a shell If there is anymore that I have missed please include it

    Also I have heard that bash is a scripting language and I didn't know there was such a thing too long ago, all I have heard of is programming languages.

    What is a scripting language and how is it different.

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

    Implementing a configuration in Wordpress

    Posted: 02 Jan 2021 01:26 PM PST

    Hello, I need help implementing a configuration on a wordpress website. Is this possible with a plugin or any alternative?

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

    How much programming hours do you think it took to make Duolingo?

    Posted: 02 Jan 2021 12:30 PM PST

    Hello everyone! I think the title covers my question. I'm wondering how many programming hours went into making Duolingo, the language app. It is really a simple app with few features. Ignoring time spent on the actual content of the app, how much time do you think it took to create? (in its current form anyway)

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

    Large compiled files

    Posted: 02 Jan 2021 11:05 AM PST

    Which language produces the largest compiled files? I'm running raspbian on a raspberry Pi 1 and so far, go is the highest I've seen at about 1.1 M for hello world.

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

    Artificial Intelligence

    Posted: 02 Jan 2021 10:17 AM PST

    Hello, I'm a student who has to do a presentation about Artifical Intelligence, but I find it hard to explain what Artifical Intelligence actually is, since its such a broad topic. So, programmers of reddit, how would you explain AI?

    Thank you in advance for any answers.

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

    [ c ] How do I determine the size of an array like this?

    Posted: 02 Jan 2021 09:43 AM PST

    #include <stdio.h> #include <stdlib.h> int * array(); int main(){ int *p; p = array(); int size = sizeof(p) / sizeof(int); //expecting 10 here printf("\n%d", size); } int * array(){ int *c = (int *)malloc(10 * sizeof(int)); for(int i = 0; i < 10; i++){ c[i] = i; } return c; } 
    submitted by /u/robsseventhaccount
    [link] [comments]

    How do companies do high volume list counting when there are a lot of additions/subtractions so quickly?

    Posted: 01 Jan 2021 11:07 PM PST

    Hypothetical example is a subscription service. People who subscribe/unsubscribe from a list.

    If you are keeping track of multiple lists to display on a screen, you can't really loop through all of the available lists and do select count(*) from lists where id in (1,2,3,4,..,N) efficiently.

    When you have extremely high volume here, what techniques are used?

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

    How to check the type of a variable in C++? Questions about simple leap year program.

    Posted: 02 Jan 2021 09:10 AM PST

    This checks if a given year is a leap year or not. Seems to work ok, but I wanted to make sure it warns the user/terminates if user enters something invalid, like a char. I also don't get how the number the user enters (collected via std::cin ) is automatically collected as/turned into an integer (If that's how it works? When the user enters something, wouldn't it be collected as a string?). How might I do something like "if year is not of type integer, print "Must enter an integer- try again"?

    Also, why does the program print out infinite lines of "Enter a year: 0 is a leap year" if I enter something like 'C' at the prompt?

    Edit: I found this: https://www.learncpp.com/cpp-tutorial/stdcin-and-handling-invalid-input/

    This is my first C++ program so maybe my book/tutorial will explain this stuff later.

    #include <iostream> int main (){ int year = 0; char keepGoing; char key; do { std::cout << "Enter a year: "; std::cin >> year; if (year >= INT_MAX){ std::cout << "Year too big. Must be between 0 and " << INT_MAX << ". Terminating.\n"; exit(1); } if (year < 0){ std::cout << "Year cannot be less than 0. Terminating.\n"; exit(1); } bool condition1 = false; //to be a leap year, both bool condition2 = false; //conditions must be made true if (year % 4 == 0){ condition1 = true; } else { condition1 = false; } if ((year % 100 == 0) && (year % 400 == 0)){ condition2 = true; } else { condition2 = false; } if ((condition1 == true) && (condition2 == true)){ std::cout << year << " is a leap year.\n"; } else { std::cout << year << " is not a leap year.\n"; } std::cout << "Enter another? 'y' or 'n' "; std::cin >> keepGoing; } while(keepGoing == 'y' || keepGoing == 'Y'); return 0; } 
    submitted by /u/cy_anst_a_tistician
    [link] [comments]

    Which IDE should I get for C++?

    Posted: 02 Jan 2021 03:38 AM PST

    Title describes it. I've narrowed it down to Visual Studio, Clion, and Eclipse so far, but I'm not sure which to pick. I have no experience with C++ at all, so I do not know which features would be more useful. Any recommendations?

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

    New Python Journey

    Posted: 02 Jan 2021 03:16 AM PST

    Hello Everyone

    I have a Networking back ground and started programming again. I learned HTML and CSS ten years ago and had to stop coding to focus on another love, Networking. which was a plus because, networking was in high demand were i lived at the time. I always enjoyed learning code and now living in the San Diego area, Software Engineer and programming related jobs are murdering the job market. Python being the most prevalent due to the automation factor. I started learning Python a day ago, and could feel the juices flowing as they did ten years ago. However, I would like to dedicate 2021 to Python and another language next year. My question is, what are some great beginner books for learning Python? And over the next year what are recommended ways to document my projects for future employment?

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

    How do you decide what to learn next ?

    Posted: 02 Jan 2021 06:40 AM PST

    Apart from obvious "what's interesting" and "what's close to what I am doing now"....

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

    Why doesn't my program print anything after all the commands?

    Posted: 02 Jan 2021 06:28 AM PST

    https://ibb.co/bbYLBHM

    The problem is to parse a series of commands that instruct a robot arm on how to manipulate blocks that lie on a flat table. Initially, there are n blocks on the table (numbered from 0 to n − 1) with block bi adjacent to block bi+1 for all 0 ≤ i < n − 1 as shown in the diagram below:

    https://ibb.co/WpWQBYT

    The valid commands for the robot arm that manipulates blocks are:

    • move a onto b

    where a and b are block numbers, puts block a onto block b after returning any blocks that are stacked on top of blocks a and b to their initial positions.

    • move a over b

    puts block a onto the top of the stack containing block b, after returning any blocks that are stacked on top of block a to their initial positions.

    • pile a onto b

    moves the pile of blocks consisting of block a, and any blocks that are stacked above block a, onto block b. All blocks on top of block b are moved to their initial positions prior to the pile taking place. The blocks stacked above block a retain their order when moved.

    • pile a over b

    puts the pile of blocks consisting of block a, and any blocks that are stacked above block a, onto the top of the stack containing block b. The blocks stacked above block a retain their original order when moved.

    • quit

    terminates manipulations in the block world. Any command in which a = b or in which a and b are in the same stack of blocks is an illegal command. All illegal commands should be ignored and should have no effect on the configuration of blocks.

    Input:

    https://ibb.co/pWJ9c7Q

    Output:

    https://ibb.co/Nt03mm3

    my code:

    #include<stdio.h> #include<string.h> void back(int arr[]){ } int main(){ int noi=0; printf("please input n:"); int n; scanf(" %d",&n); int arr[n][n]; //this for storing their position int i,j; for(i=0;i<n;i++){ for(j=0;j<n;j++){ arr[i][j]=-1; } arr[i][0]=i; } //empty as -1 char str1[5],str2[5],cmd[20];//cmd is the complete line which will be spilt int s,d;//source & destination char st[2],dt[2];//char variable of int s and d char* tk;//a pointer for strtok int quit=0; while(1){ s=-1; d=-1; while(!(s>=0 && s<n && d>=0 && d<n)){ fflush(stdin); fgets(cmd,sizeof(cmd),stdin); tk=strtok(cmd," "); if(strcmp(tk,"quit")==0){ quit=1; break; }else{ strcpy(str1,tk); tk=strtok(NULL," "); strcpy(st,tk); s=atoi(st); tk=strtok(NULL," "); strcpy(str2,tk); tk=strtok(NULL," "); strcpy(dt,tk); d=atoi(dt); } } if(quit==1){ break; } //finally doing the commands if(strcmp(str1,"move")==0){ if(strcmp(str2,"onto")==0){ //empty s for(i=0;i<n && arr[s][i]!=-1;i++){ arr[arr[s][i]][0]=arr[s][i]; arr[s][i]=-1; } //empty d for(i=0;i<n && arr[d][i]!=-1;i++){ arr[arr[d][i]][0]=arr[d][i]; arr[d][i]=-1; } //now move s to d i=1; arr[d][i]=arr[s][0]; arr[s][0]=-1; }else if(strcmp(str2,"over")==0){ //empty s for(i=0;i<n && arr[s][i]!=-1;i++){ arr[arr[s][i]][0]=arr[s][i]; arr[s][i]=-1; } //move s to d i=1; while(arr[d][i]!=-1){ i++; } arr[d][i]=arr[s][0]; arr[s][0]=-1; }else{ continue; } }else if(strcmp(str1,"pile")==0){ if(strcmp(str2,"onto")){ //empty d for(i=0;i<n && arr[d][i]!=-1;i++){ arr[arr[d][i]][0]=arr[d][i]; arr[d][i]=-1; } //pile s to d //find empty of d i=1; while(arr[d][i]!=-1){ i++; } //find end(empty) of s and store in j j=0; while(arr[s][j]!=-1){ j++; } //piling int tj=0;//for iterating in s while(j-1>=0){ arr[d][i]=arr[s][tj]; arr[s][tj]=-1; j--; tj++; i++; } }else if(strcmp(str2,"over")){ //pile s to d //find empty of d i=1; while(arr[d][i]!=-1){ i++; } //find end(empty) of s and store in j j=0; while(arr[s][j]!=-1){ j++; } //piling int tj=0;//for iterating in s while(j-1>=0){ arr[d][i]=arr[s][tj]; arr[s][tj]=-1; j--; tj++; i++; } }else{ continue; } }else{ continue; } } //print results for(i=0;i<n;i++){ printf("%d:",i); for(j=0;j<n && arr[i][j]!=-1;j++){ printf("%d ",arr[i][j]); } printf("\n"); } } 
    submitted by /u/JacksonSteel
    [link] [comments]

    Once I reach a certain complexity in my software, I start getting very paranoid that I messed up somewhere in the beginning... how do I fix this

    Posted: 02 Jan 2021 02:27 AM PST

    for context, I am a graduate student in scientific computing, and I primary write in Python, and secondarily in C. when I building a model and writing the libraries for it, after I reach a certain point, like when I'm 10-20k lines deep in my modules, I start getting super worried that there is a bug in the previous lines, or the previous methods and functions and classes I wrote up. then I'm worried that if my earlier code is buggy, what's the point of writing the more complicated functions.

    how do I solve this problem?

    how do you guys perform unit tests in your code? everytime I write a method, I should have a unit test up and ready to test if it's good or not? I sometimes get lazy and decide not to test my work, but I think I should just suck it up and spend the 15-20 minutes writing up some quick tests and seeing if it all goes to plan EVERY SINGLE TIME. but what do you guys do?

    any advice y'all have would be very appreciated!!

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

    No comments:

    Post a Comment