• Breaking News

    Monday, March 8, 2021

    How to model this for game programming? Ask Programming

    How to model this for game programming? Ask Programming


    How to model this for game programming?

    Posted: 08 Mar 2021 08:42 AM PST

    Ok let's just say, you have units and each time you click a button you go into battle with another player with units. This gets rid of requiring a constant socket/ multiplayer sever running. So it's pseudo multiplayer. I can try to simulate the battle in cloud functions or aws lambda first, using data from the database instead of client to ensure validity of data, then updating battle results and then send back the results and animation instructions to client to play the necessary animation. Is this industry acceptable? And I'm still not sure how I'll model the simulation and also the animation data

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

    Why is g++ saying my header file does not exist?

    Posted: 08 Mar 2021 01:44 PM PST

    I am trying to use g++ to compile a program that uses header files I created in the same directory as the .cpp file. The cpp file is titled "pgm2.cpp" and the header file is "cardDeck.h." I have made sure to add #include <cardDeck.h> to the cpp file, but when I run the command "g++ pgm2.cpp" I get the following error:

    pgm2.cpp:12:10: fatal error: cardDeck.h: No such file or directory 12 | #include <cardDeck.h> | ^~~~~~~~~~~~ compilation terminated. 

    Is there any reason why this is happening?

    EDIT: Found my issue. Should've used quotes instead of angled brackets, so my include line should have been #include "cardDeck.h"

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

    ThreeJS help

    Posted: 08 Mar 2021 06:21 PM PST

    Website: https://www.kid.camera

    Hi there,

    On the mobile experience for my website, I was using gyro-controls (gyroscope of phone controls the json object). With the recent privacy updates from apple and google -- gyro controls has been rendered useless.

    I want to edit the code so that on mobile, the json objects spins around and is controllable from a click on drag similar to the web experience.

    Can anyone provide some help/color here?

    Thanks!

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

    Functional Programming or AI fundamentals

    Posted: 08 Mar 2021 12:07 PM PST

    I'm moving into my second year of computer science degree and have an option between AI Fundamentals or Functional Programming using Haskell.

    I'm unsure which would be more beneficial. I feel functional programming might be more practical but AI might be more interesting.

    Any advice?

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

    How to send an object through a pipe in c++

    Posted: 08 Mar 2021 05:30 PM PST

    I am currently making a program that spawns two child processes which each share a deck of cards to play blackjack (since the same card cannot be dealt twice each round). The deck object contains an array of card objects, as well as the methods to shuffle the deck and deal a card. I first made this program without multiprocessing, where the dealer would pass the deck by reference to the player functions so that they can draw cards from the same deck and decide when to hit or stand. Would it be possible to do this in multiprocessing using a pipe? I am not sure if there is a way to send an object by reference to a child process via a pipe and allow the child processes to use the functions of said object. I do know, however, that I must use a pipe and multiprocessing as those are the requirements for this assignment. Any suggestions would be much appreciated!

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

    Best way to launch and forget a short task whenever a message is received? (Java/Spring/Kafka)

    Posted: 08 Mar 2021 05:04 PM PST

    I'm working with Java and Spring, and I have a Kafka listener which needs to receive 100k messages all at once. It needs to take each message, forward it to some endpoint (takes 3-4 seconds), then save the result. The issue is that I don't want to block my listener for 4 seconds for each request. I want to spin up a separate task and then completely abandon it to complete on its own. I'm pretty new to this kind of coding and I'm not sure of the best way to do that.

    I have a bunch of Spring Integration/Spring Batch stuff set up for another piece of this which I could use, however I'm not sure if this is the right tool for the job I'm doing, as I believe I would be spinning up a Spring Batch job with only 1 input message at a time. I think there is a way to do this by manually managing some kind of input queue and managing some threads which consume from this queue, but that seems very complicated and also maybe not the most "modern" approach.

    Any advice would be much appreciated. // Thank you

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

    Can I use web scraping to program this?

    Posted: 08 Mar 2021 05:00 PM PST

    I've been wanting to make a program that collects data on how many times I've translated to/from each language on Google Translate and record this data in a database. Would web scraping be capable of collecting this information? Any tips in general about how to do this?

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

    How do I make my code function properly? I followed the advice in my previous post but now it seems the code is not even being registered as working.

    Posted: 08 Mar 2021 12:56 PM PST

    I'm in code.org

    Here is my code, the goal is to build a program that allows the user to input the state, desired enrollment range, and conference to find NCAA schools that match their preference. But my code seems to have broken.

    //the variables for the app var teams = getColumn("NCAA Division I Teams", "University"); var states = getColumn("NCAA Division I Teams", "State"); var enrollment = getColumn("NCAA Division I Teams", "Enrollment"); var conference = getColumn("NCAA Division I Teams", "Current conference"); var teamNumber = getColumn("NCAA Division I Teams", "id"); var filteredTeams = []; var filteredbyStates = []; var filteredbyEnrollment = []; var filteredbyConference = []; //first filter the teams by state function getStates() { for (var i = 0; i < teamNumber.length; i++) { if (states[i] == getText("stateInput")) { appendItem(filteredbyStates, teamNumber[i]); } else if ((getText("stateInput") == "any")) { appendItem(filteredbyStates, teamNumber[i]); } } } //After the correct state is filtered, find the correct enrollment function getEnrollment() { for (var i = 0; i < filteredbyStates.length; i++) { if (enrollment[(filteredbyStates[i])] >= getNumber("lowNumberInpunt") && (enrollment[(filteredbyStates[i])]) <= (getNumber("highNumberInput"))) { appendItem(filteredbyEnrollment, filteredbyStates[i]); } } } //Final filter is the conference function getConference() { for (var i = 0; i < filteredbyEnrollment.length; i++) { if (conference[(filteredbyEnrollment[i])] == getText("conferanceInput")) { appendItem(filteredbyConference, filteredbyEnrollment[i]); } else if ((getText("conferanceInput") == "any")) { appendItem(filteredbyConference, filteredbyEnrollment[i]); } } } //Now we have to list the universitys that we have been narrowed down to function getTeams() { for (var i = 0; i < filteredbyConference.length; i++) { appendItem(filteredTeams, teams[(filteredbyConference[i])]); } } //Now we have to update the screen function updateScreen() { setScreen("teamsScreen"); setText("teamsOutput", filteredTeams); } //finally we have to put it all together onEvent("searchButton", "click", function( ) { getStates(); getEnrollment(); getConference(); getTeams(); updateScreen(); }); 
    submitted by /u/ThreeBrokenArms
    [link] [comments]

    Python 'connection reset by peer' issue

    Posted: 08 Mar 2021 11:14 AM PST

    I won't redescribe the issue to avoid redundancy, but here is the stackoverflow link for a summary.

    https://stackoverflow.com/questions/66534738/how-to-resolve-connection-is-reset

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

    Is the distinction between prefix/postfix increment evaluation (++i vs. i++) actually useful?

    Posted: 08 Mar 2021 01:07 AM PST

    I'm reading MSDN's documentation on C#'s operators and noticed it's explanation of prefix- and postfix-increment operators:

    int i = 3; Console.WriteLine(i); // output: 3 Console.WriteLine(i++); // output: 3 Console.WriteLine(i); // output: 4 int j = 3; Console.WriteLine(j); // output: 3 Console.WriteLine(++j); // output: 4 Console.WriteLine(j); // output: 4 

    I can understand reading a variable. And I can understand incrementing a variable. And I 100% understand the difference between prefix and postfix evaluation.

    Besides the toy code above, I've never seen an actual real-world example of code that actually takes advantage of either prefix or postfix evaluation side-effects.

    My best judgement tells me that most professional programmers would balk if they saw something like this in source code:

    int a = 5; int b = 10; b += ++a; 

    Or worse:

    int a = 5; int b = 10; int c = a++ * --b; 

    In virtually every case that I've ever come across either increment operator, the increment statement occurs isolated on it's own line, so that the distinction between prefix and postfix evaluation doesn't really matter.

    Am I missing something here? Do programmers actually find the distinction between prefix and postfix increment operators useful in the real-world?

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

    Replacing Javascript with Python ...... Python as client side langauge

    Posted: 08 Mar 2021 10:37 AM PST

    Any works done so far?

    submitted by /u/Psycho-logical-being
    [link] [comments]

    How would I filter a list by multiple factors?

    Posted: 08 Mar 2021 10:07 AM PST

    I'm a student making a project where I filter a dataset by different factors such as width, height, volume and so on.

    The problem is I don't know how to filter a list like this, where you take the dataset and eliminate a choice if one of the factors is true and another is false.

    Let's say I want to find shapes that are both green and at least 5 inches tall, how would I make it so that it does not include shapes that are green but less than 5 inches or shapes that are 5 inches but not green?

    I'm in Code.org for this project

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

    What im doing wrong here?

    Posted: 08 Mar 2021 10:02 AM PST

    int main() {

    char x,b,y,w; scanf("%c",&x); if (x=b) printf("black"); if (x=y) printf("yellow"); if (x=w) printf("white"); 

    return 0; 

    }

    submitted by /u/Warm-Stress5062
    [link] [comments]

    As an experienced developer where to find like-minded people to discuss tech, ideas, possible collaborations?

    Posted: 08 Mar 2021 09:57 AM PST

    I've been coding professionally for 10 years. I never had a mentor and learned the art of software engineering on the go through sheer determination (I started working in startups where I had to do A-Z). This made me a skilled SE, it was all for good cause. I recognized this and started freelancing few years ago. I never had to search for projects as the older clients (or people whom I was recommended to) call me for new things to work on. I usually work on the projects alone or in smaller teams where I make all the decisions. I try to gather the input from other people but usually they just accept my proposition. But I hate this, I didn't learn a single thing (that would me go wow) from others in years. I want to be challenged, to be shown new things, to discuss the tech, ideas and whatnot, however I tend to share my knowledge to others. I would also love to discuss broader ideas that you usually discuss in afterwork beer session.

    I believe my brain is slowly decaying. I can already see my loss of memory and sharpness. The remote work without any proper communication does not help and I believe it is currently the main thing that makes me go dumber. Where could I find some like-minded people with whom I could discuss either SE stuff, tech in general, bigger ideas (possibly business) or anything really that nudges my brain (use it or lose it)?

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

    Writing code to sign me in for school every morning

    Posted: 08 Mar 2021 03:13 PM PST

    So I go to a school (that is now online because of covid) and we have to sign in every morning on a google forums page. One problem though... I don't want to. I would love to automate the process, but I have never written something that would interact with any website. Any ideas of where to start/ any programming advice. I'm pretty good with python, and that's really it

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

    I'm Completely Lost.

    Posted: 08 Mar 2021 12:48 AM PST

    I'm not sure if I'm allowed to post this here but here's my story.

    So since I was like 13 I've been interested in coding and to be honest I'm not very fixated on any language to be my favorite. I've coded Runescape private servers [ not very great at it ] which is in Java I've tried to learn Java but the udemy courses are mind numbing and so boring I lose interest.

    The only reason I liked coding runescape private servers is because whatever I would change in the code would be directly implemented when I updated the server so it was something that I could see and mess with until I got the required result I wanted.

    I guess what I'm trying to say is I don't mind writing code , however I'm not great at it yet. But I just wish I could work on something I could see. Or maybe I'm just not far enough along in my lessons but i just want to work on some sort of project I can see besides seeing boring results printed in a console.

    Thanks for the read.

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

    Way to print Twitter handle in json via Python with requests module?

    Posted: 08 Mar 2021 04:11 AM PST

    I'm making a Twitter bot to search Twitter for specific keywords and phrases from recent Tweets. I've been using this document as a guide, which uses the Python requests module.

    import requests import json BEARER_TOKEN = "XYZ" #define search twitter function def search_twitter(query, tweet_fields, bearer_token = BEARER_TOKEN): headers = {"Authorization": "Bearer {}".format(bearer_token)} url = "https://api.twitter.com/2/tweets/search/recent?query={}&{}".format( query, tweet_fields ) response = requests.request("GET", url, headers=headers) print(response.status_code) if response.status_code != 200: raise Exception(response.status_code, response.text) return response.json() #search term query = "new music" #twitter fields to be returned by api call tweet_fields = "tweet.fields=text,author_id,created_at" #twitter api call json_response = search_twitter(query=query, tweet_fields=tweet_fields, bearer_token=BEARER_TOKEN) #pretty printing 

    Everything works fine when I run it in the terminal, but I can't seem to find a way to print each Tweet's associated Twitter handle. I can't find the specific documentation/syntax.

    I know I have to edit this line of code to include the Twitter handle:

    tweet_fields = "tweet.fields=text,author_id,created_at" 

    Simply put, I also want to print the actual Twitter handle associated with these Tweets. Any and all information would be deeply appreciated.

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

    How to find unique occurences of the emails in the text file and list their count?

    Posted: 07 Mar 2021 11:39 PM PST

    I have a text file with data:

    example 1 dummy text hello@google.com something ex 43 hello@google.com dummy 323 your@sony.com stub 23 nice@google.com ...

    I want to find out all the unique occurences of the emails in the text file and list their count.

    For example, here the desired output would be

    hello@google.com occured 2 times your@sony.com occured 1 time nice@google.com occured 1 time

    How would I do that? The solution could be in linux, windows cmd or maybe python script, no hard requirements.

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

    GUI GOlang vs Python

    Posted: 08 Mar 2021 02:14 AM PST

    im, not a pro programmer, I made some simple and pre - medium apps that work with scripts and CL input, now I want to create GUI cross-platform mobile and desktop

    my questions are?

    - python GUI (kivy, beware ) vs Golan fyne

    - what best for speed,

    - what easy to learn

    - what easy to maintains

    - what easy to upgrade the project

    the project is POS system work with Desktop and Mobile android and IOS

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

    Do you know what `pf` stands for of the top of your head?

    Posted: 08 Mar 2021 10:28 AM PST

    I am creating some interview questions. What fraction of senior software developers do you think will know `pf` stands for without looking it up?

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

    No comments:

    Post a Comment